30 protected \ILIAS\COPage\Xsl\XslManager
$xsl;
59 \
ILIAS\COPage\PageLinker $linker = null,
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)
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";
81 $this->services_dir = $a_exp_dir .
"/components/ILIAS";
82 $this->media_service_dir = $this->services_dir .
"/MediaObjects";
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();
94 $this->content_style_id = $a_val;
126 $this->log->debug(
"export styles");
130 if (is_null($this->export_collector)) {
136 copy(
"../components/ILIAS/COPage/resources/content.css",
137 $this->exp_dir .
"/components/ILIAS/COPage/css/content.css");
139 $this->export_collector->addDirectory(
141 "/basic_style/images" 143 $this->export_collector->addFile(
144 "../components/ILIAS/COPage/css/content.css",
150 if (is_null($this->export_collector)) {
151 $style->copyImagesToDir($this->exp_dir .
"/" . $style->getImagesDirectory());
157 $res_id = $this->content_style->style($this->
getContentStyleId())->getResourceIdentification();
159 $this->export_collector->addContainerDirectory(
160 $res_id->serialize(),
184 $this->log->debug(
"export scripts");
188 foreach ($collector->getJavascriptFiles() as $js) {
192 foreach ($collector->getCssFiles() as $css) {
201 if (is_int(strpos($file,
"?"))) {
202 $file = substr($file, 0, strpos($file,
"?"));
204 if (is_file($file)) {
205 if (is_null($this->export_collector)) {
206 $dir = dirname($file);
208 if (!is_file($target_dir .
"/" . $file)) {
209 copy($file, $target_dir .
"/" . $file);
212 $this->export_collector->addFile($file, $file);
221 $this->log->debug(
"get main template");
225 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
227 if (!is_null($a_tpl)) {
251 $resource_injector->inject($tpl);
264 $this->log->debug(
"collect page elements");
274 foreach ($pcs as $pc) {
276 if ($pc[
"type"] ==
"incl") {
286 $this->int_links = array_merge($this->int_links, $pg_links);
287 $this->glossary_terms = [];
290 foreach ($this->int_links as $int_link) {
291 if ($int_link[
"type"] ==
"git") {
292 $this->glossary_terms[] = $int_link[
"id"];
296 "id" => $int_link[
"id"]
302 foreach ($pages as $page) {
303 $page_id = $page[
"id"];
304 $page_type = $page[
"type"];
308 foreach ($pg_mobs as $pg_mob) {
309 $this->mobs[$pg_mob] = $pg_mob;
311 " due to page $page_id, $page_type ).");
315 $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0, $lang);
316 foreach ($files as
$f) {
317 $this->files[
$f] =
$f;
322 foreach ($q_ids as $q_id) {
323 $this->q_ids[$q_id] = $q_id;
328 $skill_tree = $ws_tree = null;
331 foreach ($pcs as $pc) {
332 if ($pc[
"type"] ==
"skmg") {
333 $skill_id = $pc[
"id"];
340 $user_id = $page->getCreationUserId();
351 $skill_tree = $this->skill_tree_service->getGlobalSkillTree();
357 $skill_id = (
int) $skill_id;
358 $vtree = $this->skill_tree_service->getVirtualSkillTreeForNodeId($skill_id);
361 $tref_id = $skill_id;
364 $b_skills = $vtree->getSubTreeForCSkillId($skill_id .
":" . $tref_id,
true);
366 foreach ($b_skills as $bs) {
368 $level_data = $skill->getLevelData();
369 foreach ($level_data as $k => $v) {
371 $mat = $this->skill_personal_service->getAssignedMaterials(
$user_id, $bs[
"tref_id"], $v[
"id"]);
373 foreach ($mat as $item) {
374 $wsp_id = $item->getWorkspaceId();
375 $obj_id = $ws_tree->lookupObjectId($wsp_id);
380 $this->files[$obj_id] = $obj_id;
385 $this->files_direct[$obj_id] = array($obj->getFilePath(),
386 $obj->getOfflineFilename());
391 $this->files_direct[$obj_id] = array($obj->getFilePath(),
392 $obj->getOfflineFilename());
397 $this->files_direct[$obj_id] = array($obj->getFilePath(),
398 $obj->getOfflineFilename());
403 $this->files_direct[$obj_id] = array($obj->getFilePath(),
404 $obj->getOfflineFilename());
409 $this->files_direct[$obj_id] = array($obj->getFilePath(),
410 $obj->getOfflineFilename());
415 $this->files_direct[$obj_id] = array($obj->getFilePath(),
416 $obj->getOfflineFilename());
432 callable $a_update_callback = null
434 $this->log->debug(
"export page elements");
436 $total = count($this->mobs) + count($this->files) + count($this->files_direct);
439 $linked_mobs = array();
440 foreach ($this->mobs as $mob) {
444 if (is_callable($a_update_callback)) {
446 $a_update_callback($total, $cnt);
449 $linked_mobs2 = array();
450 foreach ($linked_mobs as $mob) {
457 foreach ($this->files as $file) {
459 if (is_callable($a_update_callback)) {
461 $a_update_callback($total, $cnt);
466 foreach ($this->files_direct as $file_id => $attr) {
468 if (is_callable($a_update_callback)) {
470 $a_update_callback($total, $cnt);
484 string $template_file
486 $this->global_screen->layout()->meta()->reset();
487 $tpl =
new ilGlobalTemplate($template_file,
true,
true,
"components/ILIAS/COPage");
500 array &$a_linked_mobs
502 $this->log->debug(
"export html mobs");
504 if (is_null($this->export_collector)) {
506 if (is_dir($source_dir)) {
511 $mob_res_id = $this->media_manager->getContainerResourceId($a_mob_id);
513 $this->export_collector->addContainerDirectory(
514 $mob_res_id->serialize(),
516 "/mobs/mm_" . $a_mob_id,
525 $link_xml = $this->page_linker->getLinkXML($med_links);
531 'fullscreen_link' => $this->page_linker->getFullScreenLink()
533 if ($this->ref_id > 0) {
538 $tpl->setVariable(
"MEDIA_CONTENT", $this->
renderMob($mob_obj, $link_xml,
$params));
539 $html = $tpl->printToString();
540 if (is_null($this->export_collector)) {
541 $file = $this->exp_dir .
"/media_" . $a_mob_id .
".html";
542 $fp = fopen($file,
"w+");
547 $this->export_collector->addString($html,
"/media_" . $a_mob_id .
".html");
550 if ($mob_obj->hasFullscreenItem()) {
552 $params[
"mode"] =
"fullscreen";
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 .
"/fullscreen_" . $a_mob_id .
".html";
557 $fp = fopen($file,
"w+");
562 $this->export_collector->addString($html,
"/fullscreen_" . $a_mob_id .
".html");
566 $linked_mobs = $mob_obj->getLinkedMediaObjects();
567 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
584 return $this->xsl->process($xml, $params);
593 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
596 $file_obj =
new ilObjFile($a_file_id,
false);
597 $source_file = $file_obj->getFile($file_obj->getVersion());
598 if (!is_file($source_file)) {
599 $source_file = $file_obj->getFile();
601 if (is_file($source_file)) {
602 copy($source_file, $file_dir .
"/" . $file_obj->getFileName());
611 string $a_source_file,
614 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
617 if (is_file($a_source_file)) {
631 if (count($this->q_ids) > 0) {
632 foreach ($this->q_ids as $q_id) {
636 $this->exp_dir .
"/assessment/0/" . $q_id .
"/images" 644 foreach ($this->glossary_terms as $term_id) {
651 $term_gui->setPageLinker($this->page_linker);
652 $term_gui->setOfflineDirectory($this->exp_dir);
653 $term_gui->output(
true, $tpl);
656 $html = $tpl->printToString();
657 $file = $this->exp_dir .
"/term_" . $term_id .
".html";
658 $fp = fopen($file,
"w+");
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static _lookupTemplateId(int $a_obj_id)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
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)
renderMob(\ilObjMediaObject $mob_obj, string $link_xml, array $params)
Render Mob.
static getContentPrintStyle()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLogger(string $a_component_id)
Get component logger.
exportHTMLMOB(int $a_mob_id, array &$a_linked_mobs)
Export media object to html.
ILIAS COPage PageLinker $page_linker
special template class to simplify handling of ITX/PEAR
HTML export class for pages.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static _exists(int $a_id)
checks whether a glossary term with specified id exists or not
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exportPageElements(callable $a_update_callback=null)
Export page elements.
ILIAS Style Content InternalDomainService $content_style
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 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.
ILIAS MediaObjects MediaObjectManager $media_manager
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
exportHTMLGlossaryTerms()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _lookupType(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_id=0)
static getBasicImageDir()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getASCIIFilename(string $a_filename)
setContentStyleId(int $a_val)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
ILIAS Skill Service SkillTreeService $skill_tree_service
static _lookupTitle(int $obj_id)
exportHTMLFile(string $a_file_id)
Export file object.
string $content_style_dir
getPreparedMainTemplate(ilGlobalTemplateInterface $a_tpl=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
exportSupportScripts()
Export support scripts.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getSyntaxStylePath()
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
ILIAS GlobalScreen Services $global_screen
exportHTMLFileDirect(string $a_file_id, string $a_source_file, string $a_file_name)
Export file from path.
string $media_service_dir
exportResourceFile(string $target_dir, string $file)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Skill Service SkillPersonalService $skill_personal_service
static getExportContentStylePath()
__construct(string $a_exp_dir, \ILIAS\COPage\PageLinker $linker=null, int $ref_id=0, protected ?ExportCollector $export_collector=null)
exportStyles()
Export content style.
exportQuestionFiles()
Export question images.
static _lookupType(int $id, bool $reference=false)
string $content_style_img_dir
initResourceTemplate(string $template_file)
Get resource template.
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
ILIAS COPage Xsl XslManager $xsl
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...