ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCOPageHTMLExport Class Reference

HTML export class for pages. More...

+ Collaboration diagram for ilCOPageHTMLExport:

Public Member Functions

 __construct (string $a_exp_dir, ?\ILIAS\COPage\PageLinker $linker=null, int $ref_id=0, protected ?ExportCollector $export_collector=null)
 
 setContentStyleId (int $a_val)
 
 getContentStyleId ()
 
 createDirectories ()
 
 exportStyles ()
 Export content style. More...
 
 exportSupportScripts ()
 Export support scripts. More...
 
 getPreparedMainTemplate (?ilGlobalTemplateInterface $a_tpl=null)
 
 collectPageElements (string $a_type, int $a_id, string $lang="")
 Collect page elements (that need to be exported separately) More...
 
 exportPageElements (?callable $a_update_callback=null)
 Export page elements. More...
 
 exportHTMLMOB (int $a_mob_id, array &$a_linked_mobs)
 Export media object to html. More...
 
 exportHTMLFile (string $a_file_id)
 Export file object. More...
 
 exportHTMLFileDirect (string $a_file_id, string $a_source_file, string $a_file_name)
 Export file from path. More...
 
 exportHTMLGlossaryTerms ()
 

Protected Member Functions

 exportResourceFile (string $target_dir, string $file)
 
 initResourceTemplate (string $template_file)
 Get resource template. More...
 
 renderMob (\ilObjMediaObject $mob_obj, string $link_xml, array $params)
 Render Mob. More...
 
 exportQuestionFiles ()
 Export question images. More...
 

Protected Attributes

ILIAS MediaObjects MediaObjectManager $media_manager
 
ILIAS Style Content InternalDomainService $content_style
 
ILIAS COPage Xsl XslManager $xsl
 
string $css_dir = ""
 
string $js_yahoo_dir = ""
 
string $js_dir = ""
 
string $media_service_dir = ""
 
string $services_dir = ""
 
string $content_style_img_dir = ""
 
string $content_style_dir = ""
 
string $tex_dir = ""
 
string $files_dir = ""
 
string $mobs_dir = ""
 
array $mobs = []
 
array $glossary_terms = []
 
array $files = []
 
array $files_direct = []
 
array $int_links = []
 
array $q_ids = []
 
string $exp_dir = ""
 
int $content_style_id = 0
 
ilObjUser $user
 
ilLogger $log
 
ILIAS GlobalScreen Services $global_screen
 
ILIAS Skill Service SkillTreeService $skill_tree_service
 
ILIAS Skill Service SkillPersonalService $skill_personal_service
 
ILIAS COPage PageLinker $page_linker
 
int $ref_id
 

Detailed Description

HTML export class for pages.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilCOPageHTMLExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilCOPageHTMLExport::__construct ( string  $a_exp_dir,
?\ILIAS\COPage\PageLinker  $linker = null,
int  $ref_id = 0,
protected ?ExportCollector  $export_collector = null 
)

Definition at line 57 of file class.ilCOPageHTMLExport.php.

62 {
63 global $DIC;
64 $this->log = ilLoggerFactory::getLogger('copg');
65 $this->user = $DIC->user();
66 $this->global_screen = $DIC->globalScreen();
67 $this->skill_tree_service = $DIC->skills()->tree();
68 $this->skill_personal_service = $DIC->skills()->personal();
69 $this->page_linker = is_null($linker)
70 ? new ilPageLinker("", true)
71 : $linker;
72 $this->ref_id = $ref_id;
73
74 $this->exp_dir = $a_exp_dir;
75 $this->mobs_dir = $a_exp_dir . "/mobs";
76 $this->files_dir = $a_exp_dir . "/files";
77 $this->tex_dir = $a_exp_dir . "/teximg";
78 $this->content_style_dir = $a_exp_dir . "/content_style";
79 $this->content_style_img_dir = $a_exp_dir . "/content_style/images";
80
81 $this->services_dir = $a_exp_dir . "/components/ILIAS";
82 $this->media_service_dir = $this->services_dir . "/MediaObjects";
83
84 $this->js_dir = $a_exp_dir . '/js';
85 $this->js_yahoo_dir = $a_exp_dir . '/js/yahoo';
86 $this->css_dir = $a_exp_dir . '/css';
87 $this->xsl = $DIC->copage()->internal()->domain()->xsl();
88 $this->content_style = $DIC->contentStyle()->internal()->domain();
89 $this->media_manager = $DIC->mediaObjects()->internal()->domain()->mediaObject();
90 }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: shib_login.php:26

