16 protected $mode = self::MODE_DEFAULT;
31 $this->wiki = $a_wiki;
63 $this->log->debug(
"buildExportFile...");
65 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
68 if ($this->
getMode() == self::MODE_USER)
71 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
78 include_once(
"./Services/Export/classes/class.ilExport.php");
83 if ($this->
getMode() == self::MODE_USER)
88 if ($this->
getMode() == self::MODE_USER)
90 $this->subdir = $ascii_name;
94 $this->subdir = $this->wiki->getType().
"_".$this->wiki->getId();
96 $this->export_dir = $exp_dir.
"/".$this->subdir;
102 $this->log->debug(
"export directory: ".$this->export_dir);
105 include_once(
"./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
107 $this->sys_style_html_export->addImage(
"icon_wiki.svg");
108 $this->sys_style_html_export->export();
111 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
113 $this->co_page_html_export->setContentStyleId(
114 $this->wiki->getStyleSheetId());
115 $this->co_page_html_export->createDirectories();
116 $this->co_page_html_export->exportStyles();
117 $this->co_page_html_export->exportSupportScripts();
120 $this->log->debug(
"export pages");
124 $zip_file_name = ($this->
getMode() == self::MODE_USER)
126 : $date.
"__".IL_INST_ID.
"__".$this->wiki->getType().
"_".$this->wiki->getId().
".zip";
134 $this->log->debug(
"zip: ".$zip_file);
149 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
150 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
152 foreach ($pages as $page)
154 $this->log->debug(
"page: ".$page[
"id"]);
157 $this->log->debug(
"export page");
159 $this->log->debug(
"collect page elements");
160 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
163 if ($this->
getMode() == self::MODE_USER)
166 $this->log->debug(
"update status: ".$cnt);
181 if ($this->
getMode() == self::MODE_USER)
195 $ilTabs->clearTargets();
197 $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
199 $this->tpl->getStandardTemplate();
200 $file = $this->export_dir.
"/wpg_".$a_page_id.
".html";
204 $this->log->debug(
"file already exists");
209 $this->log->debug(
"init page gui");
210 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
212 $wpg_gui->setOutputMode(
"offline");
213 $page_content = $wpg_gui->showPage();
216 $this->log->debug(
"init page gui");
217 $ep_tpl =
new ilTemplate(
"tpl.export_page.html",
true,
true,
219 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
222 include_once(
"./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
224 $ep_tpl->setVariable(
"RIGHT_CONTENT", $bl->getHTML(
true));
228 $this->tpl->setVariable(
"MAINMENU",
"");
230 $this->log->debug(
"set title");
231 $this->tpl->setTitle($this->wiki->getTitle());
232 $this->tpl->setTitleIcon(
"./images/icon_wiki.svg",
233 $lng->txt(
"obj_wiki"));
235 $this->tpl->setContent($ep_tpl->get());
237 $content = $this->tpl->get(
"DEFAULT",
false,
false,
false,
242 $this->log->debug(
"write file: ".
$file);
243 if (!($fp = @fopen(
$file,
"w+")))
245 $this->log->error(
"Could not open ".
$file.
" for writing.");
246 include_once(
"./Modules/Wiki/exceptions/class.ilWikiExportException.php");
251 $this->log->debug(
"set permissions");
255 fwrite($fp, $content);
260 if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle())
262 copy(
$file, $this->export_dir.
"/index.html");
274 include_once(
"./Services/Export/classes/class.ilExport.php");
277 $this->log->debug(
"dir: ".$exp_dir);
278 foreach (
new DirectoryIterator($exp_dir) as $fileInfo)
280 $this->log->debug(
"file: ".$fileInfo->getFilename());
281 if (pathinfo($fileInfo->getFilename(),PATHINFO_EXTENSION) ==
"zip")
283 $this->log->debug(
"return: ".$exp_dir.
"/".$fileInfo->getFilename());
284 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
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