19 declare(strict_types=1);
28 protected \ILIAS\components\Export\HTML\ExportCollector
$collector;
37 protected \ilLanguage
$lng;
51 bool $set_export_key =
true 58 $this->collector = $DIC->export()->domain()->html()->collector($blog->getId());
59 $this->collector->init();
64 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
66 $this->global_screen = $DIC->globalScreen();
67 $this->export_util =
new Util(
"",
"", $this->collector);
68 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir,
null, 0, $this->collector);
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;
120 $this->export_util->exportSystemStyle(
126 $this->export_util->exportCOPageFiles(
127 $this->content_style_domain->getEffectiveStyleId(),
134 if ($this->print_version) {
143 $this->export_util->exportResourceFiles();
144 $this->co_page_html_export->exportPageElements();
149 if ($this->include_comments) {
150 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
151 $user_export->exportUserImagesForRepObjId($this->target_dir, $this->blog->getId());
161 ?
string $a_link_template =
null,
164 string $a_index_name =
"index.html" 166 if (!$a_link_template) {
167 $a_link_template =
"bl{TYPE}_{ID}.html";
170 if ($a_co_page_html_export) {
171 $this->co_page_html_export = $a_co_page_html_export;
177 $nav = $this->blog_gui->renderNavigation(
"",
"", $a_link_template);
181 foreach (array_keys($this->items) as $month) {
182 $list = $this->blog_gui->renderList($this->items[$month],
"render", $a_link_template,
false, $this->target_dir);
188 if (!$a_tpl_callback) {
191 $tpl = $a_tpl_callback();
194 $file = self::buildExportLink($a_link_template,
"list", $month, $this->keywords);
204 foreach (array_keys($this->blog_gui->getKeywords(
false)) as $keyword) {
205 $list_items = $this->blog_gui->filterItemsByKeyword($this->items, $keyword);
206 $list = $this->blog_gui->renderList($list_items,
"render", $a_link_template,
false, $this->target_dir);
212 if (!$a_tpl_callback) {
215 $tpl = $a_tpl_callback();
218 $file = self::buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
226 foreach ($pages as $page) {
228 $blp_gui = new \ilBlogPostingGUI(0,
null, $page[
"id"]);
229 $blp_gui->setOutputMode(
"offline");
230 $blp_gui->setFullscreenLink(
"fullscreen.html");
231 $blp_gui->add_date =
true;
232 $page_content = $blp_gui->showPage();
234 $back = self::buildExportLink(
241 $file = self::buildExportLink($a_link_template,
"posting", (
string) $page[
"id"], $this->keywords);
243 if (!$a_tpl_callback) {
246 $tpl = $a_tpl_callback();
250 ? $blp_gui->getCommentsHTMLExport()
254 $nav = $this->blog_gui->renderNavigation(
264 $this->co_page_html_export->collectPageElements(
"blp:pg", $page[
"id"]);
269 if (!$a_tpl_callback) {
272 $tpl = $a_tpl_callback();
286 $print_view = $this->blog_gui->getPrintView();
287 $print_view->setOffline(
true);
288 $html = $print_view->renderPrintView();
289 $this->collector->addString($html,
"index.html");
296 foreach ($pages as $page) {
318 if (!isset(self::$keyword_export_map)) {
319 self::$keyword_export_map = array_flip(array_keys($keywords));
321 $a_id = (string) (self::$keyword_export_map[$a_id] ??
"");
330 return str_replace(array(
"{TYPE}",
"{ID}"), array($a_type, $a_id), $a_template);
337 string $a_back_url =
"" 341 $this->global_screen->layout()->meta()->reset();
344 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
345 $this->global_screen->layout()->meta()->addCss(
350 $tabs = $DIC->tabs();
351 $tabs->clearTargets();
352 $tabs->clearSubTabs();
354 $tabs->setBackTarget($this->
lng->txt(
"back"), $a_back_url);
356 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
358 $this->co_page_html_export->getPreparedMainTemplate($tpl);
360 $this->blog_gui->renderFullscreenHeader($tpl, $this->blog->getOwner(),
true);
373 string $a_right_content =
"",
374 bool $a_back =
false,
377 $file = $this->target_dir .
"/" . $a_file;
380 $ep_tpl = new \ilTemplate(
381 "tpl.export_page.html",
384 "components/ILIAS/Blog" 387 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
388 $ep_tpl->setVariable(
"COMMENTS",
$comments);
390 $ep_tpl->setVariable(
"LIST", $a_content);
396 if ($a_right_content) {
403 $this->collector->addString($content, $a_file);
408 public function delete():
void 410 $this->collector->delete();
415 return $this->collector->getFilePath();
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
ILIAS components Export HTML ExportCollector $collector
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
HTML export class for pages.
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!)
static bool $export_key_set
collectPageElements(string $a_type, int $a_id, string $lang="")
Collect page elements (that need to be exported separately)
static buildExportLink(string $a_template, string $a_type, string $a_id, array $keywords)
Build static export link.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static array $keyword_export_map
exportHTMLPagesPrint()
Export all pages as one print version.
setRightContent(string $a_html)
Sets content of right column.
ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI ilObjBlogGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI ilObjBlogGUI: ilPermissionGUI, ilObjectCopyGUI, ilRepositorySearchGUI ilObjBlogGUI: ilExportGUI, ilObjectContentStyleSettingsGUI, ilBlogExerciseGUI, ilObjNotificationSettingsGUI ilObjBlogGUI: ilObjectMetaDataGUI ilObjBlogGUI: ILIAS ilObjBlogGUI: ILIAS
__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
collectAllPagesPageElements(\ilCOPageHTMLExport $co_page_html_export)
setPrintVersion(bool $print_version)
printToString()
Use this method to get the finally rendered page as string.
includeComments(bool $a_include_comments)
getInitialisedTemplate(string $a_back_url="")
Get initialised template.
static resetInitialState()
Reset initial state (for exports)
ILIAS GlobalScreen Services $global_screen
ILIAS Style Content Object ObjectFacade $content_style_domain
static getExportContentStylePath()
const HTML_EXPORT_RENDERING
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content, string $a_right_content="", bool $a_back=false, string $comments="")
Write HTML to file.
setContent(string $a_html)
Sets content for standard template.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
ilCOPageHTMLExport $co_page_html_export