31 protected \ILIAS\COPage\Xsl\XslManager
$xsl;
60 ?\
ILIAS\COPage\PageLinker $linker =
null,
66 $this->
user = $DIC->user();
67 $this->global_screen =
$DIC->globalScreen();
68 $this->skill_tree_service =
$DIC->skills()->tree();
69 $this->skill_personal_service =
$DIC->skills()->personal();
70 $this->page_linker = is_null($linker)
75 $this->exp_dir = $a_exp_dir;
76 $this->mobs_dir = $a_exp_dir .
"/mobs";
77 $this->files_dir = $a_exp_dir .
"/files";
78 $this->tex_dir = $a_exp_dir .
"/teximg";
79 $this->content_style_dir = $a_exp_dir .
"/content_style";
80 $this->content_style_img_dir = $a_exp_dir .
"/content_style/images";
82 $this->services_dir = $a_exp_dir .
"/components/ILIAS";
83 $this->media_service_dir = $this->services_dir .
"/MediaObjects";
85 $this->js_dir = $a_exp_dir .
'/js';
86 $this->js_yahoo_dir = $a_exp_dir .
'/js/yahoo';
87 $this->css_dir = $a_exp_dir .
'/css';
88 $this->xsl =
$DIC->copage()->internal()->domain()->xsl();
89 $this->content_style =
$DIC->contentStyle()->internal()->domain();
90 $this->media_manager =
$DIC->mediaObjects()->internal()->domain()->mediaObject();
95 $this->content_style_id = $a_val;
127 $this->log->debug(
"export styles");
131 if (is_null($this->export_collector)) {
138 "../components/ILIAS/COPage/resources/content.css",
139 $this->exp_dir .
"/components/ILIAS/COPage/css/content.css"
142 $this->export_collector->addDirectory(
144 "/assets/basic_style/images"
146 $this->export_collector->addFile(
147 "../components/ILIAS/COPage/css/content.css",
153 if (is_null($this->export_collector)) {
154 $style->copyImagesToDir($this->exp_dir .
"/" . $style->getImagesDirectory());
160 $res_id = $this->content_style->style($this->
getContentStyleId())->getResourceIdentification();
162 $this->export_collector->addContainerDirectory(
163 $res_id->serialize(),
165 "assets/content_style"
187 $this->log->debug(
"export scripts");
191 foreach ($collector->getJavascriptFiles() as $js) {
195 foreach ($collector->getCssFiles() as $css) {
200 if (!is_null($this->export_collector)) {
201 $this->export_collector->addDirectory(
'node_modules/mathjax/es5',
'node_modules/mathjax/es5');
209 if (is_int(strpos($file,
"?"))) {
210 $file = substr($file, 0, strpos($file,
"?"));
212 if (is_file($file)) {
213 if (is_null($this->export_collector)) {
214 $dir = dirname($file);
216 if (!is_file($target_dir .
"/" . $file)) {
217 copy($file, $target_dir .
"/" . $file);
220 $this->export_collector->addFile($file, $file);
229 $this->log->debug(
"get main template");
233 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
235 if (!is_null($a_tpl)) {
259 $resource_injector->inject($tpl);
272 $this->log->debug(
"collect page elements");
282 foreach ($pcs as $pc) {
284 if ($pc[
"type"] ==
"incl") {
294 $this->int_links = array_merge($this->int_links, $pg_links);
295 $this->glossary_terms = [];
298 foreach ($this->int_links as $int_link) {
299 if ($int_link[
"type"] ==
"git") {
300 $this->glossary_terms[] = $int_link[
"id"];
304 "id" => $int_link[
"id"]
310 foreach ($pages as $page) {
311 $page_id = $page[
"id"];
312 $page_type = $page[
"type"];
316 foreach ($pg_mobs as $pg_mob) {
317 $this->mobs[$pg_mob] = $pg_mob;
319 " due to page $page_id, $page_type ).");
323 $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0, $lang);
324 foreach ($files as
$f) {
325 $this->files[
$f] =
$f;
330 foreach ($q_ids as $q_id) {
331 $this->q_ids[$q_id] = $q_id;
336 $skill_tree = $ws_tree =
null;
339 foreach ($pcs as $pc) {
340 if ($pc[
"type"] ==
"skmg") {
341 $skill_id = $pc[
"id"];
348 $user_id = $page->getCreationUserId();
359 $skill_tree = $this->skill_tree_service->getGlobalSkillTree();
365 $skill_id = (
int) $skill_id;
366 $vtree = $this->skill_tree_service->getVirtualSkillTreeForNodeId($skill_id);
369 $tref_id = $skill_id;
372 $b_skills = $vtree->getSubTreeForCSkillId($skill_id .
":" . $tref_id,
true);
374 foreach ($b_skills as $bs) {
376 $level_data = $skill->getLevelData();
377 foreach ($level_data as $k => $v) {
379 $mat = $this->skill_personal_service->getAssignedMaterials(
$user_id, $bs[
"tref_id"], $v[
"id"]);
381 foreach ($mat as $item) {
382 $wsp_id = $item->getWorkspaceId();
383 $obj_id = $ws_tree->lookupObjectId($wsp_id);
388 $this->files[$obj_id] = $obj_id;
393 $this->files_direct[$obj_id] = array($obj->getFilePath(),
394 $obj->getOfflineFilename());
399 $this->files_direct[$obj_id] = array($obj->getFilePath(),
400 $obj->getOfflineFilename());
405 $this->files_direct[$obj_id] = array($obj->getFilePath(),
406 $obj->getOfflineFilename());
411 $this->files_direct[$obj_id] = array($obj->getFilePath(),
412 $obj->getOfflineFilename());
417 $this->files_direct[$obj_id] = array($obj->getFilePath(),
418 $obj->getOfflineFilename());
423 $this->files_direct[$obj_id] = array($obj->getFilePath(),
424 $obj->getOfflineFilename());
440 ?callable $a_update_callback =
null
442 $this->log->debug(
"export page elements");
444 $total = count($this->mobs) + count($this->files) + count($this->files_direct);
447 $linked_mobs = array();
448 foreach ($this->mobs as $mob) {
450 $this->exportHTMLMOB($mob, $linked_mobs);
452 if (is_callable($a_update_callback)) {
454 $a_update_callback($total, $cnt);
457 $linked_mobs2 = array();
458 foreach ($linked_mobs as $mob) {
460 $this->exportHTMLMOB($mob, $linked_mobs2);
465 foreach ($this->files as $file) {
466 $this->exportHTMLFile($file);
467 if (is_callable($a_update_callback)) {
469 $a_update_callback($total, $cnt);
474 foreach ($this->files_direct as $file_id => $attr) {
475 $this->exportHTMLFileDirect($file_id, $attr[0], $attr[1]);
476 if (is_callable($a_update_callback)) {
478 $a_update_callback($total, $cnt);
482 $this->exportQuestionFiles();
485 $this->exportHTMLGlossaryTerms();
492 string $template_file
494 $export_util = new
Util(
"",
"", $this->export_collector);
496 $tpl =
new ilGlobalTemplate($template_file,
true,
true,
"components/ILIAS/COPage");
497 $this->getPreparedMainTemplate($tpl);
498 $this->global_screen->layout()->meta()->addCss(
501 $this->global_screen->layout()->meta()->addCss(
513 array &$a_linked_mobs
515 $this->log->debug(
"export html mobs");
517 $export_util =
new Util(
"",
"", $this->export_collector);
519 if (is_null($this->export_collector)) {
521 if (is_dir($source_dir)) {
526 $mob_res_id = $this->media_manager->getContainerResourceId($a_mob_id);
528 $this->export_collector->addContainerDirectory(
529 $mob_res_id->serialize(),
531 "/mobs/mm_" . $a_mob_id,
538 $tpl = $this->initResourceTemplate(
"tpl.fullscreen.html");
540 $link_xml = $this->page_linker->getLinkXML($med_links);
546 'fullscreen_link' => $this->page_linker->getFullScreenLink()
548 if ($this->ref_id > 0) {
553 $tpl->setVariable(
"MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml,
$params));
554 $html = $tpl->printToString();
555 if (is_null($this->export_collector)) {
556 $file = $this->exp_dir .
"/media_" . $a_mob_id .
".html";
557 $fp = fopen($file,
"w+");
562 $this->export_collector->addString($html,
"/media_" . $a_mob_id .
".html");
563 $export_util->exportResourceFiles();
566 if ($mob_obj->hasFullscreenItem()) {
567 $tpl = $this->initResourceTemplate(
"tpl.fullscreen.html");
568 $params[
"mode"] =
"fullscreen";
569 $tpl->setVariable(
"MEDIA_CONTENT", $this->renderMob($mob_obj, $link_xml,
$params));
570 $html = $tpl->printToString();
571 if (is_null($this->export_collector)) {
572 $file = $this->exp_dir .
"/fullscreen_" . $a_mob_id .
".html";
573 $fp = fopen($file,
"w+");
578 $this->export_collector->addString($html,
"/fullscreen_" . $a_mob_id .
".html");
579 $export_util->exportResourceFiles();
583 $linked_mobs = $mob_obj->getLinkedMediaObjects();
584 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
601 return $this->xsl->process($xml,
$params);
610 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
612 $file_obj =
new ilObjFile($a_file_id,
false);
613 $source_file = $file_obj->getFile($file_obj->getVersion());
614 if (!is_file($source_file)) {
615 $source_file = $file_obj->getFile();
617 if (is_file($source_file)) {
618 if (!is_null($this->export_collector)) {
619 $this->export_collector->addFile($source_file, $file_dir .
"/" . $file_obj->getFileName());
622 copy($source_file, $file_dir .
"/" . $file_obj->getFileName());
632 string $a_source_file,
635 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
638 if (is_file($a_source_file)) {
639 if (is_null($this->export_collector)) {
656 if (count($this->q_ids) > 0) {
657 foreach ($this->q_ids as $q_id) {
658 if (is_null($this->export_collector)) {
662 $this->exp_dir .
"/assessment/0/" . $q_id .
"/images"
666 if (is_dir($source_dir)) {
667 $this->export_collector->addDirectory(
669 "assessment/0/" . $q_id .
"/images"
679 foreach ($this->glossary_terms as $term_id) {
683 $tpl = $this->initResourceTemplate(
"tpl.glossary_term_output.html");
684 $export_util =
new Util(
"",
"", $this->export_collector);
687 $term_gui->setPageLinker($this->page_linker);
688 $term_gui->setOfflineDirectory($this->exp_dir);
689 $term_gui->output(
true, $tpl);
692 $html = $tpl->printToString();
693 if (!is_null($this->export_collector)) {
694 $this->export_collector->addString($html,
"/term_" . $term_id .
".html");
695 $export_util->exportResourceFiles();
697 $file = $this->exp_dir .
"/term_" . $term_id .
".html";
698 $fp = fopen($file,
"w+");
Util This class is an interim solution for the HTML export handling with 6.0.
HTML export class for pages.
exportPageElements(?callable $a_update_callback=null)
Export page elements.
ILIAS MediaObjects MediaObjectManager $media_manager
exportHTMLFile(string $a_file_id)
Export file object.
__construct(string $a_exp_dir, ?\ILIAS\COPage\PageLinker $linker=null, int $ref_id=0, protected ?ExportCollector $export_collector=null)
setContentStyleId(int $a_val)
exportStyles()
Export content style.
exportHTMLGlossaryTerms()
initResourceTemplate(string $template_file)
Get resource template.
ILIAS Skill Service SkillTreeService $skill_tree_service
renderMob(\ilObjMediaObject $mob_obj, string $link_xml, array $params)
Render Mob.
ILIAS Style Content InternalDomainService $content_style
getPreparedMainTemplate(?ilGlobalTemplateInterface $a_tpl=null)
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.
ILIAS Skill Service SkillPersonalService $skill_personal_service
exportHTMLMOB(int $a_mob_id, array &$a_linked_mobs)
Export media object to html.
string $media_service_dir
ILIAS GlobalScreen Services $global_screen
ILIAS COPage Xsl XslManager $xsl
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
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
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.
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()
static getExportContentStylePath()
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 _lookupTemplateId(int $a_obj_id)
static getInstance(int $a_id=0)
static _lookupType(int $a_obj_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))