ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCOPageHTMLExport Class Reference

HTML export class for pages. More...

+ Collaboration diagram for ilCOPageHTMLExport:

Public Member Functions

 __construct ($a_exp_dir, \ILIAS\COPage\PageLinker $linker=null, $ref_id=0)
 ilCOPageHTMLExport constructor. More...
 
 setContentStyleId ($a_val)
 Set content style id. More...
 
 getContentStyleId ()
 Get content style id. More...
 
 createDirectories ()
 Create directories. More...
 
 exportStyles ()
 Export content style. More...
 
 exportSupportScripts ()
 Export support scripts. More...
 
 getPreparedMainTemplate ($a_tpl="")
 Get prepared main template. More...
 
 collectPageElements ($a_type, $a_id, $lang="")
 Collect page elements (that need to be exported separately) More...
 
 exportPageElements ($a_update_callback=null)
 Export page elements. More...
 
 exportHTMLMOB ($a_mob_id, &$a_linked_mobs)
 Export media object to html. More...
 
 exportHTMLFile ($a_file_id)
 Export file object. More...
 
 exportHTMLFileDirect ($a_file_id, $a_source_file, $a_file_name)
 Export file from path. More...
 
 exportHTMLGlossaryTerms ()
 Export glossary terms. More...
 

Protected Member Functions

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

Protected Attributes

 $mobs = []
 
 $glossary_terms = []
 
 $files = []
 
 $files_direct = []
 
 $int_links = []
 
 $q_ids = []
 
 $exp_dir = ""
 
 $content_style_id = 0
 
 $user
 
 $log
 
 $global_screen
 
 $page_linker
 
 $ref_id
 

Detailed Description

HTML export class for pages.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id

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

Constructor & Destructor Documentation

◆ __construct()

ilCOPageHTMLExport::__construct (   $a_exp_dir,
\ILIAS\COPage\PageLinker  $linker = null,
  $ref_id = 0 
)

ilCOPageHTMLExport constructor.

Parameters
$a_exp_dir

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

References $DIC, $ref_id, ilPlayerUtil\getFlashVideoPlayerDirectory(), ilLoggerFactory\getLogger(), and user().

83  {
84  global $DIC;
85 
86  $this->log = ilLoggerFactory::getLogger('copg');
87  $this->user = $DIC->user();
88  $this->global_screen = $DIC->globalScreen();
89  $this->page_linker = is_null($linker)
90  ? new ilPageLinker("", true)
91  : $linker;
92  $this->ref_id = $ref_id;
93 
94  $this->exp_dir = $a_exp_dir;
95  $this->mobs_dir = $a_exp_dir . "/mobs";
96  $this->files_dir = $a_exp_dir . "/files";
97  $this->tex_dir = $a_exp_dir . "/teximg";
98  $this->content_style_dir = $a_exp_dir . "/content_style";
99  $this->content_style_img_dir = $a_exp_dir . "/content_style/images";
100 
101  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
102  $this->services_dir = $a_exp_dir . "/Services";
103  $this->media_service_dir = $this->services_dir . "/MediaObjects";
104  $this->flv_dir = $a_exp_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
105  $this->mp3_dir = $this->media_service_dir . "/flash_mp3_player";
106 
107  $this->js_dir = $a_exp_dir . '/js';
108  $this->js_yahoo_dir = $a_exp_dir . '/js/yahoo';
109  $this->css_dir = $a_exp_dir . '/css';
110  }
Page linker.
user()
Definition: user.php:4
static getFlashVideoPlayerDirectory()
Get flash video player directory.
$DIC
Definition: xapitoken.php:46
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ collectPageElements()

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

Collect page elements (that need to be exported separately)

Parameters
string$a_pg_typepage type
int$a_pg_idpage id

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

References $a_type, Vendor\Package\$f, $files, $lang, $q_ids, ilObjFile\_getFilesOfObject(), ilObjMediaObject\_getMobsOfObject(), ilPCQuestion\_getQuestionIdsForPage(), ilInternalLink\_getTargetsOfSource(), ilSkillTemplateReference\_lookupTemplateId(), ilObject\_lookupTitle(), ilSkillTreeNode\_lookupType(), ilObject\_lookupType(), ilPersonalSkill\getAssignedMaterial(), ilGlossaryDefinition\getDefinitionList(), ilSkillTreeNodeFactory\getInstance(), and ilPageContentUsage\getUsagesOfPage().

