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