References $DIC, $ref_id, ilLoggerFactory\getLogger(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ collectPageElements()

ilCOPageHTMLExport::collectPageElements ( string  $a_type,
int  $a_id,
string  $lang = "" 
)

Collect page elements (that need to be exported separately)

Definition at line 266 of file class.ilCOPageHTMLExport.php.

270 : void {
271 $this->log->debug("collect page elements");
272
273 // collect all dependent pages (only one level deep)
274 $pages[] = [
275 "type" => $a_type,
276 "id" => $a_id
277 ];
278
279 // ... content includes
280 $pcs = ilPageContentUsage::getUsagesOfPage($a_id, $a_type, 0, false, $lang);
281 foreach ($pcs as $pc) {
282 // content includes
283 if ($pc["type"] == "incl") {
284 $pages[] = [
285 "type" => "mep:pg",
286 "id" => $pc["id"]
287 ];
288 }
289 }
290
291 // ... internal links
292 $pg_links = \ilInternalLink::_getTargetsOfSource($a_type, $a_id, $lang);
293 $this->int_links = array_merge($this->int_links, $pg_links);
294 $this->glossary_terms = [];
295
296 // ... glossary pages of internal links
297 foreach ($this->int_links as $int_link) {
298 if ($int_link["type"] == "git") {
299 $this->glossary_terms[] = $int_link["id"];
300 // store linked/embedded media objects of glosssary term
301 $pages[] = [
302 "type" => "term:pg",
303 "id" => $int_link["id"]
304 ];
305 }
306 }
307
308 // resources of pages
309 foreach ($pages as $page) {
310 $page_id = $page["id"];
311 $page_type = $page["type"];
312
313 // collect media objects
314 $pg_mobs = ilObjMediaObject::_getMobsOfObject($page_type, $page_id, 0, $lang);
315 foreach ($pg_mobs as $pg_mob) {
316 $this->mobs[$pg_mob] = $pg_mob;
317 $this->log->debug("HTML Export: Add media object $pg_mob (" . \ilObject::_lookupTitle($pg_mob) . ") " .
318 " due to page $page_id, $page_type ).");
319 }
320
321 // collect all files
322 $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0, $lang);
323 foreach ($files as $f) {
324 $this->files[$f] = $f;
325 }
326
327 // collect all questions
329 foreach ($q_ids as $q_id) {
330 $this->q_ids[$q_id] = $q_id;
331 }
332 }
333
334 // collect page content items
335 $skill_tree = $ws_tree = null;
336
337 // skills
338 foreach ($pcs as $pc) {
339 if ($pc["type"] == "skmg") {
340 $skill_id = $pc["id"];
341
342 // trying to find user id
343 $user_id = null;
344 switch ($a_type) {
345 case "prtf:pg":
346 $page = new ilPortfolioPage($a_id);
347 $user_id = $page->getCreationUserId();
348 break;
349
350 default:
351 // :TODO:
352 break;
353 }
354
355 if ($user_id) {
356 // we only need 1 instance each
357 if (!$skill_tree) {
358 $skill_tree = $this->skill_tree_service->getGlobalSkillTree();
359
360 $ws_tree = new ilWorkspaceTree($user_id);
361 }
362
363 // walk skill tree
364 $skill_id = (int) $skill_id;
365 $vtree = $this->skill_tree_service->getVirtualSkillTreeForNodeId($skill_id);
366 $tref_id = 0;
367 if (ilSkillTreeNode::_lookupType($skill_id) == "sktr") {
368 $tref_id = $skill_id;
369 $skill_id = ilSkillTemplateReference::_lookupTemplateId($skill_id);
370 }
371 $b_skills = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
372
373 foreach ($b_skills as $bs) {
374 $skill = ilSkillTreeNodeFactory::getInstance($bs["skill_id"]);
375 $level_data = $skill->getLevelData();
376 foreach ($level_data as $k => $v) {
377 // get assigned materials from personal skill
378 $mat = $this->skill_personal_service->getAssignedMaterials($user_id, $bs["tref_id"], $v["id"]);
379 if (count($mat)) {
380 foreach ($mat as $item) {
381 $wsp_id = $item->getWorkspaceId();
382 $obj_id = $ws_tree->lookupObjectId($wsp_id);
383
384 // all possible material types for now
385 switch (ilObject::_lookupType($obj_id)) {
386 case "file":
387 $this->files[$obj_id] = $obj_id;
388 break;
389
390 case "tstv":
391 $obj = new ilObjTestVerification($obj_id, false);
392 $this->files_direct[$obj_id] = array($obj->getFilePath(),
393 $obj->getOfflineFilename());
394 break;
395
396 case "excv":
397 $obj = new ilObjExerciseVerification($obj_id, false);
398 $this->files_direct[$obj_id] = array($obj->getFilePath(),
399 $obj->getOfflineFilename());
400 break;
401
402 case "crsv":
403 $obj = new ilObjCourseVerification($obj_id, false);
404 $this->files_direct[$obj_id] = array($obj->getFilePath(),
405 $obj->getOfflineFilename());
406 break;
407
408 case "cmxv":
409 $obj = new ilObjCmiXapiVerification($obj_id, false);
410 $this->files_direct[$obj_id] = array($obj->getFilePath(),
411 $obj->getOfflineFilename());
412 break;
413
414 case "ltiv":
415 $obj = new ilObjLTIConsumerVerification($obj_id, false);
416 $this->files_direct[$obj_id] = array($obj->getFilePath(),
417 $obj->getOfflineFilename());
418 break;
419
420 case "scov":
421 $obj = new ilObjSCORMVerification($obj_id, false);
422 $this->files_direct[$obj_id] = array($obj->getFilePath(),
423 $obj->getOfflineFilename());
424 break;
425 }
426 }
427 }
428 }
429 }
430 }
431 }
432 }
433 }
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _lookupType(int $id, bool $reference=false)
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 _lookupType(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lang
Definition: xapiexit.php:25

Referenced by ILIAS\Blog\Export\BlogHtmlExport\collectAllPagesPageElements().

+ Here is the caller graph for this function:

◆ createDirectories()

ilCOPageHTMLExport::createDirectories ( )

Definition at line 102 of file class.ilCOPageHTMLExport.php.

102 : void
103 {
104 ilFileUtils::makeDir($this->mobs_dir);
105 ilFileUtils::makeDir($this->files_dir);
106 ilFileUtils::makeDir($this->tex_dir);
107 ilFileUtils::makeDir($this->content_style_dir);
108 ilFileUtils::makeDir($this->content_style_img_dir);
109 ilFileUtils::makeDir($this->services_dir);
110 ilFileUtils::makeDir($this->media_service_dir);
111
112 ilFileUtils::makeDirParents($this->js_dir);
113 ilFileUtils::makeDirParents($this->js_yahoo_dir);
114 ilFileUtils::makeDirParents($this->css_dir);
115 ilFileUtils::makeDirParents($this->css_dir . "/yahoo");
116 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilFileUtils\makeDir(), and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ exportHTMLFile()

ilCOPageHTMLExport::exportHTMLFile ( string  $a_file_id)

Export file object.

Definition at line 598 of file class.ilCOPageHTMLExport.php.

598 : void
599 {
600 $file_dir = $this->files_dir . "/file_" . $a_file_id;
601 ilFileUtils::makeDir($file_dir);
602
603 $file_obj = new ilObjFile($a_file_id, false);
604 $source_file = $file_obj->getFile($file_obj->getVersion());
605 if (!is_file($source_file)) {
606 $source_file = $file_obj->getFile();
607 }
608 if (is_file($source_file)) {
609 copy($source_file, $file_dir . "/" . $file_obj->getFileName());
610 }
611 }
Class ilObjFile.

References ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ exportHTMLFileDirect()

ilCOPageHTMLExport::exportHTMLFileDirect ( string  $a_file_id,
string  $a_source_file,
string  $a_file_name 
)

Export file from path.

Definition at line 616 of file class.ilCOPageHTMLExport.php.

620 : void {
621 $file_dir = $this->files_dir . "/file_" . $a_file_id;
622 ilFileUtils::makeDir($file_dir);
623
624 if (is_file($a_source_file)) {
625 copy(
626 $a_source_file,
627 $file_dir . "/" . ilFileUtils::getASCIIFilename($a_file_name)
628 );
629 }
630 }
static getASCIIFilename(string $a_filename)

◆ exportHTMLGlossaryTerms()

ilCOPageHTMLExport::exportHTMLGlossaryTerms ( )

Definition at line 649 of file class.ilCOPageHTMLExport.php.

649 : void
650 {
651 foreach ($this->glossary_terms as $term_id) {
652 if (!ilGlossaryTerm::_exists($term_id)) {
653 continue;
654 }
655 $tpl = $this->initResourceTemplate("tpl.glossary_term_output.html");
656
657 $term_gui = new ilGlossaryTermGUI($term_id);
658 $term_gui->setPageLinker($this->page_linker);
659 $term_gui->setOfflineDirectory($this->exp_dir);
660 $term_gui->output(true, $tpl);
661
662 // write file
663 $html = $tpl->printToString();
664 $file = $this->exp_dir . "/term_" . $term_id . ".html";
665 $fp = fopen($file, "w+");
666 fwrite($fp, $html);
667 fclose($fp);
668 }
669 }
initResourceTemplate(string $template_file)
Get resource template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(int $a_id)
checks whether a glossary term with specified id exists or not

References ilGlossaryTerm\_exists().

+ Here is the call graph for this function:

◆ exportHTMLMOB()

ilCOPageHTMLExport::exportHTMLMOB ( int  $a_mob_id,
array &  $a_linked_mobs 
)

Export media object to html.

Definition at line 505 of file class.ilCOPageHTMLExport.php.

508 : void {
509 $this->log->debug("export html mobs");
510
511 if (is_null($this->export_collector)) {
512 $source_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
513 if (is_dir($source_dir)) {
514 ilFileUtils::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
515 ilFileUtils::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
516 }
517 } else {
518 $mob_res_id = $this->media_manager->getContainerResourceId($a_mob_id);
519 if ($mob_res_id) {
520 $this->export_collector->addContainerDirectory(
521 $mob_res_id->serialize(),
522 "",
523 "/mobs/mm_" . $a_mob_id,
524 );
525 }
526 }
527
528 $mob_obj = new ilObjMediaObject($a_mob_id);
529
530 $tpl = $this->initResourceTemplate("tpl.fullscreen.html");
531 $med_links = ilMediaItem::_getMapAreasIntLinks($a_mob_id);
532 $link_xml = $this->page_linker->getLinkXML($med_links);
533
534 $params = [
535 "mode" => "media",
536 'enlarge_path' => ilUtil::getImagePath("media/enlarge.svg", false, "output", true),
537 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
538 'fullscreen_link' => $this->page_linker->getFullScreenLink()
539 ];
540 if ($this->ref_id > 0) {
541 $params["ref_id"] = $this->ref_id;
542 $params["link_params"] = "ref_id=" . $this->ref_id;
543 }
544
545 $tpl->setVariable("MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml, $params));
546 $html = $tpl->printToString();
547 if (is_null($this->export_collector)) {
548 $file = $this->exp_dir . "/media_" . $a_mob_id . ".html";
549 $fp = fopen($file, "w+");
550 fwrite($fp, $html);
551 fclose($fp);
552 unset($fp);
553 } else {
554 $this->export_collector->addString($html, "/media_" . $a_mob_id . ".html");
555 }
556
557 if ($mob_obj->hasFullscreenItem()) {
558 $tpl = $this->initResourceTemplate("tpl.fullscreen.html");
559 $params["mode"] = "fullscreen";
560 $tpl->setVariable("MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml, $params));
561 $html = $tpl->printToString();
562 if (is_null($this->export_collector)) {
563 $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
564 $fp = fopen($file, "w+");
565 fwrite($fp, $html);
566 fclose($fp);
567 unset($fp);
568 } else {
569 $this->export_collector->addString($html, "/fullscreen_" . $a_mob_id . ".html");
570 }
571 }
572
573 $linked_mobs = $mob_obj->getLinkedMediaObjects();
574 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
575 }
renderMob(\ilObjMediaObject $mob_obj, string $link_xml, array $params)
Render Mob.
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _getMapAreasIntLinks(int $a_mob_id)
get all internal links of map areas of a mob
static isTypeAllowed(string $a_type)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31

References ilFileUtils\getWebspaceDir(), ilFileUtils\makeDir(), and ilFileUtils\rCopy().

+ Here is the call graph for this function:

◆ exportPageElements()

ilCOPageHTMLExport::exportPageElements ( ?callable  $a_update_callback = null)

Export page elements.

Definition at line 438 of file class.ilCOPageHTMLExport.php.

440 : void {
441 $this->log->debug("export page elements");
442
443 $total = count($this->mobs) + count($this->files) + count($this->files_direct);
444 $cnt = 0;
445 // export all media objects
446 $linked_mobs = array();
447 foreach ($this->mobs as $mob) {
448 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
449 $this->exportHTMLMOB($mob, $linked_mobs);
450 }
451 if (is_callable($a_update_callback)) {
452 $cnt++;
453 $a_update_callback($total, $cnt);
454 }
455 }
456 $linked_mobs2 = array(); // mobs linked in link areas
457 foreach ($linked_mobs as $mob) {
458 if (ilObject::_exists($mob)) {
459 $this->exportHTMLMOB($mob, $linked_mobs2);
460 }
461 }
462
463 // export all file objects
464 foreach ($this->files as $file) {
465 $this->exportHTMLFile($file);
466 if (is_callable($a_update_callback)) {
467 $cnt++;
468 $a_update_callback($total, $cnt);
469 }
470 }
471
472 // export all files (which are not objects
473 foreach ($this->files_direct as $file_id => $attr) {
474 $this->exportHTMLFileDirect($file_id, $attr[0], $attr[1]);
475 if (is_callable($a_update_callback)) {
476 $cnt++;
477 $a_update_callback($total, $cnt);
478 }
479 }
480
481 $this->exportQuestionFiles();
482
483 // export all glossary terms
485 }
exportHTMLFile(string $a_file_id)
Export file object.
exportHTMLFileDirect(string $a_file_id, string $a_source_file, string $a_file_name)
Export file from path.
exportHTMLMOB(int $a_mob_id, array &$a_linked_mobs)
Export media object to html.
exportQuestionFiles()
Export question images.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

◆ exportQuestionFiles()

ilCOPageHTMLExport::exportQuestionFiles ( )
protected

Export question images.

Definition at line 635 of file class.ilCOPageHTMLExport.php.

635 : void
636 {
637 // export questions (images)
638 if (count($this->q_ids) > 0) {
639 foreach ($this->q_ids as $q_id) {
640 ilFileUtils::makeDirParents($this->exp_dir . "/assessment/0/" . $q_id . "/images");
642 ilFileUtils::getWebspaceDir() . "/assessment/0/" . $q_id . "/images",
643 $this->exp_dir . "/assessment/0/" . $q_id . "/images"
644 );
645 }
646 }
647 }

References ilFileUtils\getWebspaceDir(), ilFileUtils\makeDirParents(), and ilFileUtils\rCopy().

+ Here is the call graph for this function:

◆ exportResourceFile()

ilCOPageHTMLExport::exportResourceFile ( string  $target_dir,
string  $file 
)
protected

Definition at line 204 of file class.ilCOPageHTMLExport.php.

207 : void {
208 if (is_int(strpos($file, "?"))) {
209 $file = substr($file, 0, strpos($file, "?"));
210 }
211 if (is_file($file)) {
212 if (is_null($this->export_collector)) {
213 $dir = dirname($file);
214 ilFileUtils::makeDirParents($target_dir . "/" . $dir);
215 if (!is_file($target_dir . "/" . $file)) {
216 copy($file, $target_dir . "/" . $file);
217 }
218 } else {
219 $this->export_collector->addFile($file, $file);
220 }
221 }
222 }

Referenced by exportStyles(), and exportSupportScripts().

+ Here is the caller graph for this function:

◆ exportStyles()

ilCOPageHTMLExport::exportStyles ( )

Export content style.

Exceptions

ILIAS\Filesystem\Exception\DirectoryNotFoundException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

Definition at line 124 of file class.ilCOPageHTMLExport.php.

124 : void
125 {
126 $this->log->debug("export styles");
127
128 // export content style sheet
129 if ($this->getContentStyleId() < 1) { // basic style
130 if (is_null($this->export_collector)) {
133 $this->exp_dir . "/" . ilObjStyleSheet::getBasicImageDir()
134 );
135 ilFileUtils::makeDirParents($this->exp_dir . "/components/ILIAS/COPage/css");
136 copy(
137 "../components/ILIAS/COPage/resources/content.css",
138 $this->exp_dir . "/components/ILIAS/COPage/css/content.css"
139 );
140 } else {
141 $this->export_collector->addDirectory(
143 "/basic_style/images"
144 );
145 $this->export_collector->addFile(
146 "../components/ILIAS/COPage/css/content.css",
148 );
149 }
150 } else {
151 $style = new ilObjStyleSheet($this->getContentStyleId());
152 if (is_null($this->export_collector)) {
153 $style->copyImagesToDir($this->exp_dir . "/" . $style->getImagesDirectory());
154 $this->exportResourceFile(
155 $this->exp_dir,
157 );
158 } else {
159 $res_id = $this->content_style->style($this->getContentStyleId())->getResourceIdentification();
160 if ($res_id) {
161 $this->export_collector->addContainerDirectory(
162 $res_id->serialize(),
163 "",
164 "content_style"
165 );
166 }
167 }
168 }
169
170 // export syntax highlighting style
171 $syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
172 $this->exportResourceFile($this->exp_dir, $syn_stylesheet);
173
174 // export print style
175 $print_stylesheet = ilObjStyleSheet::getContentPrintStyle();
176 $this->exportResourceFile($this->exp_dir, $print_stylesheet);
177 }
exportResourceFile(string $target_dir, string $file)
Class ilObjStyleSheet.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)

