95 $this->blog = $blog_gui->object;
96 $this->export_dir = $exp_dir;
98 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
100 $this->global_screen = $DIC->globalScreen();
101 $this->export_util = new \ILIAS\Services\Export\HTML\Util($exp_dir, $sub_dir);
102 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir);
103 $this->tabs = $DIC->tabs();
104 $this->lng = $DIC->language();
106 $this->items = $this->blog_gui->getItems();
107 $this->keywords = $this->blog_gui->getKeywords(
false);
108 if ($set_export_key) {
109 $this->global_screen->tool()->context()->current()->addAdditionalData(
122 $this->include_comments = $a_include_comments;
145 $this->export_util->exportSystemStyle();
146 $this->export_util->exportCOPageFiles($this->blog->getStyleSheetId(),
"blog");
157 $this->export_util->exportResourceFiles();
158 $this->co_page_html_export->exportPageElements();
168 if ($this->include_comments) {
169 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
170 $user_export->exportUserImagesForRepObjId($this->target_dir, $this->blog->getId());
180 $blga_set = new \ilSetting(
"blga");
181 if ($blga_set->get(
"banner")) {
182 $banner = $this->blog->getImageFullPath();
184 copy($banner, $this->target_dir .
"/" . basename($banner));
205 $this->blog->getType() .
"_" . $this->blog->getId() .
".zip";
220 public function exportHTMLPages($a_link_template = null, $a_tpl_callback = null, $a_co_page_html_export = null, $a_index_name =
"index.html")
222 if (!$a_link_template) {
223 $a_link_template =
"bl{TYPE}_{ID}.html";
226 if ($a_co_page_html_export) {
227 $this->co_page_html_export = $a_co_page_html_export;
233 $nav = $this->blog_gui->renderNavigation(
"",
"", $a_link_template);
238 foreach (array_keys($this->items) as $month) {
239 $list = $this->blog_gui->renderList($this->items[$month],
"render", $a_link_template,
false, $this->target_dir);
245 if (!$a_tpl_callback) {
248 $tpl = call_user_func($a_tpl_callback);
251 $file = self::buildExportLink($a_link_template,
"list", $month, $this->keywords);
255 copy($file, $this->target_dir .
"/" . $a_index_name);
261 foreach (array_keys($this->blog_gui->getKeywords(
false)) as $keyword) {
262 $this->keyword = $keyword;
263 $list_items = $this->blog_gui->filterItemsByKeyword($this->items, $keyword);
264 $list = $this->blog_gui->renderList($list_items,
"render", $a_link_template,
false, $this->target_dir);
270 if (!$a_tpl_callback) {
273 $tpl = call_user_func($a_tpl_callback);
276 $file = self::buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
284 foreach ($pages as $page) {
286 $blp_gui = new \ilBlogPostingGUI(0, null, $page[
"id"]);
287 $blp_gui->setOutputMode(
"offline");
288 $blp_gui->setFullscreenLink(
"fullscreen.html");
289 $blp_gui->add_date =
true;
290 $page_content = $blp_gui->showPage();
292 $back = self::buildExportLink(
299 $file = self::buildExportLink($a_link_template,
"posting", $page[
"id"], $this->keywords);
301 if (!$a_tpl_callback) {
304 $tpl = call_user_func($a_tpl_callback);
308 ? $blp_gui->getCommentsHTMLExport()
312 $nav = $this->blog_gui->renderNavigation(
322 $this->co_page_html_export->collectPageElements(
"blp:pg", $page[
"id"]);
344 if (!isset(self::$keyword_export_map)) {
345 self::$keyword_export_map = array_flip(array_keys(
$keywords));
347 $a_id = self::$keyword_export_map[$a_id];
356 $link = str_replace(
"{TYPE}", $a_type, $a_template);
357 return str_replace(
"{ID}", $a_id, $link);
368 $this->global_screen->layout()->meta()->reset();
371 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
372 $this->global_screen->layout()->meta()->addCss(
377 $tabs = $DIC->tabs();
378 $tabs->clearTargets();
379 $tabs->clearSubTabs();
381 $tabs->setBackTarget($this->lng->txt(
"back"), $a_back_url);
383 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
385 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
387 $this->blog_gui->renderFullscreenHeader(
$tpl, $this->blog->getOwner(),
true);
406 $file = $this->target_dir .
"/" . $a_file;
408 if (@is_file($file)) {
413 $ep_tpl = new \ilTemplate(
414 "tpl.export_page.html",
420 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
421 $ep_tpl->setVariable(
"COMMENTS", $comments);
423 $ep_tpl->setVariable(
"LIST", $a_content);
430 if ($a_right_content) {
432 unset($a_right_content);
438 file_put_contents($file, $content);
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
exportHTMLPages($a_link_template=null, $a_tpl_callback=null, $a_co_page_html_export=null, $a_index_name="index.html")
Export all pages (note: this one is called from the portfolio html export!)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static buildExportLink($a_template, $a_type, $a_id, $keywords)
Build static export link.
exportUserImages()
Export user images.
exportBanner()
Export banner.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
Class ilGlobalPageTemplate.
static copyProfilePicturesToDirectory($a_user_id, $a_dir)
Get profile picture direcotory.
initDirectories()
Initialize directories.
static $keyword_export_map
includeComments($a_include_comments)
Include comments.
__construct(\ilObjBlogGUI $blog_gui, string $exp_dir, string $sub_dir, bool $set_export_key=true)
constructor
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static resetInitialState()
Reset initial state (for exports)
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
getInitialisedTemplate($a_back_url="")
Get initialised template.
const HTML_EXPORT_RENDERING
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content, string $a_right_content="", bool $a_back=false, $comments="")
Write HTML to file.