34 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
52 if (!$this->__checkSession($sid)) {
58 $access = $DIC->rbac()->system();
59 $logger = $DIC->logger()->wsrv();
61 if (!$access->checkAccess(
'edit_userassignment',
ROLE_FOLDER_ID)) {
62 $logger->warning(
'Missing permission "edit_userassignment".');
64 'Missing permission "edit_userassignment".',
71 $logger->warning(
'Invalid user id given. Cannot instantiate user for id: ' . $user_id);
73 'Invalid user id given. Cannot instantiate user for id: ' . $user_id,
78 foreach ($reference_ids as $ref_id) {
82 $logger->warning(
'Invalid reference id passed to SOAP::addDesktopItems: ' . $ref_id);
110 if (!$this->__checkSession($sid)) {
116 $access = $DIC->rbac()->system();
117 $logger = $DIC->logger()->wsrv();
119 if (!$access->checkAccess(
'edit_userassignment',
ROLE_FOLDER_ID)) {
120 $logger->warning(
'Missing permission "edit_userassignment".');
122 'Missing permission "edit_userassignment".',
129 $logger->warning(
'Invalid user id given. Cannot instantiate user for id: ' . $user_id);
131 'Invalid user id given. Cannot instantiate user for id: ' . $user_id,
136 foreach ($reference_ids as $ref_id) {
139 if (!$ref_obj instanceof
ilObject) {
140 $logger->warning(
'Invalid reference id passed to SOAP::removeDesktopItems: ' . $ref_id);
161 if (!$this->__checkSession($sid)) {
166 'No import id given.',
173 $ilLog = $DIC[
'ilLog'];
176 $ilLog->write(
"SOAP getObjIdByImportId(): import_id = " . $import_id .
' obj_id = ' . $obj_id);
178 return $obj_id ? $obj_id :
"0";
186 if (!$this->__checkSession($sid)) {
191 'No import id given.',
198 $tree = $DIC[
'tree'];
205 foreach ($ref_ids as $ref_id) {
207 if ($tree->isInTree($ref_id)) {
208 $new_refs[] = $ref_id;
211 return $new_refs ? $new_refs : array();
219 if (!$this->__checkSession($sid)) {
224 'No object id given.',
230 foreach ($ref_ids as $ref_id) {
231 $new_refs[] = $ref_id;
233 return $new_refs ? $new_refs : array();
249 if (!$this->__checkSession($sid)) {
254 if (!count($ref_ids) || !is_array($ref_ids)) {
255 return $this->
__raiseError(
'No reference id(s) given.',
'Client');
259 if (count($ref_ids)) {
260 foreach ($ref_ids as $ref_id) {
261 $ref_id = trim($ref_id);
262 if (!is_numeric($ref_id)) {
263 return $this->
__raiseError(
'Reference ID has to be numeric. Value: ' . $ref_id,
'Client');
268 return $this->
__raiseError(
'No object found for reference ID. Value: ' . $ref_id,
'Client');
271 return $this->
__raiseError(
'No untrashed reference found for reference ID. Value: ' . $ref_id,
'Client');
273 $obj_ids[] = $obj_id;
286 if (!$this->__checkSession($sid)) {
289 if (!is_numeric($a_ref_id)) {
291 'No valid reference id given. Please choose an existing reference id of an ILIAS object',
297 return $this->
__raiseError(
'Cannot create object instance!',
'Server');
302 return $this->
__raiseError(
"Object with ID $a_ref_id has been deleted.",
'Client');
305 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
308 $xml_writer->enablePermissionCheck(
true);
310 $xml_writer->setUserId($user_id);
311 $xml_writer->enableOperations(
true);
313 $xml_writer->setObjects(array($tmp_obj));
314 if ($xml_writer->start()) {
315 return $xml_writer->getXML();
318 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
326 if (!$this->__checkSession($sid)) {
329 if (!strlen($a_title)) {
331 'No valid query string given.',
336 include_once
'./Services/Search/classes/class.ilQueryParser.php';
339 $query_parser->setMinWordLength(0,
true);
341 $query_parser->parse();
342 if (!$query_parser->validate()) {
344 $query_parser->getMessage(),
349 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
351 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
354 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser); 355 $object_search->setFields(array(
'title'));
356 $object_search->appendToFilter(
'role');
357 $object_search->appendToFilter(
'rolt');
358 $res =&$object_search->performSearch();
360 $res->setUserId($user_id);
366 foreach (
$res->getUniqueResults() as $entry) {
367 if ($entry[
'type'] ==
'role' or $entry[
'type'] ==
'rolt') {
381 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
384 $xml_writer->enablePermissionCheck(
true);
386 $xml_writer->setUserId($user_id);
387 $xml_writer->enableOperations(
true);
389 $xml_writer->setObjects($objs);
390 if ($xml_writer->start()) {
391 return $xml_writer->getXML();
394 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
402 if (!$this->__checkSession($sid)) {
405 if (!is_array($types)) {
407 'Types must be an array of object types.',
411 if ($combination !=
'and' and $combination !=
'or') {
413 'No valid combination given. Must be "and" or "or".',
419 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
423 $typeFilterQuery =
'';
424 if (is_array($types)) {
425 foreach ($types as $objectType) {
426 if (0 === strlen($typeFilterQuery)) {
427 $typeFilterQuery .=
'+( ';
429 $typeFilterQuery .=
'OR';
431 $typeFilterQuery .= (
' type:' . (string) $objectType .
' ');
433 $typeFilterQuery .=
') ';
436 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
438 $query_parser->parse();
440 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
444 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
445 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
447 $filter->setCandidates($searcher->getResult());
450 $result_ids = $filter->getResults();
453 foreach ((array) $result_ids as $ref_id => $obj_id) {
459 include_once
'./Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
461 if ($filter->getResultObjIds()) {
462 $highlighter = $searcher->highlight($filter->getResultObjIds());
465 include_once
'./Services/Search/classes/class.ilQueryParser.php';
468 #$query_parser->setMinWordLength(3); 470 $query_parser->parse();
471 if (!$query_parser->validate()) {
473 $query_parser->getMessage(),
478 #include_once './Services/Search/classes/class.ilObjectSearchFactory.php'; 479 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser); 481 include_once
'./Services/Search/classes/Like/class.ilLikeObjectSearch.php';
484 $object_search->setFilter($types);
486 $res =&$object_search->performSearch();
488 $res->setUserId($user_id);
491 $res->setMaxHits(100);
497 foreach (
$res->getUniqueResults() as $entry) {
509 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
515 $xml_writer->enableReferences(
false);
516 $xml_writer->setMode(ilObjectXmlWriter::MODE_SEARCH_RESULT);
517 $xml_writer->setHighlighter($highlighter);
520 $xml_writer->enablePermissionCheck(
true);
523 $xml_writer->setUserId($user_id);
524 $xml_writer->enableOperations(
true);
527 $xml_writer->setObjects($objs);
528 if ($xml_writer->start()) {
529 #$GLOBALS['DIC']['ilLog']->write(__METHOD__.': '.$xml_writer->xmlDumpMem(true)); 530 return $xml_writer->getXML();
533 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
541 if (!$this->__checkSession($sid)) {
549 $tree = $DIC[
'tree'];
553 'No valid reference id given.',
559 'No valid reference id given.',
570 foreach ($tree->getChilds($ref_id,
'title') as $child) {
571 if ($all or in_array($child[
'type'], $types)) {
578 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
581 $xml_writer->enablePermissionCheck(
true);
582 $xml_writer->setObjects($objs);
583 $xml_writer->enableOperations(
true);
585 $xml_writer->setUserId($user_id);
588 if ($xml_writer->start()) {
589 #$GLOBALS['DIC']['ilLog']->write(__METHOD__.': '.$xml_writer->getXML()); 590 return $xml_writer->getXML();
593 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
601 if (!$this->__checkSession($sid)) {
607 $tree = $DIC[
'tree'];
608 $access = $DIC[
'ilAccess'];
610 $nodedata = $tree->getNodeData($ref_id);
611 $nodearray = $tree->getSubTree($nodedata);
614 $filter = (array) $types;
618 $objDefinition = $DIC[
'objDefinition'];
619 foreach ($nodearray as $node) {
620 if (!$objDefinition->isAdministrationObject($node[
'type']) && !$objDefinition->isSystemObject($node[
'type'])) {
621 if (!in_array($node[
'type'], $filter)) {
624 if ($access->checkAccess(
"read",
"", (
int) $node[
'ref_id'])) {
633 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
636 $xml_writer->enablePermissionCheck(
true);
637 $xml_writer->setObjects($nodes);
638 $xml_writer->enableOperations(
false);
641 $xml_writer->setUserId($user_id);
644 if ($xml_writer->start()) {
645 return $xml_writer->getXML();
648 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
651 public function addObject($sid, $a_target_id, $a_xml)
656 if (!$this->__checkSession($sid)) {
659 if (!strlen($a_xml)) {
661 'No valid xml string given.',
668 $rbacsystem = $DIC[
'rbacsystem'];
669 $objDefinition = $DIC[
'objDefinition'];
672 $ilObjDataCache = $DIC[
'ilObjDataCache'];
676 'No valid target given.',
682 return $this->
__raiseError(
"Parent with ID $a_target_id has been deleted.",
'Client');
685 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
686 if (!in_array($target_obj->getType(), $allowed_types)) {
688 'No valid target type. Target must be reference id of "course, group, category or folder"',
693 $allowed_subtypes = $target_obj->getPossibleSubObjects();
695 foreach ($allowed_subtypes as $row) {
696 if ($row[
'name'] !=
'rolf') {
697 $allowed[] = $row[
'name'];
701 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
705 $xml_parser->startParsing();
707 return $this->
__raiseError($se->getMessage(),
'Client');
712 foreach ($xml_parser->getObjectData() as $object_data) {
719 if (!in_array($object_data[
'type'], $allowed)) {
721 'Objects of type: ' . $object_data[
'type'] .
' are not allowed to be subobjects of type ' .
722 $target_obj->getType() .
'!',
726 if (!$rbacsystem->checkAccess(
'create', $a_target_id, $object_data[
'type'])) {
728 'No permission to create objects of type ' . $object_data[
'type'] .
'!',
745 'An object with import id ' . $object_data[
'import_id'] .
' already exists!',
751 $class_name = $objDefinition->getClassName($object_data[
'type']);
752 $location = $objDefinition->getLocation($object_data[
'type']);
754 $class_constr =
"ilObj" . $class_name;
755 require_once(
$location .
"/class.ilObj" . $class_name .
".php");
757 $newObj =
new $class_constr();
759 if (isset($object_data[
'owner']) && strlen($object_data[
'owner'])) {
760 if ((
int) $object_data[
'owner']) {
762 $ilObjDataCache->lookupType((
int) $object_data[
'owner']) ==
'usr') {
763 $newObj->setOwner((
int) $object_data[
'owner']);
768 $newObj->setOwner((
int) $usr_id);
773 $newObj->setType($object_data[
'type']);
774 if (strlen($object_data[
'import_id'])) {
775 $newObj->setImportId($object_data[
'import_id']);
778 if ($objDefinition->supportsOfflineHandling($newObj->getType())) {
779 $newObj->setOfflineStatus((
bool) $object_data[
'offline']);
781 $newObj->setTitle($object_data[
'title']);
782 $newObj->setDescription($object_data[
'description']);
784 $newObj->createReference();
785 $newObj->putInTree($a_target_id);
786 $newObj->setPermissions($a_target_id);
788 switch ($object_data[
'type']) {
792 $object_data[
'owner'] ? $object_data[
'owner'] :
$ilUser->getId(),
793 $newObj->getDefaultAdminRole()
803 $newObj->createLMTree();
807 $newObj->addTranslation($object_data[
"title"], $object_data[
"description"],
$lng->getLangKey(),
true);
813 $ref_id = $newObj->getRefId();
814 return $ref_id ? $ref_id :
"0";
822 if (!$this->__checkSession($sid)) {
825 if (!is_numeric($a_source_id)) {
827 'No source id given.',
831 if (!is_numeric($a_target_id)) {
833 'No target id given.',
840 $objDefinition = $DIC[
'objDefinition'];
841 $rbacsystem = $DIC[
'rbacsystem'];
842 $tree = $DIC[
'tree'];
846 'No valid source id given.',
852 'No valid target id given.',
857 if (!$objDefinition->allowLink($source_obj->getType()) and
858 $source_obj->getType() !=
'cat' and
859 $source_obj->getType() !=
'crs') {
861 'Linking of object type: ' . $source_obj->getType() .
' is not allowed',
866 $allowed_subtypes = $target_obj->getPossibleSubObjects();
867 foreach ($allowed_subtypes as $row) {
868 if ($row[
'name'] !=
'rolf') {
869 $allowed[] = $row[
'name'];
872 if (!in_array($source_obj->getType(), $allowed)) {
874 'Objects of type: ' . $source_obj->getType() .
' are not allowed to be subobjects of type ' .
875 $target_obj->getType() .
'!',
881 if (!$rbacsystem->checkAccess(
'create', $target_obj->getRefId(), $source_obj->getType())) {
883 'No permission to create objects of type ' . $source_obj->getType() .
'!',
887 if (!$rbacsystem->checkAccess(
'delete', $source_obj->getRefId())) {
889 'No permission to link object with id: ' . $source_obj->getRefId() .
'!',
895 if ($source_obj->getType() !=
'cat' and $source_obj->getType() !=
'crs') {
897 $possibleChilds = $tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
898 foreach ($possibleChilds as $child) {
899 if ($child[
"obj_id"] == $source_obj->getId()) {
900 return $this->
__raiseError(
"Object already linked to target.",
"Client");
906 $new_ref_id = $source_obj->createReference();
907 $source_obj->putInTree($target_obj->getRefId());
908 $source_obj->setPermissions($target_obj->getRefId());
910 return $new_ref_id ? $new_ref_id :
"0";
912 switch ($source_obj->getType()) {
914 include_once(
'./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
919 include_once(
'./Modules/CourseReference/classes/class.ilObjCourseReference.php');
923 include_once(
'./Modules/GroupReference/classes/class.ilObjGroupReference.php');
928 $new_ref_id = $new_ref->createReference();
930 $new_ref->putInTree($target_obj->getRefId());
931 $new_ref->setPermissions($target_obj->getRefId());
933 $new_ref->setTargetId($source_obj->getId());
936 return $new_ref_id ? $new_ref_id : 0;
945 if (!$this->__checkSession($sid)) {
948 if (!is_numeric($reference_id)) {
950 'No reference id given.',
956 $tree = $DIC->repositoryTree();
957 $rbacsystem = $DIC[
'rbacsystem'];
958 $rbacadmin = $DIC[
'rbacadmin'];
959 $user = $DIC->user();
963 'No valid reference id given.',
967 if (!$rbacsystem->checkAccess(
'delete', $del_obj->getRefId())) {
969 'No permission to delete object with id: ' . $del_obj->getRefId() .
'!',
975 if ($tree->isDeleted($reference_id)) {
976 return $this->
__raiseError(
'Node already deleted',
'Server');
979 if ($del_obj->getType() ==
'rolf') {
980 return $this->
__raiseError(
'Delete is not available for role folders.',
'Client');
983 $subnodes = $tree->getSubtree($tree->getNodeData($reference_id));
984 foreach ($subnodes as $subnode) {
985 $rbacadmin->revokePermission($subnode[
"child"]);
987 if (!$tree->moveToTrash($reference_id,
true, $user->getId())) {
988 return $this->
__raiseError(
'Node already deleted',
'Client');
999 if (!$this->__checkSession($sid)) {
1002 if (!strlen($import_id)) {
1004 'No import id given. Aborting!',
1010 $rbacsystem = $DIC[
'rbacsystem'];
1011 $tree = $DIC[
'tree'];
1012 $ilLog = $DIC[
'ilLog'];
1017 'No object found with import id: ' . $import_id,
1023 $permission_ok =
false;
1025 if ($rbacsystem->checkAccess(
'delete', $ref_id)) {
1026 $permission_ok =
true;
1030 if (!$permission_ok) {
1032 'No permission to delete the object with import id: ' . $import_id,
1038 foreach ($ref_ids as $ref_id) {
1040 $node_data = $tree->getNodeData($ref_id);
1041 $subtree_nodes = $tree->getSubtree($node_data);
1043 foreach ($subtree_nodes as $node) {
1044 $ilLog->write(
'Soap: removeFromSystemByImportId(). Deleting object with title id: ' . $node[
'title']);
1046 if (!is_object($tmp_obj)) {
1048 'Cannot create instance of reference id: ' . $node[
'ref_id'],
1055 $tree->deleteTree($node_data);
1062 public function updateObjects($sid, $a_xml)
1067 if (!$this->__checkSession($sid)) {
1070 if (!strlen($a_xml)) {
1072 'No valid xml string given.',
1079 $rbacreview = $DIC[
'rbacreview'];
1080 $rbacsystem = $DIC[
'rbacsystem'];
1082 $ilAccess = $DIC[
'ilAccess'];
1083 $objDefinition = $DIC[
'objDefinition'];
1085 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
1088 $xml_parser->startParsing();
1090 return $this->
__raiseError($se->getMessage(),
'Client');
1092 return $this->
__raiseError($e->getMessage(),
'Client');
1097 $object_datas = $xml_parser->getObjectData();
1098 foreach ($object_datas as &$object_data) {
1105 if (!$object_data[
"obj_id"]) {
1106 return $this->
__raiseError(
'No obj_id in xml found.',
'Client');
1107 } elseif ((
int) $object_data[
"obj_id"] == -1 && count($object_data[
"references"])>0) {
1110 foreach ($object_data[
"references"] as $refid) {
1118 if (!$obj_id_from_refid) {
1119 return $this->
__raiseError(
'No obj_id found for reference id ' . $object_data[
"references"][0],
'CLIENT_OBJECT_NOT_FOUND');
1122 $object_data[
"obj_id"] = $obj_id_from_refid;
1127 if ($tmp_obj == null) {
1128 return $this->
__raiseError(
'No object for id ' . $object_data[
'obj_id'] .
'!',
'CLIENT_OBJECT_NOT_FOUND');
1130 $object_data[
"instance"] = $tmp_obj;
1133 if ($object_data[
'type'] ==
'role') {
1134 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data[
'obj_id'],
true);
1135 $rolf_id = $rolf_ids[0];
1137 if (!$rbacsystem->checkAccess(
'write', $rolf_id)) {
1138 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1141 $permission_ok =
false;
1143 if ($ilAccess->checkAccess(
'write',
'', $ref_id)) {
1144 $permission_ok =
true;
1148 if (!$permission_ok) {
1149 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1154 if (count($object_datas) > 0) {
1155 foreach ($object_datas as $object_data) {
1160 $tmp_obj = $object_data[
"instance"];
1161 $tmp_obj->setTitle($object_data[
'title']);
1162 $tmp_obj->setDescription($object_data[
'description']);
1164 if ($objDefinition->supportsOfflineHandling($tmp_obj->getType())) {
1165 $tmp_obj->setOfflineStatus($object_data[
'offline']);
1169 if (strlen($object_data[
'owner']) && is_numeric($object_data[
'owner'])) {
1170 $tmp_obj->setOwner($object_data[
'owner']);
1171 $tmp_obj->updateOwner();
1184 if (!$this->__checkSession($sid)) {
1188 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1191 $rbacreview = $DIC[
'rbacreview'];
1192 $rbacadmin = $DIC[
'rbacadmin'];
1193 $objDefinition = $DIC[
'objDefinition'];
1194 $rbacsystem = $DIC[
'rbacsystem'];
1197 $tree = $DIC[
'tree'];
1201 return $this->
__raiseError(
'No valid source given.',
'Client');
1206 return $this->
__raiseError(
'No valid target given.',
'Client');
1211 return $this->
__raiseError(
'Object is trashed.',
'Client');
1215 return $this->
__raiseError(
'Object is trashed.',
'Client');
1219 if ($this->
isFault($canAddType)) {
1224 $possibleChilds = $tree->getChildsByType(
$target_id, $ref_id);
1225 foreach ($possibleChilds as $child) {
1226 if ($child[
"obj_id"] == $ref_id) {
1227 return $this->
__raiseError(
"Object already exists in target.",
"Client");
1232 if ($tree->isGrandChild($ref_id,
$target_id)) {
1233 return $this->
__raiseError(
"Cannot move object into itself.",
"Client");
1236 $old_parent = $tree->getParentId($ref_id);
1238 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1240 include_once(
'./Services/Conditions/classes/class.ilConditionHandler.php');
1255 if (!$this->__checkSession($sid)) {
1260 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1263 $rbacreview = $DIC[
'rbacreview'];
1264 $objDefinition = $DIC[
'objDefinition'];
1265 $rbacsystem = $DIC[
'rbacsystem'];
1269 include_once
'./webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1272 $xml_parser->startParsing();
1274 return $this->
__raiseError($se->getMessage(),
"Client");
1278 if (!$rbacsystem->checkAccess(
'copy', $xml_parser->getSourceId())) {
1279 return $this->
__raiseError(
"Missing copy permissions for object with reference id " . $xml_parser->getSourceId(),
'Client');
1283 $source_id = $xml_parser->getSourceId();
1289 return $this->
__raiseError(
'No valid source given.',
'Client');
1294 return $this->
__raiseError(
'No valid target given.',
'Client');
1299 if ($this->
isFault($canAddType)) {
1304 $options = $xml_parser->getOptions();
1309 $clientid = substr($sid, strpos($sid,
"::") + 2);
1310 $sessionid = str_replace(
"::" . $clientid,
"", $sid);
1312 $ret = $source_object->cloneAllObject(
1315 $source_object_type,
1322 return $ret[
'ref_id'];
1327 $wizard_options->saveOwner(
$ilUser->getId());
1328 $wizard_options->saveRoot($source_id);
1330 foreach ($options as $source_id => $option) {
1331 $wizard_options->addEntry($source_id, $option);
1333 $wizard_options->read();
1336 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1337 return is_object($newObject) ? $newObject->getRefId() : -1;
1346 if (!$this->__checkSession($sid)) {
1352 $ilAccess = $DIC[
'ilAccess'];
1353 $objDefinition = $DIC[
'objDefinition'];
1354 $rbacsystem = $DIC[
'rbacsystem'];
1358 if (!$rbacsystem->checkAccess(
'read', $ref_id)) {
1359 return $this->
__raiseError(
"Missing read permissions for object with reference id " . $ref_id,
'Client');
1363 return $this->
__raiseError(
"Object is in Trash",
'Client');
1367 $tree = $DIC[
'tree'];
1369 $items = $tree->getPathFull($ref_id);
1371 include_once
'webservice/soap/classes/class.ilXMLResultSet.php';
1372 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1373 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
1376 $xmlResultSet->addColumn(
"ref_id");
1377 $xmlResultSet->addColumn(
"type");
1378 $xmlResultSet->addColumn(
"title");
1381 foreach ($items as $item) {
1382 if ($item[
"ref_id"] == $ref_id) {
1385 if ($item[
"title"] ==
"ILIAS" && $item[
"type"] ==
"root") {
1386 $item[
"title"] =
$lng->txt(
"repository");
1390 $xmlResultSet->addRow($row);
1391 $row->setValue(
"ref_id", $item[
"ref_id"]);
1392 $row->setValue(
"type", $item[
"type"]);
1393 $row->setValue(
"title", $item[
"title"]);
1396 return $writer->getXML();
1405 $objDefinition = $DIC[
'objDefinition'];
1406 $rbacsystem = $DIC[
'rbacsystem'];
1408 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
1410 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
1413 $allowed_subtypes = $objDefinition->getSubObjects(
$target_type);
1416 foreach ($allowed_subtypes as $row) {
1417 if ($row[
'name'] !=
'rolf') {
1418 $allowed[] = $row[
'name'];
1422 if (!in_array(
$type, $allowed)) {
1426 return $this->
__raiseError(
'No permission to create objects of type ' .
$type .
'!',
'Client');
1436 $ilAccess = $DIC[
'ilAccess'];
1438 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1441 if ($a_action ==
'create') {
1442 if (count($a_object_data[
'references']) > 1) {
1443 if (in_array($a_object_data[
'type'], array(
'cat',
'crs',
'grp',
'fold'))) {
1445 "Cannot create references for type " . $a_object_data[
'type'],
1450 if (count($a_object_data[
'references']) == 1) {
1451 if ($a_target_id != $a_object_data[
'references'][0][
'parent_id']) {
1453 "Cannot create references for type " . $a_object_data[
'type'],
1459 foreach ($a_object_data[
'references'] as $ref_data) {
1460 if (!$ref_data[
'parent_id']) {
1461 return $this->
__raiseError(
'Element References: No parent Id given!',
'Client');
1466 if ($this->
isFault($can_add_type)) {
1467 return $can_add_type;
1473 if ($a_action ==
'update') {
1474 foreach ($a_object_data[
'references'] as $ref_data) {
1475 if (!$ref_data[
'ref_id']) {
1476 return $this->
__raiseError(
'Element References: No reference id given!',
'Client');
1479 if (!$ilAccess->checkAccess(
'write',
'', $ref_data[
'ref_id'])) {
1480 return $this->
__raiseError(
'No write permission for object with reference id ' . $ref_data[
'ref_id'] .
'!',
'Client');
1492 $tree = $DIC[
'tree'];
1493 $ilLog = $DIC[
'ilLog'];
1495 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1499 foreach ($a_object_data[
'references'] as $ref_data) {
1500 if (isset($ref_data[
'time_target']) ) {
1501 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1502 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1506 $items->toggleChangeable(isset($ref_data[
'time_target'][
'changeable']) ? $ref_data[
'time_target'][
'changeable'] : $old[
'changeable']);
1507 $items->setTimingStart(isset($ref_data[
'time_target'][
'starting_time']) ? $ref_data[
'time_target'][
'starting_time'] : $old[
'timing_start']);
1508 $items->setTimingEnd(isset($ref_data[
'time_target'][
'ending_time']) ? $ref_data[
'time_target'][
'ending_time'] : $old[
'timing_end']);
1509 $items->toggleVisible(isset($ref_data[
'time_target'][
'timing_visibility']) ? $ref_data[
'time_target'][
'timing_visibility'] : $old[
'visible']);
1510 $items->setSuggestionStart(isset($ref_data[
'time_target'][
'suggestion_start']) ? $ref_data[
'time_target'][
'suggestion_start'] : $old[
'suggestion_start']);
1511 $items->setSuggestionEnd(isset($ref_data[
'time_target'][
'suggestion_end']) ? $ref_data[
'time_target'][
'suggestion_end'] : $old[
'suggestion_end']);
1513 switch ($ref_data[
'time_target'][
'timing_type']) {
1529 $items->update($ref_data[
'ref_id']);
1540 $tree = $DIC[
'tree'];
1541 $ilLog = $DIC[
'ilLog'];
1543 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1547 $original_id =
$source->getRefId();
1549 foreach ($a_object_data[
'references'] as $ref_data) {
1550 $new_ref_id = $ref_id = $original_id;
1551 if ($tree->getParentId($original_id) != $ref_data[
'parent_id']) {
1553 $new_ref_id =
$source->createReference();
1554 $source->putInTree($ref_data[
'parent_id']);
1555 $source->setPermissions($ref_data[
'parent_id']);
1557 if (isset($ref_data[
'time_target']) ) {
1558 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1559 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1561 if (!isset($ref_data[
'time_target'][
'starting_time'])) {
1562 $ref_data[
'time_target'][
'starting_time'] = time();
1564 if (!isset($ref_data[
'time_target'][
'ending_time'])) {
1565 $ref_data[
'time_target'][
'ending_time'] = time();
1569 $items->toggleChangeable($ref_data[
'time_target'][
'changeable']);
1570 $items->setTimingStart($ref_data[
'time_target'][
'starting_time']);
1571 $items->setTimingEnd($ref_data[
'time_target'][
'ending_time']);
1572 $items->toggleVisible($ref_data[
'time_target'][
'timing_visibility']);
1573 $items->setSuggestionStart($ref_data[
'time_target'][
'suggestion_start']);
1574 $items->setSuggestionEnd($ref_data[
'time_target'][
'suggestion_end']);
1576 switch ($ref_data[
'time_target'][
'timing_type']) {
1592 $items->update($new_ref_id);
XML Writer for XMLResultSet.
Parses result XML from lucene search highlight.
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
getRefIdsByObjId($sid, $obj_id)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
searchObjects($sid, $types, $key, $combination, $user_id)
getRefIdsByImportId($sid, $import_id)
removeDesktopItems($sid, $user_id, $reference_ids)
Remove desktop items for user.
deleteObject($sid, $reference_id)
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static getItem($a_ref_id)
Get item data.
const TIMINGS_DEACTIVATED
static _isInTrash($a_ref_id)
checks wether object is in trash
static _lookupId($a_user_str)
Lookup id by login.
getObjectByReference($sid, $a_ref_id, $user_id)
SaxParserException thrown by ilSaxParser if property throwException is set.
moveObject($sid, $ref_id, $target_id)
Exception class for ObjectXMLWriter and ObjectXMLParser.
updateReferences($a_object_data)
static _getAllReferences($a_id)
get all reference ids of object
getXMLTree($sid, $ref_id, $types, $user_id)
static _lookupObjectId($a_ref_id)
lookup object id
addDesktopItems($sid, $user_id, $reference_ids)
Add desktop items for user.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
const TIMING_TEMPORARILY_AVAILABLE
static getInstance($a_user_id)
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
__raiseError($a_message, $a_code)
static _allocateCopyId()
Allocate a copy for further entries.
const IL_CRS_ADMIN
Base class for course and group participants.
static getTypeByRefId($a_ref_id, $stop_on_error=true)
get object type by reference id
addReference($sid, $a_source_id, $a_target_id)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
getPathForRefId($sid, $ref_id)
getTreeChilds($sid, $ref_id, $types, $user_id)
static _adjustMovedObjectConditions($a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
getObjIdsByRefIds($sid, $ref_ids)
Returns a array of object ids which match the references id, given by a comma seperated string...
initAuth($sid)
Init authentication.
getObjectsByTitle($sid, $a_title, $user_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getObjIdByImportId($sid, $import_id)
copyObject($sid, $copy_settings_xml)
copy object in repository $sid session id $settings_xml contains copy wizard settings following ilias...
addReferences($source, $a_object_data)
Class ilObjectActivation.
canAddType($type, $target_type, $target_id)
validateReferences($a_action, $a_object_data, $a_target_id=0)
static _lookupObjIdByImportId($a_import_id)
removeFromSystemByImportId($sid, $import_id)