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[
"source"] !=
"") {
388 if ($f[
"type"] ==
"js") {
389 $this->global_screen->layout()->meta()->addJs($f[
"source"]);
391 if ($f[
"type"] ==
"css") {
392 $this->global_screen->layout()->meta()->addCss($f[
"source"]);
409 "target" => $a_target_dir .
'/js/yahoo/yahoo-min.js',
412 "target" => $a_target_dir .
'/js/yahoo/yahoo-dom-event.js',
415 "target" => $a_target_dir .
'/js/yahoo/animation-min.js',
417 array(
"source" =>
'./Services/Accordion/js/accordion.js',
418 "target" => $a_target_dir .
'/js/accordion.js',
420 array(
"source" =>
'./Services/Accordion/css/accordion.css',
421 "target" => $a_target_dir .
'/css/accordion.css',
423 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
424 "target" => $a_target_dir .
'/js/pure.js',
426 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
427 "target" => $a_target_dir .
'/js/question_handling.js',
429 array(
"source" =>
'./Modules/Scorm2004/templates/default/question_handling.css',
430 "target" => $a_target_dir .
'/css/question_handling.css',
432 array(
"source" =>
'./Modules/TestQuestionPool/templates/default/test_javascript.css',
433 "target" => $a_target_dir .
'/css/test_javascript.css',
444 array(
"source" =>
'./Modules/LearningModule/js/LearningModule.js',
445 "target" => $a_target_dir .
'/js/LearningModule.js',
452 $scripts[] = array(
"source" =>
"",
459 if (is_int(strpos($p,
"ExtLink"))) {
460 $scripts[] = array(
"source" => $p,
461 "target" => $a_target_dir .
'/js/ilExtLink.js',
464 if (is_int(strpos($p,
"linkify"))) {
465 $scripts[] = array(
"source" => $p,
466 "target" => $a_target_dir .
'/js/linkify.js',
473 "source" =>
"src/UI/templates/js/MainControls/dist/mainbar.js",
477 "source" =>
"src/UI/templates/js/MainControls/metabar.js",
481 "source" =>
"src/UI/templates/js/MainControls/slate.js",
485 "source" =>
"src/UI/templates/js/Page/stdpage.js",
489 "source" =>
"src/GlobalScreen/Client/dist/GS.js",
506 $all_languages = ($this->lang ==
"all");
513 $lm_tree = $lm->getLMTree();
514 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
515 $first_page_id = $first_page[
"child"];
520 $this->offline_files = [];
524 $exp_id_map = array();
526 if (
$lm_set->get(
"html_export_ids")) {
527 foreach ($pages as $page) {
529 if (trim($exp_id) !=
"") {
530 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
540 foreach ($pages as $page) {
542 $ilLocator->clearItems();
543 $this->
exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]),
$lang,
"", $exp_id_map);
544 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"],
$lang);
558 $tabs = $DIC->tabs();
560 $tabs->clearTargets();
561 $tabs->clearSubTabs();
562 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
564 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
575 protected function initScreen(
int $lm_page_id,
string $frame)
577 $this->global_screen->layout()->meta()->reset();
581 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
590 "obj_id" => $lm_page_id,
591 "ref_id" => $this->lm->getRefId(),
595 $this->lm_gui->initByRequest($params);
600 $this->lm_gui->injectTemplate(
$tpl);
616 $target_dir = $this->target_dir;
619 if (!in_array(
$lang, [
"-",
""]) && $this->lang ==
"all") {
620 $lang_suffix =
"_" .
$lang;
628 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
629 $file = $target_dir .
"/lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
631 $file = $target_dir .
"/lm_pg_" . $lm_page_id . $lang_suffix .
".html";
634 if ($frame !=
"toc") {
635 $file = $target_dir .
"/frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
637 $file = $target_dir .
"/frame_" . $frame . $lang_suffix .
".html";
642 if (@is_file($file)) {
646 $content = $this->lm_gui->layout(
"main.xml",
false);
649 $fp = @fopen($file,
"w+");
650 fwrite($fp, $content);
655 if ($is_first && $frame ==
"") {
656 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.
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.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
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.