16 protected $mode = self::MODE_DEFAULT;
31 $this->wiki = $a_wiki;
63 $this->log->debug(
"buildExportFile...");
65 if ($this->
getMode() == self::MODE_USER)
68 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
75 include_once(
"./Services/Export/classes/class.ilExport.php");
80 if ($this->
getMode() == self::MODE_USER)
85 if ($this->
getMode() == self::MODE_USER)
87 $this->subdir = $ascii_name;
91 $this->subdir = $this->wiki->getType().
"_".$this->wiki->getId();
93 $this->export_dir = $exp_dir.
"/".$this->subdir;
99 $this->log->debug(
"export directory: ".$this->export_dir);
102 include_once(
"./Services/Style/classes/class.ilSystemStyleHTMLExport.php");
104 $this->sys_style_html_export->addImage(
"icon_wiki.svg");
105 $this->sys_style_html_export->export();
108 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
110 $this->co_page_html_export->setContentStyleId(
111 $this->wiki->getStyleSheetId());
112 $this->co_page_html_export->createDirectories();
113 $this->co_page_html_export->exportStyles();
114 $this->co_page_html_export->exportSupportScripts();
117 $this->log->debug(
"export pages");
121 $zip_file_name = ($this->
getMode() == self::MODE_USER)
123 : $date.
"__".IL_INST_ID.
"__".$this->wiki->getType().
"_".$this->wiki->getId().
".zip";
131 $this->log->debug(
"zip: ".$zip_file);
146 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
147 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
149 foreach ($pages as $page)
151 $this->log->debug(
"page: ".$page[
"id"]);
154 $this->log->debug(
"export page");
156 $this->log->debug(
"collect page elements");
157 $this->co_page_html_export->collectPageElements(
"wpg:pg", $page[
"id"]);
160 if ($this->
getMode() == self::MODE_USER)
163 $this->log->debug(
"update status: ".$cnt);
178 if ($this->
getMode() == self::MODE_USER)
192 $ilTabs->clearTargets();
194 $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
196 $this->tpl->getStandardTemplate();
197 $file = $this->export_dir.
"/wpg_".$a_page_id.
".html";
201 $this->log->debug(
"file already exists");
206 $this->log->debug(
"init page gui");
207 include_once(
"./Modules/Wiki/classes/class.ilWikiPageGUI.php");
209 $wpg_gui->setOutputMode(
"offline");
210 $page_content = $wpg_gui->showPage();
213 $this->log->debug(
"init page gui");
214 $ep_tpl =
new ilTemplate(
"tpl.export_page.html",
true,
true,
216 $ep_tpl->setVariable(
"PAGE_CONTENT", $page_content);
219 include_once(
"./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
221 $ep_tpl->setVariable(
"RIGHT_CONTENT", $bl->getHTML(
true));
225 $this->tpl->setVariable(
"MAINMENU",
"");
227 $this->log->debug(
"set title");
228 $this->tpl->setTitle($this->wiki->getTitle());
229 $this->tpl->setTitleIcon(
"./images/icon_wiki.svg",
230 $lng->txt(
"obj_wiki"));
232 $this->tpl->setContent($ep_tpl->get());
234 $content = $this->tpl->get(
"DEFAULT",
false,
false,
false,
239 $this->log->debug(
"write file: ".
$file);
240 if (!($fp = @fopen(
$file,
"w+")))
242 $this->log->error(
"Could not open ".
$file.
" for writing.");
243 include_once(
"./Modules/Wiki/exceptions/class.ilWikiExportException.php");
248 $this->log->debug(
"set permissions");
252 fwrite($fp, $content);
257 if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle())
259 copy(
$file, $this->export_dir.
"/index.html");
271 include_once(
"./Services/Export/classes/class.ilExport.php");
274 $this->log->debug(
"dir: ".$exp_dir);
277 $this->log->debug(
"file: ".$fileInfo->getFilename());
278 if (pathinfo($fileInfo->getFilename(),PATHINFO_EXTENSION) ==
"zip")
280 $this->log->debug(
"return: ".$exp_dir.
"/".$fileInfo->getFilename());
281 return $exp_dir.
"/".$fileInfo->getFilename();
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.
_createExportDirectory($a_obj_id, $a_export_type="xml", $a_obj_type="")
Create export directory.
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 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.
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
static getAllPages($a_wiki_id)
Get all pages of wiki.