93 $this->locator = $DIC[
"ilLocator"];
94 $this->
user = $DIC->user();
96 $this->export_dir = $export_dir;
97 $this->sub_dir = $sub_dir;
99 $this->target_dir = $export_dir .
"/" . $sub_dir;
100 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir, $this->
getLinker(), $lm->
getRefId());
102 $this->lm->getStyleSheetId(),
108 $this->lm_gui = new \ilLMPresentationGUI(
$export_format, (
$lang ==
"all"), $this->target_dir,
false);
111 $this->lm_settings = new \ilSetting(
"lm");
115 $this->initial_user_language = $this->
user->getLanguage();
116 $this->initial_current_user_language = $this->
user->getCurrentLanguage();
118 $this->global_screen = $DIC->globalScreen();
119 $this->export_util = new \ILIAS\Services\Export\HTML\Util($export_dir, $sub_dir);
132 return new \ilLMPresentationLinker(
136 $this->lm->getRefId(),
155 $additional_data = $this->global_screen->tool()->context()->current()->getAdditionalData();
156 if ($additional_data->exists($key)) {
157 $additional_data->replace($key,
$data);
159 $additional_data->add($key,
$data);
169 $this->
user->setLanguage($this->initial_user_language);
170 $this->
user->setCurrentLanguage($this->initial_current_user_language);
182 foreach ([
"mobs",
"files",
"textimg",
"style",
183 "style/images",
"content_style",
"content_style",
"content_style/images"] as $dir) {
195 protected function getLanguageIterator() :
\Iterator 201 private $position = 0;
215 if ($lang !=
"all") {
216 $this->langs = [
$lang];
219 $this->langs[] = $otl[
"lang_code"];
224 public function rewind()
229 public function current()
231 return $this->langs[$this->position];
234 public function key()
236 return $this->position;
239 public function next()
244 public function valid()
246 return isset($this->langs[$this->position]);
271 if ($lang == $this->obj_transl->getMasterLanguage()) {
274 $lm_gui->lang =
$lang;
285 $this->global_screen->tool()->context()->current()->addAdditionalData(
301 $this->export_util->exportSystemStyle();
302 $this->export_util->exportCOPageFiles($this->lm->getStyleSheetId(),
"lm");
304 $lang_iterator = $this->getLanguageIterator();
307 foreach ($lang_iterator as
$lang) {
350 $this->export_util->exportResourceFiles();
352 $this->co_page_html_export->exportPageElements();
365 if ($this->lang ==
"") {
366 $zip_target_dir = $this->lm->getExportDirectory(
"html");
368 $zip_target_dir = $this->lm->getExportDirectory(
"html_" . $this->lang);
374 $zip_file = $zip_target_dir .
"/" . $date .
"__" . IL_INST_ID .
"__" .
375 $this->lm->getType() .
"_" . $this->lm->getId() .
".zip";
387 if ($f[
"type"] ==
"js") {
388 $this->global_screen->layout()->meta()->addJs($f[
"source"]);
390 if ($f[
"type"] ==
"css") {
391 $this->global_screen->layout()->meta()->addCss($f[
"source"]);
407 "target" => $a_target_dir .
'/js/yahoo/yahoo-min.js',
410 "target" => $a_target_dir .
'/js/yahoo/yahoo-dom-event.js',
413 "target" => $a_target_dir .
'/js/yahoo/animation-min.js',
415 array(
"source" =>
'./Services/Accordion/js/accordion.js',
416 "target" => $a_target_dir .
'/js/accordion.js',
418 array(
"source" =>
'./Services/Accordion/css/accordion.css',
419 "target" => $a_target_dir .
'/css/accordion.css',
421 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
422 "target" => $a_target_dir .
'/js/pure.js',
424 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
425 "target" => $a_target_dir .
'/js/question_handling.js',
427 array(
"source" =>
'./Modules/Scorm2004/templates/default/question_handling.css',
428 "target" => $a_target_dir .
'/css/question_handling.css',
430 array(
"source" =>
'./Modules/TestQuestionPool/templates/default/test_javascript.css',
431 "target" => $a_target_dir .
'/css/test_javascript.css',
442 array(
"source" =>
'./Modules/LearningModule/js/LearningModule.js',
443 "target" => $a_target_dir .
'/js/LearningModule.js',
450 $scripts[] = array(
"source" =>
"",
457 if (is_int(strpos($p,
"ExtLink"))) {
458 $scripts[] = array(
"source" => $p,
459 "target" => $a_target_dir .
'/js/ilExtLink.js',
462 if (is_int(strpos($p,
"linkify"))) {
463 $scripts[] = array(
"source" => $p,
464 "target" => $a_target_dir .
'/js/linkify.js',
471 "source" =>
"src/UI/templates/js/MainControls/mainbar.js",
475 "source" =>
"src/UI/templates/js/MainControls/metabar.js",
479 "source" =>
"src/UI/templates/js/MainControls/slate.js",
483 "source" =>
"src/UI/templates/js/Page/stdpage.js",
487 "source" =>
"src/GlobalScreen/Client/dist/GS.js",
504 $all_languages = ($this->lang ==
"all");
511 $lm_tree = $lm->getLMTree();
512 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
513 $first_page_id = $first_page[
"child"];
518 $this->offline_files = [];
522 $exp_id_map = array();
524 if (
$lm_set->get(
"html_export_ids")) {
525 foreach ($pages as $page) {
527 if (trim($exp_id) !=
"") {
528 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
538 foreach ($pages as $page) {
540 $ilLocator->clearItems();
541 $this->
exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]),
$lang,
"", $exp_id_map);
542 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"],
$lang);
556 $tabs = $DIC->tabs();
558 $tabs->clearTargets();
559 $tabs->clearSubTabs();
560 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
562 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
573 protected function initScreen(
int $lm_page_id,
string $frame)
575 $this->global_screen->layout()->meta()->reset();
579 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
588 "obj_id" => $lm_page_id,
589 "ref_id" => $this->lm->getRefId(),
593 $this->lm_gui->initByRequest($params);
598 $this->lm_gui->injectTemplate(
$tpl);
614 $target_dir = $this->target_dir;
617 if (!in_array(
$lang, [
"-",
""]) && $this->lang ==
"all") {
618 $lang_suffix =
"_" .
$lang;
626 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
627 $file = $target_dir .
"/lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
629 $file = $target_dir .
"/lm_pg_" . $lm_page_id . $lang_suffix .
".html";
632 if ($frame !=
"toc") {
633 $file = $target_dir .
"/frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
635 $file = $target_dir .
"/frame_" . $frame . $lang_suffix .
".html";
640 if (@is_file($file)) {
644 $content = $this->lm_gui->layout(
"main.xml",
false);
647 $fp = @fopen($file,
"w+");
648 fwrite($fp, $content);
653 if ($is_first && $frame ==
"") {
654 copy($file, $target_dir .
"/index" . $lang_suffix .
".html");
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
exportPageHTML( $lm_page_id, $is_first=false, $lang="-", $frame="", $exp_id_map=[])
export page html
getLanguages()
Get languages.
Class ilObjLearningModule.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
const LM_HTML_EXPORT_RENDERING
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
setLanguage($a_str)
set user language public
static getLocalJsPaths()
Get paths of necessary js files.
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
initLanguage(\ilObjUser $user, \ilLMPresentationGUI $lm_gui, string $lang)
Init language.
exportHTMLPages()
export all pages of learning module to html file
getSupplyingExportFiles($a_target_dir=".")
Get supplying export files.
zipPackage()
Zip everything.
static getLocalJsTreeJsPath()
Get local path of jsTree js.
getInitialisedTemplate()
Get initialised template.
Class ilLMPresentationGUI.
resetUserLanguage()
Reset user language.
Class ilGlobalPageTemplate.
addSupplyingExportFiles()
Add supplying export files.
__construct(\ilObjLearningModule $lm, $export_dir, $sub_dir, $export_format="html", $lang="")
Constructor.
getId()
get object id public
initDirectories()
Initialize directories.
static getLocalExplorerJsPath()
Get local path of explorer js.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
exportHTML($zip=true)
export html package
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
$initial_current_user_language
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
initScreen(int $lm_page_id, string $frame)
Init page.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getLocalPath($a_name="")
Get local path of a YUI js file.
static resetInitialState()
Reset initial state (for exports)
setAdditionalContextData($key, $data)
Set additional context data.
static getInstance($a_obj_id)
Get instance.
getRefId()
get reference id public
static getLogger($a_component_id)
Get component logger.
static getPageList($lm_id)
static
static getLocalJsTreeCssPath()
Get local path of jsTree js.
initGlobalScreen()
Init global screen.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getLanguage()
returns a 2char-language-string public
setCurrentLanguage($a_val)
Set current language.
Class handles translation mode for an object.