ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 
 $glo_obj
 
 $inst_id
 

Protected Attributes

 $settings
 

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 51 of file class.ilGlossaryExport.php.

References $DIC, $ilDB, $ilErr, $ilSetting, $settings, settings(), and time.

52  {
53  global $DIC;
54 
55  $this->settings = $DIC->settings();
56  $ilErr = $DIC["ilErr"];
57  $ilDB = $DIC->database();
58  $ilSetting = $DIC->settings();
59 
60  $this->glo_obj = $a_glo_obj;
61 
62  $this->err = $ilErr;
63  $this->db = $ilDB;
64  $this->mode = $a_mode;
65 
66  $settings = $ilSetting->getAll();
67  // The default '0' is required for the directory structure (smeyer)
68  $this->inst_id = $settings["inst_id"] ? $settings['inst_id'] : 0;
69 
70  $date = time();
71  switch ($this->mode) {
72  case "xml":
73  $this->export_dir = $this->glo_obj->getExportDirectory();
74  $this->subdir = $date . "__" . $this->inst_id . "__" .
75  $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
76  $this->filename = $this->subdir . ".xml";
77  break;
78 
79  case "html":
80  $this->export_dir = $this->glo_obj->getExportDirectory("html");
81  $this->subdir = $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
82  $this->filename = $this->subdir . ".zip";
83  break;
84 
85  }
86  }
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
global $ilSetting
Definition: privfeed.php:17
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

Member Function Documentation

◆ buildExportFile()

ilGlossaryExport::buildExportFile ( )

build export file (complete zip file)

public

Returns

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

References buildExportFileHTML(), and buildExportFileXML().

100  {
101  switch ($this->mode) {
102  case "html":
103  return $this->buildExportFileHTML();
104  break;
105 
106  default:
107  return $this->buildExportFileXML();
108  break;
109  }
110  }
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 174 of file class.ilGlossaryExport.php.

Referenced by buildExportFile().

175  {
176  // create directories
177  $this->glo_obj->createExportDirectory("html");
178 
179  // get Log File
180  $expDir = $this->glo_obj->getExportDirectory();
181 
182  // get xml content
183  $this->glo_obj->exportHTML($this->export_dir . "/" . $this->subdir, $expLog);
184  }
+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilGlossaryExport::buildExportFileXML ( )

build export file (complete zip file)

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

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

Referenced by buildExportFile().

116  {
117  require_once("./Services/Xml/classes/class.ilXmlWriter.php");
118 
119  $this->xml = new ilXmlWriter;
120 
121  // set dtd definition
122  $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");
123 
124  // set generated comment
125  $this->xml->xmlSetGenCmt("Export of ILIAS Glossary " .
126  $this->glo_obj->getId() . " of installation " . $this->inst . ".");
127 
128  // set xml header
129  $this->xml->xmlHeader();
130 
131  // create directories
132  $this->glo_obj->createExportDirectory();
133  ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
134  ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
135 
136  // get Log File
137  $expDir = $this->glo_obj->getExportDirectory();
138  include_once './Services/Logging/classes/class.ilLog.php';
139  $expLog = new ilLog($expDir, "export.log");
140  $expLog->delete();
141  $expLog->setLogFormat("");
142  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
143 
144  // get xml content
145  $this->glo_obj->exportXML(
146  $this->xml,
147  $this->inst_id,
148  $this->export_dir . "/" . $this->subdir,
149  $expLog
150  );
151 
152 
153 
154  // dump xml document to file
155  $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
156 
157  // zip the file
158  ilUtil::zip(
159  $this->export_dir . "/" . $this->subdir,
160  $this->export_dir . "/" . $this->subdir . ".zip"
161  );
162 
163  // destroy writer object
164  $this->xml->_XmlWriter;
165 
166  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
167 
168  return $this->export_dir . "/" . $this->subdir . ".zip";
169  }
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 ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilGlossaryExport::getInstId ( )

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

References $inst_id.

89  {
90  return $this->inst_id;
91  }

Field Documentation

◆ $db

ilGlossaryExport::$db

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

◆ $err

ilGlossaryExport::$err

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

◆ $glo_obj

ilGlossaryExport::$glo_obj

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

◆ $inst_id

ilGlossaryExport::$inst_id

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

Referenced by getInstId().

◆ $settings

ilGlossaryExport::$settings
protected

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

Referenced by __construct().


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