26 protected \ILIAS\COPage\Xsl\XslManager
$xsl;
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->skill_personal_service = $DIC->skills()->personal();
67 $this->page_linker = is_null($linker)
72 $this->exp_dir = $a_exp_dir;
73 $this->mobs_dir = $a_exp_dir .
"/mobs";
74 $this->files_dir = $a_exp_dir .
"/files";
75 $this->tex_dir = $a_exp_dir .
"/teximg";
76 $this->content_style_dir = $a_exp_dir .
"/content_style";
77 $this->content_style_img_dir = $a_exp_dir .
"/content_style/images";
79 $this->services_dir = $a_exp_dir .
"/Services";
80 $this->media_service_dir = $this->services_dir .
"/MediaObjects";
82 $this->mp3_dir = $this->media_service_dir .
"/flash_mp3_player";
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();
92 $this->content_style_id = $a_val;
126 $this->log->debug(
"export styles");
135 copy(
"Services/COPage/css/content.css", $this->exp_dir .
"/Services/COPage/css/content.css");
138 $style->copyImagesToDir($this->exp_dir .
"/" . $style->getImagesDirectory());
161 $this->log->debug(
"export scripts");
165 foreach ($collector->getJavascriptFiles() as $js) {
169 foreach ($collector->getCssFiles() as $css) {
180 if (is_int(strpos($file,
"?"))) {
181 $file = substr($file, 0, strpos($file,
"?"));
183 if (is_file($file)) {
184 $dir = dirname($file);
186 if (!is_file($target_dir .
"/" . $file)) {
187 copy($file, $target_dir .
"/" . $file);
196 $this->log->debug(
"get main template");
200 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
202 if (!is_null($a_tpl)) {
225 $resource_injector->inject($tpl);
238 $this->log->debug(
"collect page elements");
248 foreach ($pcs as $pc) {
250 if ($pc[
"type"] ==
"incl") {
260 $this->int_links = array_merge($this->int_links, $pg_links);
261 $this->glossary_terms = [];
264 foreach ($this->int_links as $int_link) {
265 if ($int_link[
"type"] ==
"git") {
266 $this->glossary_terms[] = $int_link[
"id"];
270 "id" => $int_link[
"id"]
276 foreach ($pages as $page) {
277 $page_id = $page[
"id"];
278 $page_type = $page[
"type"];
282 foreach ($pg_mobs as $pg_mob) {
283 $this->mobs[$pg_mob] = $pg_mob;
285 " due to page $page_id, $page_type ).");
289 $files = ilObjFile::_getFilesOfObject($page_type, $page_id, 0,
$lang);
290 foreach ($files as
$f) {
291 $this->files[
$f] =
$f;
296 foreach ($q_ids as $q_id) {
297 $this->q_ids[$q_id] = $q_id;
302 $skill_tree = $ws_tree = null;
305 foreach ($pcs as $pc) {
306 if ($pc[
"type"] ==
"skmg") {
307 $skill_id = $pc[
"id"];
314 $user_id = $page->getCreationUserId();
325 $skill_tree = $this->skill_tree_service->getGlobalSkillTree();
331 $skill_id = (
int) $skill_id;
332 $vtree = $this->skill_tree_service->getVirtualSkillTreeForNodeId($skill_id);
335 $tref_id = $skill_id;
338 $b_skills = $vtree->getSubTreeForCSkillId($skill_id .
":" . $tref_id,
true);
340 foreach ($b_skills as $bs) {
342 $level_data = $skill->getLevelData();
343 foreach ($level_data as $k => $v) {
345 $mat = $this->skill_personal_service->getAssignedMaterials($user_id, $bs[
"tref_id"], $v[
"id"]);
347 foreach ($mat as $item) {
348 $wsp_id = $item->getWorkspaceId();
349 $obj_id = $ws_tree->lookupObjectId($wsp_id);
354 $this->files[$obj_id] = $obj_id;
359 $this->files_direct[$obj_id] = array($obj->getFilePath(),
360 $obj->getOfflineFilename());
365 $this->files_direct[$obj_id] = array($obj->getFilePath(),
366 $obj->getOfflineFilename());
371 $this->files_direct[$obj_id] = array($obj->getFilePath(),
372 $obj->getOfflineFilename());
377 $this->files_direct[$obj_id] = array($obj->getFilePath(),
378 $obj->getOfflineFilename());
383 $this->files_direct[$obj_id] = array($obj->getFilePath(),
384 $obj->getOfflineFilename());
389 $this->files_direct[$obj_id] = array($obj->getFilePath(),
390 $obj->getOfflineFilename());
406 callable $a_update_callback = null
408 $this->log->debug(
"export page elements");
410 $total = count($this->mobs) + count($this->files) + count($this->files_direct);
413 $linked_mobs = array();
414 foreach ($this->mobs as $mob) {
418 if (is_callable($a_update_callback)) {
420 $a_update_callback($total, $cnt);
423 $linked_mobs2 = array();
424 foreach ($linked_mobs as $mob) {
431 foreach ($this->files as $file) {
433 if (is_callable($a_update_callback)) {
435 $a_update_callback($total, $cnt);
440 foreach ($this->files_direct as $file_id => $attr) {
442 if (is_callable($a_update_callback)) {
444 $a_update_callback($total, $cnt);
458 string $template_file
460 $this->global_screen->layout()->meta()->reset();
474 array &$a_linked_mobs
476 $this->log->debug(
"export html mobs");
479 if (is_dir($source_dir)) {
488 $link_xml = $this->page_linker->getLinkXML($med_links);
494 'fullscreen_link' => $this->page_linker->getFullScreenLink()
496 if ($this->ref_id > 0) {
501 $tpl->setVariable(
"MEDIA_CONTENT", $this->
renderMob($mob_obj, $link_xml,
$params));
502 $html = $tpl->printToString();
503 $file = $this->exp_dir .
"/media_" . $a_mob_id .
".html";
504 $fp = fopen($file,
"w+");
509 if ($mob_obj->hasFullscreenItem()) {
511 $params[
"mode"] =
"fullscreen";
512 $tpl->setVariable(
"MEDIA_CONTENT", $this->
renderMob($mob_obj, $link_xml,
$params));
513 $html = $tpl->printToString();
514 $file = $this->exp_dir .
"/fullscreen_" . $a_mob_id .
".html";
515 $fp = fopen($file,
"w+");
521 $linked_mobs = $mob_obj->getLinkedMediaObjects();
522 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
539 return $this->xsl->process($xml, $params);
548 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
551 $file_obj =
new ilObjFile($a_file_id,
false);
552 $source_file = $file_obj->getFile($file_obj->getVersion());
553 if (!is_file($source_file)) {
554 $source_file = $file_obj->getFile();
556 if (is_file($source_file)) {
557 copy($source_file, $file_dir .
"/" . $file_obj->getFileName());
566 string $a_source_file,
569 $file_dir = $this->files_dir .
"/file_" . $a_file_id;
572 if (is_file($a_source_file)) {
586 if (count($this->q_ids) > 0) {
587 foreach ($this->q_ids as $q_id) {
591 $this->exp_dir .
"/assessment/0/" . $q_id .
"/images" 599 foreach ($this->glossary_terms as $term_id) {
606 $term_gui->setPageLinker($this->page_linker);
607 $term_gui->setOfflineDirectory($this->exp_dir);
608 $term_gui->output(
true, $tpl);
611 $html = $tpl->printToString();
612 $file = $this->exp_dir .
"/term_" . $term_id .
".html";
613 $fp = fopen($file,
"w+");
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static _lookupTemplateId(int $a_obj_id)
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
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
static _exists(int $a_id)
checks whether a glossary term with specified id exists or not
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
exportPageElements(callable $a_update_callback=null)
Export page elements.
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.
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 getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _lookupType(int $a_obj_id)
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 getFlashVideoPlayerDirectory()
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...
__construct(string $a_exp_dir, \ILIAS\COPage\PageLinker $linker=null, int $ref_id=0)
ILIAS Skill Service SkillPersonalService $skill_personal_service
static copyPlayerFilesToTargetDirectory(string $a_target_dir)
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 ...