/** * Add zip files to folder * * @param array selection array: key is ref_id, value is "last_file", "omit" or "create" */ function __addZipFiles($a_parent_id, $a_selection = "") { $this->course_obj->initCourseItemObject(); $this->course_obj->items_obj->setParentId($a_parent_id); foreach ($this->course_obj->items_obj->getAllItems() as $item) { if (!($tmp_obj =& ilObjectFactory::getInstanceByRefId($item['child'], false))) { continue; } $action = $a_selection[$item['child']]; if ($a_selection == "") { $action = "create"; } if ($action == "omit") { continue; } if ($action == "create") { $abs_file_name = $tmp_obj->getXMLZip(); } else { include_once "./Services/Export/classes/class.ilExport.php"; $info = ilExport::_getLastExportFileInformation($item['obj_id'], "xml", $item['type']); $abs_file_name = ilExport::_getExportDirectory($item['obj_id'], "xml", $item['type']) . "/" . $info["file"]; if (!@is_file($abs_file_name)) { $abs_file_name = ""; } } // must return absolute path to zip file if ($abs_file_name != "") { //$new_name = 'il_'.$this->ilias->getSetting('inst_id').'_'.$tmp_obj->getType().'_'.$item['obj_id'].'.zip'; $new_name = basename($abs_file_name); $this->course_files_obj->copyFile($abs_file_name, $this->course_files_obj->getArchiveDirectory() . '/' . $this->getName() . '/' . $new_name); if (is_file($this->course_files_obj->getArchiveDirectory() . '/' . $this->getName() . '/' . $new_name)) { $this->copied_files[] = array("title" => $item['title'], "file" => $new_name, "type" => $item['type']); } } $this->__addZipFiles($item['child']); unset($tmp_obj); } return true; }