19declare(strict_types=1);
31 protected \ILIAS\DI\UIServices
$ui;
38 protected \ilObjLearningModule
$lm;
63 $this->
locator = $DIC[
"ilLocator"];
64 $this->
user = $DIC->user();
70 $cs =
$DIC->contentStyle();
71 $this->
ui = $DIC->ui();
72 $this->content_style_domain = $cs->domain()->styleForRefId($this->lm->getRefId());
73 $this->collector =
$DIC->export()->domain()->html()->collector($this->lm->getId());
74 $this->collector->init();
76 $this->export_util =
new Util(
"",
"", $this->collector);
77 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir, $this->
getLinker(), $lm->
getRefId(), $this->collector);
79 $this->co_page_html_export->setContentStyleId(
80 $this->content_style_domain->getEffectiveStyleId()
85 $this->lm_gui = new \ilLMPresentationGUI(
$export_format, (
$lang ==
"all"), $this->target_dir,
false);
88 $this->lm_settings = new \ilSetting(
"lm");
92 $this->initial_user_language = $this->
user->getLanguage();
93 $this->initial_current_user_language = $this->
user->getCurrentLanguage();
95 $this->global_screen =
$DIC->globalScreen();
102 return new \ilLMPresentationLinker(
106 $this->lm->getRefId(),
121 $additional_data = $this->global_screen->tool()->context()->current()->getAdditionalData();
122 if ($additional_data->exists($key)) {
123 $additional_data->replace($key,
$data);
125 $additional_data->add($key,
$data);
131 $this->
user->setLanguage($this->initial_user_language);
132 $this->
user->setCurrentLanguage($this->initial_current_user_language);
136 protected function getLanguageIterator(): \Iterator
139 private int $position = 0;
141 private array $langs = [];
148 if (
$lang !=
"all") {
149 $this->langs = [
$lang];
152 $this->langs[] = $otl->getLanguageCode();
157 public function rewind(): void
162 public function current(): string
164 return $this->langs[$this->position];
167 public function key():
int
169 return $this->position;
172 public function next(): void
177 public function valid(): bool
179 return isset($this->langs[$this->position]);
200 if (
$lang == $this->obj_transl->getBaseLanguage()) {
211 $this->global_screen->tool()->context()->current()->addAdditionalData(
223 $this->initGlobalScreen();
225 $this->export_util->exportSystemStyle(
230 $this->export_util->exportCOPageFiles($this->content_style_domain->getEffectiveStyleId(),
"lm");
232 $lang_iterator = $this->getLanguageIterator();
235 foreach ($lang_iterator as $lang) {
236 $this->initLanguage($this->
user, $this->lm_gui, $lang);
237 $this->exportHTMLPages();
240 $this->resetUserLanguage();
242 $this->addSupplyingExportFiles();
244 $this->co_page_html_export->exportPageElements();
254 foreach ($this->getSupplyingExportFiles() as
$f) {
255 if (
$f[
"source"] !=
"") {
256 if (
$f[
"type"] ==
"js") {
257 $this->global_screen->layout()->meta()->addJs(
$f[
"source"]);
259 if (
$f[
"type"] ==
"css") {
260 $this->global_screen->layout()->meta()->addCss(
$f[
"source"]);
272 array(
"source" =>
'./components/ILIAS/Accordion/css/accordion.css',
273 "target" => $a_target_dir .
'/css/accordion.css',
275 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/pure_rendering.js',
276 "target" => $a_target_dir .
'/js/pure.js',
278 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js',
279 "target" => $a_target_dir .
'/js/question_handling.js',
281 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.css',
282 "target" => $a_target_dir .
'/css/question_handling.css',
284 array(
"source" =>
'./components/ILIAS/TestQuestionPool/templates/default/test_javascript.css',
285 "target" => $a_target_dir .
'/css/test_javascript.css',
296 array(
"source" =>
'./components/ILIAS/LearningModule/js/LearningModule.js',
297 "target" => $a_target_dir .
'/js/LearningModule.js',
301 $mathJaxSetting = new \ilSetting(
"MathJax");
302 $use_mathjax = (bool) $mathJaxSetting->get(
"enable");
304 $scripts[] = array(
"source" =>
"",
305 "target" => $mathJaxSetting->get(
"path_to_mathjax"),
311 if (is_int(strpos($p,
"ExtLink"))) {
312 $scripts[] = array(
"source" => $p,
313 "target" => $a_target_dir .
'/js/ilExtLink.js',
316 if (is_int(strpos($p,
"linkify"))) {
317 $scripts[] = array(
"source" => $p,
318 "target" => $a_target_dir .
'/js/linkify.js',
325 "source" =>
"assets/js/mainbar.js",
329 "source" =>
"assets/js/metabar.js",
333 "source" =>
"assets/js/slate.js",
337 "source" =>
"assets/js/stdpage.js",
341 "source" =>
"assets/js/GS.js",
356 $lm_gui = $this->lm_gui;
357 $lang = $lm_gui->lang;
358 $all_languages = ($this->lang ==
"all");
360 $ilLocator = $this->locator;
364 $lm_tree = $lm->getLMTree();
365 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
366 $first_page_id = $first_page[
"child"];
371 $this->offline_files = [];
375 $exp_id_map = array();
377 if (
$lm_set->get(
"html_export_ids")) {
378 foreach ($pages as $page) {
380 if (trim($exp_id) !=
"") {
381 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
391 foreach ($pages as $page) {
393 $ilLocator->clearItems();
394 $this->exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]), $lang,
"", $exp_id_map);
395 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"], $lang);
404 $tabs =
$DIC->tabs();
406 $tabs->clearTargets();
407 $tabs->clearSubTabs();
408 $tpl = new \ilGlobalPageTemplate(
$DIC->globalScreen(),
$DIC->ui(),
$DIC->http());
410 $this->co_page_html_export->getPreparedMainTemplate($tpl);
423 $this->export_util->resetGlobalScreen();
426 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
428 $this->addSupplyingExportFiles();
431 $tpl = $this->getInitialisedTemplate();
435 "obj_id" => $lm_page_id,
436 "ref_id" => $this->lm->getRefId(),
440 $this->lm_gui->initByRequest(
$params);
445 $this->lm_gui->injectTemplate($tpl);
454 bool $is_first =
false,
457 array $exp_id_map = []
459 $target_dir = $this->target_dir;
461 if (!in_array($lang, [
"-",
""]) && $this->lang ===
"all") {
462 $lang_suffix =
"_" . $lang;
465 $this->initScreen($lm_page_id, $frame);
468 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
469 $file =
"lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
471 $file =
"lm_pg_" . $lm_page_id . $lang_suffix .
".html";
474 if ($frame !=
"toc") {
475 $file =
"frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
477 $file =
"frame_" . $frame . $lang_suffix .
".html";
487 $content = $this->lm_gui->layout(
"main.xml",
false);
489 $this->collector->addString($content, $file);
491 if ($is_first && $frame ==
"") {
492 $this->collector->addString($content,
"index" . $lang_suffix .
".html");
494 $this->export_util->exportResourceFiles();
Class handles translation mode for an object.
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=".")
ILIAS GlobalScreen Services $global_screen
string $initial_current_user_language
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
ExportCollector $collector
Util This class is an interim solution for the HTML export handling with 6.0.
static getLocalJsTreeCssPath()
static getLocalExplorerJsPath()
static getLocalJsTreeJsPath()
const LM_HTML_EXPORT_RENDERING
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
static getPageList(int $lm_id)
Class ilLMPresentationGUI GUI class for learning module presentation.
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...
setLanguage(string $language)
setCurrentLanguage(string $language)
Set current language.
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="")
get full style sheet file name (path inclusive) of current user
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params