36 protected \ILIAS\components\Export\HTML\ExportCollector
$collector;
40 protected \ilDBInterface
$db;
42 protected \ilLanguage
$lng;
45 protected string $mode = self::MODE_DEFAULT;
61 $this->db = $DIC->database();
62 $this->
user = $DIC->user();
63 $this->
lng = $DIC->language();
64 $this->
tabs = $DIC->tabs();
65 $this->wiki = $a_wiki;
67 $this->global_screen = $DIC->globalScreen();
68 $this->main_tpl = $DIC->ui()->mainTemplate();
69 $this->content_style_domain = $DIC
72 ->styleForRefId($a_wiki->
getRefId());
73 $this->html_export = $DIC->export()->domain()->html();
98 $this->log->debug(
"buildExportFile...");
102 if (in_array($this->
getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
103 $this->user_html_exp = new \ilWikiUserHTMLExport($this->wiki,
$ilDB, $ilUser, ($this->
getMode() === self::MODE_USER_COMMENTS));
117 if (in_array($this->
getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
118 $subdir = $ascii_name;
120 $subdir = $this->wiki->getType() .
"_" . $this->wiki->getId();
123 if ($print_version) {
131 $zip_file_name = (in_array($this->
getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS]))
132 ? $ascii_name .
".zip" 133 : $date .
"__" .
IL_INST_ID .
"__" . $this->wiki->getType() .
"_" . $this->wiki->getId() .
".zip";
135 $this->collector = $this->html_export->collector($this->wiki->getId(), $this->
getMode());
136 $this->collector->init($zip_file_name);
138 $this->export_util = new \ILIAS\components\Export\HTML\Util(
"",
"", $this->collector);
139 $this->co_page_html_export = new \ilCOPageHTMLExport(
"",
null, 0, $this->collector);
141 $this->export_util->exportSystemStyle(
146 $eff_style_id = $this->content_style_domain->getEffectiveStyleId();
147 $this->export_util->exportCOPageFiles($eff_style_id,
"wiki");
148 $this->co_page_html_export->setContentStyleId($eff_style_id);
151 $this->log->debug(
"export pages");
152 if (!self::$context_init) {
153 $global_screen->tool()->context()->current()->addAdditionalData(
157 self::$context_init =
true;
159 if ($print_version) {
166 $this->export_util->exportResourceFiles();
199 foreach ($pages as $page) {
200 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
201 $this->co_page_html_export->getPreparedMainTemplate($tpl);
202 $this->log->debug(
"page: " . $page[
"id"]);
204 $this->log->debug(
"export page");
206 $this->log->debug(
"collect page elements");
207 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
210 if (in_array($this->
getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
212 $this->log->debug(
"update status: " . $cnt);
216 $this->co_page_html_export->exportPageElements(
217 function (
int $total,
int $cnt):
void {
230 foreach ($pages as $page) {
232 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
235 $this->co_page_html_export->exportPageElements();
238 $wiki_gui = new \ilObjWikiGUI([], $this->wiki->getRefId(),
true);
239 $print_view = $wiki_gui->getPrintView(
true);
240 $print_view->setOffline(
true);
241 $html = $print_view->renderPrintView();
242 $this->collector->addString($html,
"index.html");
263 if (in_array($this->
getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
277 $this->log->debug(
"Export page:" . $a_page_id);
284 $file =
"wpg_" . $a_page_id .
".html";
293 $this->log->debug(
"init page gui");
294 $wpg_gui = new \ilWikiPageGUI(
297 $this->wiki->getRefId()
299 $wpg_gui->setOutputMode(
"offline");
300 $page_content = $wpg_gui->showPage();
303 $this->log->debug(
"init page gui-" . $this->
getMode() .
"-");
304 $ep_tpl = new \ilTemplate(
305 "tpl.export_page.html",
308 "components/ILIAS/Wiki" 310 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
312 $comments = (in_array($this->
getMode(), [self::MODE_USER_COMMENTS, self::MODE_COMMENTS]))
313 ? $wpg_gui->getCommentsHTMLExport()
315 $ep_tpl->setVariable(
"COMMENTS",
$comments);
318 $bl = new \ilWikiImportantPagesBlockGUI();
322 $this->log->debug(
"set title");
323 $tpl->
setTitle($this->wiki->getTitle());
326 $lng->txt(
"obj_wiki")
345 $this->collector->addString($content, $file);
350 if ($this->wiki->getStartPage() === $wpg_gui->getPageObject()->getTitle()) {
351 $this->collector->addString($content,
"index.html");
362 $this->log->debug(
"dir: " . $exp_dir);
363 if (!is_dir($exp_dir)) {
367 $this->log->debug(
"file: " . $fileInfo->getFilename());
368 if (pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION) ===
"zip") {
369 $this->log->debug(
"return: " . $exp_dir .
"/" . $fileInfo->getFilename());
370 return $exp_dir .
"/" . $fileInfo->getFilename();
378 $fm = $this->html_export->fileManager();
379 $latest = $fm->getLatestOfObjectIdAndType($this->wiki->getId(), $this->
getMode());
381 $fm->deliver($latest);
387 return $this->html_export->fileManager()->getLatestOfObjectIdAndType($this->wiki->getId(), $this->
getMode());
updateUserHTMLStatusForPageElements(int $a_total, int $a_cnt)
Export user images.
static getLogger(string $a_component_id)
Get component logger.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
Wiki HTML exporter class.
__construct(\ilObjWiki $a_wiki)
ilWikiUserHTMLExport $user_html_exp
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS components Export HTML ExportCollector $collector
static getASCIIFilename(string $a_filename)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ILIAS components Export HTML Util $export_util
setRightContent(string $a_html)
Sets content of right column.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getUserExportFile()
Get user export file.
ILIAS Style Content Object ObjectFacade $content_style_domain
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
printToString()
Use this method to get the finally rendered page as string.
ILIAS GlobalScreen Services $global_screen
clearTargets()
clear all targets
exportPageHTML(int $a_page_id, \ilGlobalPageTemplate $tpl)
Export page html.
ilCOPageHTMLExport $co_page_html_export
ILIAS Export HTML ExternalDomainService $html_export
exportHTMLPagesPrint()
Export all pages as one print version.
ilGlobalTemplateInterface $main_tpl
const HTML_EXPORT_RENDERING
exportHTMLPages()
Export all pages.
static getAllWikiPages(int $a_wiki_id, string $lang="-")
buildExportFile(bool $print_version=false)
Build export file.
setContent(string $a_html)
Sets content for standard template.