Ejemplo n.º 1
0
 /**
  * Export personal data
  *
  * @param
  * @return
  */
 function exportPersonalData()
 {
     include_once "./Services/Export/classes/class.ilExport.php";
     $exp = new ilExport();
     $dir = ilExport::_getExportDirectory($this->getId(), "xml", "usr", "personal_data");
     ilUtil::delDir($dir, true);
     $title = $this->getLastname() . ", " . $this->getLastname() . " [" . $this->getLogin() . "]";
     $exp->exportEntity("personal_data", $this->getId(), "4.3.0", "Services/User", $title, $dir);
 }
 /**
  * Export page layout template object
  */
 function exportLayoutObject()
 {
     include_once "./Services/Export/classes/class.ilExport.php";
     $exp = new ilExport();
     $tmpdir = ilUtil::ilTempnam();
     ilUtil::makeDir($tmpdir);
     $succ = $exp->exportEntity("pgtp", (int) $_GET["layout_id"], "4.2.0", "Services/COPage", "Title", $tmpdir);
     if ($succ["success"]) {
         ilUtil::deliverFile($succ["directory"] . "/" . $succ["file"], $succ["file"], "", false, false, false);
     }
     if (is_file($succ["directory"] . "/" . $succ["file"])) {
         unlink($succ["directory"] . "/" . $succ["file"]);
     }
     if (is_dir($succ["directory"])) {
         unlink($succ["directory"]);
     }
 }
 /**
  * build xml export file
  */
 function buildExportFileXML()
 {
     global $ilBench;
     $ilBench->start("ContentObjectExport", "buildExportFile");
     require_once "./Services/Xml/classes/class.ilXmlWriter.php";
     $this->xml = new ilXmlWriter();
     // set dtd definition
     $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
     // set generated comment
     $this->xml->xmlSetGenCmt("Export of ILIAS Content Module " . $this->cont_obj->getId() . " of installation " . $this->inst . ".");
     // set xml header
     $this->xml->xmlHeader();
     // create directories
     $this->cont_obj->createExportDirectory();
     ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
     ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
     // get Log File
     $expDir = $this->cont_obj->getExportDirectory();
     $expLog = new ilLog($expDir, "export.log");
     $expLog->delete();
     $expLog->setLogFormat("");
     $expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
     // get xml content
     //echo "ContObjExport:".$this->inst_id.":<br>";
     $ilBench->start("ContentObjectExport", "buildExportFile_getXML");
     $this->cont_obj->exportXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog);
     $ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
     // export style
     if ($this->cont_obj->getStyleSheetId() > 0) {
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $style_obj = new ilObjStyleSheet($this->cont_obj->getStyleSheetId(), false);
         //$style_obj->exportXML($this->export_dir."/".$this->subdir);
         $style_obj->setExportSubDir("style");
         $style_file = $style_obj->export();
         if (is_file($style_file)) {
             copy($style_file, $this->export_dir . "/" . $this->subdir . "/style.zip");
         }
     }
     // dump xml document to screen (only for debugging reasons)
     /*
     echo "<PRE>";
     echo htmlentities($this->xml->xmlDumpMem($format));
     echo "</PRE>";
     */
     // dump xml document to file
     $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
     // help export (workaround to use ref id here)
     if (ilObjContentObject::isOnlineHelpModule((int) $_GET["ref_id"])) {
         include_once "./Services/Export/classes/class.ilExport.php";
         $exp = new ilExport();
         $exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help", "OnlineHelp", $this->export_dir . "/" . $this->subdir);
     }
     // zip the file
     ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip");
     // destroy writer object
     $this->xml->_XmlWriter;
     $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
     $ilBench->stop("ContentObjectExport", "buildExportFile");
     return $this->export_dir . "/" . $this->subdir . ".zip";
 }