19declare(strict_types=1);
29 protected \ILIAS\Blog\Permission\PermissionManager
$perm;
37 protected \ILIAS\Blog\InternalGUIService
$gui;
39 protected \ILIAS\components\Export\HTML\ExportCollector
$collector;
46 protected \ilLanguage
$lng;
56 protected int $node_id,
57 protected int $owner_id,
58 protected bool $is_repository,
61 bool $set_export_key =
true
65 $blog_service =
$DIC->blog()->internal();
66 $domain = $blog_service->domain();
71 $this->blog_id = $domain->getObjectIdForWspId($this->node_id);
74 $this->id_type = ($this->is_repository)
78 $this->perm = $domain->perm(
81 $domain->user()->getId(),
85 $this->gui = $blog_service->gui();
86 $keyword_manager = $blog_service->domain()->keywords();
87 $this->
settings = $blog_service->domain()->blogSettings()->getByObjId($this->blog_id);
89 $this->collector =
$DIC->export()->domain()->html()->collector($this->blog_id);
90 $this->collector->init();
93 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
95 $this->global_screen =
$DIC->globalScreen();
96 $this->export_util =
new Util(
"",
"", $this->collector);
97 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir,
null, 0, $this->collector);
98 $this->
tabs = $DIC->tabs();
99 $this->
lng = $DIC->language();
101 $this->posting_list = $blog_service->domain()->postingList($this->blog_id);
102 $this->items = $this->posting_list->getPostingsGroupedByMonth();
103 $this->keywords = $keyword_manager->getKeywords($this->blog_id,
false);
104 if ($set_export_key && !self::$export_key_set) {
105 self::$export_key_set =
true;
106 $this->global_screen->tool()->context()->current()->addAdditionalData(
112 $cs =
$DIC->contentStyle();
113 if ($this->is_repository) {
114 $this->content_style_domain = $cs->domain()->styleForRefId($this->node_id);
116 $this->content_style_domain = $cs->domain()->styleForObjId($this->blog_id);
118 $this->posting_manager = $blog_service->domain()->posting();
119 $this->exp_manager = $blog_service->domain()->export()->manager();
121 protected function init(): void
131 bool $a_include_comments
133 $this->include_comments = $a_include_comments;
150 $this->initDirectories();
152 $this->export_util->exportSystemStyle(
158 $this->export_util->exportCOPageFiles(
159 $this->content_style_domain->getEffectiveStyleId(),
163 if ($this->print_version) {
164 $this->exportHTMLPagesPrint();
166 $this->exportHTMLPages();
172 $this->export_util->exportResourceFiles();
173 $this->co_page_html_export->exportPageElements();
178 if ($this->include_comments) {
179 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
180 $user_export->exportUserImagesForRepObjId($this->target_dir, $this->blog_id);
187 string $a_cmd =
"preview",
188 string $a_link_template =
"",
189 bool $a_show_inactive =
false,
190 string $a_export_directory =
""
192 return $this->gui->posting()->postingList(
214 ?
string $a_link_template =
null,
215 ?\Closure $a_tpl_callback =
null,
217 string $a_index_name =
"index.html"
219 if (!$a_link_template) {
220 $a_link_template =
"bl{TYPE}_{ID}.html";
223 if ($a_co_page_html_export) {
224 $this->co_page_html_export = $a_co_page_html_export;
230 $nav = $this->gui->navigation()->sideBar(
232 $this->gui->navigation()->exportLink(
245 foreach (array_keys($this->items) as $month) {
246 $list = $this->renderList($this->items[$month], $month,
"render", $a_link_template,
false, $this->target_dir);
252 if (!$a_tpl_callback) {
253 $tpl = $this->getInitialisedTemplate();
255 $tpl = $a_tpl_callback();
258 $file = $this->exp_manager->buildExportLink($a_link_template,
"list", $month, $this->keywords);
259 $file = $this->writeExportFile($file,
$tpl, $list, $nav);
262 $file = $this->writeExportFile($a_index_name,
$tpl, $list, $nav);
268 foreach (array_keys($this->keywords) as $keyword) {
269 $list_items = $this->posting_list->getByKeyword($keyword);
270 $list = $this->renderList($list_items,
"",
"render", $a_link_template,
false, $this->target_dir);
276 if (!$a_tpl_callback) {
277 $tpl = $this->getInitialisedTemplate();
279 $tpl = $a_tpl_callback();
282 $file = $this->exp_manager->buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
283 $file = $this->writeExportFile($file,
$tpl, $list, $nav);
289 $pages = $this->posting_manager->getAllPostings($this->blog_id, 0);
290 foreach ($pages as
$page) {
291 $page_id =
$page->getId();
293 $blp_gui = new \ilBlogPostingGUI(0,
null, $page_id);
294 $blp_gui->setOutputMode(
"offline");
295 $blp_gui->setFullscreenLink(
"fullscreen.html");
296 $blp_gui->add_date =
true;
297 $page_content = $blp_gui->showPage();
299 $back = $this->exp_manager->buildExportLink(
306 $file = $this->exp_manager->buildExportLink($a_link_template,
"posting", (
string) $page_id, $this->keywords);
308 if (!$a_tpl_callback) {
309 $tpl = $this->getInitialisedTemplate();
311 $tpl = $a_tpl_callback();
315 ? $blp_gui->getCommentsHTMLExport()
319 $nav = $this->gui->navigation()->sideBar(
321 $this->gui->navigation()->exportLink(
334 $this->writeExportFile($file,
$tpl, $page_content, $nav, (
bool) $back,
$comments);
336 $this->co_page_html_export->collectPageElements(
"blp:pg", $page_id);
341 if (!$a_tpl_callback) {
342 $tpl = $this->getInitialisedTemplate();
344 $tpl = $a_tpl_callback();
346 $file = $this->writeExportFile($a_index_name,
$tpl,
"", $nav);
355 $this->collectAllPagesPageElements($this->co_page_html_export);
358 $print_view = $this->gui->presentation()->getPrintView(
362 $print_view->setOffline(
true);
363 $html = $print_view->renderPrintView();
364 $this->collector->addString($html,
"index.html");
370 $page_ids = $this->posting_manager->getAllPostingIds($this->blog_id, 0);
371 foreach ($page_ids as $page_id) {
393 $map = array_flip(array_keys($keywords));
394 $a_id = (string) ($map[$a_id] ??
"");
403 return str_replace(array(
"{TYPE}",
"{ID}"), array($a_type, $a_id), $a_template);
410 string $a_back_url =
""
412 $this->export_util->resetGlobalScreen();
415 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
416 $this->global_screen->layout()->meta()->addCss(
422 $tabs->clearTargets();
423 $tabs->clearSubTabs();
425 $tabs->setBackTarget($this->
lng->txt(
"back"), $a_back_url);
428 $tpl = new \ilGlobalPageTemplate(
429 $this->global_screen,
434 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
436 $context = $this->gui->blogContext(
445 $this->gui->presentation()->presentationGUI(
447 $this->content_style_domain,
448 )->renderFullscreenHeader(
$tpl, $this->owner_id,
true);
461 string $a_right_content =
"",
462 bool $a_back =
false,
465 $file = $this->target_dir .
"/" . $a_file;
468 $ep_tpl = new \ilTemplate(
469 "tpl.export_page.html",
472 "components/ILIAS/Blog"
475 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
476 $ep_tpl->setVariable(
"COMMENTS",
$comments);
478 $ep_tpl->setVariable(
"LIST", $a_content);
484 if ($a_right_content) {
491 $this->collector->addString($content, $a_file);
496 public function delete():
void
498 $this->collector->delete();
503 return $this->collector->getFilePath();
includeComments(bool $a_include_comments)
ExportManager $exp_manager
ILIAS Blog Settings Settings $settings
ILIAS components Export HTML ExportCollector $collector
ILIAS Blog Posting PostingManager $posting_manager
buildExportLink(string $a_template, string $a_type, string $a_id, array $keywords)
Build static export link.
ILIAS Blog InternalGUIService $gui
__construct(protected int $node_id, protected int $owner_id, protected bool $is_repository, string $exp_dir, string $sub_dir, bool $set_export_key=true)
static bool $export_key_set
ILIAS Style Content Object ObjectFacade $content_style_domain
exportHTMLPagesPrint()
Export all pages as one print version.
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 Blog Posting PostingList $posting_list
renderList(array $items, string $month="", string $a_cmd="preview", string $a_link_template="", bool $a_show_inactive=false, string $a_export_directory="")
ILIAS Blog Permission PermissionManager $perm
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.
setPrintVersion(bool $print_version)
ilCOPageHTMLExport $co_page_html_export
getInitialisedTemplate(string $a_back_url="")
Get initialised template.
ILIAS GlobalScreen Services $global_screen
Util This class is an interim solution for the HTML export handling with 6.0.
HTML export class for pages.
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
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 getExportContentStylePath()
static _lookupObjId(int $ref_id)
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="")
get full style sheet file name (path inclusive) of current user
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readonly ilGlobalTemplateInterface $tpl
if(!file_exists('../ilias.ini.php'))