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.',
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);
363 $res->filter(ROOT_FOLDER_ID,
true);
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);
493 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
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.',
557 if (intval($ref_id) == SYSTEM_FOLDER_ID) {
559 'No valid reference id given.',
571 include_once
'./Services/WebServices/FileManager/classes/class.ilFMSettings.php';
572 if (in_array(
'parent', (array) $types)) {
573 $objs[] = $target_obj;
577 foreach ($tree->getChilds($ref_id,
'title') as $child) {
578 if ($all or in_array($child[
'type'], $types)) {
585 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
590 $xml_writer->enableReferences(
false);
593 $xml_writer->enablePermissionCheck(
true);
594 $xml_writer->setObjects($objs);
595 $xml_writer->enableOperations(
true);
597 $xml_writer->setUserId($user_id);
600 if ($xml_writer->start()) {
601 #$GLOBALS['DIC']['ilLog']->write(__METHOD__.': '.$xml_writer->getXML()); 602 return $xml_writer->getXML();
605 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
613 if (!$this->__checkSession($sid)) {
619 $tree = $DIC[
'tree'];
621 $nodedata = $tree->getNodeData($ref_id);
622 $nodearray = $tree->getSubTree($nodedata);
625 $filter = (array) $types;
629 $objDefinition = $DIC[
'objDefinition'];
630 foreach ($nodearray as $node) {
631 if (!$objDefinition->isAdministrationObject($node[
'type']) && !$objDefinition->isSystemObject($node[
'type'])) {
632 if (!in_array($node[
'type'], $filter)) {
641 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
644 $xml_writer->enablePermissionCheck(
true);
645 $xml_writer->setObjects($nodes);
646 $xml_writer->enableOperations(
false);
649 $xml_writer->setUserId($user_id);
652 if ($xml_writer->start()) {
653 return $xml_writer->getXML();
656 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
659 public function addObject($sid, $a_target_id, $a_xml)
664 if (!$this->__checkSession($sid)) {
667 if (!strlen($a_xml)) {
669 'No valid xml string given.',
676 $rbacsystem = $DIC[
'rbacsystem'];
677 $objDefinition = $DIC[
'objDefinition'];
680 $ilObjDataCache = $DIC[
'ilObjDataCache'];
684 'No valid target given.',
690 return $this->
__raiseError(
"Parent with ID $a_target_id has been deleted.",
'Client');
693 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
694 if (!in_array($target_obj->getType(), $allowed_types)) {
696 'No valid target type. Target must be reference id of "course, group, category or folder"',
701 $allowed_subtypes = $target_obj->getPossibleSubObjects();
703 foreach ($allowed_subtypes as $row) {
704 if ($row[
'name'] !=
'rolf') {
705 $allowed[] = $row[
'name'];
709 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
713 $xml_parser->startParsing();
715 return $this->
__raiseError($se->getMessage(),
'Client');
720 foreach ($xml_parser->getObjectData() as $object_data) {
727 if (!in_array($object_data[
'type'], $allowed)) {
729 'Objects of type: ' . $object_data[
'type'] .
' are not allowed to be subobjects of type ' .
730 $target_obj->getType() .
'!',
734 if (!$rbacsystem->checkAccess(
'create', $a_target_id, $object_data[
'type'])) {
736 'No permission to create objects of type ' . $object_data[
'type'] .
'!',
753 'An object with import id ' . $object_data[
'import_id'] .
' already exists!',
759 $class_name = $objDefinition->getClassName($object_data[
'type']);
760 $location = $objDefinition->getLocation($object_data[
'type']);
762 $class_constr =
"ilObj" . $class_name;
763 require_once(
$location .
"/class.ilObj" . $class_name .
".php");
765 $newObj =
new $class_constr();
767 if (isset($object_data[
'owner']) && strlen($object_data[
'owner'])) {
768 if ((
int) $object_data[
'owner']) {
770 $ilObjDataCache->lookupType((
int) $object_data[
'owner']) ==
'usr') {
771 $newObj->setOwner((
int) $object_data[
'owner']);
776 $newObj->setOwner((
int) $usr_id);
781 $newObj->setType($object_data[
'type']);
782 if (strlen($object_data[
'import_id'])) {
783 $newObj->setImportId($object_data[
'import_id']);
786 if ($objDefinition->supportsOfflineHandling($newObj->getType())) {
787 $newObj->setOfflineStatus((
bool) $object_data[
'offline']);
789 $newObj->setTitle($object_data[
'title']);
790 $newObj->setDescription($object_data[
'description']);
792 $newObj->createReference();
793 $newObj->putInTree($a_target_id);
794 $newObj->setPermissions($a_target_id);
796 switch ($object_data[
'type']) {
800 $object_data[
'owner'] ? $object_data[
'owner'] :
$ilUser->getId(),
801 $newObj->getDefaultAdminRole()
811 $newObj->createLMTree();
815 $newObj->addTranslation($object_data[
"title"], $object_data[
"description"],
$lng->getLangKey(),
true);
821 $ref_id = $newObj->getRefId();
822 return $ref_id ? $ref_id :
"0";
830 if (!$this->__checkSession($sid)) {
833 if (!is_numeric($a_source_id)) {
835 'No source id given.',
839 if (!is_numeric($a_target_id)) {
841 'No target id given.',
848 $objDefinition = $DIC[
'objDefinition'];
849 $rbacsystem = $DIC[
'rbacsystem'];
850 $tree = $DIC[
'tree'];
854 'No valid source id given.',
860 'No valid target id given.',
865 if (!$objDefinition->allowLink($source_obj->getType()) and
866 $source_obj->getType() !=
'cat' and
867 $source_obj->getType() !=
'crs') {
869 'Linking of object type: ' . $source_obj->getType() .
' is not allowed',
874 $allowed_subtypes = $target_obj->getPossibleSubObjects();
875 foreach ($allowed_subtypes as $row) {
876 if ($row[
'name'] !=
'rolf') {
877 $allowed[] = $row[
'name'];
880 if (!in_array($source_obj->getType(), $allowed)) {
882 'Objects of type: ' . $source_obj->getType() .
' are not allowed to be subobjects of type ' .
883 $target_obj->getType() .
'!',
889 if (!$rbacsystem->checkAccess(
'create', $target_obj->getRefId(), $source_obj->getType())) {
891 'No permission to create objects of type ' . $source_obj->getType() .
'!',
895 if (!$rbacsystem->checkAccess(
'delete', $source_obj->getRefId())) {
897 'No permission to link object with id: ' . $source_obj->getRefId() .
'!',
903 if ($source_obj->getType() !=
'cat' and $source_obj->getType() !=
'crs') {
905 $possibleChilds = $tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
906 foreach ($possibleChilds as $child) {
907 if ($child[
"obj_id"] == $source_obj->getId()) {
908 return $this->
__raiseError(
"Object already linked to target.",
"Client");
914 $new_ref_id = $source_obj->createReference();
915 $source_obj->putInTree($target_obj->getRefId());
916 $source_obj->setPermissions($target_obj->getRefId());
918 return $new_ref_id ? $new_ref_id :
"0";
920 switch ($source_obj->getType()) {
922 include_once(
'./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
927 include_once(
'./Modules/CourseReference/classes/class.ilObjCourseReference.php');
931 include_once(
'./Modules/GroupReference/classes/class.ilObjGroupReference.php');
936 $new_ref_id = $new_ref->createReference();
938 $new_ref->putInTree($target_obj->getRefId());
939 $new_ref->setPermissions($target_obj->getRefId());
941 $new_ref->setTargetId($source_obj->getId());
944 return $new_ref_id ? $new_ref_id : 0;
953 if (!$this->__checkSession($sid)) {
956 if (!is_numeric($reference_id)) {
958 'No reference id given.',
964 $tree = $DIC->repositoryTree();
965 $rbacsystem = $DIC[
'rbacsystem'];
966 $rbacadmin = $DIC[
'rbacadmin'];
967 $user = $DIC->user();
971 'No valid reference id given.',
975 if (!$rbacsystem->checkAccess(
'delete', $del_obj->getRefId())) {
977 'No permission to delete object with id: ' . $del_obj->getRefId() .
'!',
983 if ($tree->isDeleted($reference_id)) {
984 return $this->
__raiseError(
'Node already deleted',
'Server');
987 if ($del_obj->getType() ==
'rolf') {
988 return $this->
__raiseError(
'Delete is not available for role folders.',
'Client');
991 $subnodes = $tree->getSubtree($tree->getNodeData($reference_id));
992 foreach ($subnodes as $subnode) {
993 $rbacadmin->revokePermission($subnode[
"child"]);
995 if (!$tree->moveToTrash($reference_id,
true, $user->getId())) {
996 return $this->
__raiseError(
'Node already deleted',
'Client');
1007 if (!$this->__checkSession($sid)) {
1010 if (!strlen($import_id)) {
1012 'No import id given. Aborting!',
1018 $rbacsystem = $DIC[
'rbacsystem'];
1019 $tree = $DIC[
'tree'];
1025 'No object found with import id: ' . $import_id,
1031 $permission_ok =
false;
1033 if ($rbacsystem->checkAccess(
'delete', $ref_id)) {
1034 $permission_ok =
true;
1038 if (!$permission_ok) {
1040 'No permission to delete the object with import id: ' . $import_id,
1046 foreach ($ref_ids as $ref_id) {
1048 $node_data = $tree->getNodeData($ref_id);
1049 $subtree_nodes = $tree->getSubtree($node_data);
1051 foreach ($subtree_nodes as $node) {
1052 $ilLog->write(
'Soap: removeFromSystemByImportId(). Deleting object with title id: ' . $node[
'title']);
1054 if (!is_object($tmp_obj)) {
1056 'Cannot create instance of reference id: ' . $node[
'ref_id'],
1063 $tree->deleteTree($node_data);
1070 public function updateObjects($sid, $a_xml)
1075 if (!$this->__checkSession($sid)) {
1078 if (!strlen($a_xml)) {
1080 'No valid xml string given.',
1087 $rbacreview = $DIC[
'rbacreview'];
1088 $rbacsystem = $DIC[
'rbacsystem'];
1090 $ilAccess = $DIC[
'ilAccess'];
1091 $objDefinition = $DIC[
'objDefinition'];
1093 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
1096 $xml_parser->startParsing();
1098 return $this->
__raiseError($se->getMessage(),
'Client');
1100 return $this->
__raiseError($e->getMessage(),
'Client');
1105 $object_datas = $xml_parser->getObjectData();
1106 foreach ($object_datas as &$object_data) {
1113 if (!$object_data[
"obj_id"]) {
1114 return $this->
__raiseError(
'No obj_id in xml found.',
'Client');
1115 } elseif ((
int) $object_data[
"obj_id"] == -1 && count($object_data[
"references"])>0) {
1118 foreach ($object_data[
"references"] as $refid) {
1126 if (!$obj_id_from_refid) {
1127 return $this->
__raiseError(
'No obj_id found for reference id ' . $object_data[
"references"][0],
'CLIENT_OBJECT_NOT_FOUND');
1130 $object_data[
"obj_id"] = $obj_id_from_refid;
1135 if ($tmp_obj == null) {
1136 return $this->
__raiseError(
'No object for id ' . $object_data[
'obj_id'] .
'!',
'CLIENT_OBJECT_NOT_FOUND');
1138 $object_data[
"instance"] = $tmp_obj;
1141 if ($object_data[
'type'] ==
'role') {
1142 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data[
'obj_id'],
true);
1143 $rolf_id = $rolf_ids[0];
1145 if (!$rbacsystem->checkAccess(
'write', $rolf_id)) {
1146 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1149 $permission_ok =
false;
1151 if ($ilAccess->checkAccess(
'write',
'', $ref_id)) {
1152 $permission_ok =
true;
1156 if (!$permission_ok) {
1157 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1162 if (count($object_datas) > 0) {
1163 foreach ($object_datas as $object_data) {
1168 $tmp_obj = $object_data[
"instance"];
1169 $tmp_obj->setTitle($object_data[
'title']);
1170 $tmp_obj->setDescription($object_data[
'description']);
1172 if ($objDefinition->supportsOfflineHandling($tmp_obj->getType())) {
1173 $tmp_obj->setOfflineStatus($object_data[
'offline']);
1177 if (strlen($object_data[
'owner']) && is_numeric($object_data[
'owner'])) {
1178 $tmp_obj->setOwner($object_data[
'owner']);
1179 $tmp_obj->updateOwner();
1192 if (!$this->__checkSession($sid)) {
1196 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1199 $rbacreview = $DIC[
'rbacreview'];
1200 $rbacadmin = $DIC[
'rbacadmin'];
1201 $objDefinition = $DIC[
'objDefinition'];
1202 $rbacsystem = $DIC[
'rbacsystem'];
1205 $tree = $DIC[
'tree'];
1209 return $this->
__raiseError(
'No valid source given.',
'Client');
1214 return $this->
__raiseError(
'No valid target given.',
'Client');
1219 return $this->
__raiseError(
'Object is trashed.',
'Client');
1223 return $this->
__raiseError(
'Object is trashed.',
'Client');
1227 if ($this->
isFault($canAddType)) {
1232 $possibleChilds = $tree->getChildsByType(
$target_id, $ref_id);
1233 foreach ($possibleChilds as $child) {
1234 if ($child[
"obj_id"] == $ref_id) {
1235 return $this->
__raiseError(
"Object already exists in target.",
"Client");
1240 if ($tree->isGrandChild($ref_id,
$target_id)) {
1241 return $this->
__raiseError(
"Cannot move object into itself.",
"Client");
1244 $old_parent = $tree->getParentId($ref_id);
1246 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1248 include_once(
'./Services/Conditions/classes/class.ilConditionHandler.php');
1263 if (!$this->__checkSession($sid)) {
1268 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1271 $rbacreview = $DIC[
'rbacreview'];
1272 $objDefinition = $DIC[
'objDefinition'];
1273 $rbacsystem = $DIC[
'rbacsystem'];
1277 include_once
'./webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1280 $xml_parser->startParsing();
1282 return $this->
__raiseError($se->getMessage(),
"Client");
1286 if (!$rbacsystem->checkAccess(
'copy', $xml_parser->getSourceId())) {
1287 return $this->
__raiseError(
"Missing copy permissions for object with reference id " . $xml_parser->getSourceId(),
'Client');
1291 $source_id = $xml_parser->getSourceId();
1297 return $this->
__raiseError(
'No valid source given.',
'Client');
1302 return $this->
__raiseError(
'No valid target given.',
'Client');
1307 if ($this->
isFault($canAddType)) {
1312 $options = $xml_parser->getOptions();
1317 $clientid = substr($sid, strpos($sid,
"::") + 2);
1318 $sessionid = str_replace(
"::" . $clientid,
"", $sid);
1320 $ret = $source_object->cloneAllObject(
1323 $source_object_type,
1330 return $ret[
'ref_id'];
1335 $wizard_options->saveOwner(
$ilUser->getId());
1336 $wizard_options->saveRoot($source_id);
1338 foreach ($options as $source_id => $option) {
1339 $wizard_options->addEntry($source_id, $option);
1341 $wizard_options->read();
1344 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1345 return is_object($newObject) ? $newObject->getRefId() : -1;
1354 if (!$this->__checkSession($sid)) {
1360 $ilAccess = $DIC[
'ilAccess'];
1361 $objDefinition = $DIC[
'objDefinition'];
1362 $rbacsystem = $DIC[
'rbacsystem'];
1366 if (!$rbacsystem->checkAccess(
'read', $ref_id)) {
1367 return $this->
__raiseError(
"Missing read permissions for object with reference id " . $ref_id,
'Client');
1371 return $this->
__raiseError(
"Object is in Trash",
'Client');
1375 $tree = $DIC[
'tree'];
1377 $items = $tree->getPathFull($ref_id);
1379 include_once
'webservice/soap/classes/class.ilXMLResultSet.php';
1380 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1381 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
1384 $xmlResultSet->addColumn(
"ref_id");
1385 $xmlResultSet->addColumn(
"type");
1386 $xmlResultSet->addColumn(
"title");
1389 foreach ($items as $item) {
1390 if ($item[
"ref_id"] == $ref_id) {
1393 if ($item[
"title"] ==
"ILIAS" && $item[
"type"] ==
"root") {
1394 $item[
"title"] =
$lng->txt(
"repository");
1398 $xmlResultSet->addRow($row);
1399 $row->setValue(
"ref_id", $item[
"ref_id"]);
1400 $row->setValue(
"type", $item[
"type"]);
1401 $row->setValue(
"title", $item[
"title"]);
1404 return $writer->getXML();
1413 $objDefinition = $DIC[
'objDefinition'];
1414 $rbacsystem = $DIC[
'rbacsystem'];
1416 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
1418 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
1421 $allowed_subtypes = $objDefinition->getSubObjects(
$target_type);
1424 foreach ($allowed_subtypes as $row) {
1425 if ($row[
'name'] !=
'rolf') {
1426 $allowed[] = $row[
'name'];
1430 if (!in_array(
$type, $allowed)) {
1434 return $this->
__raiseError(
'No permission to create objects of type ' .
$type .
'!',
'Client');
1444 $ilAccess = $DIC[
'ilAccess'];
1446 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1449 if ($a_action ==
'create') {
1450 if (count($a_object_data[
'references']) > 1) {
1451 if (in_array($a_object_data[
'type'], array(
'cat',
'crs',
'grp',
'fold'))) {
1453 "Cannot create references for type " . $a_object_data[
'type'],
1458 if (count($a_object_data[
'references']) == 1) {
1459 if ($a_target_id != $a_object_data[
'references'][0][
'parent_id']) {
1461 "Cannot create references for type " . $a_object_data[
'type'],
1467 foreach ($a_object_data[
'references'] as $ref_data) {
1468 if (!$ref_data[
'parent_id']) {
1469 return $this->
__raiseError(
'Element References: No parent Id given!',
'Client');
1474 if ($this->
isFault($can_add_type)) {
1475 return $can_add_type;
1481 if ($a_action ==
'update') {
1482 foreach ($a_object_data[
'references'] as $ref_data) {
1483 if (!$ref_data[
'ref_id']) {
1484 return $this->
__raiseError(
'Element References: No reference id given!',
'Client');
1487 if (!$ilAccess->checkAccess(
'write',
'', $ref_data[
'ref_id'])) {
1488 return $this->
__raiseError(
'No write permission for object with reference id ' . $ref_data[
'ref_id'] .
'!',
'Client');
1500 $tree = $DIC[
'tree'];
1503 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1507 foreach ($a_object_data[
'references'] as $ref_data) {
1508 if (isset($ref_data[
'time_target']) ) {
1509 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1510 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1514 $items->toggleChangeable(isset($ref_data[
'time_target'][
'changeable']) ? $ref_data[
'time_target'][
'changeable'] : $old[
'changeable']);
1515 $items->setTimingStart(isset($ref_data[
'time_target'][
'starting_time']) ? $ref_data[
'time_target'][
'starting_time'] : $old[
'timing_start']);
1516 $items->setTimingEnd(isset($ref_data[
'time_target'][
'ending_time']) ? $ref_data[
'time_target'][
'ending_time'] : $old[
'timing_end']);
1517 $items->toggleVisible(isset($ref_data[
'time_target'][
'timing_visibility']) ? $ref_data[
'time_target'][
'timing_visibility'] : $old[
'visible']);
1518 $items->setSuggestionStart(isset($ref_data[
'time_target'][
'suggestion_start']) ? $ref_data[
'time_target'][
'suggestion_start'] : $old[
'suggestion_start']);
1519 $items->setSuggestionEnd(isset($ref_data[
'time_target'][
'suggestion_end']) ? $ref_data[
'time_target'][
'suggestion_end'] : $old[
'suggestion_end']);
1521 switch ($ref_data[
'time_target'][
'timing_type']) {
1537 $items->update($ref_data[
'ref_id']);
1548 $tree = $DIC[
'tree'];
1551 if (!isset($a_object_data[
'references']) or !count($a_object_data[
'references'])) {
1555 $original_id =
$source->getRefId();
1557 foreach ($a_object_data[
'references'] as $ref_data) {
1558 $new_ref_id = $ref_id = $original_id;
1559 if ($tree->getParentId($original_id) != $ref_data[
'parent_id']) {
1561 $new_ref_id =
$source->createReference();
1562 $source->putInTree($ref_data[
'parent_id']);
1563 $source->setPermissions($ref_data[
'parent_id']);
1565 if (isset($ref_data[
'time_target']) ) {
1566 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1567 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1569 if (!isset($ref_data[
'time_target'][
'starting_time'])) {
1570 $ref_data[
'time_target'][
'starting_time'] = time();
1572 if (!isset($ref_data[
'time_target'][
'ending_time'])) {
1573 $ref_data[
'time_target'][
'ending_time'] = time();
1577 $items->toggleChangeable($ref_data[
'time_target'][
'changeable']);
1578 $items->setTimingStart($ref_data[
'time_target'][
'starting_time']);
1579 $items->setTimingEnd($ref_data[
'time_target'][
'ending_time']);
1580 $items->toggleVisible($ref_data[
'time_target'][
'timing_visibility']);
1581 $items->setSuggestionStart($ref_data[
'time_target'][
'suggestion_start']);
1582 $items->setSuggestionEnd($ref_data[
'time_target'][
'suggestion_end']);
1584 switch ($ref_data[
'time_target'][
'timing_type']) {
1600 $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
static getInstance()
Get singleton instance.
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
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)