References exportResourceFile(), ilObjStyleSheet\getBasicImageDir(), ilObjStyleSheet\getContentPrintStyle(), getContentStyleId(), ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getExportContentStylePath(), ilObjStyleSheet\getSyntaxStylePath(), ilFileUtils\makeDirParents(), and ilFileUtils\rCopy().

+ Here is the call graph for this function:

◆ exportSupportScripts()

ilCOPageHTMLExport::exportSupportScripts ( )

Export support scripts.

Todo:
: use ilPageContent js/css functions here (problem: currently they need a page object for init)

Definition at line 184 of file class.ilCOPageHTMLExport.php.

184 : void
185 {
186 $this->log->debug("export scripts");
187
188 $collector = new \ILIAS\COPage\ResourcesCollector(ilPageObjectGUI::OFFLINE);
189
190 foreach ($collector->getJavascriptFiles() as $js) {
191 $this->exportResourceFile($this->exp_dir, $js);
192 }
193
194 foreach ($collector->getCssFiles() as $css) {
195 $this->exportResourceFile($this->exp_dir, $css);
196 }
197
198 // mathjax needs the whole directory to dynamically load resources
199 if (!is_null($this->export_collector)) {
200 $this->export_collector->addDirectory('node_modules/mathjax/es5', 'node_modules/mathjax/es5');
201 }
202 }

References exportResourceFile(), and ilPageObjectGUI\OFFLINE.

+ Here is the call graph for this function:

◆ getContentStyleId()

ilCOPageHTMLExport::getContentStyleId ( )

Definition at line 97 of file class.ilCOPageHTMLExport.php.

97 : int
98 {
100 }

References $content_style_id.

Referenced by exportStyles().

+ Here is the caller graph for this function:

◆ getPreparedMainTemplate()

ilCOPageHTMLExport::getPreparedMainTemplate ( ?ilGlobalTemplateInterface  $a_tpl = null)

Definition at line 224 of file class.ilCOPageHTMLExport.php.

227 global $DIC;
228 $this->log->debug("get main template");
229
230
231 $resource_collector = new \ILIAS\COPage\ResourcesCollector(ilPageObjectGUI::OFFLINE);
232 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
233
234 if (!is_null($a_tpl)) {
235 $tpl = $a_tpl;
236 } else {
237 // template workaround: reset of template
238 $tpl = new ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
239 }
240
241 // scripts needed
242 /* @todo check
243 $scripts = [];
244 $scripts = array_merge($scripts, ilPlayerUtil::getJsFilePaths());
245
246 $mathJaxSetting = new ilSetting("MathJax");
247 $use_mathjax = $mathJaxSetting->get("enable");
248 if ($use_mathjax) {
249 $scripts[] = $mathJaxSetting->get("path_to_mathjax");
250 }
251 */
252
253 $tpl->addCss(\ilUtil::getStyleSheetLocation());
254 // important, we pass 0 here, since the export will use the standard directory
257
258 $resource_injector->inject($tpl);
259
260 return $tpl;
261 }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user

◆ initResourceTemplate()

ilCOPageHTMLExport::initResourceTemplate ( string  $template_file)
protected

Get resource template.

Definition at line 490 of file class.ilCOPageHTMLExport.php.

493 $this->global_screen->layout()->meta()->reset();
494 $tpl = new ilGlobalTemplate($template_file, true, true, "components/ILIAS/COPage");
495 $this->getPreparedMainTemplate($tpl);
496 $tpl->addCss(\ilUtil::getStyleSheetLocation());
499 return $tpl;
500 }
getPreparedMainTemplate(?ilGlobalTemplateInterface $a_tpl=null)
special template class to simplify handling of ITX/PEAR

◆ renderMob()

ilCOPageHTMLExport::renderMob ( \ilObjMediaObject  $mob_obj,
string  $link_xml,
array  $params 
)
protected

Render Mob.

Definition at line 580 of file class.ilCOPageHTMLExport.php.

584 : string {
585 $xml = "<dummy>" .
586 $mob_obj->getXML(IL_MODE_ALIAS) .
587 $mob_obj->getXML(IL_MODE_OUTPUT) .
588 $link_xml .
589 "</dummy>";
590
591 return $this->xsl->process($xml, $params);
592 }
const IL_MODE_ALIAS
const IL_MODE_OUTPUT

◆ setContentStyleId()

ilCOPageHTMLExport::setContentStyleId ( int  $a_val)

Definition at line 92 of file class.ilCOPageHTMLExport.php.

92 : void
93 {
94 $this->content_style_id = $a_val;
95 }

Field Documentation

◆ $content_style

ILIAS Style Content InternalDomainService ilCOPageHTMLExport::$content_style
protected

Definition at line 29 of file class.ilCOPageHTMLExport.php.

◆ $content_style_dir

string ilCOPageHTMLExport::$content_style_dir = ""
protected

Definition at line 37 of file class.ilCOPageHTMLExport.php.

◆ $content_style_id

int ilCOPageHTMLExport::$content_style_id = 0
protected

Definition at line 48 of file class.ilCOPageHTMLExport.php.

Referenced by getContentStyleId().

◆ $content_style_img_dir

string ilCOPageHTMLExport::$content_style_img_dir = ""
protected

Definition at line 36 of file class.ilCOPageHTMLExport.php.

◆ $css_dir

string ilCOPageHTMLExport::$css_dir = ""
protected

Definition at line 31 of file class.ilCOPageHTMLExport.php.

◆ $exp_dir

string ilCOPageHTMLExport::$exp_dir = ""
protected

Definition at line 47 of file class.ilCOPageHTMLExport.php.

◆ $files

array ilCOPageHTMLExport::$files = []
protected

Definition at line 43 of file class.ilCOPageHTMLExport.php.

◆ $files_dir

string ilCOPageHTMLExport::$files_dir = ""
protected

Definition at line 39 of file class.ilCOPageHTMLExport.php.

◆ $files_direct

array ilCOPageHTMLExport::$files_direct = []
protected

Definition at line 44 of file class.ilCOPageHTMLExport.php.

◆ $global_screen

ILIAS GlobalScreen Services ilCOPageHTMLExport::$global_screen
protected

Definition at line 51 of file class.ilCOPageHTMLExport.php.

◆ $glossary_terms

array ilCOPageHTMLExport::$glossary_terms = []
protected

Definition at line 42 of file class.ilCOPageHTMLExport.php.

◆ $int_links

array ilCOPageHTMLExport::$int_links = []
protected

Definition at line 45 of file class.ilCOPageHTMLExport.php.

◆ $js_dir

string ilCOPageHTMLExport::$js_dir = ""
protected

Definition at line 33 of file class.ilCOPageHTMLExport.php.

◆ $js_yahoo_dir

string ilCOPageHTMLExport::$js_yahoo_dir = ""
protected

Definition at line 32 of file class.ilCOPageHTMLExport.php.

