90 $this->blog = $blog_gui->object;
91 $this->export_dir = $exp_dir;
93 $this->target_dir = $exp_dir .
"/" .
$sub_dir;
95 $this->global_screen = $DIC->globalScreen();
96 $this->export_util = new \ILIAS\Services\Export\HTML\Util($exp_dir, $sub_dir);
97 $this->co_page_html_export = new \ilCOPageHTMLExport($this->target_dir);
98 $this->tabs = $DIC->tabs();
99 $this->lng = $DIC->language();
101 $this->items = $this->blog_gui->getItems();
102 $this->keywords = $this->blog_gui->getKeywords(
false);
103 if ($set_export_key) {
104 $this->global_screen->tool()->context()->current()->addAdditionalData(
131 $this->export_util->exportSystemStyle();
132 $this->export_util->exportCOPageFiles($this->blog->getStyleSheetId(),
"blog");
140 $this->export_util->exportResourceFiles();
141 $this->co_page_html_export->exportPageElements();
152 $blga_set = new \ilSetting(
"blga");
153 if ($blga_set->get(
"banner")) {
154 $banner = $this->blog->getImageFullPath();
156 copy($banner, $this->target_dir .
"/" . basename($banner));
173 "/" . $date .
"__" . IL_INST_ID .
"__" .
174 $this->blog->getType() .
"_" . $this->blog->getId() .
".zip";
190 public function exportHTMLPages($a_link_template = null, $a_tpl_callback = null, $a_co_page_html_export = null, $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);
208 foreach (array_keys($this->items) as $month) {
209 $list = $this->blog_gui->renderList($this->items[$month],
"render", $a_link_template,
false, $this->target_dir);
215 if (!$a_tpl_callback) {
218 $tpl = call_user_func($a_tpl_callback);
221 $file = self::buildExportLink($a_link_template,
"list", $month, $this->keywords);
225 copy($file, $this->target_dir .
"/" . $a_index_name);
231 foreach (array_keys($this->blog_gui->getKeywords(
false)) as $keyword) {
232 $this->keyword = $keyword;
233 $list_items = $this->blog_gui->filterItemsByKeyword($this->items, $keyword);
234 $list = $this->blog_gui->renderList($list_items,
"render", $a_link_template,
false, $this->target_dir);
240 if (!$a_tpl_callback) {
243 $tpl = call_user_func($a_tpl_callback);
246 $file = self::buildExportLink($a_link_template,
"keyword", $keyword, $this->keywords);
254 foreach ($pages as $page) {
256 $blp_gui = new \ilBlogPostingGUI(0, null, $page[
"id"]);
257 $blp_gui->setOutputMode(
"offline");
258 $blp_gui->setFullscreenLink(
"fullscreen.html");
259 $blp_gui->add_date =
true;
260 $page_content = $blp_gui->showPage();
262 $back = self::buildExportLink(
269 $file = self::buildExportLink($a_link_template,
"posting", $page[
"id"], $this->keywords);
271 if (!$a_tpl_callback) {
274 $tpl = call_user_func($a_tpl_callback);
278 $nav = $this->blog_gui->renderNavigation(
288 $this->co_page_html_export->collectPageElements(
"blp:pg", $page[
"id"]);
310 if (!isset(self::$keyword_export_map)) {
311 self::$keyword_export_map = array_flip(array_keys(
$keywords));
313 $a_id = self::$keyword_export_map[$a_id];
322 $link = str_replace(
"{TYPE}",
$a_type, $a_template);
323 return str_replace(
"{ID}", $a_id, $link);
334 $this->global_screen->layout()->meta()->reset();
337 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
338 $this->global_screen->layout()->meta()->addCss(
343 $tabs = $DIC->tabs();
344 $tabs->clearTargets();
345 $tabs->clearSubTabs();
347 $tabs->setBackTarget($this->lng->txt(
"back"), $a_back_url);
349 $tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
351 $this->co_page_html_export->getPreparedMainTemplate(
$tpl);
353 $this->blog_gui->renderFullscreenHeader(
$tpl, $this->blog->getOwner(),
true);
372 $file = $this->target_dir .
"/" . $a_file;
374 if (@is_file($file)) {
379 $ep_tpl = new \ilTemplate(
380 "tpl.export_page.html",
386 $ep_tpl->setVariable(
"PAGE_CONTENT", $a_content);
388 $ep_tpl->setVariable(
"LIST", $a_content);
395 if ($a_right_content) {
397 unset($a_right_content);
403 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!)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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.
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.
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content, string $a_right_content="", bool $a_back=false)
Write HTML to file.
static $keyword_export_map
__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
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively