57 \
ILIAS\COPage\PageLinker $linker =
null,
63 $this->
user = $DIC->user();
64 $this->global_screen =
$DIC->globalScreen();
65 $this->skill_tree_service =
$DIC->skills()->tree();
66 $this->page_linker = is_null($linker)
71 $this->exp_dir = $a_exp_dir;
72 $this->mobs_dir = $a_exp_dir .
"/mobs";
73 $this->files_dir = $a_exp_dir .
"/files";
74 $this->tex_dir = $a_exp_dir .
"/teximg";
75 $this->content_style_dir = $a_exp_dir .
"/content_style";
76 $this->content_style_img_dir = $a_exp_dir .
"/content_style/images";
78 $this->services_dir = $a_exp_dir .
"/Services";
79 $this->media_service_dir = $this->services_dir .
"/MediaObjects";
81 $this->mp3_dir = $this->media_service_dir .
"/flash_mp3_player";
83 $this->js_dir = $a_exp_dir .
'/js';
84 $this->js_yahoo_dir = $a_exp_dir .
'/js/yahoo';
85 $this->css_dir = $a_exp_dir .
'/css';
90 $this->content_style_id = $a_val;
124 $this->log->debug(
"export styles");
133 copy(
"Services/COPage/css/content.css", $this->exp_dir .
"/Services/COPage/css/content.css");
136 $style->copyImagesToDir($this->exp_dir .
"/" . $style->getImagesDirectory());
159 $this->log->debug(
"export scripts");
163 foreach ($collector->getJavascriptFiles() as $js) {
167 foreach ($collector->getCssFiles() as $css) {
178 if (is_int(strpos($file,
"?"))) {
179 $file = substr($file, 0, strpos($file,
"?"));
181 if (is_file($file)) {
182 $dir = dirname($file);
184 if (!is_file($target_dir .
"/" . $file)) {
185 copy($file, $target_dir .
"/" . $file);
194 $this->log->debug(
"get main template");
198 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
200 if (!is_null($a_tpl)) {
223 $resource_injector->inject(
$tpl);
236 $this->log->debug(
"collect page elements");
246 foreach ($pcs as $pc) {
248 if ($pc[
"type"] ==
"incl") {
258 $this->int_links = array_merge($this->int_links, $pg_links);
259 $this->glossary_terms = [];
262 foreach ($this->int_links as $int_link) {
263 if ($int_link[
"type"] ==
"git") {
264 $this->glossary_terms[] = $int_link[
"id"];
267 foreach ($defs as $def) {
277 foreach ($pages as $page) {
278 $page_id = $page[
"id"];
279 $page_type = $page[
"type"];
283 foreach ($pg_mobs as $pg_mob) {
284 $this->mobs[$pg_mob] = $pg_mob;
286 " due to page $page_id, $page_type ).");
290 $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0,
$lang);
291 foreach ($files as
$f) {
292 $this->files[
$f] =
$f;
297 foreach ($q_ids as $q_id) {
298 $this->q_ids[$q_id] = $q_id;
303 $skill_tree = $ws_tree =
null;
306 foreach ($pcs as $pc) {
307 if ($pc[
"type"] ==
"skmg") {
308 $skill_id = $pc[
"id"];
315 $user_id = $page->getCreationUserId();
326 $skill_tree = $this->skill_tree_service->getGlobalSkillTree();
332 $skill_id = (
int) $skill_id;
333 $vtree = $this->skill_tree_service->getVirtualSkillTreeForNodeId($skill_id);
336 $tref_id = $skill_id;
339 $b_skills = $vtree->getSubTreeForCSkillId($skill_id .
":" . $tref_id,
true);
341 foreach ($b_skills as $bs) {
343 $level_data = $skill->getLevelData();
344 foreach ($level_data as $k => $v) {
348 foreach ($mat as $item) {
349 $wsp_id = $item[
"wsp_id"];
350 $obj_id = $ws_tree->lookupObjectId($wsp_id);
355 $this->files[$obj_id] = $obj_id;
360 $this->files_direct[$obj_id] = array($obj->getFilePath(),
361 $obj->getOfflineFilename());
366 $this->files_direct[$obj_id] = array($obj->getFilePath(),
367 $obj->getOfflineFilename());
372 $this->files_direct[$obj_id] = array($obj->getFilePath(),
373 $obj->getOfflineFilename());
378 $this->files_direct[$obj_id] = array($obj->getFilePath(),
379 $obj->getOfflineFilename());
384 $this->files_direct[$obj_id] = array($obj->getFilePath(),
385 $obj->getOfflineFilename());
390 $this->files_direct[$obj_id] = array($obj->getFilePath(),
391 $obj->getOfflineFilename());
407 callable $a_update_callback =
null
409 $this->log->debug(
"export page elements");
411 $total = count($this->mobs) + count($this->files) + count($this->files_direct);
414 $linked_mobs = array();
415 foreach ($this->mobs as $mob) {
417 $this->exportHTMLMOB($mob, $linked_mobs);
419 if (is_callable($a_update_callback)) {
421 $a_update_callback($total, $cnt);
424 $linked_mobs2 = array();
425 foreach ($linked_mobs as $mob) {
427 $this->exportHTMLMOB($mob, $linked_mobs2);
432 foreach ($this->files as $file) {
433 $this->exportHTMLFile($file);
434 if (is_callable($a_update_callback)) {
436 $a_update_callback($total, $cnt);
441 foreach ($this->files_direct as $file_id => $attr) {
442 $this->exportHTMLFileDirect($file_id, $attr[0], $attr[1]);
443 if (is_callable($a_update_callback)) {
445 $a_update_callback($total, $cnt);
449 $this->exportQuestionFiles();
452 $this->exportHTMLGlossaryTerms();
459 string $template_file
461 $this->global_screen->layout()->meta()->reset();
463 $this->getPreparedMainTemplate(
$tpl);
475 array &$a_linked_mobs
477 $this->log->debug(
"export html mobs");
480 if (is_dir($source_dir)) {
487 $tpl = $this->initResourceTemplate(
"tpl.fullscreen.html");
489 $link_xml = $this->page_linker->getLinkXML($med_links);
495 'fullscreen_link' => $this->page_linker->getFullScreenLink()
497 if ($this->ref_id > 0) {
502 $tpl->setVariable(
"MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml,
$params));
503 $html =
$tpl->printToString();
504 $file = $this->exp_dir .
"/media_" . $a_mob_id .
".html";
505 $fp = fopen($file,
"w+");
510 if ($mob_obj->hasFullscreenItem()) {
511 $tpl = $this->initResourceTemplate(
"tpl.fullscreen.html");
512 $params[
"mode"] =
"fullscreen";
513 $tpl->setVariable(
"MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml,
$params));
514 $html =
$tpl->printToString();
515 $file = $this->exp_dir .
"/fullscreen_" . $a_mob_id .
".html";
516 $fp = fopen($file,
"w+");
522 $linked_mobs = $mob_obj->getLinkedMediaObjects();
523 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
536 $output = xslt_process(
548 "/_xsl" => file_get_contents(
"./Services/COPage/xsl/page.xsl")
563 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
566 $file_obj =
new ilObjFile($a_file_id,
false);
567 $source_file = $file_obj->getFile($file_obj->getVersion());
568 if (!is_file($source_file)) {
569 $source_file = $file_obj->getFile();
571 if (is_file($source_file)) {
572 copy($source_file, $file_dir .
"/" . $file_obj->getFileName());
581 string $a_source_file,
584 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
587 if (is_file($a_source_file)) {
601 if (count($this->q_ids) > 0) {
602 foreach ($this->q_ids as $q_id) {
606 $this->exp_dir .
"/assessment/0/" . $q_id .
"/images"
614 foreach ($this->glossary_terms as $term_id) {
615 $tpl = $this->initResourceTemplate(
"tpl.glossary_term_output.html");
618 $term_gui->setPageLinker($this->page_linker);
619 $term_gui->setOfflineDirectory($this->exp_dir);
620 $term_gui->output(
true,
$tpl);
623 $html =
$tpl->printToString();
624 $file = $this->exp_dir .
"/term_" . $term_id .
".html";
625 $fp = fopen($file,
"w+");
HTML export class for pages.
SkillTreeService $skill_tree_service
exportHTMLFile(string $a_file_id)
Export file object.
setContentStyleId(int $a_val)
exportStyles()
Export content style.
exportHTMLGlossaryTerms()
initResourceTemplate(string $template_file)
Get resource template.
renderMob(\ilObjMediaObject $mob_obj, string $link_xml, array $params)
Render Mob.
string $content_style_dir
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
exportHTMLFileDirect(string $a_file_id, string $a_source_file, string $a_file_name)
Export file from path.
exportSupportScripts()
Export support scripts.
exportPageElements(callable $a_update_callback=null)
Export page elements.
getPreparedMainTemplate(ilGlobalTemplateInterface $a_tpl=null)
exportHTMLMOB(int $a_mob_id, array &$a_linked_mobs)
Export media object to html.
string $media_service_dir
__construct(string $a_exp_dir, \ILIAS\COPage\PageLinker $linker=null, int $ref_id=0)
ILIAS GlobalScreen Services $global_screen
string $content_style_img_dir
ILIAS COPage PageLinker $page_linker
exportResourceFile(string $target_dir, string $file)
exportQuestionFiles()
Export question images.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static getASCIIFilename(string $a_filename)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
special template class to simplify handling of ITX/PEAR
static getDefinitionList(int $a_term_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getTargetsOfSource(string $a_source_type, int $a_source_id, string $a_source_lang="-")
Get all targets of a source object (e.g., a page)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getBasicImageDir()
static getContentPrintStyle()
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getSyntaxStylePath()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupTitle(int $obj_id)
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
static getUsagesOfPage(int $a_usage_id, string $a_usage_type, int $a_hist_nr=0, bool $a_all_hist_nrs=false, string $a_lang="-")
Get page content usages for page.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAssignedMaterial(int $a_user_id, int $a_tref_id, int $a_level)
Get assigned material (for a skill level and user)
static getFlashVideoPlayerDirectory()
static copyPlayerFilesToTargetDirectory(string $a_target_dir)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTemplateId(int $a_obj_id)
static getInstance(int $a_id=0)
static _lookupType(int $a_obj_id)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Class ChatMainBarProvider \MainMenu\Provider.