319  {
320  $this->log->debug("collect page elements");
321 
322  // collect all dependent pages (only one level deep)
323  $pages[] = [
324  "type" => $a_type,
325  "id" => $a_id
326  ];
327 
328  // ... content includes
329  $pcs = ilPageContentUsage::getUsagesOfPage($a_id, $a_type, 0, false, $lang);
330  foreach ($pcs as $pc) {
331  // content includes
332  if ($pc["type"] == "incl") {
333  $pages[] = [
334  "type" => "mep:pg",
335  "id" => $pc["id"]
336  ];
337  }
338  }
339 
340  // ... internal links
342  $this->int_links = array_merge($this->int_links, $pg_links);
343  $this->glossary_terms = [];
344 
345  // ... glossary pages of internal links
346  foreach ($this->int_links as $int_link) {
347  if ($int_link["type"] == "git") {
348  $this->glossary_terms[] = $int_link["id"];
349  // store linked/embedded media objects of glosssary term
350  $defs = \ilGlossaryDefinition::getDefinitionList($int_link["id"]);
351  foreach ($defs as $def) {
352  $pages[] = [
353  "type" => "gdf:pg",
354  "id" => $def["obj_id"]
355  ];
356  }
357  }
358  }
359 
360  // resources of pages
361  foreach ($pages as $page) {
362  $page_id = $page["id"];
363  $page_type = $page["type"];
364 
365  // collect media objects
366  $pg_mobs = ilObjMediaObject::_getMobsOfObject($page_type, $page_id, 0, $lang);
367  foreach ($pg_mobs as $pg_mob) {
368  $this->mobs[$pg_mob] = $pg_mob;
369  $this->log->debug("HTML Export: Add media object $pg_mob (" . \ilObject::_lookupTitle($pg_mob) . ") " .
370  " due to page $page_id, $page_type ).");
371  }
372 
373  // collect all files
374  $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0, $lang);
375  foreach ($files as $f) {
376  $this->files[$f] = $f;
377  }
378 
379  // collect all questions
381  foreach ($q_ids as $q_id) {
382  $this->q_ids[$q_id] = $q_id;
383  }
384  }
385 
386  // collect page content items
387  $skill_tree = $ws_tree = null;
388 
389  // skills
390  foreach ($pcs as $pc) {
391  if ($pc["type"] == "skmg") {
392  $skill_id = $pc["id"];
393 
394  // trying to find user id
395  $user_id = null;
396  switch ($a_type) {
397  case "prtf:pg":
398  include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
399  $page = new ilPortfolioPage($a_id);
400  $user_id = $page->create_user;
401  break;
402 
403  default:
404  // :TODO:
405  break;
406  }
407 
408  if ($user_id) {
409  // we only need 1 instance each
410  if (!$skill_tree) {
411  include_once "Services/Skill/classes/class.ilSkillTree.php";
412  $skill_tree = new ilSkillTree();
413 
414  include_once "Services/Skill/classes/class.ilPersonalSkill.php";
415 
416  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
417  $ws_tree = new ilWorkspaceTree($user_id);
418  }
419 
420  // walk skill tree
421  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
422  $vtree = new ilVirtualSkillTree();
423  $tref_id = 0;
424  $skill_id = (int) $skill_id;
425  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
426  if (ilSkillTreeNode::_lookupType($skill_id) == "sktr") {
427  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
428  $tref_id = $skill_id;
429  $skill_id = ilSkillTemplateReference::_lookupTemplateId($skill_id);
430  }
431  $b_skills = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
432 
433  foreach ($b_skills as $bs) {
434  $skill = ilSkillTreeNodeFactory::getInstance($bs["skill_id"]);
435  $level_data = $skill->getLevelData();
436  foreach ($level_data as $k => $v) {
437  // get assigned materials from personal skill
438  $mat = ilPersonalSkill::getAssignedMaterial($user_id, $bs["tref_id"], $v["id"]);
439  if (sizeof($mat)) {
440  foreach ($mat as $item) {
441  $wsp_id = $item["wsp_id"];
442  $obj_id = $ws_tree->lookupObjectId($wsp_id);
443 
444  // all possible material types for now
445  switch (ilObject::_lookupType($obj_id)) {
446  case "file":
447  $this->files[$obj_id] = $obj_id;
448  break;
449 
450  case "tstv":
451  include_once "Modules/Test/classes/class.ilObjTestVerification.php";
452  $obj = new ilObjTestVerification($obj_id, false);
453  $this->files_direct[$obj_id] = array($obj->getFilePath(),
454  $obj->getOfflineFilename());
455  break;
456 
457  case "excv":
458  include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
459  $obj = new ilObjExerciseVerification($obj_id, false);
460  $this->files_direct[$obj_id] = array($obj->getFilePath(),
461  $obj->getOfflineFilename());
462  break;
463 
464  case "crsv":
465  include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
466  $obj = new ilObjCourseVerification($obj_id, false);
467  $this->files_direct[$obj_id] = array($obj->getFilePath(),
468  $obj->getOfflineFilename());
469  break;
470 
471  case "cmxv":
472  $obj = new ilObjCmiXapiVerification($obj_id, false);
473  $this->files_direct[$obj_id] = array($obj->getFilePath(),
474  $obj->getOfflineFilename());
475  break;
476 
477  case "ltiv":
478  $obj = new ilObjLTIConsumerVerification($obj_id, false);
479  $this->files_direct[$obj_id] = array($obj->getFilePath(),
480  $obj->getOfflineFilename());
481  break;
482 
483  case "scov":
484  include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
485  $obj = new ilObjSCORMVerification($obj_id, false);
486  $this->files_direct[$obj_id] = array($obj->getFilePath(),
487  $obj->getOfflineFilename());
488  break;
489  }
490  }
491  }
492  }
493  }
494  }
495  }
496  }
497  }
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static getDefinitionList($a_term_id)
static
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
Skill tree.
static _lookupTitle($a_id)
lookup object title
Tree handler for personal workspace.
static _lookupType($a_obj_id)
Lookup Type.
$a_type
Definition: workflow.php:92
static getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr=0, $a_all_hist_nrs=false, $a_lang="-")
Get page content usages for page.
Page for user portfolio.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
static _lookupType($a_id, $a_reference=false)
lookup object type
$lang
Definition: xapiexit.php:8
static getAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
+ Here is the call graph for this function:

