36 protected \ILIAS\components\Export\HTML\ExportCollector
$collector;
40 protected \ilDBInterface
$db;
42 protected \ilLanguage
$lng;
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();
94 $global_screen = $this->global_screen;
96 $ilUser = $this->user;
98 $this->log->debug(
"buildExportFile...");
100 if (in_array($this->getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
101 $this->user_html_exp = new \ilWikiUserHTMLExport($this->wiki,
$ilDB, $ilUser, ($this->getMode() === self::MODE_USER_COMMENTS));
115 if (in_array($this->getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
116 $subdir = $ascii_name;
118 $subdir = $this->wiki->getType() .
"_" . $this->wiki->getId();
121 if ($print_version) {
129 $zip_file_name = (in_array($this->getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS]))
130 ? $ascii_name .
".zip"
131 : $date .
"__" .
IL_INST_ID .
"__" . $this->wiki->getType() .
"_" . $this->wiki->getId() .
".zip";
133 $this->collector = $this->html_export->collector($this->wiki->getId(), $this->getMode());
134 $this->collector->init($zip_file_name);
136 $this->export_util = new \ILIAS\components\Export\HTML\Util(
"",
"", $this->collector);
137 $this->co_page_html_export = new \ilCOPageHTMLExport(
"",
null, 0, $this->collector);
139 $this->export_util->exportSystemStyle(
144 $eff_style_id = $this->content_style_domain->getEffectiveStyleId();
145 $this->export_util->exportCOPageFiles($eff_style_id,
"wiki");
146 $this->co_page_html_export->setContentStyleId($eff_style_id);
149 $this->log->debug(
"export pages");
150 if (!self::$context_init) {
151 $global_screen->tool()->context()->current()->addAdditionalData(
155 self::$context_init =
true;
157 if ($print_version) {
158 $this->exportHTMLPagesPrint();
160 $this->exportHTMLPages();
164 $this->export_util->exportResourceFiles();
181 return $this->collector;
197 foreach ($pages as $page) {
198 $tpl = new \ilGlobalPageTemplate(
$DIC->globalScreen(),
$DIC->ui(),
$DIC->http());
199 $this->co_page_html_export->getPreparedMainTemplate($tpl);
200 $this->log->debug(
"page: " . $page[
"id"]);
202 $this->log->debug(
"export page");
203 $this->exportPageHTML($page[
"id"], $tpl);
204 $this->log->debug(
"collect page elements");
205 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
208 if (in_array($this->getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
210 $this->log->debug(
"update status: " . $cnt);
214 $this->co_page_html_export->exportPageElements(
215 function (
int $total,
int $cnt):
void {
216 $this->updateUserHTMLStatusForPageElements($total, $cnt);
228 foreach ($pages as $page) {
230 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
233 $this->co_page_html_export->exportPageElements();
236 $wiki_gui = new \ilObjWikiGUI([], $this->wiki->getRefId(),
true);
237 $print_view = $wiki_gui->getPrintView(
true);
238 $print_view->setOffline(
true);
239 $html = $print_view->renderPrintView();
240 $this->collector->addString($html,
"index.html");
261 if (in_array($this->getMode(), [self::MODE_USER, self::MODE_USER_COMMENTS])) {
275 $this->log->debug(
"Export page:" . $a_page_id);
277 $ilTabs = $this->tabs;
279 $ilTabs->clearTargets();
282 $file =
"wpg_" . $a_page_id .
".html";
291 $this->log->debug(
"init page gui");
292 $wpg_gui = new \ilWikiPageGUI(
295 $this->wiki->getRefId()
297 $wpg_gui->setOutputMode(
"offline");
298 $page_content = $wpg_gui->showPage();
301 $this->log->debug(
"init page gui-" . $this->getMode() .
"-");
302 $ep_tpl = new \ilTemplate(
303 "tpl.export_page.html",
306 "components/ILIAS/Wiki"
308 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
310 $comments = (in_array($this->getMode(), [self::MODE_USER_COMMENTS, self::MODE_COMMENTS]))
311 ? $wpg_gui->getCommentsHTMLExport()
313 $ep_tpl->setVariable(
"COMMENTS",
$comments);
316 $bl = new \ilWikiImportantPagesBlockGUI();
320 $this->log->debug(
"set title");
321 $tpl->
setTitle($this->wiki->getTitle());
324 $lng->txt(
"obj_wiki")
343 $this->collector->addString($content, $file);
348 if ($this->wiki->getStartPage() === $wpg_gui->getPageObject()->getTitle()) {
349 $this->collector->addString($content,
"index.html");
360 $this->log->debug(
"dir: " . $exp_dir);
361 if (!is_dir($exp_dir)) {
364 foreach (
new \DirectoryIterator($exp_dir) as $fileInfo) {
365 $this->log->debug(
"file: " . $fileInfo->getFilename());
366 if (pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION) ===
"zip") {
367 $this->log->debug(
"return: " . $exp_dir .
"/" . $fileInfo->getFilename());
368 return $exp_dir .
"/" . $fileInfo->getFilename();
376 $fm = $this->html_export->fileManager();
377 $latest = $fm->getLatestOfObjectIdAndType($this->wiki->getId(), $this->getMode());
379 $fm->deliver($latest);
385 return $this->html_export->fileManager()->getLatestOfObjectIdAndType($this->wiki->getId(), $this->getMode());
Wiki HTML exporter class.
Wiki HTML exporter class.
ilCOPageHTMLExport $co_page_html_export
ILIAS components Export HTML Util $export_util
exportHTMLPages()
Export all pages.
ILIAS Export HTML ExternalDomainService $html_export
ilGlobalTemplateInterface $main_tpl
updateUserHTMLStatusForPageElements(int $a_total, int $a_cnt)
Export user images.
getUserExportFile()
Get user export file.
__construct(\ilObjWiki $a_wiki)
ILIAS GlobalScreen Services $global_screen
ilWikiUserHTMLExport $user_html_exp
exportPageHTML(int $a_page_id, \ilGlobalPageTemplate $tpl)
Export page html.
buildExportFile(bool $print_version=false)
Build export file.
exportHTMLPagesPrint()
Export all pages as one print version.
ILIAS components Export HTML ExportCollector $collector
ILIAS Style Content Object ObjectFacade $content_style_domain
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object
static getASCIIFilename(string $a_filename)
printToString()
Use this method to get the finally rendered page as string.
setContent(string $a_html)
Sets content for standard template.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setRightContent(string $a_html)
Sets content of right column.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
const HTML_EXPORT_RENDERING
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...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getAllWikiPages(int $a_wiki_id, string $lang="-")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))