34 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
51 if (!$this->__checkSession($sid)) {
57 $access = $DIC->rbac()->system();
58 $logger = $DIC->logger()->wsrv();
60 if (!$access->checkAccess(
'edit_userassignment', ROLE_FOLDER_ID)) {
61 $logger->warning(
'Missing permission "edit_userassignment".');
63 'Missing permission "edit_userassignment".',
70 $logger->warning(
'Invalid user id given. Cannot instantiate user for id: ' . $user_id);
72 'Invalid user id given. Cannot instantiate user for id: ' . $user_id,
77 foreach ($reference_ids as $ref_id) {
81 $logger->warning(
'Invalid reference id passed to SOAP::addDesktopItems: ' . $ref_id);
108 if (!$this->__checkSession($sid)) {
114 $access = $DIC->rbac()->system();
115 $logger = $DIC->logger()->wsrv();
117 if (!$access->checkAccess(
'edit_userassignment', ROLE_FOLDER_ID)) {
118 $logger->warning(
'Missing permission "edit_userassignment".');
120 'Missing permission "edit_userassignment".',
127 $logger->warning(
'Invalid user id given. Cannot instantiate user for id: ' . $user_id);
129 'Invalid user id given. Cannot instantiate user for id: ' . $user_id,
134 foreach ($reference_ids as $ref_id) {
137 if (!$ref_obj instanceof
ilObject) {
138 $logger->warning(
'Invalid reference id passed to SOAP::removeDesktopItems: ' . $ref_id);
158 if (!$this->__checkSession($sid)) {
163 'No import id given.',
173 $ilLog->write(
"SOAP getObjIdByImportId(): import_id = " . $import_id .
' obj_id = ' . $obj_id);
175 return $obj_id ? $obj_id :
"0";
183 if (!$this->__checkSession($sid)) {
188 'No import id given.',
195 $tree = $DIC[
'tree'];
202 foreach ($ref_ids as $ref_id) {
204 if (
$tree->isInTree($ref_id)) {
205 $new_refs[] = $ref_id;
208 return $new_refs ? $new_refs : array();
216 if (!$this->__checkSession($sid)) {
221 'No object id given.',
227 foreach ($ref_ids as $ref_id) {
228 $new_refs[] = $ref_id;
230 return $new_refs ? $new_refs : array();
246 if (!$this->__checkSession($sid)) {
251 if (!count($ref_ids) || !is_array($ref_ids)) {
252 return $this->
__raiseError(
'No reference id(s) given.',
'Client');
256 if (count($ref_ids)) {
257 foreach ($ref_ids as $ref_id) {
258 $ref_id = trim($ref_id);
259 if (!is_numeric($ref_id)) {
260 return $this->
__raiseError(
'Reference ID has to be numeric. Value: ' . $ref_id,
'Client');
265 return $this->
__raiseError(
'No object found for reference ID. Value: ' . $ref_id,
'Client');
268 return $this->
__raiseError(
'No untrashed reference found for reference ID. Value: ' . $ref_id,
'Client');
270 $obj_ids[] = $obj_id;
283 if (!$this->__checkSession($sid)) {
286 if (!is_numeric($a_ref_id)) {
288 'No valid reference id given. Please choose an existing reference id of an ILIAS object',
294 return $this->
__raiseError(
'Cannot create object instance!',
'Server');
299 return $this->
__raiseError(
"Object with ID $a_ref_id has been deleted.",
'Client');
302 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
305 $xml_writer->enablePermissionCheck(
true);
307 $xml_writer->setUserId($user_id);
308 $xml_writer->enableOperations(
true);
310 $xml_writer->setObjects(array($tmp_obj));
311 if ($xml_writer->start()) {
312 return $xml_writer->getXML();
315 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
323 if (!$this->__checkSession($sid)) {
326 if (!strlen($a_title)) {
328 'No valid query string given.',
333 include_once
'./Services/Search/classes/class.ilQueryParser.php';
336 $query_parser->setMinWordLength(0,
true);
338 $query_parser->parse();
339 if (!$query_parser->validate()) {
341 $query_parser->getMessage(),
346 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
348 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
351 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser); 352 $object_search->setFields(array(
'title'));
353 $object_search->appendToFilter(
'role');
354 $object_search->appendToFilter(
'rolt');
355 $res =&$object_search->performSearch();
357 $res->setUserId($user_id);
360 $res->filter(ROOT_FOLDER_ID,
true);
363 foreach (
$res->getUniqueResults() as $entry) {
364 if ($entry[
'type'] ==
'role' or $entry[
'type'] ==
'rolt') {
378 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
381 $xml_writer->enablePermissionCheck(
true);
383 $xml_writer->setUserId($user_id);
384 $xml_writer->enableOperations(
true);
386 $xml_writer->setObjects($objs);
387 if ($xml_writer->start()) {
388 return $xml_writer->getXML();
391 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
399 if (!$this->__checkSession($sid)) {
402 if (!is_array($types)) {
404 'Types must be an array of object types.',
408 if ($combination !=
'and' and $combination !=
'or') {
410 'No valid combination given. Must be "and" or "or".',
416 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
420 $typeFilterQuery =
'';
421 if (is_array($types)) {
422 foreach ($types as $objectType) {
423 if (0 === strlen($typeFilterQuery)) {
424 $typeFilterQuery .=
'+( ';
426 $typeFilterQuery .=
'OR';
428 $typeFilterQuery .= (
' type:' . (string) $objectType .
' ');
430 $typeFilterQuery .=
') ';
433 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
435 $query_parser->parse();
437 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
441 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
442 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
444 $filter->setCandidates($searcher->getResult());
447 $result_ids = $filter->getResults();
450 foreach ((array) $result_ids as $ref_id => $obj_id) {
456 include_once
'./Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
458 if ($filter->getResultObjIds()) {
459 $highlighter = $searcher->highlight($filter->getResultObjIds());
462 include_once
'./Services/Search/classes/class.ilQueryParser.php';
465 #$query_parser->setMinWordLength(3); 467 $query_parser->parse();
468 if (!$query_parser->validate()) {
470 $query_parser->getMessage(),
475 #include_once './Services/Search/classes/class.ilObjectSearchFactory.php'; 476 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser); 478 include_once
'./Services/Search/classes/Like/class.ilLikeObjectSearch.php';
481 $object_search->setFilter($types);
483 $res =&$object_search->performSearch();
485 $res->setUserId($user_id);
488 $res->setMaxHits(100);
490 $res->filter(ROOT_FOLDER_ID, $combination ==
'and' ?
true :
false);
494 foreach (
$res->getUniqueResults() as $entry) {
506 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
512 $xml_writer->enableReferences(
false);
513 $xml_writer->setMode(ilObjectXmlWriter::MODE_SEARCH_RESULT);
514 $xml_writer->setHighlighter($highlighter);
517 $xml_writer->enablePermissionCheck(
true);
520 $xml_writer->setUserId($user_id);
521 $xml_writer->enableOperations(
true);
524 $xml_writer->setObjects($objs);
525 if ($xml_writer->start()) {
526 #$GLOBALS['DIC']['ilLog']->write(__METHOD__.': '.$xml_writer->xmlDumpMem(true)); 527 return $xml_writer->getXML();
530 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
538 if (!$this->__checkSession($sid)) {
546 $tree = $DIC[
'tree'];
550 'No valid reference id given.',
554 if (intval($ref_id) == SYSTEM_FOLDER_ID) {
556 'No valid reference id given.',
568 include_once
'./Services/WebServices/FileManager/classes/class.ilFMSettings.php';
569 if (in_array(
'parent', (array) $types)) {
570 $objs[] = $target_obj;
574 foreach (
$tree->getChilds($ref_id,
'title') as $child) {
575 if ($all
or in_array($child[
'type'], $types)) {
582 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
587 $xml_writer->enableReferences(
false);
590 $xml_writer->enablePermissionCheck(
true);
591 $xml_writer->setObjects($objs);
592 $xml_writer->enableOperations(
true);
594 $xml_writer->setUserId($user_id);
597 if ($xml_writer->start()) {
598 #$GLOBALS['DIC']['ilLog']->write(__METHOD__.': '.$xml_writer->getXML()); 599 return $xml_writer->getXML();
602 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
610 if (!$this->__checkSession($sid)) {
616 $tree = $DIC[
'tree'];
618 $nodedata =
$tree->getNodeData($ref_id);
619 $nodearray =
$tree->getSubTree($nodedata);
622 $filter = (array) $types;
626 $objDefinition = $DIC[
'objDefinition'];
627 foreach ($nodearray as $node) {
628 if (!$objDefinition->isAdministrationObject($node[
'type']) && !$objDefinition->isSystemObject($node[
'type'])) {
629 if (!in_array($node[
'type'], $filter)) {
638 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
641 $xml_writer->enablePermissionCheck(
true);
642 $xml_writer->setObjects(
$nodes);
643 $xml_writer->enableOperations(
false);
646 $xml_writer->setUserId($user_id);
649 if ($xml_writer->start()) {
650 return $xml_writer->getXML();
653 return $this->
__raiseError(
'Cannot create object xml !',
'Server');
656 public function addObject($sid, $a_target_id, $a_xml)
661 if (!$this->__checkSession($sid)) {
664 if (!strlen($a_xml)) {
666 'No valid xml string given.',
673 $rbacsystem = $DIC[
'rbacsystem'];
674 $objDefinition = $DIC[
'objDefinition'];
677 $ilObjDataCache = $DIC[
'ilObjDataCache'];
681 'No valid target given.',
687 return $this->
__raiseError(
"Parent with ID $a_target_id has been deleted.",
'Client');
690 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
691 if (!in_array($target_obj->getType(), $allowed_types)) {
693 'No valid target type. Target must be reference id of "course, group, category or folder"',
698 $allowed_subtypes = $target_obj->getPossibleSubObjects();
700 foreach ($allowed_subtypes as
$row) {
701 if ($row[
'name'] !=
'rolf') {
702 $allowed[] = $row[
'name'];
706 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
710 $xml_parser->startParsing();
712 return $this->
__raiseError($se->getMessage(),
'Client');
717 foreach ($xml_parser->getObjectData() as $object_data) {
724 if (!in_array($object_data[
'type'], $allowed)) {
726 'Objects of type: ' . $object_data[
'type'] .
' are not allowed to be subobjects of type ' .
727 $target_obj->getType() .
'!',
731 if (!$rbacsystem->checkAccess(
'create', $a_target_id, $object_data[
'type'])) {
733 'No permission to create objects of type ' . $object_data[
'type'] .
'!',
750 'An object with import id ' . $object_data[
'import_id'] .
' already exists!',
756 $class_name = $objDefinition->getClassName($object_data[
'type']);
757 $location = $objDefinition->getLocation($object_data[
'type']);
759 $class_constr =
"ilObj" . $class_name;
760 require_once(
$location .
"/class.ilObj" . $class_name .
".php");
762 $newObj =
new $class_constr();
764 if (isset($object_data[
'owner']) && strlen($object_data[
'owner'])) {
765 if ((
int) $object_data[
'owner']) {
767 $ilObjDataCache->lookupType((
int) $object_data[
'owner']) ==
'usr') {
768 $newObj->setOwner((
int) $object_data[
'owner']);
773 $newObj->setOwner((
int) $usr_id);
778 $newObj->setType($object_data[
'type']);
779 if (strlen($object_data[
'import_id'])) {
780 $newObj->setImportId($object_data[
'import_id']);
783 if ($objDefinition->supportsOfflineHandling($newObj->getType())) {
784 $newObj->setOfflineStatus((
bool) $object_data[
'offline']);
786 $newObj->setTitle($object_data[
'title']);
787 $newObj->setDescription($object_data[
'description']);
789 $newObj->createReference();
790 $newObj->putInTree($a_target_id);
791 $newObj->setPermissions($a_target_id);
793 switch ($object_data[
'type']) {
797 $object_data[
'owner'] ? $object_data[
'owner'] :
$ilUser->getId(),
798 $newObj->getDefaultAdminRole()
808 $newObj->createLMTree();
812 $newObj->addTranslation($object_data[
"title"], $object_data[
"description"],
$lng->getLangKey(),
true);
818 $ref_id = $newObj->getRefId();
819 return $ref_id ? $ref_id :
"0";
827 if (!$this->__checkSession($sid)) {
830 if (!is_numeric($a_source_id)) {
832 'No source id given.',
836 if (!is_numeric($a_target_id)) {
838 'No target id given.',
845 $objDefinition = $DIC[
'objDefinition'];
846 $rbacsystem = $DIC[
'rbacsystem'];
847 $tree = $DIC[
'tree'];
851 'No valid source id given.',
857 'No valid target id given.',
862 if (!$objDefinition->allowLink($source_obj->getType())
and 863 $source_obj->getType() !=
'cat' and 864 $source_obj->getType() !=
'crs') {
866 'Linking of object type: ' . $source_obj->getType() .
' is not allowed',
871 $allowed_subtypes = $target_obj->getPossibleSubObjects();
872 foreach ($allowed_subtypes as
$row) {
873 if ($row[
'name'] !=
'rolf') {
874 $allowed[] = $row[
'name'];
877 if (!in_array($source_obj->getType(), $allowed)) {
879 'Objects of type: ' . $source_obj->getType() .
' are not allowed to be subobjects of type ' .
880 $target_obj->getType() .
'!',
886 if (!$rbacsystem->checkAccess(
'create', $target_obj->getRefId(), $source_obj->getType())) {
888 'No permission to create objects of type ' . $source_obj->getType() .
'!',
892 if (!$rbacsystem->checkAccess(
'delete', $source_obj->getRefId())) {
894 'No permission to link object with id: ' . $source_obj->getRefId() .
'!',
900 if ($source_obj->getType() !=
'cat' and $source_obj->getType() !=
'crs') {
902 $possibleChilds =
$tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
903 foreach ($possibleChilds as $child) {
904 if ($child[
"obj_id"] == $source_obj->getId()) {
905 return $this->
__raiseError(
"Object already linked to target.",
"Client");
911 $new_ref_id = $source_obj->createReference();
912 $source_obj->putInTree($target_obj->getRefId());
913 $source_obj->setPermissions($target_obj->getRefId());
915 return $new_ref_id ? $new_ref_id :
"0";
917 switch ($source_obj->getType()) {
919 include_once(
'./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
924 include_once(
'./Modules/CourseReference/classes/class.ilObjCourseReference.php');
928 include_once(
'./Modules/GroupReference/classes/class.ilObjGroupReference.php');
933 $new_ref_id = $new_ref->createReference();
935 $new_ref->putInTree($target_obj->getRefId());
936 $new_ref->setPermissions($target_obj->getRefId());
938 $new_ref->setTargetId($source_obj->getId());
941 return $new_ref_id ? $new_ref_id : 0;
950 if (!$this->__checkSession($sid)) {
953 if (!is_numeric($reference_id)) {
955 'No reference id given.',
961 $tree = $DIC[
'tree'];
962 $rbacsystem = $DIC[
'rbacsystem'];
963 $rbacadmin = $DIC[
'rbacadmin'];
967 'No valid reference id given.',
971 if (!$rbacsystem->checkAccess(
'delete', $del_obj->getRefId())) {
973 'No permission to delete object with id: ' . $del_obj->getRefId() .
'!',
979 if (
$tree->isDeleted($reference_id)) {
980 return $this->
__raiseError(
'Node already deleted',
'Server');
983 if ($del_obj->getType() ==
'rolf') {
984 return $this->
__raiseError(
'Delete is not available for role folders.',
'Client');
987 $subnodes =
$tree->getSubtree(
$tree->getNodeData($reference_id));
988 foreach ($subnodes as $subnode) {
989 $rbacadmin->revokePermission($subnode[
"child"]);
993 if (!
$tree->saveSubTree($reference_id,
true)) {
994 return $this->
__raiseError(
'Node already deleted',
'Client');
1005 if (!$this->__checkSession($sid)) {
1008 if (!strlen($import_id)) {
1010 'No import id given. Aborting!',
1016 $rbacsystem = $DIC[
'rbacsystem'];
1017 $tree = $DIC[
'tree'];
1023 'No object found with import id: ' . $import_id,
1029 $permission_ok =
false;
1031 if ($rbacsystem->checkAccess(
'delete', $ref_id)) {
1032 $permission_ok =
true;
1036 if (!$permission_ok) {
1038 'No permission to delete the object with import id: ' . $import_id,
1044 foreach ($ref_ids as $ref_id) {
1046 $node_data =
$tree->getNodeData($ref_id);
1047 $subtree_nodes =
$tree->getSubtree($node_data);
1049 foreach ($subtree_nodes as $node) {
1050 $ilLog->write(
'Soap: removeFromSystemByImportId(). Deleting object with title id: ' . $node[
'title']);
1052 if (!is_object($tmp_obj)) {
1054 'Cannot create instance of reference id: ' . $node[
'ref_id'],
1061 $tree->deleteTree($node_data);
1068 public function updateObjects($sid, $a_xml)
1073 if (!$this->__checkSession($sid)) {
1076 if (!strlen($a_xml)) {
1078 'No valid xml string given.',
1085 $rbacreview = $DIC[
'rbacreview'];
1086 $rbacsystem = $DIC[
'rbacsystem'];
1088 $ilAccess = $DIC[
'ilAccess'];
1089 $objDefinition = $DIC[
'objDefinition'];
1091 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
1094 $xml_parser->startParsing();
1096 return $this->
__raiseError($se->getMessage(),
'Client');
1098 return $this->
__raiseError($e->getMessage(),
'Client');
1103 $object_datas = $xml_parser->getObjectData();
1104 foreach ($object_datas as &$object_data) {
1111 if (!$object_data[
"obj_id"]) {
1112 return $this->
__raiseError(
'No obj_id in xml found.',
'Client');
1113 } elseif ((
int) $object_data[
"obj_id"] == -1 && count($object_data[
"references"])>0) {
1116 foreach ($object_data[
"references"] as $refid) {
1124 if (!$obj_id_from_refid) {
1125 return $this->
__raiseError(
'No obj_id found for reference id ' . $object_data[
"references"][0],
'CLIENT_OBJECT_NOT_FOUND');
1128 $object_data[
"obj_id"] = $obj_id_from_refid;
1133 if ($tmp_obj == null) {
1134 return $this->
__raiseError(
'No object for id ' . $object_data[
'obj_id'] .
'!',
'CLIENT_OBJECT_NOT_FOUND');
1136 $object_data[
"instance"] = $tmp_obj;
1139 if ($object_data[
'type'] ==
'role') {
1140 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data[
'obj_id'],
true);
1141 $rolf_id = $rolf_ids[0];
1143 if (!$rbacsystem->checkAccess(
'write', $rolf_id)) {
1144 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1147 $permission_ok =
false;
1149 if ($ilAccess->checkAccess(
'write',
'', $ref_id)) {
1150 $permission_ok =
true;
1154 if (!$permission_ok) {
1155 return $this->
__raiseError(
'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
'Client');
1160 if (count($object_datas) > 0) {
1161 foreach ($object_datas as $object_data) {
1166 $tmp_obj = $object_data[
"instance"];
1167 $tmp_obj->setTitle($object_data[
'title']);
1168 $tmp_obj->setDescription($object_data[
'description']);
1170 if ($objDefinition->supportsOfflineHandling($tmp_obj->getType())) {
1171 $tmp_obj->setOfflineStatus($object_data[
'offline']);
1175 if (strlen($object_data[
'owner']) && is_numeric($object_data[
'owner'])) {
1176 $tmp_obj->setOwner($object_data[
'owner']);
1177 $tmp_obj->updateOwner();
1190 if (!$this->__checkSession($sid)) {
1194 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1197 $rbacreview = $DIC[
'rbacreview'];
1198 $rbacadmin = $DIC[
'rbacadmin'];
1199 $objDefinition = $DIC[
'objDefinition'];
1200 $rbacsystem = $DIC[
'rbacsystem'];
1203 $tree = $DIC[
'tree'];
1207 return $this->
__raiseError(
'No valid source given.',
'Client');
1212 return $this->
__raiseError(
'No valid target given.',
'Client');
1217 return $this->
__raiseError(
'Object is trashed.',
'Client');
1221 return $this->
__raiseError(
'Object is trashed.',
'Client');
1225 if ($this->
isFault($canAddType)) {
1231 foreach ($possibleChilds as $child) {
1232 if ($child[
"obj_id"] == $ref_id) {
1233 return $this->
__raiseError(
"Object already exists in target.",
"Client");
1239 return $this->
__raiseError(
"Cannot move object into itself.",
"Client");
1242 $old_parent =
$tree->getParentId($ref_id);
1244 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1246 include_once(
'./Services/Conditions/classes/class.ilConditionHandler.php');
1261 if (!$this->__checkSession($sid)) {
1266 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1269 $rbacreview = $DIC[
'rbacreview'];
1270 $objDefinition = $DIC[
'objDefinition'];
1271 $rbacsystem = $DIC[
'rbacsystem'];
1275 include_once
'./webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1278 $xml_parser->startParsing();
1280 return $this->
__raiseError($se->getMessage(),
"Client");
1284 if (!$rbacsystem->checkAccess(
'copy', $xml_parser->getSourceId())) {
1285 return $this->
__raiseError(
"Missing copy permissions for object with reference id " . $xml_parser->getSourceId(),
'Client');
1289 $source_id = $xml_parser->getSourceId();
1295 return $this->
__raiseError(
'No valid source given.',
'Client');
1300 return $this->
__raiseError(
'No valid target given.',
'Client');
1305 if ($this->
isFault($canAddType)) {
1310 $options = $xml_parser->getOptions();
1315 $clientid = substr($sid, strpos($sid,
"::") + 2);
1316 $sessionid = str_replace(
"::" . $clientid,
"", $sid);
1318 $ret = $source_object->cloneAllObject(
1321 $source_object_type,
1328 return $ret[
'ref_id'];
1333 $wizard_options->saveOwner(
$ilUser->getId());
1334 $wizard_options->saveRoot($source_id);
1336 foreach (
$options as $source_id => $option) {
1337 $wizard_options->addEntry($source_id, $option);
1339 $wizard_options->read();
1342 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1343 return is_object($newObject) ? $newObject->getRefId() : -1;
1352 if (!$this->__checkSession($sid)) {
1358 $ilAccess = $DIC[
'ilAccess'];
1359 $objDefinition = $DIC[
'objDefinition'];
1360 $rbacsystem = $DIC[
'rbacsystem'];
1364 if (!$rbacsystem->checkAccess(
'read', $ref_id)) {
1365 return $this->
__raiseError(
"Missing read permissions for object with reference id " . $ref_id,
'Client');
1369 return $this->
__raiseError(
"Object is in Trash",
'Client');
1373 $tree = $DIC[
'tree'];
1375 $items =
$tree->getPathFull($ref_id);
1377 include_once
'webservice/soap/classes/class.ilXMLResultSet.php';
1378 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1379 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
1382 $xmlResultSet->addColumn(
"ref_id");
1383 $xmlResultSet->addColumn(
"type");
1384 $xmlResultSet->addColumn(
"title");
1387 foreach ($items as $item) {
1388 if ($item[
"ref_id"] == $ref_id) {
1391 if ($item[
"title"] ==
"ILIAS" && $item[
"type"] ==
"root") {
1392 $item[
"title"] =
$lng->txt(
"repository");
1396 $xmlResultSet->addRow(
$row);
1397 $row->setValue(
"ref_id", $item[
"ref_id"]);
1398 $row->setValue(
"type", $item[
"type"]);
1399 $row->setValue(
"title", $item[
"title"]);
1402 return $writer->getXML();
1411 $objDefinition = $DIC[
'objDefinition'];
1412 $rbacsystem = $DIC[
'rbacsystem'];
1414 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
1416 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
1419 $allowed_subtypes = $objDefinition->getSubObjects(
$target_type);
1422 foreach ($allowed_subtypes as
$row) {
1423 if ($row[
'name'] !=
'rolf') {
1424 $allowed[] = $row[
'name'];
1428 if (!in_array(
$type, $allowed)) {
1432 return $this->
__raiseError(
'No permission to create objects of type ' .
$type .
'!',
'Client');
1442 $ilAccess = $DIC[
'ilAccess'];
1444 if (!isset($a_object_data[
'references'])
or !count($a_object_data[
'references'])) {
1447 if ($a_action ==
'create') {
1448 if (count($a_object_data[
'references']) > 1) {
1449 if (in_array($a_object_data[
'type'], array(
'cat',
'crs',
'grp',
'fold'))) {
1451 "Cannot create references for type " . $a_object_data[
'type'],
1456 if (count($a_object_data[
'references']) == 1) {
1457 if ($a_target_id != $a_object_data[
'references'][0][
'parent_id']) {
1459 "Cannot create references for type " . $a_object_data[
'type'],
1465 foreach ($a_object_data[
'references'] as $ref_data) {
1466 if (!$ref_data[
'parent_id']) {
1467 return $this->
__raiseError(
'Element References: No parent Id given!',
'Client');
1472 if ($this->
isFault($can_add_type)) {
1473 return $can_add_type;
1479 if ($a_action ==
'update') {
1480 foreach ($a_object_data[
'references'] as $ref_data) {
1481 if (!$ref_data[
'ref_id']) {
1482 return $this->
__raiseError(
'Element References: No reference id given!',
'Client');
1485 if (!$ilAccess->checkAccess(
'write',
'', $ref_data[
'ref_id'])) {
1486 return $this->
__raiseError(
'No write permission for object with reference id ' . $ref_data[
'ref_id'] .
'!',
'Client');
1498 $tree = $DIC[
'tree'];
1501 if (!isset($a_object_data[
'references'])
or !count($a_object_data[
'references'])) {
1505 foreach ($a_object_data[
'references'] as $ref_data) {
1506 if (isset($ref_data[
'time_target']) ) {
1507 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1508 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1512 $items->toggleChangeable(isset($ref_data[
'time_target'][
'changeable']) ? $ref_data[
'time_target'][
'changeable'] : $old[
'changeable']);
1513 $items->setTimingStart(isset($ref_data[
'time_target'][
'starting_time']) ? $ref_data[
'time_target'][
'starting_time'] : $old[
'timing_start']);
1514 $items->setTimingEnd(isset($ref_data[
'time_target'][
'ending_time']) ? $ref_data[
'time_target'][
'ending_time'] : $old[
'timing_end']);
1515 $items->toggleVisible(isset($ref_data[
'time_target'][
'timing_visibility']) ? $ref_data[
'time_target'][
'timing_visibility'] : $old[
'visible']);
1516 $items->setSuggestionStart(isset($ref_data[
'time_target'][
'suggestion_start']) ? $ref_data[
'time_target'][
'suggestion_start'] : $old[
'suggestion_start']);
1517 $items->setSuggestionEnd(isset($ref_data[
'time_target'][
'suggestion_end']) ? $ref_data[
'time_target'][
'suggestion_end'] : $old[
'suggestion_end']);
1519 switch ($ref_data[
'time_target'][
'timing_type']) {
1535 $items->update($ref_data[
'ref_id']);
1546 $tree = $DIC[
'tree'];
1549 if (!isset($a_object_data[
'references'])
or !count($a_object_data[
'references'])) {
1553 $original_id =
$source->getRefId();
1555 foreach ($a_object_data[
'references'] as $ref_data) {
1556 $new_ref_id = $ref_id = $original_id;
1557 if (
$tree->getParentId($original_id) != $ref_data[
'parent_id']) {
1559 $new_ref_id =
$source->createReference();
1560 $source->putInTree($ref_data[
'parent_id']);
1561 $source->setPermissions($ref_data[
'parent_id']);
1563 if (isset($ref_data[
'time_target']) ) {
1564 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1565 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1567 if (!isset($ref_data[
'time_target'][
'starting_time'])) {
1568 $ref_data[
'time_target'][
'starting_time'] = time();
1570 if (!isset($ref_data[
'time_target'][
'ending_time'])) {
1571 $ref_data[
'time_target'][
'ending_time'] = time();
1575 $items->toggleChangeable($ref_data[
'time_target'][
'changeable']);
1576 $items->setTimingStart($ref_data[
'time_target'][
'starting_time']);
1577 $items->setTimingEnd($ref_data[
'time_target'][
'ending_time']);
1578 $items->toggleVisible($ref_data[
'time_target'][
'timing_visibility']);
1579 $items->setSuggestionStart($ref_data[
'time_target'][
'suggestion_start']);
1580 $items->setSuggestionEnd($ref_data[
'time_target'][
'suggestion_end']);
1582 switch ($ref_data[
'time_target'][
'timing_type']) {
1598 $items->update($new_ref_id);
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
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 _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
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 _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
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)