ILIAS  release_4-4 Revision
ilWikiHTMLExport Class Reference

Wiki HTML exporter class. More...

+ Collaboration diagram for ilWikiHTMLExport:

Public Member Functions

 __construct ($a_wiki_gui)
 Constructir. More...
 
 buildExportFile ()
 Build export file. More...
 
 exportHTMLPages ()
 Export all pages. More...
 
 exportPageHTML ($a_page_id)
 Export page html. More...
 

Protected Attributes

 $wiki_gui
 

Detailed Description

Wiki HTML exporter class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ /

Definition at line 11 of file class.ilWikiHTMLExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilWikiHTMLExport::__construct (   $a_wiki_gui)

Constructir.

Parameters

Definition at line 21 of file class.ilWikiHTMLExport.php.

22  {
23  $this->wiki_gui = $a_wiki_gui;
24  $this->wiki = $a_wiki_gui->object;
25  }

Member Function Documentation

◆ buildExportFile()

ilWikiHTMLExport::buildExportFile ( )

Build export file.

Parameters

Definition at line 33 of file class.ilWikiHTMLExport.php.

References ilExport\_createExportDirectory(), ilExport\_getExportDirectory(), ilUtil\delDir(), exportHTMLPages(), ilUtil\makeDir(), and ilUtil\zip().

34  {
35  global $ilias;
36 
37  // create export file
38  include_once("./Services/Export/classes/class.ilExport.php");
39  ilExport::_createExportDirectory($this->wiki->getId(), "html", "wiki");
40  $exp_dir =
41  ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki");
42 
43  $this->subdir = $this->wiki->getType()."_".$this->wiki->getId();
44  $this->export_dir = $exp_dir."/".$this->subdir;
45 
46  // initialize temporary target directory
47  ilUtil::delDir($this->export_dir);
48  ilUtil::makeDir($this->export_dir);
49 
50  // system style html exporter
51  include_once("./Services/Style/classes/class.ilSystemStyleHTMLExport.php");
52  $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
53  $this->sys_style_html_export->addImage("icon_wiki_b.png");
54  $this->sys_style_html_export->export();
55 
56  // init co page html exporter
57  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
58  $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
59  $this->co_page_html_export->setContentStyleId(
60  $this->wiki->getStyleSheetId());
61  $this->co_page_html_export->createDirectories();
62  $this->co_page_html_export->exportStyles();
63  $this->co_page_html_export->exportSupportScripts();
64 
65  // export pages
66  $this->exportHTMLPages();
67 
68  // zip everything
69  if (true)
70  {
71  // zip it all
72  $date = time();
73  $zip_file = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki").
74  "/".$date."__".IL_INST_ID."__".
75  $this->wiki->getType()."_".$this->wiki->getId().".zip";
76  ilUtil::zip($this->export_dir, $zip_file);
77  ilUtil::delDir($this->export_dir);
78  }
79  }
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.
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 _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ exportHTMLPages()

ilWikiHTMLExport::exportHTMLPages ( )

Export all pages.

Definition at line 84 of file class.ilWikiHTMLExport.php.

References $ilBench, $tpl, ilPageObject\_exists(), exportPageHTML(), and ilWikiPage\getAllPages().

Referenced by buildExportFile().

85  {
86  global $tpl, $ilBench, $ilLocator;
87 
88  $pages = ilWikiPage::getAllPages($this->wiki->getId());
89 
90  include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
91  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
92  foreach ($pages as $page)
93  {
94  if (ilWikiPage::_exists("wpg", $page["id"]))
95  {
96  $this->exportPageHTML($page["id"]);
97  $this->co_page_html_export->collectPageElements("wpg:pg", $page["id"]);
98  }
99  }
100  $this->co_page_html_export->exportPageElements();
101  }
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
exportPageHTML($a_page_id)
Export page html.
global $ilBench
Definition: ilias.php:18
static getAllPages($a_wiki_id)
Get all pages of wiki.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPageHTML()

ilWikiHTMLExport::exportPageHTML (   $a_page_id)

Export page html.

Definition at line 106 of file class.ilWikiHTMLExport.php.

References $file, $ilUser, and $lng.

Referenced by exportHTMLPages().

107  {
108  global $ilUser, $lng, $ilTabs;
109 
110  $ilTabs->clearTargets();
111 
112  $this->tpl = $this->co_page_html_export->getPreparedMainTemplate();
113 
114  $this->tpl->getStandardTemplate();
115  $file = $this->export_dir."/wpg_".$a_page_id.".html";
116  // return if file is already existing
117  if (@is_file($file))
118  {
119  return;
120  }
121 
122  // page
123  include_once("./Modules/Wiki/classes/class.ilWikiPageGUI.php");
124  $wpg_gui = new ilWikiPageGUI($a_page_id);
125  $wpg_gui->setOutputMode("offline");
126  $page_content = $wpg_gui->showPage();
127 
128  // export template: page content
129  $ep_tpl = new ilTemplate("tpl.export_page.html", true, true,
130  "Modules/Wiki");
131  $ep_tpl->setVariable("PAGE_CONTENT", $page_content);
132 
133  // export template: right content
134  include_once("./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php");
135  $bl = new ilWikiImportantPagesBlockGUI();
136  $ep_tpl->setVariable("RIGHT_CONTENT", $bl->getHTML(true));
137 
138  // workaround
139 // $this->tpl->setVariable("MAINMENU", "<div style='min-height:40px;'></div>");
140  $this->tpl->setVariable("MAINMENU", "");
141 
142  $this->tpl->setTitle($this->wiki->getTitle());
143  $this->tpl->setTitleIcon("./images/icon_wiki_b.png",
144  $lng->txt("obj_wiki"));
145 
146  $this->tpl->setContent($ep_tpl->get());
147  //$this->tpl->fillMainContent();
148  $content = $this->tpl->get("DEFAULT", false, false, false,
149  true, true, true);
150 
151 //echo htmlentities($content); exit;
152  // open file
153  if (!($fp = @fopen($file,"w+")))
154  {
155  die ("<b>Error</b>: Could not open \"".$file."\" for writing".
156  " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
157  }
158 
159  // set file permissions
160  chmod($file, 0770);
161 
162  // write xml data into the file
163  fwrite($fp, $content);
164 
165  // close file
166  fclose($fp);
167 
168  if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle())
169  {
170  copy($file, $this->export_dir."/index.html");
171  }
172  }
print $file
special template class to simplify handling of ITX/PEAR
Class ilWikiPage GUI class.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

Field Documentation

◆ $wiki_gui

ilWikiHTMLExport::$wiki_gui
protected

Definition at line 13 of file class.ilWikiHTMLExport.php.


The documentation for this class was generated from the following file: