19 declare(strict_types=1);
37 protected \ilObjLearningModule
$lm;
57 string $export_format =
"html",
62 $this->
locator = $DIC[
"ilLocator"];
63 $this->
user = $DIC->user();
68 $this->target_dir = $export_dir .
"/" .
$sub_dir;
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);
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()) {
200 $lm_gui->lang =
$lang;
208 $this->global_screen->tool()->context()->current()->addAdditionalData(
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) {
241 $this->export_util->exportResourceFiles();
243 $this->co_page_html_export->exportPageElements();
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",
368 $lang = $lm_gui->lang;
369 $all_languages = ($this->lang ==
"all");
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);
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 = []
473 if (!in_array($lang, [
"-",
""]) && $this->lang ===
"all") {
474 $lang_suffix =
"_" .
$lang;
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");
__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.
Class handles translation mode for an object.
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()
Class ilLMPresentationGUI GUI class for learning module presentation.
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()
ilCOPageHTMLExport $co_page_html_export
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLanguage(string $a_str)
static getPageList(int $lm_id)
static getLocalJsTreeCssPath()
setCurrentLanguage(string $a_val)
Set current language.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ExportCollector $collector