/** * Add subitems * @param object $a_id * @param object $a_type * @return */ protected function addSubitems($a_id, $a_type, $a_target_release) { $GLOBALS['ilLog']->write(__METHOD__); $set_number = 1; foreach ($this->eo->getSubitemsForExport() as $ref_id) { // get last export file $obj_id = ilObject::_lookupObjId($ref_id); $expi = ilExportFileInfo::lookupLastExport($obj_id, 'xml', $a_target_release); if (!$expi instanceof ilExportFileInfo) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find export file for refId ' . $ref_id . ', type ' . ilObject::_lookupType($a_id)); continue; } $exp_dir = ilExport::_getExportDirectory($obj_id, 'xml', ilObject::_lookupType($obj_id)); $exp_full = $exp_dir . DIRECTORY_SEPARATOR . $expi->getFilename(); $GLOBALS['ilLog']->write(__METHOD__ . ': zip path ' . $exp_full); // Unzip ilUtil::unzip($exp_full, true, false); // create set directory ilUtil::makeDirParents($this->cont_export_dir . DIRECTORY_SEPARATOR . 'set_' . $set_number); // cut .zip $new_path_rel = 'set_' . $set_number . DIRECTORY_SEPARATOR . $expi->getBasename(); $new_path_abs = $this->cont_export_dir . DIRECTORY_SEPARATOR . $new_path_rel; $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $new_path_rel . ' ' . $new_path_abs); // Move export rename($exp_dir . DIRECTORY_SEPARATOR . $expi->getBasename(), $new_path_abs); $GLOBALS['ilLog']->write($exp_dir . DIRECTORY_SEPARATOR . $expi->getBasename() . ' -> ' . $new_path_abs); // Delete latest container xml of source if ($a_id == $obj_id) { $expi->delete(); if (file_exists($exp_full)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting' . $exp_full); unlink($exp_full); } } $this->cont_manifest_writer->xmlElement('ExportSet', array('Path' => $new_path_rel, 'Type' => ilObject::_lookupType($obj_id))); ++$set_number; } }
/** * parse tree * @param object $a_source * @return */ public function parseContainer($a_source) { global $tree, $objDefinition, $ilAccess; $first = true; foreach ($tree->getSubTree($root = $tree->getNodeData($a_source)) as $node) { if ($node['type'] == 'rolf') { continue; } if (!$objDefinition->allowExport($node['type'])) { #continue; } include_once "./Modules/File/classes/class.ilObjFileAccess.php"; if ($node['type'] == "file" && ilObjFileAccess::_isFileHidden($node['title'])) { continue; } $r = array(); if ($last = ilExportFileInfo::lookupLastExport($node['obj_id'], 'xml')) { $r['last_export'] = $last->getCreationDate()->get(IL_CAL_UNIX); } else { $r['last_export'] = 0; } $r['last'] = false; $r['source'] = $first; $r['ref_id'] = $node['child']; $r['depth'] = $node['depth'] - $root['depth']; $r['type'] = $node['type']; $r['title'] = $node['title']; $r['export'] = $objDefinition->allowExport($node['type']); $r['perm_export'] = $ilAccess->checkAccess('write', '', $node['child']); $rows[] = $r; $first = false; } $rows[] = array('last' => true); $this->setData((array) $rows); }