38 protected \ilLanguage
$lng;
52 bool $set_export_key =
true
60 $this->export_dir = $exp_dir;
62 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
64 $this->global_screen =
$DIC->globalScreen();
65 $this->export_util = new \ILIAS\Services\Export\HTML\Util($exp_dir,
$sub_dir);
66 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir);
67 $this->
tabs = $DIC->tabs();
68 $this->
lng = $DIC->language();
70 $this->items = $this->blog_gui->getItems();
71 $this->keywords = $this->blog_gui->getKeywords(
false);
72 if ($set_export_key && !self::$export_key_set) {
73 self::$export_key_set =
true;
74 $this->global_screen->tool()->context()->current()->addAdditionalData(
80 $cs =
$DIC->contentStyle();
82 $this->content_style_domain = $cs->domain()->styleForRefId($this->blog->getRefId());
84 $this->content_style_domain = $cs->domain()->styleForObjId($this->blog->getId());
87 protected function init(): void
97 bool $a_include_comments
99 $this->include_comments = $a_include_comments;
116 $this->initDirectories();
117 $this->export_util->exportSystemStyle();
118 $this->export_util->exportCOPageFiles(
119 $this->content_style_domain->getEffectiveStyleId(),
124 $this->exportBanner();
127 if ($this->print_version) {
128 $this->exportHTMLPagesPrint();
130 $this->exportHTMLPages();
134 $this->exportUserImages();
136 $this->export_util->exportResourceFiles();
137 $this->co_page_html_export->exportPageElements();
139 return $this->zipPackage();
144 if ($this->include_comments) {
145 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
146 $user_export->exportUserImagesForRepObjId($this->target_dir, $this->blog->getId());
153 $blga_set = new \ilSetting(
"blga");
154 if ($blga_set->get(
"banner")) {
155 $banner = $this->blog->getImageFullPath();
157 copy($banner, $this->target_dir .
"/" . basename($banner));
168 $type = ($this->include_comments)
173 $this->blog->getType() .
"_" . $this->blog->getId() .
".zip";
185 string $a_link_template =
null,
186 ?\Closure $a_tpl_callback =
null,
188 string $a_index_name =
"index.html"
190 if (!$a_link_template) {
191 $a_link_template =
"bl{TYPE}_{ID}.html";
194 if ($a_co_page_html_export) {
195 $this->co_page_html_export = $a_co_page_html_export;
201 $nav = $this->blog_gui->renderNavigation(
"",
"", $a_link_template);
206 foreach (array_keys($this->items) as $month) {
207 $list = $this->blog_gui->renderList($this->items[$month],
"render", $a_link_template,
false, $this->target_dir);
213 if (!$a_tpl_callback) {
214 $tpl = $this->getInitialisedTemplate();
216 $tpl = $a_tpl_callback();
219 $file = self::buildExportLink($a_link_template,
"list", $month, $this->keywords);
220 $file = $this->writeExportFile($file,
$tpl, $list, $nav);
223 copy($file, $this->target_dir .
"/" . $a_index_name);
229 foreach (array_keys($this->blog_gui->getKeywords(
false)) as $keyword) {
230 $list_items = $this->blog_gui->filterItemsByKeyword($this->items, $keyword);
231 $list = $this->blog_gui->renderList($list_items,
"render", $a_link_template,
false, $this->target_dir);
237 if (!$a_tpl_callback) {
238 $tpl = $this->getInitialisedTemplate();
240 $tpl = $a_tpl_callback();
243 $file = self::buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
244 $file = $this->writeExportFile($file,
$tpl, $list, $nav);
251 foreach ($pages as $page) {
253 $blp_gui = new \ilBlogPostingGUI(0,
null, $page[
"id"]);
254 $blp_gui->setOutputMode(
"offline");
255 $blp_gui->setFullscreenLink(
"fullscreen.html");
256 $blp_gui->add_date =
true;
257 $page_content = $blp_gui->showPage();
259 $back = self::buildExportLink(
266 $file = self::buildExportLink($a_link_template,
"posting", $page[
"id"], $this->keywords);
268 if (!$a_tpl_callback) {
269 $tpl = $this->getInitialisedTemplate();
271 $tpl = $a_tpl_callback();
275 ? $blp_gui->getCommentsHTMLExport()
279 $nav = $this->blog_gui->renderNavigation(
287 $this->writeExportFile($file,
$tpl, $page_content, $nav, $back,
$comments);
289 $this->co_page_html_export->collectPageElements(
"blp:pg", $page[
"id"]);
299 $this->collectAllPagesPageElements($this->co_page_html_export);
302 $print_view = $this->blog_gui->getPrintView();
303 $print_view->setOffline(
true);
304 $html = $print_view->renderPrintView();
305 file_put_contents($this->target_dir .
"/index.html", $html);
312 foreach ($pages as $page) {
334 if (!isset(self::$keyword_export_map)) {
335 self::$keyword_export_map = array_flip(array_keys($keywords));
337 $a_id = (string) (self::$keyword_export_map[$a_id] ??
"");
346 return str_replace(array(
"{TYPE}",
"{ID}"), array($a_type, $a_id), $a_template);
353 string $a_back_url =
""
357 $this->global_screen->layout()->meta()->reset();
360 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
361 $this->global_screen->layout()->meta()->addCss(
366 $tabs =
$DIC->tabs();
367 $tabs->clearTargets();
368 $tabs->clearSubTabs();
370 $tabs->setBackTarget($this->
lng->txt(
"back"), $a_back_url);
372 $tpl = new \ilGlobalPageTemplate(
$DIC->globalScreen(),
$DIC->ui(),
$DIC->http());
374 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
376 $this->blog_gui->renderFullscreenHeader(
$tpl, $this->blog->getOwner(),
true);
389 string $a_right_content =
"",
390 bool $a_back =
false,
393 $file = $this->target_dir .
"/" . $a_file;
395 if (is_file($file)) {
400 $ep_tpl = new \ilTemplate(
401 "tpl.export_page.html",
407 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
408 $ep_tpl->setVariable(
"COMMENTS",
$comments);
410 $ep_tpl->setVariable(
"LIST", $a_content);
416 if ($a_right_content) {
423 file_put_contents($file, $content);
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!)
includeComments(bool $a_include_comments)
ILIAS Services Export HTML Util $export_util
static array $keyword_export_map
static bool $export_key_set
ILIAS Style Content Object ObjectFacade $content_style_domain
exportHTMLPagesPrint()
Export all pages as one print version.
collectAllPagesPageElements(\ilCOPageHTMLExport $co_page_html_export)
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content, string $a_right_content="", bool $a_back=false, string $comments="")
Write HTML to file.
static buildExportLink(string $a_template, string $a_type, string $a_id, array $keywords)
Build static export link.
setPrintVersion(bool $print_version)
ilCOPageHTMLExport $co_page_html_export
getInitialisedTemplate(string $a_back_url="")
Get initialised template.
ILIAS GlobalScreen Services $global_screen
__construct()
Constructor setup ILIAS global object @access public.
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
HTML export class for pages.
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
printToString()
Use this method to get the finally rendered page as string.
setContent(string $a_html)
Sets content for standard template.
setRightContent(string $a_html)
Sets content of right column.
const HTML_EXPORT_RENDERING
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static copyProfilePicturesToDirectory(int $a_user_id, string $a_dir)
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="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...