ILIAS  release_8 Revision v8.24
class.ilSoapObjectAdministration.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
31include_once './webservice/soap/classes/class.ilSoapAdministration.php';
32
34{
38 public function getObjIdByImportId(string $sid, string $import_id)
39 {
40 $this->initAuth($sid);
41 $this->initIlias();
42
43 if (!$this->checkSession($sid)) {
44 return $this->raiseError($this->getMessage(), $this->getMessageCode());
45 }
46 if (!$import_id) {
47 return $this->raiseError(
48 'No import id given.',
49 'Client'
50 );
51 }
52
53 global $DIC;
54
55 $ilLog = $DIC['ilLog'];
56 $obj_id = ilObject::_lookupObjIdByImportId($import_id);
57 $ilLog->write("SOAP getObjIdByImportId(): import_id = " . $import_id . ' obj_id = ' . $obj_id);
58 return $obj_id ?: "0";
59 }
60
64 public function getRefIdsByImportId(string $sid, string $import_id)
65 {
66 $this->initAuth($sid);
67 $this->initIlias();
68
69 if (!$this->checkSession($sid)) {
70 return $this->raiseError($this->getMessage(), $this->getMessageCode());
71 }
72 if (!$import_id) {
73 return $this->raiseError(
74 'No import id given.',
75 'Client'
76 );
77 }
78
79 global $DIC;
80
81 $tree = $DIC->repositoryTree();
82 $obj_id = ilObject::_lookupObjIdByImportId($import_id);
83 $ref_ids = ilObject::_getAllReferences($obj_id);
84
85 $new_refs = [];
86 foreach ($ref_ids as $ref_id) {
87 if ($tree->isInTree($ref_id)) {
88 $new_refs[] = $ref_id;
89 }
90 }
91 return $new_refs;
92 }
93
97 public function getRefIdsByObjId(string $sid, int $obj_id)
98 {
99 $this->initAuth($sid);
100 $this->initIlias();
101
102 if (!$this->checkSession($sid)) {
103 return $this->raiseError($this->getMessage(), $this->getMessageCode());
104 }
105 if (!$obj_id) {
106 return $this->raiseError(
107 'No object id given.',
108 'Client'
109 );
110 }
111
112 $ref_ids = ilObject::_getAllReferences($obj_id);
113 $new_refs = [];
114 foreach ($ref_ids as $ref_id) {
115 $new_refs[] = $ref_id;
116 }
117 return $new_refs;
118 }
119
123 public function getObjIdsByRefIds(string $sid, array $ref_ids)
124 {
125 $this->initAuth($sid);
126 $this->initIlias();
127
128 if (!$this->checkSession($sid)) {
129 return $this->raiseError($this->getMessage(), $this->getMessageCode());
130 }
131
132 if (!count($ref_ids)) {
133 return $this->raiseError('No reference id(s) given.', 'Client');
134 }
135
136 $obj_ids = [];
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');
141 }
142
144 if (!$obj_id) {
145 return $this->raiseError('No object found for reference ID. Value: ' . $ref_id, 'Client');
146 }
147 if (!ilObject::_hasUntrashedReference($obj_id)) {
148 return $this->raiseError(
149 'No untrashed reference found for reference ID. Value: ' . $ref_id,
150 'Client'
151 );
152 }
153 $obj_ids[] = $obj_id;
154 }
155
156 return $obj_ids;
157 }
158
162 public function getObjectByReference(string $sid, int $a_ref_id, ?int $user_id = null)
163 {
164 $this->initAuth($sid);
165 $this->initIlias();
166
167 if (!$this->checkSession($sid)) {
168 return $this->raiseError($this->getMessage(), $this->getMessageCode());
169 }
170
171 if (!$tmp_obj = ilObjectFactory::getInstanceByRefId($a_ref_id, false)) {
172 return $this->raiseError('Cannot create object instance!', 'Server');
173 }
174 if (ilObject::_isInTrash($a_ref_id)) {
175 return $this->raiseError("Object with ID $a_ref_id has been deleted.", 'Client');
176 }
177 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
178
179 $xml_writer = new ilObjectXMLWriter();
180 $xml_writer->enablePermissionCheck(true);
181 if (is_int($user_id)) {
182 $xml_writer->setUserId($user_id);
183 $xml_writer->enableOperations(true);
184 }
185 $xml_writer->setObjects(array($tmp_obj));
186 if ($xml_writer->start()) {
187 return $xml_writer->getXML();
188 }
189 return $this->raiseError('Cannot create object xml !', 'Server');
190 }
191
195 public function getObjectsByTitle(string $sid, string $a_title, ?int $user_id = null)
196 {
197 $this->initAuth($sid);
198 $this->initIlias();
199
200 if (!$this->checkSession($sid)) {
201 return $this->raiseError($this->getMessage(), $this->getMessageCode());
202 }
203 if ($a_title === '') {
204 return $this->raiseError(
205 'No valid query string given.',
206 'Client'
207 );
208 }
209 include_once './Services/Search/classes/class.ilQueryParser.php';
210 $query_parser = new ilQueryParser($a_title);
211 $query_parser->setMinWordLength(0);
212 $query_parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
213 $query_parser->parse();
214 if (!$query_parser->validate()) {
215 return $this->raiseError(
216 $query_parser->getMessage(),
217 'Client'
218 );
219 }
220
221 include_once './Services/Search/classes/class.ilObjectSearchFactory.php';
222 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
223 $object_search = new ilLikeObjectSearch($query_parser);
224 $object_search->setFields(array('title'));
225 $object_search->appendToFilter('role');
226 $object_search->appendToFilter('rolt');
227 $res = $object_search->performSearch();
228 if ($user_id) {
229 $res->setUserId($user_id);
230 }
231
232 $res->filter(ROOT_FOLDER_ID, true);
233
234 $objs = array();
235 foreach ($res->getUniqueResults() as $entry) {
236 if ($entry['type'] === 'role' || $entry['type'] === 'rolt') {
237 if ($tmp = ilObjectFactory::getInstanceByObjId($entry['obj_id'], false)) {
238 $objs[] = $tmp;
239 }
240 continue;
241 }
242 if ($tmp = ilObjectFactory::getInstanceByRefId($entry['ref_id'], false)) {
243 $objs[] = $tmp;
244 }
245 }
246 if (!count($objs)) {
247 return '';
248 }
249
250 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
251
252 $xml_writer = new ilObjectXMLWriter();
253 $xml_writer->enablePermissionCheck(true);
254 if (is_int($user_id)) {
255 $xml_writer->setUserId($user_id);
256 $xml_writer->enableOperations(true);
257 }
258 $xml_writer->setObjects($objs);
259 if ($xml_writer->start()) {
260 return $xml_writer->getXML();
261 }
262 return $this->raiseError('Cannot create object xml !', 'Server');
263 }
264
268 public function searchObjects(string $sid, ?array $types, string $key, string $combination, ?int $user_id = null)
269 {
270 $this->initAuth($sid);
271 $this->initIlias();
272
273 if (!$this->checkSession($sid)) {
274 return $this->raiseError($this->getMessage(), $this->getMessageCode());
275 }
276
277 if ($combination !== 'and' && $combination !== 'or') {
278 return $this->raiseError(
279 'No valid combination given. Must be "and" or "or".',
280 'Client'
281 );
282 }
283
284 $highlighter = null;
285 include_once './Services/Search/classes/class.ilSearchSettings.php';
286 if (ilSearchSettings::getInstance()->enabledLucene()) {
287 ilSearchSettings::getInstance()->setMaxHits(25);
288
289 $typeFilterQuery = '';
290 if (is_array($types)) {
291 foreach ($types as $objectType) {
292 if ($typeFilterQuery === '') {
293 $typeFilterQuery .= '+( ';
294 } else {
295 $typeFilterQuery .= 'OR';
296 }
297 $typeFilterQuery .= (' type:' . $objectType . ' ');
298 }
299 $typeFilterQuery .= ') ';
300 }
301
302 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
303 $query_parser = new ilLuceneQueryParser($typeFilterQuery . $key);
304 $query_parser->parse();
305
306 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
307 $searcher = ilLuceneSearcher::getInstance($query_parser);
308 $searcher->search();
309
310 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
311 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
312 $filter = ilLuceneSearchResultFilter::getInstance($user_id);
313 $filter->setCandidates($searcher->getResult());
314 $filter->filter();
315
316 $result_ids = $filter->getResults();
317 $objs = array();
319 foreach ($result_ids as $ref_id => $obj_id) {
321 if ($obj instanceof ilObject) {
322 $objs[] = $obj;
323 }
324 }
325 include_once './Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
326 $highlighter = new ilLuceneHighlighterResultParser();
327 if ($filter->getResultObjIds()) {
328 $highlighter = $searcher->highlight($filter->getResultObjIds());
329 }
330 } else {
331 include_once './Services/Search/classes/class.ilQueryParser.php';
332
333 $query_parser = new ilQueryParser($key);
334 $query_parser->setCombination($combination === 'and' ? ilQueryParser::QP_COMBINATION_AND : ilQueryParser::QP_COMBINATION_OR);
335 $query_parser->parse();
336 if (!$query_parser->validate()) {
337 return $this->raiseError(
338 $query_parser->getMessage(),
339 'Client'
340 );
341 }
342
343 include_once './Services/Search/classes/Like/class.ilLikeObjectSearch.php';
344 $object_search = new ilLikeObjectSearch($query_parser);
345 $object_search->setFilter($types);
346 $res = $object_search->performSearch();
347 if (is_int($user_id)) {
348 $res->setUserId($user_id);
349 }
350 $res->setMaxHits(100);
351 $res->filter(ROOT_FOLDER_ID, $combination === 'and');
352 $counter = 0;
353 $objs = array();
354 foreach ($res->getUniqueResults() as $entry) {
355 $obj = ilObjectFactory::getInstanceByRefId($entry['ref_id'], false);
356 if ($obj instanceof ilObject) {
357 $objs[] = $obj;
358 }
359 }
360 }
361
362 if (!count($objs)) {
363 return '';
364 }
365
366 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
367 $xml_writer = new ilObjectXMLWriter();
368 if (ilSearchSettings::getInstance()->enabledLucene()) {
369 $xml_writer->enableReferences(false);
370 $xml_writer->setMode(ilObjectXMLWriter::MODE_SEARCH_RESULT);
371 $xml_writer->setHighlighter($highlighter);
372 }
373
374 $xml_writer->enablePermissionCheck(true);
375
376 if ($user_id) {
377 $xml_writer->setUserId($user_id);
378 $xml_writer->enableOperations(true);
379 }
380
381 $xml_writer->setObjects($objs);
382 if ($xml_writer->start()) {
383 return $xml_writer->getXML();
384 }
385
386 return $this->raiseError('Cannot create object xml !', 'Server');
387 }
388
392 public function getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $user_id = null)
393 {
394 $this->initAuth($sid);
395 $this->initIlias();
396
397 if (!$this->checkSession($sid)) {
398 return $this->raiseError($this->getMessage(), $this->getMessageCode());
399 }
400
401 $all = false;
402
403 global $DIC;
404
405 $tree = $DIC['tree'];
406
407 if (!$target_obj = ilObjectFactory::getInstanceByRefId($ref_id, false)) {
408 return $this->raiseError(
409 'No valid reference id given.',
410 'Client'
411 );
412 }
413 if ($ref_id === SYSTEM_FOLDER_ID) {
414 return $this->raiseError(
415 'No valid reference id given.',
416 'Client'
417 );
418 }
419
420 if (!is_array($types)) {
421 $all = true;
422 }
423
424 $objs = array();
425
426 foreach ($tree->getChilds($ref_id, 'title') as $child) {
427 if ($all || in_array($child['type'], $types, true)) {
428 if ($tmp = ilObjectFactory::getInstanceByRefId($child['ref_id'], false)) {
429 $objs[] = $tmp;
430 }
431 }
432 }
433
434 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
435 $xml_writer = new ilObjectXMLWriter();
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);
441 }
442
443 if ($xml_writer->start()) {
444 return $xml_writer->getXML();
445 }
446 return $this->raiseError('Cannot create object xml !', 'Server');
447 }
448
452 public function getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_id =null)
453 {
454 $this->initAuth($sid);
455 $this->initIlias();
456
457 if (!$this->checkSession($sid)) {
458 return $this->raiseError($this->getMessage(), $this->getMessageCode());
459 }
460
461 global $DIC;
462
463 $tree = $DIC['tree'];
464 $access = $DIC['ilAccess'];
465
466 $nodedata = $tree->getNodeData($ref_id);
467 $nodearray = $tree->getSubTree($nodedata);
468
469 $filter = $types;
470
471 global $DIC;
472
473 $objDefinition = $DIC['objDefinition'];
474 $nodes = [];
475 foreach ($nodearray as $node) {
476 if (
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']) &&
481 ($tmp = ilObjectFactory::getInstanceByRefId($node['ref_id'], false))) {
482 $nodes[] = $tmp;
483 }
484 }
485
486 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
487 $xml_writer = new ilObjectXMLWriter();
488 $xml_writer->enablePermissionCheck(true);
489 $xml_writer->setObjects($nodes);
490 $xml_writer->enableOperations(false);
491
492 if (is_int($user_id)) {
493 $xml_writer->setUserId($user_id);
494 }
495
496 if ($xml_writer->start()) {
497 return $xml_writer->getXML();
498 }
499
500 return $this->raiseError('Cannot create object xml !', 'Server');
501 }
502
506 public function addObject(string $sid, int $a_target_id, string $a_xml)
507 {
508 $this->initAuth($sid);
509 $this->initIlias();
510
511 if (!$this->checkSession($sid)) {
512 return $this->raiseError($this->getMessage(), $this->getMessageCode());
513 }
514 if ($a_xml === '') {
515 return $this->raiseError(
516 'No valid xml string given.',
517 'Client'
518 );
519 }
520
521 global $DIC;
522
523 $rbacsystem = $DIC['rbacsystem'];
524 $objDefinition = $DIC['objDefinition'];
525 $ilUser = $DIC['ilUser'];
526 $lng = $DIC['lng'];
527 $ilObjDataCache = $DIC['ilObjDataCache'];
528
529 if (!$target_obj = ilObjectFactory::getInstanceByRefId($a_target_id, false)) {
530 return $this->raiseError(
531 'No valid target given.',
532 'Client'
533 );
534 }
535
536 if (ilObject::_isInTrash($a_target_id)) {
537 return $this->raiseError("Parent with ID $a_target_id has been deleted.", 'Client');
538 }
539
540 $allowed_types = array('root', 'cat', 'grp', 'crs', 'fold');
541 if (!in_array($target_obj->getType(), $allowed_types)) {
542 return $this->raiseError(
543 'No valid target type. Target must be reference id of "course, group, category or folder"',
544 'Client'
545 );
546 }
547
548 $allowed_subtypes = $target_obj->getPossibleSubObjects();
549 $allowed = [];
550 foreach ($allowed_subtypes as $row) {
551 if ($row['name'] !== 'rolf') {
552 $allowed[] = $row['name'];
553 }
554 }
555
556 include_once './webservice/soap/classes/class.ilObjectXMLParser.php';
557
558 $xml_parser = new ilObjectXMLParser($a_xml, true);
559 try {
560 $xml_parser->startParsing();
561 } catch (ilSaxParserException $se) {
562 return $this->raiseError($se->getMessage(), 'Client');
563 } catch (ilObjectXMLException $e) {
564 return $this->raiseError($e->getMessage(), 'Client');
565 }
566
567 $newObj = null;
568 foreach ($xml_parser->getObjectData() as $object_data) {
569 $res = $this->validateReferences('create', $object_data, $a_target_id);
570 if ($this->isFault($res)) {
571 return $res;
572 }
573
574 // Check possible subtype
575 if (!in_array($object_data['type'], $allowed, true)) {
576 return $this->raiseError(
577 'Objects of type: ' . $object_data['type'] . ' are not allowed to be subobjects of type ' .
578 $target_obj->getType() . '!',
579 'Client'
580 );
581 }
582 if (!$rbacsystem->checkAccess('create', $a_target_id, $object_data['type'])) {
583 return $this->raiseError(
584 'No permission to create objects of type ' . $object_data['type'] . '!',
585 'Client'
586 );
587 }
588
589 // It's not possible to add objects with non unique import ids
590 if ($object_data['import_id'] != '' && ilObject::_lookupObjIdByImportId($object_data['import_id'])) {
591 return $this->raiseError(
592 'An object with import id ' . $object_data['import_id'] . ' already exists!',
593 'Server'
594 );
595 }
596
597 // call gui object method
598 $class_name = $objDefinition->getClassName($object_data['type']);
599 $location = $objDefinition->getLocation($object_data['type']);
600
601 $class_constr = "ilObj" . $class_name;
602 require_once($location . "/class.ilObj" . $class_name . ".php");
603
604 $newObj = new $class_constr();
605 if (isset($object_data['owner']) && $object_data['owner'] != '') {
606 if ((int) $object_data['owner']) {
607 if (ilObject::_exists((int) $object_data['owner']) &&
608 $ilObjDataCache->lookupType((int) $object_data['owner']) === 'usr') {
609 $newObj->setOwner((int) $object_data['owner']);
610 }
611 } else {
612 $usr_id = ilObjUser::_lookupId(trim($object_data['owner']));
613 if ((int) $usr_id) {
614 $newObj->setOwner((int) $usr_id);
615 }
616 }
617 }
618
619 $newObj->setType($object_data['type']);
620 if ($object_data['import_id'] != '') {
621 $newObj->setImportId($object_data['import_id']);
622 }
623
624 if ($objDefinition->supportsOfflineHandling($newObj->getType())) {
625 $newObj->setOfflineStatus((bool) $object_data['offline']);
626 }
627 $newObj->setTitle($object_data['title']);
628 $newObj->setDescription($object_data['description']);
629 $newObj->create(); // true for upload
630 $newObj->createReference();
631 $newObj->putInTree($a_target_id);
632 $newObj->setPermissions($a_target_id);
633
634 switch ($object_data['type']) {
635 case 'grp':
636 // Add member
637 $newObj->addMember(
638 $object_data['owner'] ?: $ilUser->getId(),
639 $newObj->getDefaultAdminRole()
640 );
641 break;
642
643 case 'crs':
644 $newObj->getMemberObject()->add($ilUser->getId(), ilParticipants::IL_CRS_ADMIN);
645 break;
646 case 'lm':
647 $newObj->createLMTree();
648 break;
649 case 'cat':
651 $newObj->addTranslation(
652 $object_data["title"],
653 $object_data["description"],
654 $lng->getLangKey(),
655 true
656 );
657 break;
658 }
659
660 $this->addReferences($newObj, $object_data);
661 }
662 if (!$newObj instanceof ilObject) {
663 return 0;
664 }
665 $ref_id = $newObj->getRefId();
666 return $ref_id ?: "0";
667 }
668
672 public function addReference(string $sid, int $a_source_id, int $a_target_id)
673 {
674 $this->initAuth($sid);
675 $this->initIlias();
676
677 if (!$this->checkSession($sid)) {
678 return $this->raiseError($this->getMessage(), $this->getMessageCode());
679 }
680
681 global $DIC;
682
683 $objDefinition = $DIC['objDefinition'];
684 $rbacsystem = $DIC['rbacsystem'];
685 $tree = $DIC['tree'];
686
687 if (!$source_obj = ilObjectFactory::getInstanceByRefId($a_source_id, false)) {
688 return $this->raiseError(
689 'No valid source id given.',
690 'Client'
691 );
692 }
693 if (!$target_obj = ilObjectFactory::getInstanceByRefId($a_target_id, false)) {
694 return $this->raiseError(
695 'No valid target id given.',
696 'Client'
697 );
698 }
699
700 if (!$objDefinition->allowLink($source_obj->getType()) and
701 $source_obj->getType() !== 'cat' and
702 $source_obj->getType() !== 'crs') {
703 return $this->raiseError(
704 'Linking of object type: ' . $source_obj->getType() . ' is not allowed',
705 'Client'
706 );
707 }
708
709 $allowed_subtypes = $target_obj->getPossibleSubObjects();
710 $allowed = [];
711 foreach ($allowed_subtypes as $row) {
712 if ($row['name'] !== 'rolf') {
713 $allowed[] = $row['name'];
714 }
715 }
716 if (!in_array($source_obj->getType(), $allowed, true)) {
717 return $this->raiseError(
718 'Objects of type: ' . $source_obj->getType() . ' are not allowed to be subobjects of type ' .
719 $target_obj->getType() . '!',
720 'Client'
721 );
722 }
723
724 // Permission checks
725 if (!$rbacsystem->checkAccess('create', $target_obj->getRefId(), $source_obj->getType())) {
726 return $this->raiseError(
727 'No permission to create objects of type ' . $source_obj->getType() . '!',
728 'Client'
729 );
730 }
731 if (!$rbacsystem->checkAccess('delete', $source_obj->getRefId())) {
732 return $this->raiseError(
733 'No permission to link object with id: ' . $source_obj->getRefId() . '!',
734 'Client'
735 );
736 }
737
738 if ($source_obj->getType() !== 'cat' and $source_obj->getType() !== 'crs') {
739 // check if object already linked to target
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");
744 }
745 }
746
747 // Finally link it to target position
748
749 $new_ref_id = $source_obj->createReference();
750 $source_obj->putInTree($target_obj->getRefId());
751 $source_obj->setPermissions($target_obj->getRefId());
752
753 return $new_ref_id ?: "0";
754 }
755
756 $new_ref = null;
757 switch ($source_obj->getType()) {
758 case 'cat':
759 include_once('./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
760 $new_ref = new ilObjCategoryReference();
761 break;
762
763 case 'crs':
764 include_once('./Modules/CourseReference/classes/class.ilObjCourseReference.php');
765 $new_ref = new ilObjCourseReference();
766 break;
767 case 'grp':
768 include_once('./Modules/GroupReference/classes/class.ilObjGroupReference.php');
769 $new_ref = new ilObjGroupReference();
770 break;
771 }
772 $new_ref->create();
773 $new_ref_id = $new_ref->createReference();
774
775 $new_ref->putInTree($target_obj->getRefId());
776 $new_ref->setPermissions($target_obj->getRefId());
777
778 $new_ref->setTargetId($source_obj->getId());
779 $new_ref->update();
780
781 if (!$new_ref instanceof ilObject) {
782 return 0;
783 }
784
785 return $new_ref_id ?: 0;
786 }
787
791 public function deleteObject(string $sid, int $reference_id)
792 {
793 $this->initAuth($sid);
794 $this->initIlias();
795
796 if (!$this->checkSession($sid)) {
797 return $this->raiseError($this->getMessage(), $this->getMessageCode());
798 }
799
800 global $DIC;
801
802 $tree = $DIC->repositoryTree();
803 $rbacsystem = $DIC['rbacsystem'];
804 $rbacadmin = $DIC['rbacadmin'];
805 $user = $DIC->user();
806
807 if (!$del_obj = ilObjectFactory::getInstanceByRefId($reference_id, false)) {
808 return $this->raiseError(
809 'No valid reference id given.',
810 'Client'
811 );
812 }
813 if (!$rbacsystem->checkAccess('delete', $del_obj->getRefId())) {
814 return $this->raiseError(
815 'No permission to delete object with id: ' . $del_obj->getRefId() . '!',
816 'Client'
817 );
818 }
819
820 if ($tree->isDeleted($reference_id)) {
821 return $this->raiseError('Node already deleted', 'Server');
822 }
823
824 if ($del_obj->getType() === 'rolf') {
825 return $this->raiseError('Delete is not available for role folders.', 'Client');
826 }
827
828 $subnodes = $tree->getSubTree($tree->getNodeData($reference_id));
829 foreach ($subnodes as $subnode) {
830 $rbacadmin->revokePermission($subnode["child"]);
831 }
832 if (!$tree->moveToTrash($reference_id, true, $user->getId())) {
833 return $this->raiseError('Node already deleted', 'Client');
834 }
835 return true;
836 }
837
841 public function removeFromSystemByImportId(string $sid, string $import_id)
842 {
843 $this->initAuth($sid);
844 $this->initIlias();
845
846 if (!$this->checkSession($sid)) {
847 return $this->raiseError($this->getMessage(), $this->getMessageCode());
848 }
849 if ($import_id === '') {
850 return $this->raiseError(
851 'No import id given. Aborting!',
852 'Client'
853 );
854 }
855 global $DIC;
856
857 $rbacsystem = $DIC['rbacsystem'];
858 $tree = $DIC['tree'];
859 $ilLog = $DIC['ilLog'];
860
861 // get obj_id
862 if (!$obj_id = ilObject::_lookupObjIdByImportId($import_id)) {
863 return $this->raiseError(
864 'No object found with import id: ' . $import_id,
865 'Client'
866 );
867 }
868
869 // Check access
870 $permission_ok = false;
871 foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
872 if ($rbacsystem->checkAccess('delete', $ref_id)) {
873 $permission_ok = true;
874 break;
875 }
876 }
877 if (!$permission_ok) {
878 return $this->raiseError(
879 'No permission to delete the object with import id: ' . $import_id,
880 'Server'
881 );
882 }
883
884 // Delete all references (delete permssions and entries in object_reference)
885 foreach ($ref_ids as $ref_id) {
886 // All subnodes
887 $node_data = $tree->getNodeData($ref_id);
888 $subtree_nodes = $tree->getSubtree($node_data);
889
890 foreach ($subtree_nodes as $node) {
891 $ilLog->write('Soap: removeFromSystemByImportId(). Deleting object with title id: ' . $node['title']);
892 $tmp_obj = ilObjectFactory::getInstanceByRefId($node['ref_id']);
893 if (!is_object($tmp_obj)) {
894 return $this->raiseError(
895 'Cannot create instance of reference id: ' . $node['ref_id'],
896 'Server'
897 );
898 }
899 $tmp_obj->delete();
900 }
901 // Finally delete tree
902 $tree->deleteTree($node_data);
903 }
904 return true;
905 }
906
910 public function updateObjects(string $sid, string $a_xml)
911 {
912 $this->initAuth($sid);
913 $this->initIlias();
914
915 if (!$this->checkSession($sid)) {
916 return $this->raiseError($this->getMessage(), $this->getMessageCode());
917 }
918 if ($a_xml === '') {
919 return $this->raiseError(
920 'No valid xml string given.',
921 'Client'
922 );
923 }
924
925 global $DIC;
926
927 $rbacreview = $DIC['rbacreview'];
928 $rbacsystem = $DIC['rbacsystem'];
929 $lng = $DIC['lng'];
930 $ilAccess = $DIC['ilAccess'];
931 $objDefinition = $DIC['objDefinition'];
932
933 include_once './webservice/soap/classes/class.ilObjectXMLParser.php';
934 $xml_parser = new ilObjectXMLParser($a_xml, true);
935 try {
936 $xml_parser->startParsing();
937 } catch (ilSaxParserException $se) {
938 return $this->raiseError($se->getMessage(), 'Client');
939 } catch (ilObjectXMLException $e) {
940 return $this->raiseError($e->getMessage(), 'Client');
941 }
942
943 // Validate incoming data
944 $object_datas = $xml_parser->getObjectData();
945 foreach ($object_datas as &$object_data) {
946 $res = $this->validateReferences('update', $object_data);
947 if ($this->isFault($res)) {
948 return $res;
949 }
950
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) {
954 // object id might be unknown, resolve references instead to determine object id
955 // all references should point to the same object, so using the first one is ok.
956 foreach ($object_data["references"] as $refid) {
957 if (ilObject::_isInTrash($refid)) {
958 continue;
959 }
960 break;
961 }
962
963 $obj_id_from_refid = ilObject::_lookupObjectId($object_data["references"][0]);
964 if (!$obj_id_from_refid) {
965 return $this->raiseError(
966 'No obj_id found for reference id ' . $object_data["references"][0],
967 'CLIENT_OBJECT_NOT_FOUND'
968 );
969 }
970
971 $tmp_obj = ilObjectFactory::getInstanceByObjId($object_data['obj_id'], false);
972 $object_data["obj_id"] = $obj_id_from_refid;
973 }
974
975 $tmp_obj = ilObjectFactory::getInstanceByObjId($object_data['obj_id'], false);
976 if ($tmp_obj === null) {
977 return $this->raiseError(
978 'No object for id ' . $object_data['obj_id'] . '!',
979 'CLIENT_OBJECT_NOT_FOUND'
980 );
981 }
982
983 $object_data["instance"] = $tmp_obj;
984
985 if ($object_data['type'] === 'role') {
986 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data['obj_id'], true);
987 $rolf_id = $rolf_ids[0];
988
989 if (!$rbacsystem->checkAccess('write', $rolf_id)) {
990 return $this->raiseError(
991 'No write permission for object with id ' . $object_data['obj_id'] . '!',
992 'Client'
993 );
994 }
995 } else {
996 $permission_ok = false;
997 foreach (ilObject::_getAllReferences($object_data['obj_id']) as $ref_id) {
998 if ($ilAccess->checkAccess('write', '', $ref_id)) {
999 $permission_ok = true;
1000 break;
1001 }
1002 }
1003 if (!$permission_ok) {
1004 return $this->raiseError(
1005 'No write permission for object with id ' . $object_data['obj_id'] . '!',
1006 'Client'
1007 );
1008 }
1009 }
1010 }
1011 unset($object_data);
1012
1013 // perform update
1014 if (count($object_datas) > 0) {
1015 foreach ($object_datas as $object_data) {
1016 $this->updateReferences($object_data);
1020 $tmp_obj = $object_data["instance"];
1021 $tmp_obj->setTitle($object_data['title']);
1022 $tmp_obj->setDescription($object_data['description']);
1023
1024 if ($objDefinition->supportsOfflineHandling($tmp_obj->getType())) {
1025 $tmp_obj->setOfflineStatus($object_data['offline']);
1026 }
1027
1028 $tmp_obj->update();
1029 if ($object_data['owner'] != '' && is_numeric($object_data['owner'])) {
1030 $tmp_obj->setOwner($object_data['owner']);
1031 $tmp_obj->updateOwner();
1032 }
1033 }
1034 return true;
1035 }
1036 return false;
1037 }
1038
1042 public function moveObject(string $sid, int $ref_id, int $target_id)
1043 {
1044 $this->initAuth($sid);
1045 $this->initIlias();
1046
1047 if (!$this->checkSession($sid)) {
1048 return $this->raiseError($this->getMessage(), $this->getMessageCode());
1049 }
1050
1051 include_once './webservice/soap/classes/class.ilSoapUtils.php';
1052 global $DIC;
1053
1054 $rbacreview = $DIC['rbacreview'];
1055 $rbacadmin = $DIC['rbacadmin'];
1056 $objDefinition = $DIC['objDefinition'];
1057 $rbacsystem = $DIC['rbacsystem'];
1058 $lng = $DIC['lng'];
1059 $ilUser = $DIC['ilUser'];
1060 $tree = $DIC['tree'];
1061
1062 // does source object exist
1063 if (!$source_object_type = ilObjectFactory::getTypeByRefId($ref_id, false)) {
1064 return $this->raiseError('No valid source given.', 'Client');
1065 }
1066
1067 // does target object exist
1068 if (!$target_object_type = ilObjectFactory::getTypeByRefId($target_id, false)) {
1069 return $this->raiseError('No valid target given.', 'Client');
1070 }
1071
1072 // check for trash
1073 if (ilObject::_isInTrash($ref_id)) {
1074 return $this->raiseError('Object is trashed.', 'Client');
1075 }
1076
1077 if (ilObject::_isInTrash($target_id)) {
1078 return $this->raiseError('Object is trashed.', 'Client');
1079 }
1080
1081 $canAddType = $this->canAddType($source_object_type, $target_object_type, $target_id);
1082 if ($this->isFault($canAddType)) {
1083 return $canAddType;
1084 }
1085
1086 // check if object already linked to target
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");
1091 }
1092 }
1093
1094 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1095 if ($tree->isGrandChild($ref_id, $target_id)) {
1096 return $this->raiseError("Cannot move object into itself.", "Client");
1097 }
1098
1099 $old_parent = $tree->getParentId($ref_id);
1100 $tree->moveTree($ref_id, $target_id);
1101 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1102
1104 return true;
1105 }
1106
1110 public function copyObject(string $sid, string $copy_settings_xml)
1111 {
1112 $this->initAuth($sid);
1113 $this->initIlias();
1114
1115 if (!$this->checkSession($sid)) {
1116 return $this->raiseError($this->getMessage(), $this->getMessageCode());
1117 }
1118
1119 include_once './webservice/soap/classes/class.ilSoapUtils.php';
1120 global $DIC;
1121
1122 $rbacreview = $DIC['rbacreview'];
1123 $objDefinition = $DIC['objDefinition'];
1124 $rbacsystem = $DIC['rbacsystem'];
1125 $lng = $DIC['lng'];
1126 $ilUser = $DIC['ilUser'];
1127
1128 include_once './webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1129 $xml_parser = new ilCopyWizardSettingsXMLParser($copy_settings_xml);
1130 try {
1131 $xml_parser->startParsing();
1132 } catch (ilSaxParserException $se) {
1133 return $this->raiseError($se->getMessage(), "Client");
1134 }
1135
1136 // checking copy permissions, objects and create permissions
1137 if (!$rbacsystem->checkAccess('copy', $xml_parser->getSourceId())) {
1138 return $this->raiseError(
1139 "Missing copy permissions for object with reference id " . $xml_parser->getSourceId(),
1140 'Client'
1141 );
1142 }
1143
1144 // checking copy permissions, objects and create permissions
1145 $source_id = $xml_parser->getSourceId();
1146 $target_id = $xml_parser->getTargetId();
1147
1148 // does source object exist
1149 if (!$source_object_type = ilObjectFactory::getTypeByRefId($source_id, false)) {
1150 return $this->raiseError('No valid source given.', 'Client');
1151 }
1152
1153 // does target object exist
1154 if (!$target_object_type = ilObjectFactory::getTypeByRefId($xml_parser->getTargetId(), false)) {
1155 return $this->raiseError('No valid target given.', 'Client');
1156 }
1157
1158 $canAddType = $this->canAddType($source_object_type, $target_object_type, $target_id);
1159 if ($this->isFault($canAddType)) {
1160 return $canAddType;
1161 }
1162
1163 // if is container object than clone with sub items
1164 $options = $xml_parser->getOptions();
1165 // print_r($options);
1166 $source_object = ilObjectFactory::getInstanceByRefId($source_id);
1167 if ($source_object instanceof ilContainer) {
1168 // get client id from sid
1169 $clientid = substr($sid, strpos($sid, "::") + 2);
1170 $sessionid = str_replace("::" . $clientid, "", $sid);
1171 // call container clone
1172 $ret = $source_object->cloneAllObject(
1173 $sessionid,
1174 $clientid,
1175 $source_object_type,
1176 $target_id,
1177 $source_id,
1178 $options,
1179 true
1180 );
1181
1182 return $ret['ref_id'];
1183 }
1184
1185 // create copy wizard settings
1187 $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
1188 $wizard_options->saveOwner($ilUser->getId());
1189 $wizard_options->saveRoot($source_id);
1190
1191 foreach ($options as $source_id => $option) {
1192 $wizard_options->addEntry($source_id, $option);
1193 }
1194 $wizard_options->read();
1195
1196 // call object clone
1197 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1198 return is_object($newObject) ? $newObject->getRefId() : -1;
1199 }
1200
1204 public function getPathForRefId(string $sid, int $ref_id)
1205 {
1206 $this->initAuth($sid);
1207 $this->initIlias();
1208
1209 if (!$this->checkSession($sid)) {
1210 return $this->raiseError($this->getMessage(), $this->getMessageCode());
1211 }
1212
1213 global $DIC;
1214
1215 $ilAccess = $DIC['ilAccess'];
1216 $objDefinition = $DIC['objDefinition'];
1217 $rbacsystem = $DIC['rbacsystem'];
1218 $lng = $DIC['lng'];
1219 $ilUser = $DIC['ilUser'];
1220
1221 if (!$rbacsystem->checkAccess('read', $ref_id)) {
1222 return $this->raiseError("Missing read permissions for object with reference id " . $ref_id, 'Client');
1223 }
1224
1226 return $this->raiseError("Object is in Trash", 'Client');
1227 }
1228 global $DIC;
1229
1230 $tree = $DIC['tree'];
1231 $lng = $DIC['lng'];
1232 $items = $tree->getPathFull($ref_id);
1233
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';
1237
1238 $xmlResultSet = new ilXMLResultSet();
1239 $xmlResultSet->addColumn("ref_id");
1240 $xmlResultSet->addColumn("type");
1241 $xmlResultSet->addColumn("title");
1242
1243 $writer = new ilXMLResultSetWriter($xmlResultSet);
1244 foreach ($items as $item) {
1245 if ((int) $item["ref_id"] === $ref_id) {
1246 continue;
1247 }
1248 if ($item["title"] === "ILIAS" && $item["type"] === "root") {
1249 $item["title"] = $lng->txt("repository");
1250 }
1251
1252 $row = new ilXMLResultSetRow();
1253 $xmlResultSet->addRow($row);
1254 $row->setValue("ref_id", $item["ref_id"]);
1255 $row->setValue("type", $item["type"]);
1256 $row->setValue("title", $item["title"]);
1257 }
1258 $writer->start();
1259 return $writer->getXML();
1260 }
1261
1262 private function canAddType(string $type, string $target_type, int $target_id)
1263 {
1264 // checking for target subtypes. Can we add source to target
1265 global $DIC;
1266
1267 $objDefinition = $DIC['objDefinition'];
1268 $rbacsystem = $DIC['rbacsystem'];
1269
1270 $allowed_types = array('root', 'cat', 'grp', 'crs', 'fold');
1271 if (!in_array($target_type, $allowed_types, true)) {
1272 return $this->raiseError(
1273 'No valid target type. Target must be reference id of "course, group, category or folder"',
1274 'Client'
1275 );
1276 }
1277
1278 $allowed_subtypes = $objDefinition->getSubObjects($target_type);
1279 $allowed = array();
1280
1281 foreach ($allowed_subtypes as $row) {
1282 if ($row['name'] !== 'rolf') {
1283 $allowed[] = $row['name'];
1284 }
1285 }
1286
1287 if (!in_array($type, $allowed, true)) {
1288 return $this->raiseError(
1289 'Objects of type: ' . $type . ' are not allowed to be subobjects of type ' . $target_type . '!',
1290 'Client'
1291 );
1292 }
1293 if (!$rbacsystem->checkAccess('create', $target_id, $type)) {
1294 return $this->raiseError('No permission to create objects of type ' . $type . '!', 'Client');
1295 }
1296
1297 return true;
1298 }
1299
1300 private function validateReferences(string $a_action, array $a_object_data, int $a_target_id = 0)
1301 {
1302 global $DIC;
1303
1304 $ilAccess = $DIC['ilAccess'];
1305
1306 if (!isset($a_object_data['references']) || !count($a_object_data['references'])) {
1307 return true;
1308 }
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'],
1313 true
1314 )) {
1315 return $this->raiseError(
1316 "Cannot create references for type " . $a_object_data['type'],
1317 'Client'
1318 );
1319 }
1320 if (count($a_object_data['references']) === 1 && $a_target_id != $a_object_data['references'][0]['parent_id']) {
1321 return $this->raiseError(
1322 "Cannot create references for type " . $a_object_data['type'],
1323 'Client'
1324 );
1325 }
1326
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');
1330 }
1331
1333 $can_add_type = $this->canAddType($a_object_data['type'], $target_type, $ref_data['parent_id']);
1334 if ($this->isFault($can_add_type)) {
1335 return $can_add_type;
1336 }
1337 }
1338 return true;
1339 }
1340
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');
1345 }
1346 // check permissions
1347 if (!$ilAccess->checkAccess('write', '', $ref_data['ref_id'])) {
1348 return $this->raiseError(
1349 'No write permission for object with reference id ' . $ref_data['ref_id'] . '!',
1350 'Client'
1351 );
1352 }
1353 // TODO: check if all references belong to the same object
1354 }
1355 return true;
1356 }
1357 return true;
1358 }
1359
1360 private function updateReferences(array $a_object_data) : void
1361 {
1362 global $DIC;
1363
1364 $tree = $DIC['tree'];
1365 $ilLog = $DIC['ilLog'];
1366
1367 if (!isset($a_object_data['references']) || !count($a_object_data['references'])) {
1368 return;
1369 }
1370
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');
1375 $old = ilObjectActivation::getItem($ref_data['ref_id']);
1376
1377 $items = new ilObjectActivation();
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']);
1384
1385 switch ($ref_data['time_target']['timing_type']) {
1387 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_DEACTIVATED . ' ' . $ref_data['time_target']['timing_type']);
1388 $items->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
1389 break;
1390
1392 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_ACTIVATION . ' ' . $ref_data['time_target']['timing_type']);
1393 $items->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1394 break;
1395
1397 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_PRESETTING . ' ' . $ref_data['time_target']['timing_type']);
1398 $items->setTimingType(ilObjectActivation::TIMINGS_PRESETTING);
1399 break;
1400 }
1401 $items->update($ref_data['ref_id']);
1402 }
1403 }
1404 }
1405
1406 private function addReferences(ilObject $source, array $a_object_data) : void
1407 {
1408 global $DIC;
1409
1410 $tree = $DIC->repositoryTree();
1411 $ilLog = $DIC['ilLog'];
1412
1413 if (!isset($a_object_data['references']) || !count($a_object_data['references'])) {
1414 return;
1415 }
1416
1417 $original_id = $source->getRefId();
1418
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']) {
1422 // New reference requested => create it
1423 $new_ref_id = $source->createReference();
1424 $source->putInTree($ref_data['parent_id']);
1425 $source->setPermissions($ref_data['parent_id']);
1426 }
1427 if (isset($ref_data['time_target']) /* and ($crs_ref_id = $tree->checkForParentType($new_ref_id,'crs')) */) {
1428 include_once('./webservice/soap/classes/class.ilObjectXMLWriter.php');
1429 include_once('./Services/Object/classes/class.ilObjectActivation.php');
1430
1431 if (!isset($ref_data['time_target']['starting_time'])) {
1432 $ref_data['time_target']['starting_time'] = time();
1433 }
1434 if (!isset($ref_data['time_target']['ending_time'])) {
1435 $ref_data['time_target']['ending_time'] = time();
1436 }
1437
1438 $items = new ilObjectActivation();
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']);
1445
1446 switch ($ref_data['time_target']['timing_type']) {
1448 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_DEACTIVATED . ' ' . $ref_data['time_target']['timing_type']);
1449 $items->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
1450 break;
1451
1453 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_ACTIVATION . ' ' . $ref_data['time_target']['timing_type']);
1454 $items->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1455 break;
1456
1458 $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_PRESETTING . ' ' . $ref_data['time_target']['timing_type']);
1459 $items->setTimingType(ilObjectActivation::TIMINGS_PRESETTING);
1460 break;
1461 }
1462 $items->update($new_ref_id);
1463 }
1464 }
1465 }
1466}
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance(int $a_copy_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupId($a_user_str)
Class ilObjectActivation.
static getItem(int $ref_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Exception class for ObjectXMLWriter and ObjectXMLParser.
XML writer class Class to simplify manual writing of xml documents.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _getAllReferences(int $id)
get all reference ids for object ID
static _isInTrash(int $ref_id)
static _lookupObjIdByImportId(string $import_id)
Get (latest) object id for an import id.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
SaxParserException thrown by ilSaxParser if property throwException is set.
soap server Base class for all SOAP registered methods.
raiseError(string $a_message, $a_code)
addReferences(ilObject $source, array $a_object_data)
getObjectsByTitle(string $sid, string $a_title, ?int $user_id=null)
addReference(string $sid, int $a_source_id, int $a_target_id)
validateReferences(string $a_action, array $a_object_data, int $a_target_id=0)
copyObject(string $sid, string $copy_settings_xml)
removeFromSystemByImportId(string $sid, string $import_id)
getRefIdsByImportId(string $sid, string $import_id)
deleteObject(string $sid, int $reference_id)
moveObject(string $sid, int $ref_id, int $target_id)
canAddType(string $type, string $target_type, int $target_id)
getObjIdByImportId(string $sid, string $import_id)
searchObjects(string $sid, ?array $types, string $key, string $combination, ?int $user_id=null)
getObjIdsByRefIds(string $sid, array $ref_ids)
getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_id=null)
getObjectByReference(string $sid, int $a_ref_id, ?int $user_id=null)
getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $user_id=null)
Row Class for XMLResultSet.
XML Writer for XMLResultSet.
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
$target_id
Definition: goto.php:52
$target_type
Definition: goto.php:51
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67
$res
Definition: ltiservices.php:69
$source
Definition: metadata.php:93
string $key
Consumer key/client ID value.
Definition: System.php:193
$type
$lng