33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
46 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
55 include_once
'./include/inc.header.php';
59 $ilLog->write(
"SOAP getObjIdByImportId(): import_id = ".$import_id.
' obj_id = '.$obj_id);
61 return $obj_id ? $obj_id :
"0";
70 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
79 include_once
'./include/inc.header.php';
90 if ($tree->isInTree($ref_id))
95 return $new_refs ? $new_refs : array();
102 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
111 include_once
'./include/inc.header.php';
118 return $new_refs ? $new_refs : array();
133 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
138 include_once
'./include/inc.header.php';
140 if(!count($ref_ids) || !is_array ($ref_ids))
142 return $this->
__raiseError(
'No reference id(s) given.',
'Client');
146 if (count($ref_ids)) {
149 $ref_id = trim($ref_id);
150 if (!is_numeric($ref_id)){
151 return $this->
__raiseError(
'Reference ID has to be numeric. Value: '.$ref_id,
'Client');
156 return $this->
__raiseError(
'No object found for reference ID. Value: '.$ref_id,
'Client');
159 return $this->
__raiseError(
'No untrashed reference found for reference ID. Value: '.$ref_id,
'Client');
161 $obj_ids[] = $obj_id;
173 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
175 if(!is_numeric($a_ref_id))
177 return $this->
__raiseError(
'No valid reference id given. Please choose an existing reference id of an ILIAS object',
182 include_once
'./include/inc.header.php';
186 return $this->
__raiseError(
'Cannot create object instance!',
'Server');
192 return $this->
__raiseError(
"Object with ID $a_ref_id has been deleted.",
'Client');
195 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
200 $xml_writer->setUserId($user_id);
201 $xml_writer->enableOperations(
true);
203 $xml_writer->setObjects(array($tmp_obj));
204 if($xml_writer->start())
206 return $xml_writer->getXML();
209 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
216 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
218 if(!strlen($a_title))
220 return $this->
__raiseError(
'No valid query string given.',
225 include_once
'./include/inc.header.php';
227 include_once
'./Services/Search/classes/class.ilQueryParser.php';
230 $query_parser->setMinWordLength(0,
true);
232 $query_parser->parse();
233 if(!$query_parser->validate())
239 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
241 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
244 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
245 $object_search->setFields(array(
'title'));
246 $object_search->appendToFilter(
'role');
247 $object_search->appendToFilter(
'rolt');
248 $res =& $object_search->performSearch();
251 $res->setUserId($user_id);
254 $res->filter(ROOT_FOLDER_ID,
true);
257 foreach(
$res->getUniqueResults() as $entry)
266 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
271 $xml_writer->setUserId($user_id);
272 $xml_writer->enableOperations(
true);
274 $xml_writer->setObjects($objs);
275 if($xml_writer->start())
277 return $xml_writer->getXML();
280 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
287 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
289 if(!is_array($types))
291 return $this->
__raiseError(
'Types must be an array of object types.',
294 if($combination !=
'and' and $combination !=
'or')
296 return $this->
__raiseError(
'No valid combination given. Must be "and" or "or".',
302 include_once
'./include/inc.header.php';
304 include_once
'./Services/Search/classes/class.ilQueryParser.php';
307 $query_parser->setMinWordLength(0,
true);
309 $query_parser->parse();
310 if(!$query_parser->validate())
316 #include_once './Services/Search/classes/class.ilObjectSearchFactory.php';
317 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
319 include_once
'./Services/Search/classes/Like/class.ilLikeObjectSearch.php';
322 $object_search->setFilter($types);
324 $res =& $object_search->performSearch();
327 $res->setUserId($user_id);
329 $res->setMaxHits(999999);
330 $res->filter(ROOT_FOLDER_ID,$combination ==
'and' ?
true :
false);
336 foreach(
$res->getUniqueResults() as $entry)
349 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
355 $xml_writer->setUserId($user_id);
356 $xml_writer->enableOperations(
true);
359 $xml_writer->setObjects($objs);
360 if($xml_writer->start())
362 return $xml_writer->getXML();
365 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
374 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
378 include_once
'./include/inc.header.php';
383 return $this->
__raiseError(
'No valid reference id given.',
386 if (intval(
$ref_id) == SYSTEM_FOLDER_ID) {
387 return $this->
__raiseError(
'No valid reference id given.',
395 $filter = is_array($types) ? $types : array();
398 foreach($tree->getChilds(
$ref_id,
'title') as $child)
400 if($all or in_array($child[
'type'],$types))
414 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
417 $xml_writer->setObjects($objs);
418 $xml_writer->enableOperations(
true);
421 $xml_writer->setUserId($user_id);
424 if($xml_writer->start())
426 return $xml_writer->getXML();
429 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
436 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
439 include_once
'./include/inc.header.php';
443 $nodedata = $tree->getNodeData(
$ref_id);
445 $nodearray = $tree->getSubTree($nodedata);
447 $filter = is_array($types) ? $types : array(
"0" =>
"root",
"adm",
"lngf",
"mail",
448 "usrf",
"rolf",
"taxf",
"trac",
"pays",
449 "auth",
"chac",
"objf",
"recf",
"assf",
450 "stys",
"seas",
"extt");
452 foreach($nodearray as $node) {
453 if (!in_array($node[
'type'], $filter)) {
461 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
464 $xml_writer->setObjects($nodes);
465 $xml_writer->enableOperations(
false);
469 $xml_writer->setUserId($user_id);
472 if($xml_writer->start())
474 return $xml_writer->getXML();
477 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
485 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
489 return $this->
__raiseError(
'No valid xml string given.',
494 include_once
'./include/inc.header.php';
495 global $rbacsystem, $objDefinition,$ilUser,
$lng, $ilObjDataCache;
505 return $this->
__raiseError(
"Parent with ID $a_target_id has been deleted.",
'Client');
508 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
509 if(!in_array($target_obj->getType(),$allowed_types))
511 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
515 $allowed_subtypes = $objDefinition->getSubObjects($target_obj->getType());
517 foreach($allowed_subtypes as $row)
519 if($row[
'name'] !=
'rolf')
521 $allowed[] = $row[
'name'];
525 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
529 $xml_parser->startParsing();
531 return $this->
__raiseError($se->getMessage(), $se->getCode());
534 foreach($xml_parser->getObjectData() as $object_data)
537 if(!in_array($object_data[
'type'],$allowed))
539 return $this->
__raiseError(
'Objects of type: '.$object_data[
'type'].
' are not allowed to be subobjects of type '.
540 $target_obj->getType().
'!',
543 if(!$rbacsystem->checkAccess(
'create',$a_target_id,$object_data[
'type']))
545 return $this->
__raiseError(
'No permission to create objects of type '.$object_data[
'type'].
'!',
548 if($object_data[
'type'] ==
'crs')
550 return $this->
__raiseError(
'Cannot create course objects. Use method addCourse() ',
557 return $this->
__raiseError(
'An object with import id '.$object_data[
'import_id'].
' already exists!',
562 $class_name = $objDefinition->getClassName($object_data[
'type']);
563 $location = $objDefinition->getLocation($object_data[
'type']);
565 $class_constr =
"ilObj".$class_name;
566 require_once(
$location.
"/class.ilObj".$class_name.
".php");
568 $newObj =
new $class_constr();
570 if(isset($object_data[
'owner']) && strlen($object_data[
'owner']))
572 if((
int)$object_data[
'owner'])
575 $ilObjDataCache->lookupType((
int)$object_data[
'owner']) ==
'usr')
577 $newObj->setOwner((
int)$object_data[
'owner']);
585 $newObj->setOwner((
int)$usr_id);
590 $newObj->setType($object_data[
'type']);
591 if(strlen($object_data[
'import_id']))
593 $newObj->setImportId($object_data[
'import_id']);
595 $newObj->setTitle($object_data[
'title']);
596 $newObj->setDescription($object_data[
'description']);
598 $newObj->createReference();
599 $newObj->putInTree($a_target_id);
600 $newObj->setPermissions($a_target_id);
601 $newObj->initDefaultRoles();
603 switch($object_data[
'type'])
607 $newObj->addMember($object_data[
'owner'] ? $object_data[
'owner'] : $ilUser->getId(),
608 $newObj->getDefaultAdminRole());
613 $newObj->createLMTree();
616 $newObj->addTranslation($object_data[
"title"],$object_data[
"description"], $lng->getLangKey(), $lng->getLangKey());
629 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
631 if(!is_numeric($a_source_id))
636 if(!is_numeric($a_target_id))
642 include_once
'./include/inc.header.php';
643 global $objDefinition, $rbacsystem, $tree;
656 if(!$objDefinition->allowLink($source_obj->getType()) and
657 $source_obj->getType() !=
'cat' and
658 $source_obj->getType() !=
'crs')
660 return $this->
__raiseError(
'Linking of object type: '.$source_obj->getType().
' is not allowed',
664 $allowed_subtypes = $objDefinition->getSubObjects($target_obj->getType());
665 foreach($allowed_subtypes as $row)
667 if($row[
'name'] !=
'rolf')
669 $allowed[] = $row[
'name'];
672 if(!in_array($source_obj->getType(),$allowed))
674 return $this->
__raiseError(
'Objects of type: '.$source_obj->getType().
' are not allowed to be subobjects of type '.
675 $target_obj->getType().
'!',
680 if(!$rbacsystem->checkAccess(
'create',$target_obj->getRefId(),$source_obj->getType()))
682 return $this->
__raiseError(
'No permission to create objects of type '.$source_obj->getType().
'!',
685 if(!$rbacsystem->checkAccess(
'delete',$source_obj->getRefId()))
687 return $this->
__raiseError(
'No permission to link object with id: '.$source_obj->getRefId().
'!',
692 if($source_obj->getType() !=
'cat' and $source_obj->getType() !=
'crs')
695 $possibleChilds = $tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
696 foreach ($possibleChilds as $child)
698 if ($child[
"obj_id"] == $source_obj->getId())
699 return $this->
__raiseError(
"Object already linked to target.",
"Client");
704 $new_ref_id = $source_obj->createReference();
705 $source_obj->putInTree($target_obj->getRefId());
706 $source_obj->setPermissions($target_obj->getRefId());
707 $source_obj->initDefaultRoles();
709 return $new_ref_id ? $new_ref_id :
"0";
713 switch($source_obj->getType())
716 include_once(
'./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
721 include_once(
'./Modules/CourseReference/classes/class.ilObjCourseReference.php');
726 $new_ref_id = $new_ref->createReference();
728 $new_ref->putInTree($target_obj->getRefId());
729 $new_ref->setPermissions($target_obj->getRefId());
730 $new_ref->initDefaultRoles();
732 $new_ref->setTargetId($source_obj->getId());
735 return $new_ref_id ? $new_ref_id : 0;
745 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
747 if(!is_numeric($reference_id))
752 include_once
'./include/inc.header.php';
753 global $tree, $rbacsystem, $rbacadmin;
757 return $this->
__raiseError(
'No valid reference id given.',
760 if(!$rbacsystem->checkAccess(
'delete',$del_obj->getRefId()))
762 return $this->
__raiseError(
'No permission to delete object with id: '.$del_obj->getRefId().
'!',
767 if($tree->isDeleted($reference_id))
769 return $this->
__raiseError(
'Node already deleted',
'Server');
772 if($del_obj->getType() ==
'rolf')
774 return $this->
__raiseError(
'Delete is not available for role folders.',
'Client');
777 $subnodes = $tree->getSubtree($tree->getNodeData($reference_id));
778 foreach($subnodes as $subnode)
780 $rbacadmin->revokePermission($subnode[
"child"]);
784 if(!$tree->saveSubTree($reference_id))
786 return $this->
__raiseError(
'Node already deleted',
'Client');
796 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
798 if(!strlen($import_id))
800 return $this->
__raiseError(
'No import id given. Aborting!',
803 include_once
'./include/inc.header.php';
804 global $rbacsystem, $tree,
$ilLog;
809 return $this->
__raiseError(
'No object found with import id: '.$import_id,
814 $permission_ok =
false;
817 if($rbacsystem->checkAccess(
'delete',$ref_id))
819 $permission_ok =
true;
825 return $this->
__raiseError(
'No permission to delete the object with import id: '.$import_id,
830 foreach($ref_ids as $ref_id)
833 $node_data = $tree->getNodeData($ref_id);
834 $subtree_nodes = $tree->getSubtree($node_data);
836 foreach($subtree_nodes as $node)
838 $ilLog->write(
'Soap: removeFromSystemByImportId(). Deleting object with title id: '.$node[
'title']);
840 if(!is_object($tmp_obj))
842 return $this->
__raiseError(
'Cannot create instance of reference id: '.$node[
'ref_id'],
848 $tree->deleteTree($node_data);
860 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
864 return $this->
__raiseError(
'No valid xml string given.',
869 include_once
'./include/inc.header.php';
870 global $rbacreview, $rbacsystem,
$lng;
872 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
875 $xml_parser->startParsing();
877 return $this->
__raiseError($se->getMessage(), $se->getCode());
882 $object_datas = $xml_parser->getObjectData();
883 foreach($object_datas as & $object_data)
885 if(!$object_data[
"obj_id"])
887 return $this->
__raiseError(
'No obj_id in xml found.',
'Client');
889 elseif ((
int) $object_data[
"obj_id"] == -1 && count($object_data[
"references"])>0)
893 foreach ($object_data[
"references"] as $refid)
903 if (!$obj_id_from_refid)
905 return $this->
__raiseError(
'No obj_id found for reference id '.$object_data[
"references"][0],
'CLIENT_OBJECT_NOT_FOUND');
909 $object_data[
"obj_id"] = $obj_id_from_refid;
914 if ($tmp_obj == null)
916 return $this->
__raiseError(
'No object for id '.$object_data[
'obj_id'].
'!',
'CLIENT_OBJECT_NOT_FOUND');
920 $object_data[
"instance"] = $tmp_obj;
923 if($object_data[
'type'] ==
'role')
925 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data[
'obj_id'],
true);
926 $rolf_id = $rolf_ids[0];
928 if(!$rbacsystem->checkAccess(
'write',$rolf_id))
930 return $this->
__raiseError(
'No write permission for object with id '.$object_data[
'obj_id'].
'!',
'Client');
935 $permission_ok =
false;
938 if($rbacsystem->checkAccess(
'write',$object_data[
'obj_id']))
940 $permission_ok =
true;
946 return $this->
__raiseError(
'No write permission for object with id '.$object_data[
'obj_id'].
'!',
'Client');
951 if (count ($object_datas) > 0)
953 foreach($object_datas as $object_data)
955 $tmp_obj = $object_data[
"instance"];
956 $tmp_obj->setTitle($object_data[
'title']);
957 $tmp_obj->setDescription($object_data[
'description']);
958 switch ($object_data[
'type']) {
960 $tmp_obj->updateTranslation($object_data[
"title"],$object_data[
"description"], $lng->getLangKey(), $lng->getLangKey());
964 if(strlen($object_data[
'owner']) && is_numeric($object_data[
'owner']))
966 $tmp_obj->setOwner($object_data[
'owner']);
967 $tmp_obj->updateOwner();
980 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
984 include_once
'./include/inc.header.php';
985 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
986 global $rbacreview, $rbacadmin, $objDefinition, $rbacsystem,
$lng, $ilUser, $tree;
991 return $this->
__raiseError(
'No valid source given.',
'Client');
997 return $this->
__raiseError(
'No valid target given.',
'Client');
1003 return $this->
__raiseError(
'Object is trashed.',
'Client');
1008 return $this->
__raiseError(
'Object is trashed.',
'Client');
1012 if ($this->
isFault($canAddType))
1019 foreach ($possibleChilds as $child)
1021 if ($child[
"obj_id"] ==
$ref_id)
1022 return $this->
__raiseError(
"Object already exists in target.",
"Client");
1026 $node_data = $tree->getNodeData(
$ref_id);
1027 $subtree_nodes = $tree->getSubTree($node_data);
1029 $all_node_data[] = $node_data;
1030 $all_subtree_nodes[] = $subtree_nodes;
1033 foreach ($subtree_nodes as $node)
1035 if($node[
'type'] ==
'rolf')
1040 if (!$rbacsystem->checkAccess(
'delete',$node[
"ref_id"]))
1042 $no_cut[] = $node[
"ref_id"];
1049 return $this->
__raiseError(
"Object contains references which you are not allowed to delete.",
"Client");
1055 return $this->
__raiseError(
"Cannot move object into itself.",
"Client");
1058 $old_parent = $tree->getParentId(
$ref_id);
1060 $rbacadmin->adjustMovedObjectPermissions(
$ref_id,$old_parent);
1062 include_once(
'classes/class.ilConditionHandler.php');
1075 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
1080 include_once
'./include/inc.header.php';
1081 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1082 global $rbacreview, $objDefinition, $rbacsystem,
$lng, $ilUser;
1084 include_once
'./webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1087 $xml_parser->startParsing();
1089 return $this->
__raiseError($se->getMessage(),
"Client");
1093 if(!$rbacsystem->checkAccess(
'copy',$xml_parser->getSourceId()))
1095 return $this->
__raiseError(
"Missing copy permissions for object with reference id ".$xml_parser->getSourceId(),
'Client');
1099 $source_id = $xml_parser->getSourceId();
1106 return $this->
__raiseError(
'No valid source given.',
'Client');
1112 return $this->
__raiseError(
'No valid target given.',
'Client');
1117 if ($this->
isFault($canAddType))
1123 $options = $xml_parser->getOptions();
1128 $clientid = substr($sid, strpos($sid,
"::") + 2);
1129 $sessionid = str_replace(
"::".$clientid,
"", $sid);
1131 return $source_object->cloneAllObject($sessionid, $clientid,
1132 $source_object_type,
1141 $wizard_options->saveOwner($ilUser->getId());
1142 $wizard_options->saveRoot($source_id);
1144 foreach($options as $source_id => $option)
1146 $wizard_options->addEntry($source_id,$option);
1148 $wizard_options->read();
1151 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1152 return is_object($newObject) ? $newObject->getRefId() : -1;
1159 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
1164 include_once
'./include/inc.header.php';
1165 global $ilAccess, $objDefinition, $rbacsystem,
$lng, $ilUser;
1167 if(!$rbacsystem->checkAccess(
'read',
$ref_id))
1169 return $this->
__raiseError(
"Missing read permissions for object with reference id ".
$ref_id,
'Client');
1174 return $this->
__raiseError(
"Object is in Trash",
'Client');
1177 $items = $tree->getPathFull(
$ref_id);
1179 include_once
'webservice/soap/classes/class.ilXMLResultSet.php';
1180 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1181 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
1184 $xmlResultSet->addColumn(
"ref_id");
1185 $xmlResultSet->addColumn(
"type");
1186 $xmlResultSet->addColumn(
"title");
1189 foreach ($items as $item) {
1190 if ($item[
"ref_id"] ==
$ref_id)
1192 if ($item[
"title"] ==
"ILIAS" && $item[
"type"] ==
"root")
1194 $item[
"title"] = $lng->txt(
"repository");
1198 $xmlResultSet->addRow($row);
1199 $row->setValue(
"ref_id", $item[
"ref_id"]);
1200 $row->setValue(
"type", $item[
"type"]);
1201 $row->setValue(
"title", $item[
"title"]);
1204 return $writer->getXML();
1210 global $objDefinition, $rbacsystem;
1212 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
1215 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
1218 $allowed_subtypes = $objDefinition->getSubObjects(
$target_type);
1221 foreach($allowed_subtypes as $row)
1223 if($row[
'name'] !=
'rolf')
1225 $allowed[] = $row[
'name'];
1229 if(!in_array($type, $allowed))
1231 return $this->
__raiseError(
'Objects of type: '.$type.
' are not allowed to be subobjects of type '.
$target_type.
'!',
'Client');
1233 if(!$rbacsystem->checkAccess(
'create',
$target_id, $type))
1235 return $this->
__raiseError(
'No permission to create objects of type '.$type.
'!',
'Client');