/**
  * Get head dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
 {
     include_once './Services/Export/classes/class.ilExportOptions.php';
     $eo = ilExportOptions::getInstance();
     $obj_id = end($a_ids);
     if ($eo->getOption(ilExportOptions::KEY_ROOT) != $obj_id) {
         return array();
     }
     if (count(ilExportOptions::getInstance()->getSubitemsForExport()) > 1) {
         return array(array('component' => 'Services/Container', 'entity' => 'struct', 'ids' => $a_ids));
     }
     return array();
 }
 /**
  * Get xml
  * @param object $a_entity
  * @param object $a_schema_version
  * @param object $a_id
  * @return 
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     global $rbacreview;
     include_once './Services/AccessControl/classes/class.ilRoleXmlExport.php';
     $writer = new ilRoleXmlExport();
     include_once './Services/Export/classes/class.ilExportOptions.php';
     $eo = ilExportOptions::getInstance();
     $eo->read();
     $rolf = $eo->getOptionByObjId($a_id, ilExportOptions::KEY_ROOT);
     // @todo refactor rolf
     $writer->setRoles(array($a_id => $rolf));
     $writer->write();
     return $writer->xmlDumpMem($format);
 }
Пример #3
0
 function &executeCommand()
 {
     global $rbacsystem;
     $this->prepareOutput();
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case 'ilrepositorysearchgui':
             include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             $rep_search->setTitle($this->lng->txt('role_add_user'));
             $rep_search->setCallback($this, 'addUserObject');
             // Set tabs
             $this->tabs_gui->setTabActive('user_assignment');
             $this->ctrl->setReturn($this, 'userassignment');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             break;
         case 'ilexportgui':
             $this->tabs_gui->setTabActive('export');
             include_once './Services/Export/classes/class.ilExportOptions.php';
             $eo = ilExportOptions::newInstance(ilExportOptions::allocateExportId());
             $eo->addOption(ilExportOptions::KEY_ROOT, 0, $this->object->getId(), $this->obj_ref_id);
             include_once './Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this, new ilObjRole($this->object->getId()));
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         default:
             if (!$cmd) {
                 if ($this->showDefaultPermissionSettings()) {
                     $cmd = "perm";
                 } else {
                     $cmd = 'userassignment';
                 }
             }
             $cmd .= "Object";
             $this->{$cmd}();
             break;
     }
     return true;
 }
 /**
  * Save selection of subitems
  * @return 
  */
 protected function saveItemSelection()
 {
     global $tree, $objDefinition, $ilAccess, $ilCtrl, $lng;
     include_once './Services/Export/classes/class.ilExportOptions.php';
     $eo = ilExportOptions::newInstance(ilExportOptions::allocateExportId());
     $eo->addOption(ilExportOptions::KEY_ROOT, 0, 0, $this->obj->getId());
     $items_selected = false;
     foreach ($tree->getSubTree($root = $tree->getNodeData($this->getParentGUI()->object->getRefId())) as $node) {
         if ($node['type'] == 'rolf') {
             continue;
         }
         if ($node['ref_id'] == $this->getParentGUI()->object->getRefId()) {
             $eo->addOption(ilExportOptions::KEY_ITEM_MODE, $node['ref_id'], $node['obj_id'], ilExportOptions::EXPORT_BUILD);
             continue;
         }
         // no export available or no access
         if (!$objDefinition->allowExport($node['type']) or !$ilAccess->checkAccess('write', '', $node['ref_id'])) {
             $eo->addOption(ilExportOptions::KEY_ITEM_MODE, $node['ref_id'], $node['obj_id'], ilExportOptions::EXPORT_OMIT);
             continue;
         }
         $mode = isset($_POST['cp_options'][$node['ref_id']]['type']) ? $_POST['cp_options'][$node['ref_id']]['type'] : ilExportOptions::EXPORT_OMIT;
         $eo->addOption(ilExportOptions::KEY_ITEM_MODE, $node['ref_id'], $node['obj_id'], $mode);
         if ($mode != ilExportOptions::EXPORT_OMIT) {
             $items_selected = true;
         }
     }
     include_once "./Services/Export/classes/class.ilExport.php";
     if ($items_selected) {
         // TODO: move this to background soap
         $eo->read();
         $exp = new ilExport();
         foreach ($eo->getSubitemsForCreation($this->obj->getRefId()) as $ref_id) {
             $obj_id = ilObject::_lookupObjId($ref_id);
             $type = ilObject::_lookupType($obj_id);
             $exp->exportObject($type, $obj_id, '4.1.0');
         }
         // Fixme: there is a naming conflict between the container settings xml and the container subitem xml.
         sleep(1);
         // Export container
         include_once './Services/Export/classes/class.ilExportContainer.php';
         $cexp = new ilExportContainer($eo);
         $cexp->exportObject($this->obj->getType(), $this->obj->getId(), '4.1.0');
     } else {
         $exp = new ilExport();
         $exp->exportObject($this->obj->getType(), $this->obj->getId(), "4.1.0");
     }
     // Delete export options
     $eo->delete();
     ilUtil::sendSuccess($lng->txt('export_created'), true);
     $ilCtrl->redirect($this, "listExportFiles");
 }
Пример #5
0
 /**
  * Create new instance
  * @param object $a_export_id
  * @return object ilExportOptions
  */
 public static function newInstance($a_export_id)
 {
     return self::$instance = new ilExportOptions($a_export_id);
 }
 /**
  * Constructor
  */
 public function __construct($a_ref_id)
 {
     parent::__construct();
     $this->source = $a_ref_id;
     $this->exp_options = ilExportOptions::getInstance();
 }