/**
  * 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");
 }