◆ $log

ilLogger ilCOPageHTMLExport::$log
protected

Definition at line 50 of file class.ilCOPageHTMLExport.php.

◆ $media_manager

ILIAS MediaObjects MediaObjectManager ilCOPageHTMLExport::$media_manager
protected

Definition at line 28 of file class.ilCOPageHTMLExport.php.

◆ $media_service_dir

string ilCOPageHTMLExport::$media_service_dir = ""
protected

Definition at line 34 of file class.ilCOPageHTMLExport.php.

◆ $mobs

array ilCOPageHTMLExport::$mobs = []
protected

Definition at line 41 of file class.ilCOPageHTMLExport.php.

◆ $mobs_dir

string ilCOPageHTMLExport::$mobs_dir = ""
protected

Definition at line 40 of file class.ilCOPageHTMLExport.php.

◆ $page_linker

ILIAS COPage PageLinker ilCOPageHTMLExport::$page_linker
protected

Definition at line 54 of file class.ilCOPageHTMLExport.php.

◆ $q_ids

array ilCOPageHTMLExport::$q_ids = []
protected

Definition at line 46 of file class.ilCOPageHTMLExport.php.

◆ $ref_id

int ilCOPageHTMLExport::$ref_id
protected

Definition at line 55 of file class.ilCOPageHTMLExport.php.

Referenced by __construct().

◆ $services_dir

string ilCOPageHTMLExport::$services_dir = ""
protected

Definition at line 35 of file class.ilCOPageHTMLExport.php.

◆ $skill_personal_service

ILIAS Skill Service SkillPersonalService ilCOPageHTMLExport::$skill_personal_service
protected

Definition at line 53 of file class.ilCOPageHTMLExport.php.

◆ $skill_tree_service

ILIAS Skill Service SkillTreeService ilCOPageHTMLExport::$skill_tree_service
protected

Definition at line 52 of file class.ilCOPageHTMLExport.php.

◆ $tex_dir

string ilCOPageHTMLExport::$tex_dir = ""
protected

Definition at line 38 of file class.ilCOPageHTMLExport.php.

◆ $user

ilObjUser ilCOPageHTMLExport::$user
protected

Definition at line 49 of file class.ilCOPageHTMLExport.php.

◆ $xsl

ILIAS COPage Xsl XslManager ilCOPageHTMLExport::$xsl
protected

Definition at line 30 of file class.ilCOPageHTMLExport.php.


The documentation for this class was generated from the following file: