36 protected \ilObjLearningModule
$lm;
61 $this->
locator = $DIC[
"ilLocator"];
62 $this->
user = $DIC->user();
68 $cs =
$DIC->contentStyle();
69 $this->content_style_domain = $cs->domain()->styleForRefId($this->lm->getRefId());
70 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir, $this->
getLinker(), $lm->
getRefId());
71 $this->co_page_html_export->setContentStyleId(
72 $this->content_style_domain->getEffectiveStyleId()
77 $this->lm_gui = new \ilLMPresentationGUI(
$export_format, (
$lang ==
"all"), $this->target_dir,
false);
80 $this->lm_settings = new \ilSetting(
"lm");
84 $this->initial_user_language = $this->
user->getLanguage();
85 $this->initial_current_user_language = $this->
user->getCurrentLanguage();
87 $this->global_screen =
$DIC->globalScreen();
95 return new \ilLMPresentationLinker(
99 $this->lm->getRefId(),
114 $additional_data = $this->global_screen->tool()->context()->current()->getAdditionalData();
115 if ($additional_data->exists(
$key)) {
124 $this->
user->setLanguage($this->initial_user_language);
125 $this->
user->setCurrentLanguage($this->initial_current_user_language);
137 foreach ([
"mobs",
"files",
"textimg",
"style",
138 "style/images",
"content_style",
"content_style",
"content_style/images"] as $dir) {
143 protected function getLanguageIterator(): \Iterator
146 private int $position = 0;
148 private array $langs = [];
155 if (
$lang !=
"all") {
156 $this->langs = [
$lang];
159 $this->langs[] = $otl->getLanguageCode();
164 public function rewind(): void
169 public function current(): string
171 return $this->langs[$this->position];
174 public function key():
int
176 return $this->position;
179 public function next(): void
184 public function valid(): bool
186 return isset($this->langs[$this->position]);
207 if (
$lang == $this->obj_transl->getMasterLanguage()) {
218 $this->global_screen->tool()->context()->current()->addAdditionalData(
230 $this->initGlobalScreen();
231 $this->initDirectories();
233 $this->export_util->exportSystemStyle();
234 $this->export_util->exportCOPageFiles($this->content_style_domain->getEffectiveStyleId(),
"lm");
236 $lang_iterator = $this->getLanguageIterator();
239 foreach ($lang_iterator as
$lang) {
240 $this->initLanguage($this->
user, $this->lm_gui,
$lang);
241 $this->exportHTMLPages();
278 $this->resetUserLanguage();
280 $this->addSupplyingExportFiles();
282 $this->export_util->exportResourceFiles();
284 $this->co_page_html_export->exportPageElements();
298 if ($this->lang ==
"") {
299 $zip_target_dir = $this->lm->getExportDirectory(
"html");
301 $zip_target_dir = $this->lm->getExportDirectory(
"html_" . $this->lang);
307 $zip_file = $zip_target_dir .
"/" . $date .
"__" .
IL_INST_ID .
"__" .
308 $this->lm->getType() .
"_" . $this->lm->getId() .
".zip";
319 foreach ($this->getSupplyingExportFiles() as
$f) {
320 if (
$f[
"source"] !=
"") {
321 if (
$f[
"type"] ==
"js") {
322 $this->global_screen->layout()->meta()->addJs(
$f[
"source"]);
324 if (
$f[
"type"] ==
"css") {
325 $this->global_screen->layout()->meta()->addCss(
$f[
"source"]);
338 "target" => $a_target_dir .
'/js/yahoo/yahoo-min.js',
341 "target" => $a_target_dir .
'/js/yahoo/yahoo-dom-event.js',
344 "target" => $a_target_dir .
'/js/yahoo/animation-min.js',
346 array(
"source" =>
'./Services/Accordion/js/accordion.js',
347 "target" => $a_target_dir .
'/js/accordion.js',
349 array(
"source" =>
'./Services/Accordion/css/accordion.css',
350 "target" => $a_target_dir .
'/css/accordion.css',
352 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/pure.js',
353 "target" => $a_target_dir .
'/js/pure.js',
355 array(
"source" =>
'./Modules/Scorm2004/scripts/questions/question_handling.js',
356 "target" => $a_target_dir .
'/js/question_handling.js',
358 array(
"source" =>
'./Modules/Scorm2004/templates/default/question_handling.css',
359 "target" => $a_target_dir .
'/css/question_handling.css',
361 array(
"source" =>
'./Modules/TestQuestionPool/templates/default/test_javascript.css',
362 "target" => $a_target_dir .
'/css/test_javascript.css',
373 array(
"source" =>
'./Modules/LearningModule/js/LearningModule.js',
374 "target" => $a_target_dir .
'/js/LearningModule.js',
381 $scripts[] = array(
"source" =>
"",
388 if (is_int(strpos($p,
"ExtLink"))) {
389 $scripts[] = array(
"source" => $p,
390 "target" => $a_target_dir .
'/js/ilExtLink.js',
393 if (is_int(strpos($p,
"linkify"))) {
394 $scripts[] = array(
"source" => $p,
395 "target" => $a_target_dir .
'/js/linkify.js',
402 "source" =>
"src/UI/templates/js/MainControls/dist/mainbar.js",
406 "source" =>
"src/UI/templates/js/MainControls/metabar.js",
410 "source" =>
"src/UI/templates/js/MainControls/slate.js",
414 "source" =>
"src/UI/templates/js/Page/stdpage.js",
418 "source" =>
"src/GlobalScreen/Client/dist/GS.js",
433 $lm_gui = $this->lm_gui;
434 $lang = $lm_gui->lang;
435 $all_languages = ($this->lang ==
"all");
437 $ilLocator = $this->locator;
441 $lm_tree = $lm->getLMTree();
442 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
443 $first_page_id = $first_page[
"child"];
448 $this->offline_files = [];
452 $exp_id_map = array();
454 if (
$lm_set->get(
"html_export_ids")) {
455 foreach ($pages as $page) {
457 if (trim($exp_id) !=
"") {
458 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
468 foreach ($pages as $page) {
470 $ilLocator->clearItems();
471 $this->exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]),
$lang,
"", $exp_id_map);
472 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"],
$lang);
481 $tabs =
$DIC->tabs();
483 $tabs->clearTargets();
484 $tabs->clearSubTabs();
485 $tpl = new \ilGlobalPageTemplate(
$DIC->globalScreen(),
$DIC->ui(),
$DIC->http());
487 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
500 $this->global_screen->layout()->meta()->reset();
504 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
506 $this->addSupplyingExportFiles();
509 $tpl = $this->getInitialisedTemplate();
513 "obj_id" => $lm_page_id,
514 "ref_id" => $this->lm->getRefId(),
518 $this->lm_gui->initByRequest(
$params);
523 $this->lm_gui->injectTemplate(
$tpl);
532 bool $is_first =
false,
535 array $exp_id_map = []
537 $target_dir = $this->target_dir;
539 if (!in_array(
$lang, [
"-",
""]) && $this->lang ===
"all") {
540 $lang_suffix =
"_" .
$lang;
544 $this->initScreen($lm_page_id, $frame);
547 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
548 $file = $target_dir .
"/lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
550 $file = $target_dir .
"/lm_pg_" . $lm_page_id . $lang_suffix .
".html";
553 if ($frame !=
"toc") {
554 $file = $target_dir .
"/frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
556 $file = $target_dir .
"/frame_" . $frame . $lang_suffix .
".html";
561 if (is_file($file)) {
565 $content = $this->lm_gui->layout(
"main.xml",
false);
568 $fp = fopen($file,
"w+");
569 fwrite($fp, $content);
574 if ($is_first && $frame ==
"") {
575 copy($file, $target_dir .
"/index" . $lang_suffix .
".html");
addSupplyingExportFiles()
Add supplying export files.
exportHTML(bool $zip=true)
setAdditionalContextData(string $key, $data)
exportPageHTML(int $lm_page_id, bool $is_first=false, string $lang="-", string $frame="", array $exp_id_map=[])
export single page to file
ilLMPresentationGUI $lm_gui
exportHTMLPages()
export all pages of learning module to html file
__construct(\ilObjLearningModule $lm, string $export_dir, string $sub_dir, string $export_format="html", string $lang="")
string $initial_user_language
initLanguage(\ilObjUser $user, \ilLMPresentationGUI $lm_gui, string $lang)
ILIAS Style Content Object ObjectFacade $content_style_domain
getSupplyingExportFiles(string $a_target_dir=".")
ilObjectTranslation $obj_transl
zipPackage()
Zip everything, zip file will be in $this->export_dir, $this->target_dir (sub-dir in export dir) will...
ILIAS GlobalScreen Services $global_screen
string $initial_current_user_language
initDirectories()
Initialize directories.
initScreen(int $lm_page_id, string $frame)
Init global screen and learning module presentation gui for page.
ilGlobalTemplateInterface $main_tpl
ilCOPageHTMLExport $co_page_html_export
ILIAS Services Export HTML Util $export_util
static getLocalJsTreeCssPath()
static getLocalExplorerJsPath()
static getLocalJsTreeJsPath()
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const LM_HTML_EXPORT_RENDERING
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
static getPageList(int $lm_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLocalJsPaths()
Get paths of necessary js files.
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCurrentLanguage(string $a_val)
Set current language.
setLanguage(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
static resetInitialState()
Reset initial state (for exports)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
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 getLocalPath(string $a_name="")
Get local path of a YUI js file.
if(strpos( $jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...