◆ createDirectories()

ilCOPageHTMLExport::createDirectories ( )

Create directories.

Parameters

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

References ilUtil\makeDir().

139  {
140  ilUtil::makeDir($this->mobs_dir);
141  ilUtil::makeDir($this->files_dir);
142  ilUtil::makeDir($this->tex_dir);
143  ilUtil::makeDir($this->content_style_dir);
144  ilUtil::makeDir($this->content_style_img_dir);
145  ilUtil::makeDir($this->services_dir);
146  ilUtil::makeDir($this->media_service_dir);
147  ilUtil::makeDir($this->flv_dir);
148  ilUtil::makeDir($this->mp3_dir);
149 
150  ilUtil::makeDir($this->js_dir);
151  ilUtil::makeDir($this->js_yahoo_dir);
152  ilUtil::makeDir($this->css_dir);
153  ilUtil::makeDir($this->css_dir . "/yahoo");
154  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ exportHTMLFile()

ilCOPageHTMLExport::exportHTMLFile (   $a_file_id)

Export file object.

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

References ilUtil\makeDir().

Referenced by exportPageElements().

659  {
660  $file_dir = $this->files_dir . "/file_" . $a_file_id;
661  ilUtil::makeDir($file_dir);
662 
663  include_once("./Modules/File/classes/class.ilObjFile.php");
664  $file_obj = new ilObjFile($a_file_id, false);
665  $source_file = $file_obj->getDirectory($file_obj->getVersion()) . "/" . $file_obj->getFileName();
666  if (!is_file($source_file)) {
667  $source_file = $file_obj->getDirectory() . "/" . $file_obj->getFileName();
668  }
669  if (is_file($source_file)) {
670  copy($source_file, $file_dir . "/" . $file_obj->getFileName());
671  }
672  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTMLFileDirect()

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

Export file from path.

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

References ilUtil\getASCIIFilename(), and ilUtil\makeDir().

Referenced by exportPageElements().

678  {
679  $file_dir = $this->files_dir . "/file_" . $a_file_id;
680  ilUtil::makeDir($file_dir);
681 
682  if (is_file($a_source_file)) {
683  copy(
684  $a_source_file,
685  $file_dir . "/" . ilUtil::getASCIIFilename($a_file_name)
686  );
687  }
688  }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTMLGlossaryTerms()

ilCOPageHTMLExport::exportHTMLGlossaryTerms ( )

Export glossary terms.

Exceptions

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

References $tpl, and initResourceTemplate().

Referenced by exportPageElements().

712  {
713  foreach ($this->glossary_terms as $term_id) {
714  $tpl = $this->initResourceTemplate("tpl.glossary_term_output.html");
715 
716  $term_gui = new ilGlossaryTermGUI($term_id);
717  $term_gui->setPageLinker($this->page_linker);
718  $term_gui->setOfflineDirectory($this->exp_dir);
719  $term_gui->output(true, $tpl);
720 
721  // write file
722  $html = $tpl->printToString();
723  $file = $this->exp_dir . "/term_" . $term_id . ".html";
724  $fp = fopen($file, "w+");
725  fwrite($fp, $html);
726  fclose($fp);
727  }
728  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
initResourceTemplate($tempalate_file)
Get resource template.
GUI class for glossary terms.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTMLMOB()

ilCOPageHTMLExport::exportHTMLMOB (   $a_mob_id,
$a_linked_mobs 
)

Export media object to html.

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

References $ref_id, $tpl, ilMediaItem\_getMapAreasIntLinks(), ilUtil\getImagePath(), ilUtil\getWebspaceDir(), initResourceTemplate(), ilUtil\makeDir(), ilUtil\rCopy(), and renderMob().

Referenced by exportPageElements().

573  {
574  $this->log->debug("export html mobs");
575 
576  $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
577  if (is_dir($source_dir)) {
578  ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
579  ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
580  }
581 
582  $mob_obj = new ilObjMediaObject($a_mob_id);
583 
584  $tpl = $this->initResourceTemplate("tpl.fullscreen.html");
585  $med_links = ilMediaItem::_getMapAreasIntLinks($a_mob_id);
586  $link_xml = $this->page_linker->getLinkXML($med_links);
587 
588  $params = [
589  "mode" => "media",
590  'enlarge_path' => ilUtil::getImagePath("enlarge.svg", false, "output", true),
591  'fullscreen_link' => $this->page_linker->getFullScreenLink("fullscreen")
592  ];
593  if ($this->ref_id > 0) {
594  $params["ref_id"] = $this->ref_id;
595  $params["link_params"] = "ref_id=" . $this->ref_id;
596  }
597 
598  $tpl->setVariable("MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml, $params));
599  $html = $tpl->printToString();
600  $file = $this->exp_dir . "/media_" . $a_mob_id . ".html";
601  $fp = fopen($file, "w+");
602  fwrite($fp, $html);
603  fclose($fp);
604  unset($fp);
605 
606  if ($mob_obj->hasFullscreenItem()) {
607  $tpl = $this->initResourceTemplate("tpl.fullscreen.html");
608  $params["mode"] = "fullscreen";
609  $tpl->setVariable("MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml, $params));
610  $html = $tpl->printToString();
611  $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
612  $fp = fopen($file, "w+");
613  fwrite($fp, $html);
614  fclose($fp);
615  unset($fp);
616  }
617 
618  $linked_mobs = $mob_obj->getLinkedMediaObjects();
619  $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
620  }
renderMob(\ilObjMediaObject $mob_obj, string $link_xml, array $params)
Render Mob.
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
initResourceTemplate($tempalate_file)
Get resource template.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjMediaObject.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPageElements()

ilCOPageHTMLExport::exportPageElements (   $a_update_callback = null)

Export page elements.

Parameters

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

References $total, ilObject\_exists(), ilObject\_lookupType(), exportHTMLFile(), exportHTMLFileDirect(), exportHTMLGlossaryTerms(), and exportHTMLMOB().

506  {
507  $this->log->debug("export page elements");
508 
509  $total = count($this->mobs) + count($this->files) + count($this->files_direct);
510  $cnt = 0;
511 
512  // export all media objects
513  $linked_mobs = array();
514  foreach ($this->mobs as $mob) {
515  if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
516  $this->exportHTMLMOB($mob, $linked_mobs);
517  }
518  if (is_callable($a_update_callback)) {
519  $cnt++;
520  $a_update_callback($total, $cnt);
521  }
522  }
523  $linked_mobs2 = array(); // mobs linked in link areas
524  foreach ($linked_mobs as $mob) {
525  if (ilObject::_exists($mob)) {
526  $this->exportHTMLMOB($mob, $linked_mobs2);
527  }
528  }
529 
530  // export all file objects
531  foreach ($this->files as $file) {
532  $this->exportHTMLFile($file);
533  if (is_callable($a_update_callback)) {
534  $cnt++;
535  $a_update_callback($total, $cnt);
536  }
537  }
538 
539  // export all files (which are not objects
540  foreach ($this->files_direct as $file_id => $attr) {
541  $this->exportHTMLFileDirect($file_id, $attr[0], $attr[1]);
542  if (is_callable($a_update_callback)) {
543  $cnt++;
544  $a_update_callback($total, $cnt);
545  }
546  }
547 
548  // export all glossary terms
549  $this->exportHTMLGlossaryTerms();
550  }
exportHTMLFile($a_file_id)
Export file object.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
exportHTMLFileDirect($a_file_id, $a_source_file, $a_file_name)
Export file from path.
exportHTMLGlossaryTerms()
Export glossary terms.
$total
Definition: Utf8Test.php:87
static _lookupType($a_id, $a_reference=false)
lookup object type
exportHTMLMOB($a_mob_id, &$a_linked_mobs)
Export media object to html.
+ Here is the call graph for this function:

◆ exportQuestionFiles()

ilCOPageHTMLExport::exportQuestionFiles ( )
protected

Export question images.

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

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

694  {
695  // export questions (images)
696  if (count($this->q_ids) > 0) {
697  foreach ($this->q_ids as $q_id) {
698  \ilUtil::makeDirParents($this->exp_dir . "/assessment/0/" . $q_id . "/images");
700  \ilUtil::getWebspaceDir() . "/assessment/0/" . $q_id . "/images",
701  $this->exp_dir . "/assessment/0/" . $q_id . "/images"
702  );
703  }
704  }
705  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ exportResourceFile()

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

Export resource file.

Parameters
string$target_dir
string$file

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

References ilUtil\makeDirParents().

Referenced by exportStyles(), and exportSupportScripts().

250  {
251  if (is_int(strpos($file, "?"))) {
252  $file = substr($file, 0, strpos($file, "?"));
253  }
254  if (is_file($file)) {
255  $dir = dirname($file);
256  \ilUtil::makeDirParents($target_dir . "/" . $dir);
257  if (!is_file($target_dir . "/" . $file)) {
258  copy($file, $target_dir . "/" . $file);
259  }
260  }
261  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportStyles()

ilCOPageHTMLExport::exportStyles ( )

Export content style.

Exceptions

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

References exportResourceFile(), ilObjStyleSheet\getBasicImageDir(), getContentStyleId(), ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getSyntaxStylePath(), ilUtil\makeDirParents(), and ilUtil\rCopy().

164  {
165  $this->log->debug("export styles");
166 
167  // export content style sheet
168  if ($this->getContentStyleId() < 1) { // basic style
170  ilUtil::makeDirParents($this->exp_dir . "/Services/COPage/css");
171  copy("Services/COPage/css/content.css", $this->exp_dir . "/Services/COPage/css/content.css");
172  } else {
173  $style = new ilObjStyleSheet($this->getContentStyleId());
174  $style->copyImagesToDir($this->exp_dir . "/" . $style->getImagesDirectory());
175  $this->exportResourceFile($this->exp_dir,
177  }
178 
179  // export syntax highlighting style
180  $syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
181  $this->exportResourceFile($this->exp_dir, $syn_stylesheet);
182  }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getContentStyleId()
Get content style id.
static getBasicImageDir()
Get basic image dir.
static getSyntaxStylePath()
get syntax style path
exportResourceFile(string $target_dir, string $file)
Export resource file.
Class ilObjStyleSheet.
+ 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)
Parameters

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

References ilPlayerUtil\copyPlayerFilesToTargetDirectory(), exportResourceFile(), and ilPageObjectGUI\OFFLINE.

193  {
194  $this->log->debug("export scripts");
195 
196  $collector = new \ILIAS\COPage\ResourcesCollector(ilPageObjectGUI::OFFLINE);
197 
198  foreach ($collector->getJavascriptFiles() as $js) {
199  $this->exportResourceFile($this->exp_dir, $js);
200  }
201 
202  foreach ($collector->getCssFiles() as $css) {
203  $this->exportResourceFile($this->exp_dir, $css);
204  }
205 
206  //copy('./Services/UIComponent/Overlay/js/ilOverlay.js', $this->js_dir . '/ilOverlay.js');
207 
208 
209  // yui stuff we use
210  /*
211  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
212  copy(
213  ilYuiUtil::getLocalPath('yahoo/yahoo-min.js'),
214  $this->js_yahoo_dir . '/yahoo-min.js'
215  );
216  copy(
217  ilYuiUtil::getLocalPath('yahoo-dom-event/yahoo-dom-event.js'),
218  $this->js_yahoo_dir . '/yahoo-dom-event.js'
219  );
220  copy(
221  ilYuiUtil::getLocalPath('animation/animation-min.js'),
222  $this->js_yahoo_dir . '/animation-min.js'
223  );
224  copy(
225  ilYuiUtil::getLocalPath('container/container-min.js'),
226  $this->js_yahoo_dir . '/container-min.js'
227  );
228  copy(
229  ilYuiUtil::getLocalPath('container/assets/skins/sam/container.css'),
230  $this->css_dir . '/container.css'
231  );
232  copy(
233  ilYuiUtil::getLocalPath('container/assets/skins/sam/container.css'),
234  $this->css_dir . '/yahoo/container.css'
235  );*/ // see #23083
236 
237 
238  // mediaelement.js
239  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
241  }
exportResourceFile(string $target_dir, string $file)
Export resource file.
static copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
+ Here is the call graph for this function:

◆ getContentStyleId()

ilCOPageHTMLExport::getContentStyleId ( )

Get content style id.

Returns
int content style id

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

References $content_style_id.

Referenced by exportStyles(), getPreparedMainTemplate(), and initResourceTemplate().

128  {
130  }
+ Here is the caller graph for this function:

◆ getPreparedMainTemplate()

ilCOPageHTMLExport::getPreparedMainTemplate (   $a_tpl = "")

Get prepared main template.

Parameters

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

References $DIC, $mathJaxSetting, $tpl, getContentStyleId(), ilObjStyleSheet\getContentStylePath(), ilPlayerUtil\getJsFilePaths(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), and ilPageObjectGUI\OFFLINE.

Referenced by initResourceTemplate().

271  {
272  global $DIC;
273  $this->log->debug("get main template");
274 
275 
276  $resource_collector = new \ILIAS\COPage\ResourcesCollector(ilPageObjectGUI::OFFLINE);
277  $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
278 
279 
280  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
281 
282  if ($a_tpl != "") {
283  $tpl = $a_tpl;
284  } else {
285  // template workaround: reset of template
286  $tpl = new ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
287  }
288  // scripts needed
289  /*
290  $scripts = array("./js/yahoo/yahoo-min.js", "./js/yahoo/yahoo-dom-event.js",
291  "./js/yahoo/animation-min.js", "./js/yahoo/container-min.js",
292  "./js/ilOverlay.js",
293  "./js/ilTooltip.js",);*/
294  $scripts = [];
295  $scripts = array_merge($scripts, ilPlayerUtil::getJsFilePaths());
296 
297  $mathJaxSetting = new ilSetting("MathJax");
298  $use_mathjax = $mathJaxSetting->get("enable");
299  if ($use_mathjax) {
300  $scripts[] = $mathJaxSetting->get("path_to_mathjax");
301  }
302 
306 
307  $resource_injector->inject($tpl);
308 
309  return $tpl;
310  }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getContentStyleId()
Get content style id.
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:32
static getJsFilePaths()
Get js file paths.
Class ilGlobalPageTemplate.
static getSyntaxStylePath()
get syntax style path
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initResourceTemplate()

ilCOPageHTMLExport::initResourceTemplate (   $tempalate_file)
protected

Get resource template.

Parameters

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

References $tpl, getContentStyleId(), ilObjStyleSheet\getContentStylePath(), getPreparedMainTemplate(), ilUtil\getStyleSheetLocation(), and ilObjStyleSheet\getSyntaxStylePath().

Referenced by exportHTMLGlossaryTerms(), and exportHTMLMOB().

559  {
560  $this->global_screen->layout()->meta()->reset();
561  $tpl = new ilGlobalTemplate($tempalate_file, true, true, "Services/COPage");
566  return $tpl;
567  }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getContentStyleId()
Get content style id.
getPreparedMainTemplate($a_tpl="")
Get prepared main template.
static getSyntaxStylePath()
get syntax style path
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderMob()

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

Render Mob.

Parameters
ilObjMediaObject$mob_obj
string$link_xml
array$params
Returns
false|string

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

References ilObjMediaObject\getXML(), IL_MODE_ALIAS, IL_MODE_OUTPUT, xslt_create(), and xslt_free().

Referenced by exportHTMLMOB().

630  {
631  // render media object html
632  $xh = xslt_create();
633  $output = xslt_process(
634  $xh,
635  "arg:/_xml",
636  "arg:/_xsl",
637  null,
638  array(
639  "/_xml" =>
640  "<dummy>" .
641  $mob_obj->getXML(IL_MODE_ALIAS) .
642  $mob_obj->getXML(IL_MODE_OUTPUT) .
643  $link_xml .
644  "</dummy>",
645  "/_xsl" => file_get_contents("./Services/COPage/xsl/page.xsl")
646  ),
647  $params
648  );
649  xslt_free($xh);
650  unset($xh);
651  return $output;
652  }
xslt_create()
xslt_free(&$proc)
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentStyleId()

ilCOPageHTMLExport::setContentStyleId (   $a_val)

Set content style id.

Parameters
int$a_valcontent style id

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

118  {
119  $this->content_style_id = $a_val;
120  }

Field Documentation

◆ $content_style_id

ilCOPageHTMLExport::$content_style_id = 0
protected

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

Referenced by getContentStyleId().

◆ $exp_dir

ilCOPageHTMLExport::$exp_dir = ""
protected

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

◆ $files

ilCOPageHTMLExport::$files = []
protected

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

Referenced by collectPageElements().

◆ $files_direct

ilCOPageHTMLExport::$files_direct = []
protected

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

◆ $global_screen

ilCOPageHTMLExport::$global_screen
protected

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

◆ $glossary_terms

ilCOPageHTMLExport::$glossary_terms = []
protected

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

◆ $int_links

ilCOPageHTMLExport::$int_links = []
protected

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

◆ $log

ilCOPageHTMLExport::$log
protected

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

◆ $mobs

ilCOPageHTMLExport::$mobs = []
protected

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

◆ $page_linker

ilCOPageHTMLExport::$page_linker
protected

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

◆ $q_ids

ilCOPageHTMLExport::$q_ids = []
protected

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

Referenced by collectPageElements().

◆ $ref_id

ilCOPageHTMLExport::$ref_id
protected

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

Referenced by __construct(), and exportHTMLMOB().

◆ $user

ilCOPageHTMLExport::$user
protected

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


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