19declare(strict_types=1);
37 protected \ilObjLearningModule
$lm;
62 $this->
locator = $DIC[
"ilLocator"];
63 $this->
user = $DIC->user();
69 $cs =
$DIC->contentStyle();
70 $this->content_style_domain = $cs->domain()->styleForRefId($this->lm->getRefId());
71 $this->collector =
$DIC->export()->domain()->html()->collector($this->lm->getId());
72 $this->collector->init();
73 $this->export_util =
new Util(
"",
"", $this->collector);
74 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir, $this->
getLinker(), $lm->
getRefId(), $this->collector);
76 $this->co_page_html_export->setContentStyleId(
77 $this->content_style_domain->getEffectiveStyleId()
82 $this->lm_gui = new \ilLMPresentationGUI(
$export_format, (
$lang ==
"all"), $this->target_dir,
false);
85 $this->lm_settings = new \ilSetting(
"lm");
89 $this->initial_user_language = $this->
user->getLanguage();
90 $this->initial_current_user_language = $this->
user->getCurrentLanguage();
92 $this->global_screen =
$DIC->globalScreen();
99 return new \ilLMPresentationLinker(
103 $this->lm->getRefId(),
118 $additional_data = $this->global_screen->tool()->context()->current()->getAdditionalData();
119 if ($additional_data->exists($key)) {
120 $additional_data->replace($key,
$data);
122 $additional_data->add($key,
$data);
128 $this->
user->setLanguage($this->initial_user_language);
129 $this->
user->setCurrentLanguage($this->initial_current_user_language);
133 protected function getLanguageIterator(): \Iterator
136 private int $position = 0;
138 private array $langs = [];
145 if (
$lang !=
"all") {
146 $this->langs = [
$lang];
149 $this->langs[] = $otl->getLanguageCode();
154 public function rewind(): void
159 public function current(): string
161 return $this->langs[$this->position];
164 public function key():
int
166 return $this->position;
169 public function next(): void
174 public function valid(): bool
176 return isset($this->langs[$this->position]);
197 if (
$lang == $this->obj_transl->getBaseLanguage()) {
208 $this->global_screen->tool()->context()->current()->addAdditionalData(
220 $this->initGlobalScreen();
222 $this->export_util->exportSystemStyle(
227 $this->export_util->exportCOPageFiles($this->content_style_domain->getEffectiveStyleId(),
"lm");
229 $lang_iterator = $this->getLanguageIterator();
232 foreach ($lang_iterator as
$lang) {
233 $this->initLanguage($this->
user, $this->lm_gui,
$lang);
234 $this->exportHTMLPages();
237 $this->resetUserLanguage();
239 $this->addSupplyingExportFiles();
241 $this->export_util->exportResourceFiles();
243 $this->co_page_html_export->exportPageElements();
253 foreach ($this->getSupplyingExportFiles() as
$f) {
254 if (
$f[
"source"] !=
"") {
255 if (
$f[
"type"] ==
"js") {
256 $this->global_screen->layout()->meta()->addJs(
$f[
"source"]);
258 if (
$f[
"type"] ==
"css") {
259 $this->global_screen->layout()->meta()->addCss(
$f[
"source"]);
272 "target" => $a_target_dir .
'/js/yahoo/yahoo-min.js',
275 "target" => $a_target_dir .
'/js/yahoo/yahoo-dom-event.js',
278 "target" => $a_target_dir .
'/js/yahoo/animation-min.js',
280 array(
"source" =>
'./components/ILIAS/Accordion/js/accordion.js',
281 "target" => $a_target_dir .
'/js/accordion.js',
283 array(
"source" =>
'./components/ILIAS/Accordion/css/accordion.css',
284 "target" => $a_target_dir .
'/css/accordion.css',
286 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/pure_rendering.js',
287 "target" => $a_target_dir .
'/js/pure.js',
289 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.js',
290 "target" => $a_target_dir .
'/js/question_handling.js',
292 array(
"source" =>
'./components/ILIAS/TestQuestionPool/resources/js/dist/question_handling.css',
293 "target" => $a_target_dir .
'/css/question_handling.css',
295 array(
"source" =>
'./components/ILIAS/TestQuestionPool/templates/default/test_javascript.css',
296 "target" => $a_target_dir .
'/css/test_javascript.css',
307 array(
"source" =>
'./components/ILIAS/LearningModule/js/LearningModule.js',
308 "target" => $a_target_dir .
'/js/LearningModule.js',
312 $mathJaxSetting = new \ilSetting(
"MathJax");
313 $use_mathjax = (bool) $mathJaxSetting->get(
"enable");
315 $scripts[] = array(
"source" =>
"",
316 "target" => $mathJaxSetting->get(
"path_to_mathjax"),
322 if (is_int(strpos($p,
"ExtLink"))) {
323 $scripts[] = array(
"source" => $p,
324 "target" => $a_target_dir .
'/js/ilExtLink.js',
327 if (is_int(strpos($p,
"linkify"))) {
328 $scripts[] = array(
"source" => $p,
329 "target" => $a_target_dir .
'/js/linkify.js',
336 "source" =>
"assets/js/mainbar.js",
340 "source" =>
"assets/js/metabar.js",
344 "source" =>
"assets/js/slate.js",
348 "source" =>
"assets/js/stdpage.js",
352 "source" =>
"assets/js/GS.js",
367 $lm_gui = $this->lm_gui;
368 $lang = $lm_gui->lang;
369 $all_languages = ($this->lang ==
"all");
371 $ilLocator = $this->locator;
375 $lm_tree = $lm->getLMTree();
376 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(),
"pg");
377 $first_page_id = $first_page[
"child"];
382 $this->offline_files = [];
386 $exp_id_map = array();
388 if (
$lm_set->get(
"html_export_ids")) {
389 foreach ($pages as $page) {
391 if (trim($exp_id) !=
"") {
392 $exp_id_map[$page[
"obj_id"]] = trim($exp_id);
402 foreach ($pages as $page) {
404 $ilLocator->clearItems();
405 $this->exportPageHTML($page[
"obj_id"], ($first_page_id == $page[
"obj_id"]),
$lang,
"", $exp_id_map);
406 $this->co_page_html_export->collectPageElements(
"lm:pg", $page[
"obj_id"],
$lang);
415 $tabs =
$DIC->tabs();
417 $tabs->clearTargets();
418 $tabs->clearSubTabs();
419 $tpl = new \ilGlobalPageTemplate(
$DIC->globalScreen(),
$DIC->ui(),
$DIC->http());
421 $this->co_page_html_export->getPreparedMainTemplate($tpl);
434 $this->global_screen->layout()->meta()->reset();
438 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
440 $this->addSupplyingExportFiles();
443 $tpl = $this->getInitialisedTemplate();
447 "obj_id" => $lm_page_id,
448 "ref_id" => $this->lm->getRefId(),
452 $this->lm_gui->initByRequest(
$params);
457 $this->lm_gui->injectTemplate($tpl);
466 bool $is_first =
false,
469 array $exp_id_map = []
471 $target_dir = $this->target_dir;
473 if (!in_array(
$lang, [
"-",
""]) && $this->lang ===
"all") {
474 $lang_suffix =
"_" .
$lang;
478 $this->initScreen($lm_page_id, $frame);
481 if (is_array($exp_id_map) && isset($a_exp_id_map[$lm_page_id])) {
482 $file =
"lm_pg_" . $exp_id_map[$lm_page_id] . $lang_suffix .
".html";
484 $file =
"lm_pg_" . $lm_page_id . $lang_suffix .
".html";
487 if ($frame !=
"toc") {
488 $file =
"frame_" . $lm_page_id .
"_" . $frame . $lang_suffix .
".html";
490 $file =
"frame_" . $frame . $lang_suffix .
".html";
500 $content = $this->lm_gui->layout(
"main.xml",
false);
502 $this->collector->addString($content, $file);
504 if ($is_first && $frame ==
"") {
505 $this->collector->addString($content,
"index" . $lang_suffix .
".html");
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
static getLocalPath(string $a_name="")
Get local path of a YUI js file.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params