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