19 declare(strict_types=1);
36 protected \ilObjLearningModule
$lm;
56 string $export_format =
"html",
61 $this->
locator = $DIC[
"ilLocator"];
62 $this->
user = $DIC->user();
67 $this->target_dir = $export_dir .
"/" .
$sub_dir;
68 $cs = $DIC->contentStyle();
69 $this->content_style_domain = $cs->domain()->styleForRefId($this->lm->getRefId());
70 $this->collector = $DIC->export()->domain()->html()->collector($this->lm->getId());
71 $this->collector->init();
72 $this->export_util =
new Util(
"",
"", $this->collector);
75 $this->co_page_html_export->setContentStyleId(
76 $this->content_style_domain->getEffectiveStyleId()
81 $this->lm_gui = new \ilLMPresentationGUI($export_format, ($lang ==
"all"), $this->target_dir,
false);
84 $this->lm_settings = new \ilSetting(
"lm");
88 $this->initial_user_language = $this->
user->getLanguage();
89 $this->initial_current_user_language = $this->
user->getCurrentLanguage();
91 $this->global_screen = $DIC->globalScreen();
98 return new \ilLMPresentationLinker(
102 $this->lm->getRefId(),
117 $additional_data = $this->global_screen->tool()->context()->current()->getAdditionalData();
118 if ($additional_data->exists($key)) {
119 $additional_data->replace($key,
$data);
121 $additional_data->add($key,
$data);
127 $this->
user->setLanguage($this->initial_user_language);
128 $this->
user->setCurrentLanguage($this->initial_current_user_language);
132 protected function getLanguageIterator(): \Iterator
135 private int $position = 0;
137 private array $langs = [];
144 if ($lang !=
"all") {
145 $this->langs = [
$lang];
148 $this->langs[] = $otl->getLanguageCode();
153 public function rewind():
void 158 public function current():
string 160 return $this->langs[$this->position];
163 public function key():
int 165 return $this->position;
168 public function next():
void 173 public function valid():
bool 175 return isset($this->langs[$this->position]);
196 if ($lang == $this->obj_transl->getMasterLanguage()) {
199 $lm_gui->lang =
$lang;
207 $this->global_screen->tool()->context()->current()->addAdditionalData(
221 $this->export_util->exportSystemStyle(
226 $this->export_util->exportCOPageFiles($this->content_style_domain->getEffectiveStyleId(),
"lm");
228 $lang_iterator = $this->getLanguageIterator();
231 foreach ($lang_iterator as $lang) {
240 $this->export_util->exportResourceFiles();
242 $this->co_page_html_export->exportPageElements();
253 if ($f[
"source"] !=
"") {
254 if ($f[
"type"] ==
"js") {
255 $this->global_screen->layout()->meta()->addJs($f[
"source"]);
257 if ($f[
"type"] ==
"css") {
258 $this->global_screen->layout()->meta()->addCss($f[
"source"]);
271 "target" => $a_target_dir .
'/js/yahoo/yahoo-min.js',
274 "target" => $a_target_dir .
'/js/yahoo/yahoo-dom-event.js',
277 "target" => $a_target_dir .
'/js/yahoo/animation-min.js',
279 array(
"source" =>
'./components/ILIAS/Accordion/js/accordion.js',
280 "target" => $a_target_dir .
'/js/accordion.js',
282 array(
"source" =>
'./components/ILIAS/Accordion/css/accordion.css',
283 "target" => $a_target_dir .
'/css/accordion.css',
285 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/pure_rendering.js',
286 "target" => $a_target_dir .
'/js/pure.js',
288 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js',
289 "target" => $a_target_dir .
'/js/question_handling.js',
291 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.css',
292 "target" => $a_target_dir .
'/css/question_handling.css',
294 array(
"source" =>
'./components/ILIAS/TestQuestionPool/templates/default/test_javascript.css',
295 "target" => $a_target_dir .
'/css/test_javascript.css',
306 array(
"source" =>
'./components/ILIAS/LearningModule/js/LearningModule.js',
307 "target" => $a_target_dir .
'/js/LearningModule.js',
311 $mathJaxSetting = new \ilSetting(
"MathJax");
312 $use_mathjax = (bool) $mathJaxSetting->get(
"enable");
314 $scripts[] = array(
"source" =>
"",
315 "target" => $mathJaxSetting->get(
"path_to_mathjax"),
321 if (is_int(strpos($p,
"ExtLink"))) {
322 $scripts[] = array(
"source" => $p,
323 "target" => $a_target_dir .
'/js/ilExtLink.js',
326 if (is_int(strpos($p,
"linkify"))) {
327 $scripts[] = array(
"source" => $p,
328 "target" => $a_target_dir .
'/js/linkify.js',
335 "source" =>
"assets/js/mainbar.js",
339 "source" =>
"assets/js/metabar.js",
343 "source" =>
"assets/js/slate.js",
347 "source" =>
"assets/js/stdpage.js",
351 "source" =>
"assets/js/GS.js",
367 $lang = $lm_gui->lang;
368 $all_languages = ($this->lang ==
"all");
374 $lm_tree = $lm->getLMTree();
375 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
376 $first_page_id = $first_page[
"child"];
381 $this->offline_files = [];
385 $exp_id_map = array();
387 if (
$lm_set->get(
"html_export_ids")) {
388 foreach ($pages as $page) {
390 if (trim($exp_id) !=
"") {
391 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
401 foreach ($pages as $page) {
403 $ilLocator->clearItems();
404 $this->
exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]), $lang,
"", $exp_id_map);
405 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"], $lang);
414 $tabs = $DIC->tabs();
416 $tabs->clearTargets();
417 $tabs->clearSubTabs();
418 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
420 $this->co_page_html_export->getPreparedMainTemplate($tpl);
433 $this->global_screen->layout()->meta()->reset();
437 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
446 "obj_id" => $lm_page_id,
447 "ref_id" => $this->lm->getRefId(),
451 $this->lm_gui->initByRequest(
$params);
456 $this->lm_gui->injectTemplate($tpl);
465 bool $is_first =
false,
468 array $exp_id_map = []
472 if (!in_array($lang, [
"-",
""]) && $this->lang ===
"all") {
473 $lang_suffix =
"_" .
$lang;
480 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
481 $file =
"lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
483 $file =
"lm_pg_" . $lm_page_id . $lang_suffix .
".html";
486 if ($frame !=
"toc") {
487 $file =
"frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
489 $file =
"frame_" . $frame . $lang_suffix .
".html";
499 $content = $this->lm_gui->layout(
"main.xml",
false);
501 $this->collector->addString($content, $file);
503 if ($is_first && $frame ==
"") {
504 $this->collector->addString($content,
"index" . $lang_suffix .
".html");
__construct(\ilObjLearningModule $lm, string $export_dir, string $sub_dir, string $export_format="html", string $lang="")
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
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.
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
const LM_HTML_EXPORT_RENDERING
static getLocalPath(string $a_name="")
Get local path of a YUI js file.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
getSupplyingExportFiles(string $a_target_dir=".")
static getLocalJsPaths()
Get paths of necessary js files.
exportPageHTML(int $lm_page_id, bool $is_first=false, string $lang="-", string $frame="", array $exp_id_map=[])
export single page to file
string $initial_user_language
setAdditionalContextData(string $key, $data)
ILIAS Style Content Object ObjectFacade $content_style_domain
initLanguage(\ilObjUser $user, \ilLMPresentationGUI $lm_gui, string $lang)
exportHTMLPages()
export all pages of learning module to html file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $initial_current_user_language
static getLocalJsTreeJsPath()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $main_tpl
ILIAS GlobalScreen Services $global_screen
addSupplyingExportFiles()
Add supplying export files.
ilLMPresentationGUI $lm_gui
exportHTML(bool $zip=true)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static getLocalExplorerJsPath()
static getInstance(int $obj_id)
ilCOPageHTMLExport $co_page_html_export
ilObjectTranslation $obj_transl
initScreen(int $lm_page_id, string $frame)
Init global screen and learning module presentation gui for page.
Util This class is an interim solution for the HTML export handling with 6.0.
static resetInitialState()
Reset initial state (for exports)
setLanguage(string $a_str)
static getPageList(int $lm_id)
static getLocalJsTreeCssPath()
setCurrentLanguage(string $a_val)
Set current language.
ExportCollector $collector