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);
172 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
173 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
175 foreach ($pages as $page) {
176 $this->log->debug(
"page: " . $page[
"id"]);
178 $this->log->debug(
"export page");
180 $this->log->debug(
"collect page elements");
181 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
184 if ($this->
getMode() == self::MODE_USER) {
186 $this->log->debug(
"update status: " . $cnt);
200 if ($this->
getMode() == self::MODE_USER) {
215 $ilTabs->clearTargets();
217 $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
219 $this->tpl->getStandardTemplate();
220 $file = $this->export_dir .
"/wpg_" . $a_page_id .
".html";
222 if (@is_file(
$file)) {
223 $this->log->debug(
"file already exists");
228 $this->log->debug(
"init page gui");
229 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
231 $wpg_gui->setOutputMode(
"offline");
232 $page_content = $wpg_gui->showPage();
235 $this->log->debug(
"init page gui");
237 "tpl.export_page.html",
242 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
245 include_once(
"./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
247 $ep_tpl->setVariable(
"RIGHT_CONTENT", $bl->getHTML(
true));
251 $this->tpl->setVariable(
"MAINMENU",
"");
253 $this->log->debug(
"set title");
254 $this->tpl->setTitle($this->wiki->getTitle());
255 $this->tpl->setTitleIcon(
256 "./images/icon_wiki.svg",
257 $lng->txt(
"obj_wiki")
260 $this->tpl->setContent($ep_tpl->get());
262 $content = $this->tpl->get(
274 $this->log->debug(
"write file: " .
$file);
275 if (!($fp = @fopen(
$file,
"w+"))) {
276 $this->log->error(
"Could not open " .
$file .
" for writing.");
277 include_once(
"./Modules/Wiki/exceptions/class.ilWikiExportException.php");
282 $this->log->debug(
"set permissions");
286 fwrite($fp, $content);
291 if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle()) {
292 copy(
$file, $this->export_dir .
"/index.html");
304 include_once(
"./Services/Export/classes/class.ilExport.php");
307 $this->log->debug(
"dir: " . $exp_dir);
309 $this->log->debug(
"file: " . $fileInfo->getFilename());
310 if (pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION) ==
"zip") {
311 $this->log->debug(
"return: " . $exp_dir .
"/" . $fileInfo->getFilename());
312 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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively