ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilGlossaryExport Class Reference

Export class for content objects. More...

+ Collaboration diagram for ilGlossaryExport:

Public Member Functions

 __construct (&$a_glo_obj, $a_mode="xml")
 Constructor public. More...
 
 getInstId ()
 
 buildExportFile ()
 build export file (complete zip file) More...
 
 buildExportFileXML ()
 build export file (complete zip file) More...
 
 buildExportFileHTML ()
 build html export file More...
 

Data Fields

 $err
 
 $db
 
 $ilias
 
 $glo_obj
 
 $inst_id
 

Detailed Description

Export class for content objects.

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

Definition at line 35 of file class.ilGlossaryExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryExport::__construct ( $a_glo_obj,
  $a_mode = "xml" 
)

Constructor public.

Definition at line 47 of file class.ilGlossaryExport.php.

References $ilDB, $ilErr, $ilias, and time.

48  {
49  global $ilErr, $ilDB, $ilias;
50 
51  $this->glo_obj = $a_glo_obj;
52 
53  $this->err = $ilErr;
54  $this->ilias = $ilias;
55  $this->db = $ilDB;
56  $this->mode = $a_mode;
57 
58  $settings = $this->ilias->getAllSettings();
59  // The default '0' is required for the directory structure (smeyer)
60  $this->inst_id = $settings["inst_id"] ? $settings['inst_id'] : 0;
61 
62  $date = time();
63  switch($this->mode)
64  {
65  case "xml":
66  $this->export_dir = $this->glo_obj->getExportDirectory();
67  $this->subdir = $date."__".$this->inst_id."__".
68  $this->glo_obj->getType()."_".$this->glo_obj->getId();
69  $this->filename = $this->subdir.".xml";
70  break;
71 
72  case "html":
73  $this->export_dir = $this->glo_obj->getExportDirectory("html");
74  $this->subdir = $this->glo_obj->getType()."_".$this->glo_obj->getId();
75  $this->filename = $this->subdir.".zip";
76  break;
77 
78  }
79 
80  }
global $ilErr
Definition: raiseError.php:16
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Member Function Documentation

◆ buildExportFile()

ilGlossaryExport::buildExportFile ( )

build export file (complete zip file)

public

Returns

Definition at line 93 of file class.ilGlossaryExport.php.

References buildExportFileHTML(), and buildExportFileXML().

94  {
95  switch ($this->mode)
96  {
97  case "html":
98  return $this->buildExportFileHTML();
99  break;
100 
101  default:
102  return $this->buildExportFileXML();
103  break;
104  }
105  }
buildExportFileHTML()
build html export file
buildExportFileXML()
build export file (complete zip file)
+ Here is the call graph for this function:

◆ buildExportFileHTML()

ilGlossaryExport::buildExportFileHTML ( )

build html export file

Definition at line 182 of file class.ilGlossaryExport.php.

References $ilBench.

Referenced by buildExportFile().

183  {
184  global $ilBench;
185 
186  // create directories
187  $this->glo_obj->createExportDirectory("html");
188 
189  // get Log File
190  $expDir = $this->glo_obj->getExportDirectory();
191 
192  // get xml content
193  $this->glo_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog);
194  }
global $ilBench
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilGlossaryExport::buildExportFileXML ( )

build export file (complete zip file)

Definition at line 110 of file class.ilGlossaryExport.php.

References $ilBench, date, ilUtil\makeDir(), ilXmlWriter\xmlSetDtdDef(), and ilUtil\zip().

Referenced by buildExportFile().

111  {
112  global $ilBench;
113 
114  $ilBench->start("GlossaryExport", "buildExportFile");
115 
116  require_once("./Services/Xml/classes/class.ilXmlWriter.php");
117 
118  $this->xml = new ilXmlWriter;
119 
120  // set dtd definition
121  $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");
122 
123  // set generated comment
124  $this->xml->xmlSetGenCmt("Export of ILIAS Glossary ".
125  $this->glo_obj->getId()." of installation ".$this->inst.".");
126 
127  // set xml header
128  $this->xml->xmlHeader();
129 
130  // create directories
131  $this->glo_obj->createExportDirectory();
132  ilUtil::makeDir($this->export_dir."/".$this->subdir);
133  ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
134 
135  // get Log File
136  $expDir = $this->glo_obj->getExportDirectory();
137  include_once './Services/Logging/classes/class.ilLog.php';
138  $expLog = new ilLog($expDir, "export.log");
139  $expLog->delete();
140  $expLog->setLogFormat("");
141  $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
142 
143  // get xml content
144 //echo "ContObjExport:".$this->inst_id.":<br>";
145  $ilBench->start("GlossaryExport", "buildExportFile_getXML");
146  $this->glo_obj->exportXML($this->xml, $this->inst_id,
147  $this->export_dir."/".$this->subdir, $expLog);
148  $ilBench->stop("GlossaryExport", "buildExportFile_getXML");
149 
150  // dump xml document to screen (only for debugging reasons)
151  /*
152  echo "<PRE>";
153  echo htmlentities($this->xml->xmlDumpMem($format));
154  echo "</PRE>";
155  */
156 
157 
158  // dump xml document to file
159  $ilBench->start("GlossaryExport", "buildExportFile_dumpToFile");
160  $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
161  , false);
162  $ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile");
163 
164  // zip the file
165  $ilBench->start("GlossaryExport", "buildExportFile_zipFile");
166  ilUtil::zip($this->export_dir."/".$this->subdir,
167  $this->export_dir."/".$this->subdir.".zip");
168  $ilBench->stop("GlossaryExport", "buildExportFile_zipFile");
169 
170  // destroy writer object
171  $this->xml->_XmlWriter;
172 
173  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
174  $ilBench->stop("GlossaryExport", "buildExportFile");
175 
176  return $this->export_dir."/".$this->subdir.".zip";
177  }
xmlSetDtdDef($dtdDef)
Sets dtd definition.
XML writer class.
logging
Definition: class.ilLog.php:18
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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 ...
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilGlossaryExport::getInstId ( )

Definition at line 82 of file class.ilGlossaryExport.php.

References $inst_id.

83  {
84  return $this->inst_id;
85  }

Field Documentation

◆ $db

ilGlossaryExport::$db

Definition at line 38 of file class.ilGlossaryExport.php.

◆ $err

ilGlossaryExport::$err

Definition at line 37 of file class.ilGlossaryExport.php.

◆ $glo_obj

ilGlossaryExport::$glo_obj

Definition at line 40 of file class.ilGlossaryExport.php.

◆ $ilias

ilGlossaryExport::$ilias

Definition at line 39 of file class.ilGlossaryExport.php.

Referenced by __construct().

◆ $inst_id

ilGlossaryExport::$inst_id

Definition at line 41 of file class.ilGlossaryExport.php.

Referenced by getInstId().


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