36 protected $mode = self::MODE_DEFAULT;
53 $this->db = $DIC->database();
54 $this->
user = $DIC->user();
55 $this->lng = $DIC->language();
56 $this->tabs = $DIC->tabs();
57 $this->wiki = $a_wiki;
89 $this->log->debug(
"buildExportFile...");
91 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
94 if ($this->
getMode() == self::MODE_USER) {
97 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
104 include_once(
"./Services/Export/classes/class.ilExport.php");
109 if ($this->
getMode() == self::MODE_USER) {
113 if ($this->
getMode() == self::MODE_USER) {
114 $this->subdir = $ascii_name;
116 $this->subdir = $this->wiki->getType() .
"_" . $this->wiki->getId();
118 $this->export_dir = $exp_dir .
"/" . $this->subdir;
124 $this->log->debug(
"export directory: " . $this->export_dir);
127 include_once(
"./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
129 $this->sys_style_html_export->addImage(
"icon_wiki.svg");
130 $this->sys_style_html_export->export();
133 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
135 $this->co_page_html_export->setContentStyleId(
137 $this->wiki->getStyleSheetId(),
138 $this->wiki->getType()
141 $this->co_page_html_export->createDirectories();
142 $this->co_page_html_export->exportStyles();
143 $this->co_page_html_export->exportSupportScripts();
146 $this->log->debug(
"export pages");
150 $zip_file_name = ($this->
getMode() == self::MODE_USER)
151 ? $ascii_name .
".zip" 152 : $date .
"__" . IL_INST_ID .
"__" . $this->wiki->getType() .
"_" . $this->wiki->getId() .
".zip";
158 "/" . $zip_file_name;
159 $this->log->debug(
"zip: " . $zip_file);
173 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
174 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
176 foreach ($pages as $page) {
177 $this->log->debug(
"page: " . $page[
"id"]);
179 $this->log->debug(
"export page");
181 $this->log->debug(
"collect page elements");
182 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
185 if ($this->
getMode() == self::MODE_USER) {
187 $this->log->debug(
"update status: " . $cnt);
201 if ($this->
getMode() == self::MODE_USER) {
216 $ilTabs->clearTargets();
218 $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
220 $this->tpl->getStandardTemplate();
221 $file = $this->export_dir .
"/wpg_" . $a_page_id .
".html";
223 if (@is_file($file)) {
224 $this->log->debug(
"file already exists");
229 $this->log->debug(
"init page gui");
230 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
232 $wpg_gui->setOutputMode(
"offline");
233 $page_content = $wpg_gui->showPage();
236 $this->log->debug(
"init page gui");
238 "tpl.export_page.html",
243 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
246 include_once(
"./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
248 $ep_tpl->setVariable(
"RIGHT_CONTENT", $bl->getHTML(
true));
252 $this->tpl->setVariable(
"MAINMENU",
"");
254 $this->log->debug(
"set title");
255 $this->tpl->setTitle($this->wiki->getTitle());
256 $this->tpl->setTitleIcon(
257 "./images/icon_wiki.svg",
258 $lng->txt(
"obj_wiki")
261 $this->tpl->setContent($ep_tpl->get());
263 $content = $this->tpl->get(
275 $this->log->debug(
"write file: " . $file);
276 if (!($fp = @
fopen($file,
"w+"))) {
277 $this->log->error(
"Could not open " . $file .
" for writing.");
278 include_once(
"./Modules/Wiki/exceptions/class.ilWikiExportException.php");
283 $this->log->debug(
"set permissions");
287 fwrite($fp, $content);
292 if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle()) {
293 copy($file, $this->export_dir .
"/index.html");
305 include_once(
"./Services/Export/classes/class.ilExport.php");
308 $this->log->debug(
"dir: " . $exp_dir);
310 $this->log->debug(
"file: " . $fileInfo->getFilename());
311 if (pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION) ==
"zip") {
312 $this->log->debug(
"return: " . $exp_dir .
"/" . $fileInfo->getFilename());
313 return $exp_dir .
"/" . $fileInfo->getFilename();
static _createExportDirectory($a_obj_id, $a_export_type="xml", $a_obj_type="")
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
__construct($a_wiki)
Constructor.
Base exception class for wikis.
getUserExportFile()
Get user export file.
HTML export class for pages.
exportHTMLPages()
Export all pages.
HTML export class for system styles.
updateUserHTMLStatusForPageElements($a_total, $a_cnt)
Callback for updating the export status during elements export (media objects, files, ...)
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
Class manages user html export.
Important pages wiki block.
special template class to simplify handling of ITX/PEAR
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
Class ilWikiPage GUI class.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
exportPageHTML($a_page_id)
Export page html.
buildExportFile()
Build export file.
static getInstance()
Singleton: get instance.
Wiki HTML exporter class.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static getLogger($a_component_id)
Get component logger.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively