Ejemplo n.º 1
0
 /**
  * Build export file
  *
  * @param
  * @return
  */
 function buildExportFile()
 {
     global $ilias;
     // create export file
     include_once "./Services/Export/classes/class.ilExport.php";
     ilExport::_createExportDirectory($this->wiki->getId(), "html", "wiki");
     $exp_dir = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki");
     $this->subdir = $this->wiki->getType() . "_" . $this->wiki->getId();
     $this->export_dir = $exp_dir . "/" . $this->subdir;
     // initialize temporary target directory
     ilUtil::delDir($this->export_dir);
     ilUtil::makeDir($this->export_dir);
     // system style html exporter
     include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
     $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
     $this->sys_style_html_export->addImage("icon_wiki.svg");
     $this->sys_style_html_export->export();
     // init co page html exporter
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
     $this->co_page_html_export->setContentStyleId($this->wiki->getStyleSheetId());
     $this->co_page_html_export->createDirectories();
     $this->co_page_html_export->exportStyles();
     $this->co_page_html_export->exportSupportScripts();
     // export pages
     $this->exportHTMLPages();
     // zip everything
     if (true) {
         // zip it all
         $date = time();
         $zip_file = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki") . "/" . $date . "__" . IL_INST_ID . "__" . $this->wiki->getType() . "_" . $this->wiki->getId() . ".zip";
         ilUtil::zip($this->export_dir, $zip_file);
         ilUtil::delDir($this->export_dir);
     }
 }
 public function sendAndCreateSimpleExportFile()
 {
     $orgu_id = ilObjOrgUnit::getRootOrgId();
     $orgu_ref_id = ilObjOrgUnit::getRootOrgRefId();
     ilExport::_createExportDirectory($orgu_id, "xml", "orgu");
     $export_dir = ilExport::_getExportDirectory($orgu_id, "xml", "orgu");
     $ts = time();
     // Workaround for test assessment
     $sub_dir = $ts . '__' . IL_INST_ID . '__' . "orgu" . '_' . $orgu_id . "";
     $new_file = $sub_dir . '.zip';
     $export_run_dir = $export_dir . "/" . $sub_dir;
     ilUtil::makeDirParents($export_run_dir);
     $writer = $this->simpleExport($orgu_ref_id);
     $writer->xmlDumpFile($export_run_dir . "/manifest.xml", false);
     // zip the file
     ilUtil::zip($export_run_dir, $export_dir . "/" . $new_file);
     ilUtil::delDir($export_run_dir);
     // Store info about export
     include_once './Services/Export/classes/class.ilExportFileInfo.php';
     $exp = new ilExportFileInfo($orgu_id);
     $exp->setVersion(ILIAS_VERSION_NUMERIC);
     $exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX));
     $exp->setExportType('xml');
     $exp->setFilename($new_file);
     $exp->create();
     ilUtil::deliverFile($export_dir . "/" . $new_file, $new_file);
     return array("success" => true, "file" => $new_file, "directory" => $export_dir);
 }
 /**
  * Build export file
  *
  * @param
  * @return
  */
 function buildExportFile()
 {
     global $ilias;
     // create export file
     include_once "./Services/Export/classes/class.ilExport.php";
     ilExport::_createExportDirectory($this->object->getId(), "html", "prtf");
     $exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf");
     $this->subdir = $this->object->getType() . "_" . $this->object->getId();
     $this->export_dir = $exp_dir . "/" . $this->subdir;
     // initialize temporary target directory
     ilUtil::delDir($this->export_dir);
     ilUtil::makeDir($this->export_dir);
     // system style html exporter
     include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
     $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
     // $this->sys_style_html_export->addImage("icon_prtf_b.png");
     $this->sys_style_html_export->export();
     // init co page html exporter
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
     /* $this->co_page_html_export->setContentStyleId(
     			$this->object->getStyleSheetId()); */
     $this->co_page_html_export->createDirectories();
     $this->co_page_html_export->exportStyles();
     $this->co_page_html_export->exportSupportScripts();
     // banner / profile picture
     $prfa_set = new ilSetting("prfa");
     if ($prfa_set->get("banner")) {
         $banner = $this->object->getImageFullPath();
         copy($banner, $this->export_dir . "/" . basename($banner));
     }
     $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big");
     if ($ppic) {
         $ppic = array_shift(explode("?", $ppic));
         copy($ppic, $this->export_dir . "/" . basename($ppic));
     }
     // export pages
     $this->exportHTMLPages();
     // zip everything
     if (true) {
         // zip it all
         $date = time();
         $zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
         ilUtil::zip($this->export_dir, $zip_file);
         ilUtil::delDir($this->export_dir);
     }
     return $zip_file;
 }
Ejemplo n.º 4
0
 /**
  * Export a container
  * 
  * @param object $a_type
  * @param object $a_obj_id
  * @param object $a_target_release
  * @return 
  */
 public function exportObject($a_type, $a_id, $a_target_release)
 {
     // Create base export directory
     ilExport::_createExportDirectory($a_id, "xml", $a_type);
     $export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
     $ts = time();
     $sub_dir = $ts . "__" . IL_INST_ID . "__" . $a_type . "_" . $a_id;
     $this->cont_export_dir = $export_dir . DIRECTORY_SEPARATOR . $sub_dir;
     ilUtil::makeDirParents($this->cont_export_dir);
     $GLOBALS['ilLog']->write(__METHOD__ . ' using base directory: ' . $this->export_run_dir);
     $this->manifestWriterBegin($a_type, $a_id, $a_target_release);
     $this->addContainer();
     $this->addSubitems($a_id, $a_type, $a_target_release);
     $this->manifestWriterEnd($a_type, $a_id, $a_target_release);
     ilUtil::zip($this->cont_export_dir, $this->cont_export_dir . '.zip');
     ilUtil::delDir($this->cont_export_dir);
 }
 /**
  * create html package
  */
 function exportHTML()
 {
     $inst_id = IL_INST_ID;
     include_once "./Services/Export/classes/class.ilExport.php";
     ilExport::_createExportDirectory($this->object->getId(), "html", $this->object->getType());
     $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html", $this->object->getType());
     $subdir = $this->object->getType() . "_" . $this->object->getId();
     $filename = $this->subdir . ".zip";
     $target_dir = $export_dir . "/" . $subdir;
     ilUtil::delDir($target_dir);
     ilUtil::makeDir($target_dir);
     $source_dir = $this->object->getDataDirectory();
     ilUtil::rCopy($source_dir, $target_dir);
     // zip it all
     $date = time();
     $zip_file = $export_dir . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
     ilUtil::zip($target_dir, $zip_file);
     ilUtil::delDir($target_dir);
 }
Ejemplo n.º 6
0
 /**
  * Creates export directory
  */
 function createExportDirectory($a_type = "xml")
 {
     include_once "./Services/Export/classes/class.ilExport.php";
     return ilExport::_createExportDirectory($this->getId(), $a_type, $this->getType());
 }
 /**
  * Build export file
  *
  * @param
  * @return
  */
 function buildExportFile()
 {
     global $ilias;
     // create export file
     include_once "./Services/Export/classes/class.ilExport.php";
     ilExport::_createExportDirectory($this->object->getId(), "html", "prtf");
     $exp_dir = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf");
     $this->subdir = $this->object->getType() . "_" . $this->object->getId();
     $this->export_dir = $exp_dir . "/" . $this->subdir;
     // initialize temporary target directory
     ilUtil::delDir($this->export_dir);
     ilUtil::makeDir($this->export_dir);
     // system style html exporter
     include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
     $this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
     // $this->sys_style_html_export->addImage("icon_prtf.svg");
     $this->sys_style_html_export->export();
     // init co page html exporter
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
     $this->co_page_html_export->setContentStyleId($this->object->getStyleSheetId());
     $this->co_page_html_export->createDirectories();
     $this->co_page_html_export->exportStyles();
     $this->co_page_html_export->exportSupportScripts();
     // banner
     $prfa_set = new ilSetting("prfa");
     if ($prfa_set->get("banner")) {
         $banner = $this->object->getImageFullPath();
         if ($banner) {
             copy($banner, $this->export_dir . "/" . basename($banner));
         }
     }
     // page element: profile picture
     $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "big", true, true);
     if ($ppic) {
         $ppic = array_shift(explode("?", $ppic));
         copy($ppic, $this->export_dir . "/" . basename($ppic));
     }
     // header image: profile picture
     $ppic = ilObjUser::_getPersonalPicturePath($this->object->getOwner(), "xsmall", true, true);
     if ($ppic) {
         $ppic = array_shift(explode("?", $ppic));
         copy($ppic, $this->export_dir . "/" . basename($ppic));
     }
     // export pages
     $this->exportHTMLPages();
     // add js/images/file to zip
     $images = $files = $js_files = array();
     foreach ($this->export_material as $items) {
         $images = array_merge($images, $items["images"]);
         $files = array_merge($files, $items["files"]);
         $js_files = array_merge($js_files, $items["js"]);
     }
     foreach (array_unique($images) as $image) {
         if (is_file($image)) {
             copy($image, $this->export_dir . "/images/" . basename($image));
         }
     }
     foreach (array_unique($js_files) as $js_file) {
         if (is_file($js_file)) {
             copy($js_file, $this->export_dir . "/js/" . basename($js_file));
         }
     }
     foreach (array_unique($files) as $file) {
         if (is_file($file)) {
             copy($file, $this->export_dir . "/files/" . basename($file));
         }
     }
     // zip everything
     if (true) {
         // zip it all
         $date = time();
         $zip_file = ilExport::_getExportDirectory($this->object->getId(), "html", "prtf") . "/" . $date . "__" . IL_INST_ID . "__" . $this->object->getType() . "_" . $this->object->getId() . ".zip";
         ilUtil::zip($this->export_dir, $zip_file);
         ilUtil::delDir($this->export_dir);
     }
     return $zip_file;
 }
Ejemplo n.º 8
0
 /**
  * Export an ILIAS object (the object type must be known by objDefinition)
  *
  * @param string $a_type repository object type
  * @param int $a_id id of object or entity that shoudl be exported
  * @param string $a_target_release target release
  *
  * @return array success and info array
  */
 function exportObject($a_type, $a_id, $a_target_release)
 {
     global $objDefinition, $tpl;
     $comp = $objDefinition->getComponentForType($a_type);
     $c = explode("/", $comp);
     $class = "il" . $c[1] . "Exporter";
     // manifest writer
     include_once "./Services/Xml/classes/class.ilXmlWriter.php";
     $this->manifest_writer = new ilXmlWriter();
     $this->manifest_writer->xmlHeader();
     $this->manifest_writer->xmlStartTag('Manifest', array("MainEntity" => $a_type, "Title" => ilObject::_lookupTitle($a_id), "TargetRelease" => $a_target_release, "InstallationId" => IL_INST_ID, "InstallationUrl" => ILIAS_HTTP_PATH));
     // get export class
     ilExport::_createExportDirectory($a_id, "xml", $a_type);
     $export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
     $ts = time();
     // Workaround for test assessment
     $sub_dir = $ts . '__' . IL_INST_ID . '__' . $a_type . '_' . $a_id;
     $new_file = $sub_dir . '.zip';
     $this->export_run_dir = $export_dir . "/" . $sub_dir;
     ilUtil::makeDirParents($this->export_run_dir);
     $this->cnt = array();
     $success = $this->processExporter($comp, $class, $a_type, $a_target_release, $a_id);
     $this->manifest_writer->xmlEndTag('Manifest');
     $this->manifest_writer->xmlDumpFile($this->export_run_dir . "/manifest.xml", false);
     // zip the file
     ilUtil::zip($this->export_run_dir, $export_dir . "/" . $new_file);
     ilUtil::delDir($this->export_run_dir);
     // Store info about export
     if ($success) {
         include_once './Services/Export/classes/class.ilExportFileInfo.php';
         $exp = new ilExportFileInfo($a_id);
         $exp->setVersion($a_target_release);
         $exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX));
         $exp->setExportType('xml');
         $exp->setFilename($new_file);
         $exp->create();
     }
     return array("success" => $success, "file" => $new_file, "directory" => $export_dir);
 }