31 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
48 'No import id given.',
55 $ilLog = $DIC[
'ilLog'];
57 $ilLog->write(
"SOAP getObjIdByImportId(): import_id = " . $import_id .
' obj_id = ' . $obj_id);
58 return $obj_id ?:
"0";
74 'No import id given.',
81 $tree = $DIC->repositoryTree();
87 if ($tree->isInTree($ref_id)) {
107 'No object id given.',
114 foreach ($ref_ids as
$ref_id) {
132 if (!count($ref_ids)) {
133 return $this->
raiseError(
'No reference id(s) given.',
'Client');
137 foreach ($ref_ids as
$ref_id) {
138 $ref_id = trim($ref_id);
139 if (!is_numeric($ref_id)) {
140 return $this->
raiseError(
'Reference ID has to be numeric. Value: ' . $ref_id,
'Client');
145 return $this->
raiseError(
'No object found for reference ID. Value: ' . $ref_id,
'Client');
149 'No untrashed reference found for reference ID. Value: ' . $ref_id,
153 $obj_ids[] = $obj_id;
172 return $this->
raiseError(
'Cannot create object instance!',
'Server');
175 return $this->
raiseError(
"Object with ID $a_ref_id has been deleted.",
'Client');
177 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
180 $xml_writer->enablePermissionCheck(
true);
181 if (is_int($user_id)) {
182 $xml_writer->setUserId($user_id);
183 $xml_writer->enableOperations(
true);
185 $xml_writer->setObjects(array($tmp_obj));
186 if ($xml_writer->start()) {
187 return $xml_writer->getXML();
189 return $this->
raiseError(
'Cannot create object xml !',
'Server');
203 if ($a_title ===
'') {
205 'No valid query string given.',
209 include_once
'./Services/Search/classes/class.ilQueryParser.php';
211 $query_parser->setMinWordLength(0);
213 $query_parser->parse();
214 if (!$query_parser->validate()) {
216 $query_parser->getMessage(),
221 include_once
'./Services/Search/classes/class.ilObjectSearchFactory.php';
222 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
224 $object_search->setFields(array(
'title'));
225 $object_search->appendToFilter(
'role');
226 $object_search->appendToFilter(
'rolt');
227 $res = $object_search->performSearch();
229 $res->setUserId($user_id);
235 foreach (
$res->getUniqueResults() as $entry) {
236 if ($entry[
'type'] ===
'role' || $entry[
'type'] ===
'rolt') {
250 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
253 $xml_writer->enablePermissionCheck(
true);
254 if (is_int($user_id)) {
255 $xml_writer->setUserId($user_id);
256 $xml_writer->enableOperations(
true);
258 $xml_writer->setObjects($objs);
259 if ($xml_writer->start()) {
260 return $xml_writer->getXML();
262 return $this->
raiseError(
'Cannot create object xml !',
'Server');
268 public function searchObjects(
string $sid, ?array $types,
string $key,
string $combination, ?
int $user_id = null)
277 if ($combination !==
'and' && $combination !==
'or') {
279 'No valid combination given. Must be "and" or "or".',
285 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
289 $typeFilterQuery =
'';
290 if (is_array($types)) {
291 foreach ($types as $objectType) {
292 if ($typeFilterQuery ===
'') {
293 $typeFilterQuery .=
'+( ';
295 $typeFilterQuery .=
'OR';
297 $typeFilterQuery .= (
' type:' . $objectType .
' ');
299 $typeFilterQuery .=
') ';
302 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
304 $query_parser->parse();
306 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
310 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
311 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
313 $filter->setCandidates($searcher->getResult());
316 $result_ids = $filter->getResults();
319 foreach ($result_ids as
$ref_id => $obj_id) {
325 include_once
'./Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
327 if ($filter->getResultObjIds()) {
328 $highlighter = $searcher->highlight($filter->getResultObjIds());
331 include_once
'./Services/Search/classes/class.ilQueryParser.php';
335 $query_parser->parse();
336 if (!$query_parser->validate()) {
338 $query_parser->getMessage(),
343 include_once
'./Services/Search/classes/Like/class.ilLikeObjectSearch.php';
345 $object_search->setFilter($types);
346 $res = $object_search->performSearch();
347 if (is_int($user_id)) {
348 $res->setUserId($user_id);
350 $res->setMaxHits(100);
354 foreach (
$res->getUniqueResults() as $entry) {
366 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
369 $xml_writer->enableReferences(
false);
371 $xml_writer->setHighlighter($highlighter);
374 $xml_writer->enablePermissionCheck(
true);
377 $xml_writer->setUserId($user_id);
378 $xml_writer->enableOperations(
true);
381 $xml_writer->setObjects($objs);
382 if ($xml_writer->start()) {
383 return $xml_writer->getXML();
386 return $this->
raiseError(
'Cannot create object xml !',
'Server');
405 $tree = $DIC[
'tree'];
409 'No valid reference id given.',
415 'No valid reference id given.',
420 if (!is_array($types)) {
426 foreach ($tree->getChilds($ref_id,
'title') as $child) {
427 if ($all || in_array($child[
'type'], $types,
true)) {
434 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
436 $xml_writer->enablePermissionCheck(
true);
437 $xml_writer->setObjects($objs);
438 $xml_writer->enableOperations(
true);
439 if (is_int($user_id)) {
440 $xml_writer->setUserId($user_id);
443 if ($xml_writer->start()) {
444 return $xml_writer->getXML();
446 return $this->
raiseError(
'Cannot create object xml !',
'Server');
463 $tree = $DIC[
'tree'];
464 $access = $DIC[
'ilAccess'];
466 $nodedata = $tree->getNodeData($ref_id);
467 $nodearray = $tree->getSubTree($nodedata);
473 $objDefinition = $DIC[
'objDefinition'];
475 foreach ($nodearray as $node) {
477 !$objDefinition->isAdministrationObject($node[
'type']) &&
478 !$objDefinition->isSystemObject($node[
'type']) &&
479 !in_array($node[
'type'], $filter,
true) &&
480 $access->checkAccess(
"read",
"", (
int) $node[
'ref_id']) &&
486 include_once
'./webservice/soap/classes/class.ilObjectXMLWriter.php';
488 $xml_writer->enablePermissionCheck(
true);
489 $xml_writer->setObjects($nodes);
490 $xml_writer->enableOperations(
false);
492 if (is_int($user_id)) {
493 $xml_writer->setUserId($user_id);
496 if ($xml_writer->start()) {
497 return $xml_writer->getXML();
500 return $this->
raiseError(
'Cannot create object xml !',
'Server');
506 public function addObject(
string $sid,
int $a_target_id,
string $a_xml)
516 'No valid xml string given.',
523 $rbacsystem = $DIC[
'rbacsystem'];
524 $objDefinition = $DIC[
'objDefinition'];
527 $ilObjDataCache = $DIC[
'ilObjDataCache'];
531 'No valid target given.',
537 return $this->
raiseError(
"Parent with ID $a_target_id has been deleted.",
'Client');
540 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
541 if (!in_array($target_obj->getType(), $allowed_types)) {
543 'No valid target type. Target must be reference id of "course, group, category or folder"',
548 $allowed_subtypes = $target_obj->getPossibleSubObjects();
550 foreach ($allowed_subtypes as $row) {
551 if ($row[
'name'] !==
'rolf') {
552 $allowed[] = $row[
'name'];
556 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
560 $xml_parser->startParsing();
562 return $this->
raiseError($se->getMessage(),
'Client');
564 return $this->
raiseError($e->getMessage(),
'Client');
568 foreach ($xml_parser->getObjectData() as $object_data) {
575 if (!in_array($object_data[
'type'], $allowed,
true)) {
577 'Objects of type: ' . $object_data[
'type'] .
' are not allowed to be subobjects of type ' .
578 $target_obj->getType() .
'!',
582 if (!$rbacsystem->checkAccess(
'create', $a_target_id, $object_data[
'type'])) {
584 'No permission to create objects of type ' . $object_data[
'type'] .
'!',
592 'An object with import id ' . $object_data[
'import_id'] .
' already exists!',
598 $class_name = $objDefinition->getClassName($object_data[
'type']);
599 $location = $objDefinition->getLocation($object_data[
'type']);
601 $class_constr =
"ilObj" . $class_name;
602 require_once(
$location .
"/class.ilObj" . $class_name .
".php");
604 $newObj =
new $class_constr();
605 if (isset($object_data[
'owner']) && $object_data[
'owner'] !=
'') {
606 if ((
int) $object_data[
'owner']) {
608 $ilObjDataCache->lookupType((
int) $object_data[
'owner']) ===
'usr') {
609 $newObj->setOwner((
int) $object_data[
'owner']);
614 $newObj->setOwner((
int) $usr_id);
619 $newObj->setType($object_data[
'type']);
620 if ($object_data[
'import_id'] !=
'') {
621 $newObj->setImportId($object_data[
'import_id']);
624 if ($objDefinition->supportsOfflineHandling($newObj->getType())) {
625 $newObj->setOfflineStatus((
bool) $object_data[
'offline']);
627 $newObj->setTitle($object_data[
'title']);
628 $newObj->setDescription($object_data[
'description']);
630 $newObj->createReference();
631 $newObj->putInTree($a_target_id);
632 $newObj->setPermissions($a_target_id);
634 switch ($object_data[
'type']) {
638 $object_data[
'owner'] ?:
$ilUser->getId(),
639 $newObj->getDefaultAdminRole()
647 $newObj->createLMTree();
651 $newObj->addTranslation(
652 $object_data[
"title"],
653 $object_data[
"description"],
672 public function addReference(
string $sid,
int $a_source_id,
int $a_target_id)
683 $objDefinition = $DIC[
'objDefinition'];
684 $rbacsystem = $DIC[
'rbacsystem'];
685 $tree = $DIC[
'tree'];
689 'No valid source id given.',
695 'No valid target id given.',
700 if (!$objDefinition->allowLink($source_obj->getType()) and
701 $source_obj->getType() !==
'cat' and
702 $source_obj->getType() !==
'crs') {
704 'Linking of object type: ' . $source_obj->getType() .
' is not allowed',
709 $allowed_subtypes = $target_obj->getPossibleSubObjects();
711 foreach ($allowed_subtypes as $row) {
712 if ($row[
'name'] !==
'rolf') {
713 $allowed[] = $row[
'name'];
716 if (!in_array($source_obj->getType(), $allowed,
true)) {
718 'Objects of type: ' . $source_obj->getType() .
' are not allowed to be subobjects of type ' .
719 $target_obj->getType() .
'!',
725 if (!$rbacsystem->checkAccess(
'create', $target_obj->getRefId(), $source_obj->getType())) {
727 'No permission to create objects of type ' . $source_obj->getType() .
'!',
731 if (!$rbacsystem->checkAccess(
'delete', $source_obj->getRefId())) {
733 'No permission to link object with id: ' . $source_obj->getRefId() .
'!',
738 if ($source_obj->getType() !==
'cat' and $source_obj->getType() !==
'crs') {
740 $possibleChilds = $tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
741 foreach ($possibleChilds as $child) {
742 if ((
int) $child[
"obj_id"] === $source_obj->getId()) {
743 return $this->
raiseError(
"Object already linked to target.",
"Client");
749 $new_ref_id = $source_obj->createReference();
750 $source_obj->putInTree($target_obj->getRefId());
751 $source_obj->setPermissions($target_obj->getRefId());
753 return $new_ref_id ?:
"0";
757 switch ($source_obj->getType()) {
759 include_once(
'./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
764 include_once(
'./Modules/CourseReference/classes/class.ilObjCourseReference.php');
768 include_once(
'./Modules/GroupReference/classes/class.ilObjGroupReference.php');
773 $new_ref_id = $new_ref->createReference();
775 $new_ref->putInTree($target_obj->getRefId());
776 $new_ref->setPermissions($target_obj->getRefId());
778 $new_ref->setTargetId($source_obj->getId());
781 if (!$new_ref instanceof
ilObject) {
785 return $new_ref_id ?: 0;
802 $tree = $DIC->repositoryTree();
803 $rbacsystem = $DIC[
'rbacsystem'];
804 $rbacadmin = $DIC[
'rbacadmin'];
805 $user = $DIC->user();
809 'No valid reference id given.',
813 if (!$rbacsystem->checkAccess(
'delete', $del_obj->getRefId())) {
815 'No permission to delete object with id: ' . $del_obj->getRefId() .
'!',
820 if ($tree->isDeleted($reference_id)) {
821 return $this->
raiseError(
'Node already deleted',
'Server');
824 if ($del_obj->getType() ===
'rolf') {
825 return $this->
raiseError(
'Delete is not available for role folders.',
'Client');
828 $subnodes = $tree->getSubTree($tree->getNodeData($reference_id));
829 foreach ($subnodes as $subnode) {
830 $rbacadmin->revokePermission($subnode[
"child"]);
832 if (!$tree->moveToTrash($reference_id,
true, $user->getId())) {
833 return $this->
raiseError(
'Node already deleted',
'Client');
849 if ($import_id ===
'') {
851 'No import id given. Aborting!',
857 $rbacsystem = $DIC[
'rbacsystem'];
858 $tree = $DIC[
'tree'];
859 $ilLog = $DIC[
'ilLog'];
864 'No object found with import id: ' . $import_id,
870 $permission_ok =
false;
872 if ($rbacsystem->checkAccess(
'delete', $ref_id)) {
873 $permission_ok =
true;
877 if (!$permission_ok) {
879 'No permission to delete the object with import id: ' . $import_id,
885 foreach ($ref_ids as $ref_id) {
887 $node_data = $tree->getNodeData($ref_id);
888 $subtree_nodes = $tree->getSubtree($node_data);
890 foreach ($subtree_nodes as $node) {
891 $ilLog->write(
'Soap: removeFromSystemByImportId(). Deleting object with title id: ' . $node[
'title']);
893 if (!is_object($tmp_obj)) {
895 'Cannot create instance of reference id: ' . $node[
'ref_id'],
902 $tree->deleteTree($node_data);
910 public function updateObjects(
string $sid,
string $a_xml)
920 'No valid xml string given.',
927 $rbacreview = $DIC[
'rbacreview'];
928 $rbacsystem = $DIC[
'rbacsystem'];
930 $ilAccess = $DIC[
'ilAccess'];
931 $objDefinition = $DIC[
'objDefinition'];
933 include_once
'./webservice/soap/classes/class.ilObjectXMLParser.php';
936 $xml_parser->startParsing();
938 return $this->
raiseError($se->getMessage(),
'Client');
940 return $this->
raiseError($e->getMessage(),
'Client');
944 $object_datas = $xml_parser->getObjectData();
945 foreach ($object_datas as &$object_data) {
951 if (!$object_data[
"obj_id"]) {
952 return $this->
raiseError(
'No obj_id in xml found.',
'Client');
953 } elseif ((
int) $object_data[
"obj_id"] === -1 && count($object_data[
"references"]) > 0) {
956 foreach ($object_data[
"references"] as $refid) {
964 if (!$obj_id_from_refid) {
966 'No obj_id found for reference id ' . $object_data[
"references"][0],
967 'CLIENT_OBJECT_NOT_FOUND' 972 $object_data[
"obj_id"] = $obj_id_from_refid;
976 if ($tmp_obj === null) {
978 'No object for id ' . $object_data[
'obj_id'] .
'!',
979 'CLIENT_OBJECT_NOT_FOUND' 983 $object_data[
"instance"] = $tmp_obj;
985 if ($object_data[
'type'] ===
'role') {
986 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data[
'obj_id'],
true);
987 $rolf_id = $rolf_ids[0];
989 if (!$rbacsystem->checkAccess(
'write', $rolf_id)) {
991 'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
996 $permission_ok =
false;
998 if ($ilAccess->checkAccess(
'write',
'', $ref_id)) {
999 $permission_ok =
true;
1003 if (!$permission_ok) {
1005 'No write permission for object with id ' . $object_data[
'obj_id'] .
'!',
1011 unset($object_data);
1014 if (count($object_datas) > 0) {
1015 foreach ($object_datas as $object_data) {
1020 $tmp_obj = $object_data[
"instance"];
1021 $tmp_obj->setTitle($object_data[
'title']);
1022 $tmp_obj->setDescription($object_data[
'description']);
1024 if ($objDefinition->supportsOfflineHandling($tmp_obj->getType())) {
1025 $tmp_obj->setOfflineStatus($object_data[
'offline']);
1029 if ($object_data[
'owner'] !=
'' && is_numeric($object_data[
'owner'])) {
1030 $tmp_obj->setOwner($object_data[
'owner']);
1031 $tmp_obj->updateOwner();
1051 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1054 $rbacreview = $DIC[
'rbacreview'];
1055 $rbacadmin = $DIC[
'rbacadmin'];
1056 $objDefinition = $DIC[
'objDefinition'];
1057 $rbacsystem = $DIC[
'rbacsystem'];
1060 $tree = $DIC[
'tree'];
1064 return $this->
raiseError(
'No valid source given.',
'Client');
1069 return $this->
raiseError(
'No valid target given.',
'Client');
1074 return $this->
raiseError(
'Object is trashed.',
'Client');
1078 return $this->
raiseError(
'Object is trashed.',
'Client');
1081 $canAddType = $this->
canAddType($source_object_type, $target_object_type, $target_id);
1082 if ($this->
isFault($canAddType)) {
1087 $possibleChilds = $tree->getChildsByType($target_id, $ref_id);
1088 foreach ($possibleChilds as $child) {
1089 if ((
int) $child[
"obj_id"] === $ref_id) {
1090 return $this->
raiseError(
"Object already exists in target.",
"Client");
1095 if ($tree->isGrandChild($ref_id, $target_id)) {
1096 return $this->
raiseError(
"Cannot move object into itself.",
"Client");
1099 $old_parent = $tree->getParentId($ref_id);
1100 $tree->moveTree($ref_id, $target_id);
1101 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1110 public function copyObject(
string $sid,
string $copy_settings_xml)
1119 include_once
'./webservice/soap/classes/class.ilSoapUtils.php';
1122 $rbacreview = $DIC[
'rbacreview'];
1123 $objDefinition = $DIC[
'objDefinition'];
1124 $rbacsystem = $DIC[
'rbacsystem'];
1128 include_once
'./webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1131 $xml_parser->startParsing();
1133 return $this->
raiseError($se->getMessage(),
"Client");
1137 if (!$rbacsystem->checkAccess(
'copy', $xml_parser->getSourceId())) {
1139 "Missing copy permissions for object with reference id " . $xml_parser->getSourceId(),
1145 $source_id = $xml_parser->getSourceId();
1150 return $this->
raiseError(
'No valid source given.',
'Client');
1155 return $this->
raiseError(
'No valid target given.',
'Client');
1159 if ($this->
isFault($canAddType)) {
1164 $options = $xml_parser->getOptions();
1169 $clientid = substr($sid, strpos($sid,
"::") + 2);
1170 $sessionid = str_replace(
"::" . $clientid,
"", $sid);
1172 $ret = $source_object->cloneAllObject(
1175 $source_object_type,
1182 return $ret[
'ref_id'];
1188 $wizard_options->saveOwner(
$ilUser->getId());
1189 $wizard_options->saveRoot($source_id);
1191 foreach ($options as $source_id => $option) {
1192 $wizard_options->addEntry($source_id, $option);
1194 $wizard_options->read();
1197 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1198 return is_object($newObject) ? $newObject->getRefId() : -1;
1215 $ilAccess = $DIC[
'ilAccess'];
1216 $objDefinition = $DIC[
'objDefinition'];
1217 $rbacsystem = $DIC[
'rbacsystem'];
1221 if (!$rbacsystem->checkAccess(
'read', $ref_id)) {
1222 return $this->
raiseError(
"Missing read permissions for object with reference id " . $ref_id,
'Client');
1226 return $this->
raiseError(
"Object is in Trash",
'Client');
1230 $tree = $DIC[
'tree'];
1232 $items = $tree->getPathFull($ref_id);
1234 include_once
'webservice/soap/classes/class.ilXMLResultSet.php';
1235 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1236 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
1239 $xmlResultSet->addColumn(
"ref_id");
1240 $xmlResultSet->addColumn(
"type");
1241 $xmlResultSet->addColumn(
"title");
1244 foreach ($items as $item) {
1245 if ((
int) $item[
"ref_id"] === $ref_id) {
1248 if ($item[
"title"] ===
"ILIAS" && $item[
"type"] ===
"root") {
1249 $item[
"title"] =
$lng->txt(
"repository");
1253 $xmlResultSet->addRow($row);
1254 $row->setValue(
"ref_id", $item[
"ref_id"]);
1255 $row->setValue(
"type", $item[
"type"]);
1256 $row->setValue(
"title", $item[
"title"]);
1259 return $writer->getXML();
1267 $objDefinition = $DIC[
'objDefinition'];
1268 $rbacsystem = $DIC[
'rbacsystem'];
1270 $allowed_types = array(
'root',
'cat',
'grp',
'crs',
'fold');
1271 if (!in_array($target_type, $allowed_types,
true)) {
1273 'No valid target type. Target must be reference id of "course, group, category or folder"',
1278 $allowed_subtypes = $objDefinition->getSubObjects($target_type);
1281 foreach ($allowed_subtypes as $row) {
1282 if ($row[
'name'] !==
'rolf') {
1283 $allowed[] = $row[
'name'];
1287 if (!in_array($type, $allowed,
true)) {
1289 'Objects of type: ' . $type .
' are not allowed to be subobjects of type ' . $target_type .
'!',
1293 if (!$rbacsystem->checkAccess(
'create', $target_id, $type)) {
1294 return $this->
raiseError(
'No permission to create objects of type ' . $type .
'!',
'Client');
1304 $ilAccess = $DIC[
'ilAccess'];
1306 if (!isset($a_object_data[
'references']) || !count($a_object_data[
'references'])) {
1309 if ($a_action ===
'create') {
1310 if (count($a_object_data[
'references']) > 1 && in_array(
1311 $a_object_data[
'type'],
1312 [
'cat',
'crs',
'grp',
'fold'],
1316 "Cannot create references for type " . $a_object_data[
'type'],
1320 if (count($a_object_data[
'references']) === 1 && $a_target_id != $a_object_data[
'references'][0][
'parent_id']) {
1322 "Cannot create references for type " . $a_object_data[
'type'],
1327 foreach ($a_object_data[
'references'] as $ref_data) {
1328 if (!$ref_data[
'parent_id']) {
1329 return $this->
raiseError(
'Element References: No parent Id given!',
'Client');
1334 if ($this->
isFault($can_add_type)) {
1335 return $can_add_type;
1341 if ($a_action ===
'update') {
1342 foreach ($a_object_data[
'references'] as $ref_data) {
1343 if (!$ref_data[
'ref_id']) {
1344 return $this->
raiseError(
'Element References: No reference id given!',
'Client');
1347 if (!$ilAccess->checkAccess(
'write',
'', $ref_data[
'ref_id'])) {
1349 'No write permission for object with reference id ' . $ref_data[
'ref_id'] .
'!',
1364 $tree = $DIC[
'tree'];
1365 $ilLog = $DIC[
'ilLog'];
1367 if (!isset($a_object_data[
'references']) || !count($a_object_data[
'references'])) {
1371 foreach ($a_object_data[
'references'] as $ref_data) {
1372 if (isset($ref_data[
'time_target'])) {
1373 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1374 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1378 $items->toggleChangeable($ref_data[
'time_target'][
'changeable'] ?? $old[
'changeable']);
1379 $items->setTimingStart($ref_data[
'time_target'][
'starting_time'] ?? $old[
'timing_start']);
1380 $items->setTimingEnd($ref_data[
'time_target'][
'ending_time'] ?? $old[
'timing_end']);
1381 $items->toggleVisible($ref_data[
'time_target'][
'timing_visibility'] ?? $old[
'visible']);
1382 $items->setSuggestionStart($ref_data[
'time_target'][
'suggestion_start'] ?? $old[
'suggestion_start']);
1383 $items->setSuggestionEnd($ref_data[
'time_target'][
'suggestion_end'] ?? $old[
'suggestion_end']);
1385 switch ($ref_data[
'time_target'][
'timing_type']) {
1401 $items->update($ref_data[
'ref_id']);
1410 $tree = $DIC->repositoryTree();
1411 $ilLog = $DIC[
'ilLog'];
1413 if (!isset($a_object_data[
'references']) || !count($a_object_data[
'references'])) {
1417 $original_id = $source->
getRefId();
1419 foreach ($a_object_data[
'references'] as $ref_data) {
1420 $new_ref_id = $original_id;
1421 if ($tree->getParentId($original_id) !== (
int) $ref_data[
'parent_id']) {
1424 $source->
putInTree($ref_data[
'parent_id']);
1427 if (isset($ref_data[
'time_target']) ) {
1428 include_once(
'./webservice/soap/classes/class.ilObjectXMLWriter.php');
1429 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
1431 if (!isset($ref_data[
'time_target'][
'starting_time'])) {
1432 $ref_data[
'time_target'][
'starting_time'] = time();
1434 if (!isset($ref_data[
'time_target'][
'ending_time'])) {
1435 $ref_data[
'time_target'][
'ending_time'] = time();
1439 $items->toggleChangeable($ref_data[
'time_target'][
'changeable']);
1440 $items->setTimingStart($ref_data[
'time_target'][
'starting_time']);
1441 $items->setTimingEnd($ref_data[
'time_target'][
'ending_time']);
1442 $items->toggleVisible($ref_data[
'time_target'][
'timing_visibility']);
1443 $items->setSuggestionStart($ref_data[
'time_target'][
'suggestion_start']);
1444 $items->setSuggestionEnd($ref_data[
'time_target'][
'suggestion_end']);
1446 switch ($ref_data[
'time_target'][
'timing_type']) {
1462 $items->update($new_ref_id);
static _lookupObjIdByImportId(string $import_id)
Get (latest) object id for an import id.
XML Writer for XMLResultSet.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
getRefIdsByImportId(string $sid, string $import_id)
getObjIdByImportId(string $sid, string $import_id)
raiseError(string $a_message, $a_code)
const TIMINGS_DEACTIVATED
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
Row Class for XMLResultSet.
static _lookupId($a_user_str)
SaxParserException thrown by ilSaxParser if property throwException is set.
setPermissions(int $parent_ref_id)
Exception class for ObjectXMLWriter and ObjectXMLParser.
updateReferences(array $a_object_data)
getPathForRefId(string $sid, int $ref_id)
static getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
searchObjects(string $sid, ?array $types, string $key, string $combination, ?int $user_id=null)
static _lookupObjId(int $ref_id)
getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_id=null)
getObjectsByTitle(string $sid, string $a_title, ?int $user_id=null)
getObjIdsByRefIds(string $sid, array $ref_ids)
createReference()
creates reference for object
getObjectByReference(string $sid, int $a_ref_id, ?int $user_id=null)
deleteObject(string $sid, int $reference_id)
canAddType(string $type, string $target_type, int $target_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
const TIMING_TEMPORARILY_AVAILABLE
getRefIdsByObjId(string $sid, int $obj_id)
static getInstance(int $a_user_id)
checkSession(string $sid)
static _isInTrash(int $ref_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjectId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _adjustMovedObjectConditions(int $a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
static _allocateCopyId()
Allocate a copy for further entries.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copyObject(string $sid, string $copy_settings_xml)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
putInTree(int $parent_ref_id)
maybe this method should be in tree object!?
static getItem(int $ref_id)
getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $user_id=null)
moveObject(string $sid, int $ref_id, int $target_id)
static _getInstance(int $a_copy_id)
addReference(string $sid, int $a_source_id, int $a_target_id)
validateReferences(string $a_action, array $a_object_data, int $a_target_id=0)
static _lookupType(int $id, bool $reference=false)
Class ilObjectActivation.
XML writer class Class to simplify manual writing of xml documents.
removeFromSystemByImportId(string $sid, string $import_id)
addReferences(ilObject $source, array $a_object_data)