3 declare(strict_types=1);
40 protected \ilLanguage
$lng;
54 bool $set_export_key =
true 62 $this->export_dir = $exp_dir;
64 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
66 $this->global_screen = $DIC->globalScreen();
67 $this->export_util = new \ILIAS\Services\Export\HTML\Util($exp_dir, $sub_dir);
68 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir);
69 $this->
tabs = $DIC->tabs();
70 $this->
lng = $DIC->language();
72 $this->items = $this->blog_gui->getItems();
73 $this->keywords = $this->blog_gui->getKeywords(
false);
74 if ($set_export_key && !self::$export_key_set) {
75 self::$export_key_set =
true;
76 $this->global_screen->tool()->context()->current()->addAdditionalData(
82 $cs = $DIC->contentStyle();
84 $this->content_style_domain = $cs->domain()->styleForRefId($this->blog->getRefId());
86 $this->content_style_domain = $cs->domain()->styleForObjId($this->blog->getId());
89 protected function init(): void
99 bool $a_include_comments
101 $this->include_comments = $a_include_comments;
119 $this->export_util->exportSystemStyle();
120 $this->export_util->exportCOPageFiles(
121 $this->content_style_domain->getEffectiveStyleId(),
129 if ($this->print_version) {
138 $this->export_util->exportResourceFiles();
139 $this->co_page_html_export->exportPageElements();
146 if ($this->include_comments) {
147 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
148 $user_export->exportUserImagesForRepObjId($this->target_dir, $this->blog->getId());
155 $blga_set = new \ilSetting(
"blga");
156 if ($blga_set->get(
"banner")) {
157 $banner = $this->blog->getImageFullPath();
159 copy($banner, $this->target_dir .
"/" . basename($banner));
175 $this->blog->getType() .
"_" . $this->blog->getId() .
".zip";
187 string $a_link_template = null,
188 ?\
Closure $a_tpl_callback = null,
190 string $a_index_name =
"index.html" 192 if (!$a_link_template) {
193 $a_link_template =
"bl{TYPE}_{ID}.html";
196 if ($a_co_page_html_export) {
197 $this->co_page_html_export = $a_co_page_html_export;
203 $nav = $this->blog_gui->renderNavigation(
"",
"", $a_link_template);
207 foreach (array_keys($this->items) as $month) {
208 $list = $this->blog_gui->renderList($this->items[$month],
"render", $a_link_template,
false, $this->target_dir);
214 if (!$a_tpl_callback) {
217 $tpl = $a_tpl_callback();
220 $file = self::buildExportLink($a_link_template,
"list", $month, $this->keywords);
224 copy($file, $this->target_dir .
"/" . $a_index_name);
230 foreach (array_keys($this->blog_gui->getKeywords(
false)) as $keyword) {
231 $list_items = $this->blog_gui->filterItemsByKeyword($this->items, $keyword);
232 $list = $this->blog_gui->renderList($list_items,
"render", $a_link_template,
false, $this->target_dir);
238 if (!$a_tpl_callback) {
241 $tpl = $a_tpl_callback();
244 $file = self::buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
252 foreach ($pages as $page) {
254 $blp_gui = new \ilBlogPostingGUI(0, null, $page[
"id"]);
255 $blp_gui->setOutputMode(
"offline");
256 $blp_gui->setFullscreenLink(
"fullscreen.html");
257 $blp_gui->add_date =
true;
258 $page_content = $blp_gui->showPage();
260 $back = self::buildExportLink(
267 $file = self::buildExportLink($a_link_template,
"posting", (
string) $page[
"id"], $this->keywords);
269 if (!$a_tpl_callback) {
272 $tpl = $a_tpl_callback();
276 ? $blp_gui->getCommentsHTMLExport()
280 $nav = $this->blog_gui->renderNavigation(
290 $this->co_page_html_export->collectPageElements(
"blp:pg", $page[
"id"]);
295 if (!$a_tpl_callback) {
298 $tpl = $a_tpl_callback();
312 $print_view = $this->blog_gui->getPrintView();
313 $print_view->setOffline(
true);
314 $html = $print_view->renderPrintView();
315 file_put_contents($this->target_dir .
"/index.html", $html);
322 foreach ($pages as $page) {
344 if (!isset(self::$keyword_export_map)) {
345 self::$keyword_export_map = array_flip(array_keys($keywords));
347 $a_id = (string) (self::$keyword_export_map[$a_id] ??
"");
356 return str_replace(array(
"{TYPE}",
"{ID}"), array($a_type, $a_id), $a_template);
363 string $a_back_url =
"" 367 $this->global_screen->layout()->meta()->reset();
370 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
371 $this->global_screen->layout()->meta()->addCss(
376 $tabs = $DIC->tabs();
377 $tabs->clearTargets();
378 $tabs->clearSubTabs();
380 $tabs->setBackTarget($this->
lng->txt(
"back"), $a_back_url);
382 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
384 $this->co_page_html_export->getPreparedMainTemplate($tpl);
386 $this->blog_gui->renderFullscreenHeader($tpl, $this->blog->getOwner(),
true);
399 string $a_right_content =
"",
400 bool $a_back =
false,
403 $file = $this->target_dir .
"/" . $a_file;
405 if (is_file($file)) {
410 $ep_tpl = new \ilTemplate(
411 "tpl.export_page.html",
417 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
418 $ep_tpl->setVariable(
"COMMENTS",
$comments);
420 $ep_tpl->setVariable(
"LIST", $a_content);
426 if ($a_right_content) {
433 file_put_contents($file, $content);
collectAllPagesPageElements(\ilCOPageHTMLExport $co_page_html_export)
static copyProfilePicturesToDirectory(int $a_user_id, string $a_dir)
static array $keyword_export_map
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
static bool $export_key_set
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
ilCOPageHTMLExport $co_page_html_export
exportHTMLPages(string $a_link_template=null, ?\Closure $a_tpl_callback=null, ?\ilCOPageHTMLExport $a_co_page_html_export=null, string $a_index_name="index.html")
Export all pages (note: this one is called from the portfolio html export!)
ILIAS Services Export HTML Util $export_util
includeComments(bool $a_include_comments)
getInitialisedTemplate(string $a_back_url="")
Get initialised template.
setRightContent(string $a_html)
Sets content of right column.
__construct()
Constructor setup ILIAS global object public.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
exportHTMLPagesPrint()
Export all pages as one print version.
printToString()
Use this method to get the finally rendered page as string.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static resetInitialState()
Reset initial state (for exports)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content, string $a_right_content="", bool $a_back=false, string $comments="")
Write HTML to file.
const HTML_EXPORT_RENDERING
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS GlobalScreen Services $global_screen
setPrintVersion(bool $print_version)
static buildExportLink(string $a_template, string $a_type, string $a_id, array $keywords)
Build static export link.
setContent(string $a_html)
Sets content for standard template.
ILIAS Style Content Object ObjectFacade $content_style_domain
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...