ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSoapObjectAdministration Class Reference
+ Inheritance diagram for ilSoapObjectAdministration:
+ Collaboration diagram for ilSoapObjectAdministration:

Public Member Functions

 getObjIdByImportId ($sid, $import_id)
 
 getRefIdsByImportId ($sid, $import_id)
 
 getRefIdsByObjId ($sid, $obj_id)
 
 getObjIdsByRefIds ($sid, $ref_ids)
 Returns a array of object ids which match the references id, given by a comma seperated string. More...
 
 getObjectByReference ($sid, $a_ref_id, $user_id)
 
 getObjectsByTitle ($sid, $a_title, $user_id)
 
 searchObjects ($sid, $types, $key, $combination, $user_id)
 
 getTreeChilds ($sid, $ref_id, $types, $user_id)
 
 getXMLTree ($sid, $ref_id, $types, $user_id)
 
 addObject ($sid, $a_target_id, $a_xml)
 
 addReference ($sid, $a_source_id, $a_target_id)
 
 deleteObject ($sid, $reference_id)
 
 removeFromSystemByImportId ($sid, $import_id)
 
 updateObjects ($sid, $a_xml)
 
 moveObject ($sid, $ref_id, $target_id)
 
 copyObject ($sid, $copy_settings_xml)
 copy object in repository $sid session id $settings_xml contains copy wizard settings following ilias_copy_wizard_settings.dtd More...
 
 getPathForRefId ($sid, $ref_id)
 
- Public Member Functions inherited from ilSoapAdministration
 __construct ($use_nusoap=true)
 Constructor. More...
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 Init authentication. More...
 
 initIlias ()
 
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 
 __raiseError ($a_message, $a_code)
 
 getNIC ($sid)
 get client information from current as xml result set More...
 
 isFault ($object)
 
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true More...
 
 getInstallationInfoXML ()
 
 getClientInfoXML ($clientid)
 

Private Member Functions

 canAddType ($type, $target_type, $target_id)
 
 validateReferences ($a_action, $a_object_data, $a_target_id=0)
 
 updateReferences ($a_object_data)
 
 addReferences ($source, $a_object_data)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes More...
 
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 
 $error_method = null
 
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true
 

Detailed Description

Definition at line 36 of file class.ilSoapObjectAdministration.php.

Member Function Documentation

◆ addObject()

ilSoapObjectAdministration::addObject (   $sid,
  $a_target_id,
  $a_xml 
)

Definition at line 560 of file class.ilSoapObjectAdministration.php.

561 {
562 $this->initAuth($sid);
563 $this->initIlias();
564
565 if(!$this->__checkSession($sid))
566 {
567 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
568 }
569 if(!strlen($a_xml))
570 {
571 return $this->__raiseError('No valid xml string given.',
572 'Client');
573 }
574
575 global $rbacsystem, $objDefinition,$ilUser, $lng, $ilObjDataCache;
576
577 if(!$target_obj =& ilObjectFactory::getInstanceByRefId($a_target_id,false))
578 {
579 return $this->__raiseError('No valid target given.',
580 'Client');
581 }
582
583 if(ilObject::_isInTrash($a_target_id))
584 {
585 return $this->__raiseError("Parent with ID $a_target_id has been deleted.", 'Client');
586 }
587
588 $allowed_types = array('root','cat','grp','crs','fold');
589 if(!in_array($target_obj->getType(),$allowed_types))
590 {
591 return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"',
592 'Client');
593 }
594
595 $allowed_subtypes = $target_obj->getPossibleSubObjects();
596
597 foreach($allowed_subtypes as $row)
598 {
599 if($row['name'] != 'rolf')
600 {
601 $allowed[] = $row['name'];
602 }
603 }
604
605 include_once './webservice/soap/classes/class.ilObjectXMLParser.php';
606
607 $xml_parser = new ilObjectXMLParser($a_xml, true);
608 try {
609 $xml_parser->startParsing();
610 }
611 catch (ilSaxParserException $se){
612 return $this->__raiseError($se->getMessage(),'Client');
613 }
614 catch(ilObjectXMLException $e) {
615 return $this->__raiseError($e->getMessage(),'Client');
616 }
617
618 foreach($xml_parser->getObjectData() as $object_data)
619 {
620 $res = $this->validateReferences('create',$object_data,$a_target_id);
621 if($this->isFault($res))
622 {
623 return $res;
624 }
625
626 // Check possible subtype
627 if(!in_array($object_data['type'],$allowed))
628 {
629 return $this->__raiseError('Objects of type: '.$object_data['type'].' are not allowed to be subobjects of type '.
630 $target_obj->getType().'!',
631 'Client');
632 }
633 if(!$rbacsystem->checkAccess('create',$a_target_id,$object_data['type']))
634 {
635 return $this->__raiseError('No permission to create objects of type '.$object_data['type'].'!',
636 'Client');
637 }
638 // begin-patch fm
639 /*
640 if($object_data['type'] == 'crs')
641 {
642 return $this->__raiseError('Cannot create course objects. Use method addCourse() ',
643 'Client');
644 }
645 */
646 // end-patch fm
647
648 // It's not possible to add objects with non unique import ids
649 if(strlen($object_data['import_id']) and ilObject::_lookupObjIdByImportId($object_data['import_id']))
650 {
651 return $this->__raiseError('An object with import id '.$object_data['import_id'].' already exists!',
652 'Server');
653 }
654
655 // call gui object method
656 $class_name = $objDefinition->getClassName($object_data['type']);
657 $location = $objDefinition->getLocation($object_data['type']);
658
659 $class_constr = "ilObj".$class_name;
660 require_once($location."/class.ilObj".$class_name.".php");
661
662 $newObj = new $class_constr();
663
664 if(isset($object_data['owner']) && strlen($object_data['owner']))
665 {
666 if((int)$object_data['owner'])
667 {
668 if(ilObject::_exists((int)$object_data['owner']) &&
669 $ilObjDataCache->lookupType((int)$object_data['owner']) == 'usr')
670 {
671 $newObj->setOwner((int)$object_data['owner']);
672 }
673 }
674 else
675 {
676 $usr_id = ilObjUser::_lookupId(trim($object_data['owner']));
677 if((int)$usr_id)
678 {
679 $newObj->setOwner((int)$usr_id);
680 }
681 }
682 }
683
684 $newObj->setType($object_data['type']);
685 if(strlen($object_data['import_id']))
686 {
687 $newObj->setImportId($object_data['import_id']);
688 }
689 $newObj->setTitle($object_data['title']);
690 $newObj->setDescription($object_data['description']);
691 $newObj->create(); // true for upload
692 $newObj->createReference();
693 $newObj->putInTree($a_target_id);
694 $newObj->setPermissions($a_target_id);
695
696 switch($object_data['type'])
697 {
698 case 'grp':
699 // Add member
700 $newObj->addMember($object_data['owner'] ? $object_data['owner'] : $ilUser->getId(),
701 $newObj->getDefaultAdminRole());
702 break;
703
704 // begin-patch fm
705 case 'crs':
706 $newObj->getMemberObject()->add($ilUser->getId(),IL_CRS_ADMIN);
707 break;
708 // end-patch fm
709 case 'lm':
710 $newObj->createLMTree();
711 break;
712 case 'cat':
713 $newObj->addTranslation($object_data["title"],$object_data["description"], $lng->getLangKey(), $lng->getLangKey());
714 break;
715 }
716
717 $this->addReferences($newObj,$object_data);
718
719 }
720 $ref_id = $newObj->getRefId();
721 return $ref_id ? $ref_id : "0";
722 }
$location
Definition: buildRTE.php:44
const IL_CRS_ADMIN
Base class for course and group participants.
static _lookupId($a_user_str)
Lookup id by login.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Exception class for ObjectXMLWriter and ObjectXMLParser.
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 _isInTrash($a_ref_id)
checks wether object is in trash
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)
global $lng
Definition: privfeed.php:17
$ref_id
Definition: sahs_server.php:39
$ilUser
Definition: imgupload.php:18

References $ilUser, $lng, $location, $ref_id, $res, $row, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_exists(), ilObject\_isInTrash(), ilObjUser\_lookupId(), ilObject\_lookupObjIdByImportId(), addReferences(), ilObjectFactory\getInstanceByRefId(), IL_CRS_ADMIN, ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilSoapAdministration\isFault(), and validateReferences().

+ Here is the call graph for this function:

◆ addReference()

ilSoapObjectAdministration::addReference (   $sid,
  $a_source_id,
  $a_target_id 
)

Definition at line 724 of file class.ilSoapObjectAdministration.php.

725 {
726 $this->initAuth($sid);
727 $this->initIlias();
728
729 if(!$this->__checkSession($sid))
730 {
731 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
732 }
733 if(!is_numeric($a_source_id))
734 {
735 return $this->__raiseError('No source id given.',
736 'Client');
737 }
738 if(!is_numeric($a_target_id))
739 {
740 return $this->__raiseError('No target id given.',
741 'Client');
742 }
743
744 global $objDefinition, $rbacsystem, $tree;
745
746 if(!$source_obj =& ilObjectFactory::getInstanceByRefId($a_source_id,false))
747 {
748 return $this->__raiseError('No valid source id given.',
749 'Client');
750 }
751 if(!$target_obj =& ilObjectFactory::getInstanceByRefId($a_target_id,false))
752 {
753 return $this->__raiseError('No valid target id given.',
754 'Client');
755 }
756
757 if(!$objDefinition->allowLink($source_obj->getType()) and
758 $source_obj->getType() != 'cat' and
759 $source_obj->getType() != 'crs')
760 {
761 return $this->__raiseError('Linking of object type: '.$source_obj->getType().' is not allowed',
762 'Client');
763 }
764
765 $allowed_subtypes = $target_obj->getPossibleSubObjects();
766 foreach($allowed_subtypes as $row)
767 {
768 if($row['name'] != 'rolf')
769 {
770 $allowed[] = $row['name'];
771 }
772 }
773 if(!in_array($source_obj->getType(),$allowed))
774 {
775 return $this->__raiseError('Objects of type: '.$source_obj->getType().' are not allowed to be subobjects of type '.
776 $target_obj->getType().'!',
777 'Client');
778 }
779
780 // Permission checks
781 if(!$rbacsystem->checkAccess('create',$target_obj->getRefId(),$source_obj->getType()))
782 {
783 return $this->__raiseError('No permission to create objects of type '.$source_obj->getType().'!',
784 'Client');
785 }
786 if(!$rbacsystem->checkAccess('delete',$source_obj->getRefId()))
787 {
788 return $this->__raiseError('No permission to link object with id: '.$source_obj->getRefId().'!',
789 'Client');
790 }
791
792
793 if($source_obj->getType() != 'cat' and $source_obj->getType() != 'crs')
794 {
795 // check if object already linked to target
796 $possibleChilds = $tree->getChildsByType($target_obj->getRefId(), $source_obj->getType());
797 foreach ($possibleChilds as $child)
798 {
799 if ($child["obj_id"] == $source_obj->getId())
800 return $this->__raiseError("Object already linked to target.","Client");
801 }
802
803 // Finally link it to target position
804
805 $new_ref_id = $source_obj->createReference();
806 $source_obj->putInTree($target_obj->getRefId());
807 $source_obj->setPermissions($target_obj->getRefId());
808
809 return $new_ref_id ? $new_ref_id : "0";
810 }
811 else
812 {
813 switch($source_obj->getType())
814 {
815 case 'cat':
816 include_once('./Modules/CategoryReference/classes/class.ilObjCategoryReference.php');
817 $new_ref = new ilObjCategoryReference();
818 break;
819
820 case 'crs':
821 include_once('./Modules/CourseReference/classes/class.ilObjCourseReference.php');
822 $new_ref = new ilObjCourseReference();
823 break;
824 case 'grp':
825 include_once('./Modules/GroupReference/classes/class.ilObjGroupReference.php');
826 $new_ref = new ilObjGroupReference();
827 break;
828 }
829 $new_ref->create();
830 $new_ref_id = $new_ref->createReference();
831
832 $new_ref->putInTree($target_obj->getRefId());
833 $new_ref->setPermissions($target_obj->getRefId());
834
835 $new_ref->setTargetId($source_obj->getId());
836 $new_ref->update();
837
838 return $new_ref_id ? $new_ref_id : 0;
839 }
840 }

References $row, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ addReferences()

ilSoapObjectAdministration::addReferences (   $source,
  $a_object_data 
)
private

Definition at line 1461 of file class.ilSoapObjectAdministration.php.

1462 {
1463 global $tree,$ilLog;
1464
1465 if(!isset($a_object_data['references']) or !count($a_object_data['references']))
1466 {
1467 return true;
1468 }
1469
1470 $original_id = $source->getRefId();
1471
1472 foreach($a_object_data['references'] as $ref_data)
1473 {
1474 $new_ref_id = $ref_id = $original_id;
1475 if($tree->getParentId($original_id) != $ref_data['parent_id'])
1476 {
1477 // New reference requested => create it
1478 $new_ref_id = $source->createReference();
1479 $source->putInTree($ref_data['parent_id']);
1480 $source->setPermissions($ref_data['parent_id']);
1481 }
1482 if(isset($ref_data['time_target']) /* and ($crs_ref_id = $tree->checkForParentType($new_ref_id,'crs')) */)
1483 {
1484 include_once('./webservice/soap/classes/class.ilObjectXMLWriter.php');
1485 include_once('./Services/Object/classes/class.ilObjectActivation.php');
1486
1487 if(!isset($ref_data['time_target']['starting_time']))
1488 {
1489 $ref_data['time_target']['starting_time'] = time();
1490 }
1491 if(!isset($ref_data['time_target']['ending_time']))
1492 {
1493 $ref_data['time_target']['ending_time'] = time();
1494 }
1495
1496 $items = new ilObjectActivation();
1497 $items->toggleChangeable($ref_data['time_target']['changeable']);
1498 $items->setTimingStart($ref_data['time_target']['starting_time']);
1499 $items->setTimingEnd($ref_data['time_target']['ending_time']);
1500 $items->toggleVisible($ref_data['time_target']['timing_visibility']);
1501 $items->setSuggestionStart($ref_data['time_target']['suggestion_start']);
1502 $items->setSuggestionEnd($ref_data['time_target']['suggestion_end']);
1503 $items->setEarliestStart($ref_data['time_target']['earliest_start']);
1504 $items->setLatestEnd($ref_data['time_target']['latest_end']);
1505
1506 switch($ref_data['time_target']['timing_type'])
1507 {
1509 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_DEACTIVATED.' '.$ref_data['time_target']['timing_type']);
1510 $items->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
1511 break;
1512
1514 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_ACTIVATION.' '.$ref_data['time_target']['timing_type']);
1515 $items->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1516 break;
1517
1519 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_PRESETTING.' '.$ref_data['time_target']['timing_type']);
1520 $items->setTimingType(ilObjectActivation::TIMINGS_PRESETTING);
1521 break;
1522 }
1523 $items->update($new_ref_id);
1524 }
1525 }
1526
1527 }
Class ilObjectActivation.

References $ilLog, $ref_id, ilObjectXMLWriter\TIMING_DEACTIVATED, ilObjectXMLWriter\TIMING_PRESETTING, ilObjectXMLWriter\TIMING_TEMPORARILY_AVAILABLE, ilObjectActivation\TIMINGS_ACTIVATION, ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by addObject().

+ Here is the caller graph for this function:

◆ canAddType()

ilSoapObjectAdministration::canAddType (   $type,
  $target_type,
  $target_id 
)
private

Definition at line 1313 of file class.ilSoapObjectAdministration.php.

1314 {
1315 // checking for target subtypes. Can we add source to target
1316 global $objDefinition, $rbacsystem;
1317
1318 $allowed_types = array('root','cat','grp','crs','fold');
1319 if(!in_array($target_type, $allowed_types))
1320 {
1321 return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"', 'Client');
1322 }
1323
1324 $allowed_subtypes = $objDefinition->getSubObjects($target_type);
1325 $allowed = array();
1326
1327 foreach($allowed_subtypes as $row)
1328 {
1329 if($row['name'] != 'rolf')
1330 {
1331 $allowed[] = $row['name'];
1332 }
1333 }
1334
1335 if(!in_array($type, $allowed))
1336 {
1337 return $this->__raiseError('Objects of type: '.$type.' are not allowed to be subobjects of type '.$target_type.'!','Client');
1338 }
1339 if(!$rbacsystem->checkAccess('create',$target_id, $type))
1340 {
1341 return $this->__raiseError('No permission to create objects of type '.$type.'!', 'Client');
1342 }
1343
1344 return true;
1345 }
$target_id
Definition: goto.php:51
$target_type
Definition: goto.php:50

References $row, $target_id, $target_type, and ilSoapAdministration\__raiseError().

Referenced by copyObject(), moveObject(), and validateReferences().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyObject()

ilSoapObjectAdministration::copyObject (   $sid,
  $copy_settings_xml 
)

copy object in repository $sid session id $settings_xml contains copy wizard settings following ilias_copy_wizard_settings.dtd

Definition at line 1172 of file class.ilSoapObjectAdministration.php.

1173 {
1174 $this->initAuth($sid);
1175 $this->initIlias();
1176
1177 if(!$this->__checkSession($sid))
1178 {
1179 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1180 }
1181
1182
1183 include_once './webservice/soap/classes/class.ilSoapUtils.php';
1184 global $rbacreview, $objDefinition, $rbacsystem, $lng, $ilUser;
1185
1186 include_once './webservice/soap/classes/class.ilCopyWizardSettingsXMLParser.php';
1187 $xml_parser = new ilCopyWizardSettingsXMLParser($copy_settings_xml);
1188 try {
1189 $xml_parser->startParsing();
1190 } catch (ilSaxParserException $se){
1191 return $this->__raiseError($se->getMessage(), "Client");
1192 }
1193
1194 // checking copy permissions, objects and create permissions
1195 if(!$rbacsystem->checkAccess('copy',$xml_parser->getSourceId()))
1196 {
1197 return $this->__raiseError("Missing copy permissions for object with reference id ".$xml_parser->getSourceId(), 'Client');
1198 }
1199
1200 // checking copy permissions, objects and create permissions
1201 $source_id = $xml_parser->getSourceId();
1202 $target_id = $xml_parser->getTargetId();
1203
1204
1205 // does source object exist
1206 if(!$source_object_type = ilObjectFactory::getTypeByRefId($source_id, false))
1207 {
1208 return $this->__raiseError('No valid source given.', 'Client');
1209 }
1210
1211 // does target object exist
1212 if(!$target_object_type = ilObjectFactory::getTypeByRefId($xml_parser->getTargetId(), false))
1213 {
1214 return $this->__raiseError('No valid target given.', 'Client');
1215 }
1216
1217
1218 $canAddType = $this->canAddType($source_object_type, $target_object_type, $target_id);
1219 if ($this->isFault($canAddType))
1220 {
1221 return $canAddType;
1222 }
1223
1224 // if is container object than clone with sub items
1225 $options = $xml_parser->getOptions();
1226// print_r($options);
1227 $source_object = ilObjectFactory::getInstanceByRefId($source_id);
1228 if ($source_object instanceof ilContainer) {
1229 // get client id from sid
1230 $clientid = substr($sid, strpos($sid, "::") + 2);
1231 $sessionid = str_replace("::".$clientid, "", $sid);
1232 // call container clone
1233 $ret = $source_object->cloneAllObject($sessionid, $clientid,
1234 $source_object_type,
1235 $target_id,
1236 $source_id,
1237 $options, true);
1238
1239 return $ret['ref_id'];
1240
1241 } else {
1242 // create copy wizard settings
1244 $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
1245 $wizard_options->saveOwner($ilUser->getId());
1246 $wizard_options->saveRoot($source_id);
1247
1248 foreach($options as $source_id => $option)
1249 {
1250 $wizard_options->addEntry($source_id,$option);
1251 }
1252 $wizard_options->read();
1253
1254 // call object clone
1255 $newObject = $source_object->cloneObject($xml_parser->getTargetId(), $copy_id);
1256 return is_object($newObject) ? $newObject->getRefId() : -1;
1257 }
1258 }
Class ilContainer.
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static getTypeByRefId($a_ref_id, $stop_on_error=true)
get object type by reference id
canAddType($type, $target_type, $target_id)
$ret
Definition: parser.php:6
if(!is_array($argv)) $options

References $ilUser, $lng, $options, $ret, $target_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilCopyWizardOptions\_allocateCopyId(), ilCopyWizardOptions\_getInstance(), canAddType(), ilObjectFactory\getInstanceByRefId(), ilObjectFactory\getTypeByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\isFault().

+ Here is the call graph for this function:

◆ deleteObject()

ilSoapObjectAdministration::deleteObject (   $sid,
  $reference_id 
)

Definition at line 842 of file class.ilSoapObjectAdministration.php.

843 {
844 $this->initAuth($sid);
845 $this->initIlias();
846
847 if(!$this->__checkSession($sid))
848 {
849 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
850 }
851 if(!is_numeric($reference_id))
852 {
853 return $this->__raiseError('No reference id given.',
854 'Client');
855 }
856 global $tree, $rbacsystem, $rbacadmin;
857
858 if(!$del_obj =& ilObjectFactory::getInstanceByRefId($reference_id,false))
859 {
860 return $this->__raiseError('No valid reference id given.',
861 'Client');
862 }
863 if(!$rbacsystem->checkAccess('delete',$del_obj->getRefId()))
864 {
865 return $this->__raiseError('No permission to delete object with id: '.$del_obj->getRefId().'!',
866 'Client');
867 }
868
869 // Delete tree
870 if($tree->isDeleted($reference_id))
871 {
872 return $this->__raiseError('Node already deleted','Server');
873 }
874
875 if($del_obj->getType() == 'rolf')
876 {
877 return $this->__raiseError('Delete is not available for role folders.','Client');
878 }
879
880 $subnodes = $tree->getSubtree($tree->getNodeData($reference_id));
881 foreach($subnodes as $subnode)
882 {
883 $rbacadmin->revokePermission($subnode["child"]);
884 // remove item from all user desktops
885 $affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
886 }
887 if(!$tree->saveSubTree($reference_id,true))
888 {
889 return $this->__raiseError('Node already deleted','Client');
890 }
891
892 return true;
893 }
static removeItemFromDesktops($a_id)
removes object from all user's desktops @access public

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilUtil\removeItemFromDesktops().

+ Here is the call graph for this function:

◆ getObjectByReference()

ilSoapObjectAdministration::getObjectByReference (   $sid,
  $a_ref_id,
  $user_id 
)

Definition at line 165 of file class.ilSoapObjectAdministration.php.

166 {
167 $this->initAuth($sid);
168 $this->initIlias();
169
170 if(!$this->__checkSession($sid))
171 {
172 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
173 }
174 if(!is_numeric($a_ref_id))
175 {
176 return $this->__raiseError('No valid reference id given. Please choose an existing reference id of an ILIAS object',
177 'Client');
178 }
179
180 if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($a_ref_id,false))
181 {
182 return $this->__raiseError('Cannot create object instance!','Server');
183 }
184
185
186 if(ilObject::_isInTrash($a_ref_id))
187 {
188 return $this->__raiseError("Object with ID $a_ref_id has been deleted.", 'Client');
189 }
190
191 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
192
193 $xml_writer = new ilObjectXMLWriter();
194 $xml_writer->enablePermissionCheck(true);
195 if($user_id)
196 {
197 $xml_writer->setUserId($user_id);
198 $xml_writer->enableOperations(true);
199 }
200 $xml_writer->setObjects(array($tmp_obj));
201 if($xml_writer->start())
202 {
203 return $xml_writer->getXML();
204 }
205
206 return $this->__raiseError('Cannot create object xml !','Server');
207 }

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getObjectsByTitle()

ilSoapObjectAdministration::getObjectsByTitle (   $sid,
  $a_title,
  $user_id 
)

Definition at line 209 of file class.ilSoapObjectAdministration.php.

210 {
211 $this->initAuth($sid);
212 $this->initIlias();
213
214 if(!$this->__checkSession($sid))
215 {
216 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
217 }
218 if(!strlen($a_title))
219 {
220 return $this->__raiseError('No valid query string given.',
221 'Client');
222 }
223
224 include_once './Services/Search/classes/class.ilQueryParser.php';
225
226 $query_parser = new ilQueryParser($a_title);
227 $query_parser->setMinWordLength(0,true);
228 $query_parser->setCombination(QP_COMBINATION_AND);
229 $query_parser->parse();
230 if(!$query_parser->validate())
231 {
232 return $this->__raiseError($query_parser->getMessage(),
233 'Client');
234 }
235
236 include_once './Services/Search/classes/class.ilObjectSearchFactory.php';
237
238 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
239 $object_search = new ilLikeObjectSearch($query_parser);
240
241 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
242 $object_search->setFields(array('title'));
243 $object_search->appendToFilter('role');
244 $object_search->appendToFilter('rolt');
245 $res =& $object_search->performSearch();
246 if($user_id)
247 {
248 $res->setUserId($user_id);
249 }
250
251 $res->filter(ROOT_FOLDER_ID,true);
252
253 $objs = array();
254 foreach($res->getUniqueResults() as $entry)
255 {
256 if($entry['type'] == 'role' or $entry['type'] == 'rolt')
257 {
258 if($tmp = ilObjectFactory::getInstanceByObjId($entry['obj_id'],false))
259 {
260 $objs[] = $tmp;
261 }
262 continue;
263 }
264 if($tmp = ilObjectFactory::getInstanceByRefId($entry['ref_id'],false))
265 {
266 $objs[] = $tmp;
267 }
268 }
269 if(!count($objs))
270 {
271 return '';
272 }
273
274 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
275
276 $xml_writer = new ilObjectXMLWriter();
277 $xml_writer->enablePermissionCheck(true);
278 if($user_id)
279 {
280 $xml_writer->setUserId($user_id);
281 $xml_writer->enableOperations(true);
282 }
283 $xml_writer->setObjects($objs);
284 if($xml_writer->start())
285 {
286 return $xml_writer->getXML();
287 }
288
289 return $this->__raiseError('Cannot create object xml !','Server');
290 }
const QP_COMBINATION_AND
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

References $res, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and QP_COMBINATION_AND.

+ Here is the call graph for this function:

◆ getObjIdByImportId()

ilSoapObjectAdministration::getObjIdByImportId (   $sid,
  $import_id 
)

Definition at line 38 of file class.ilSoapObjectAdministration.php.

39 {
40 $this->initAuth($sid);
41 $this->initIlias();
42
43 if(!$this->__checkSession($sid))
44 {
45 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
46 }
47 if(!$import_id)
48 {
49 return $this->__raiseError('No import id given.',
50 'Client');
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 }

References $ilLog, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_lookupObjIdByImportId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getObjIdsByRefIds()

ilSoapObjectAdministration::getObjIdsByRefIds (   $sid,
  $ref_ids 
)

Returns a array of object ids which match the references id, given by a comma seperated string.

Parameters
string$sidSession ID
arrayof int $ref ids as comma separated list
Returns
array of ref ids, same order as object ids there for there might by duplicates

Definition at line 125 of file class.ilSoapObjectAdministration.php.

126 {
127 $this->initAuth($sid);
128 $this->initIlias();
129
130 if(!$this->__checkSession($sid))
131 {
132 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
133 }
134
135
136 if(!count($ref_ids) || !is_array ($ref_ids))
137 {
138 return $this->__raiseError('No reference id(s) given.', 'Client');
139 }
140
141 $obj_ids = array();
142 if (count($ref_ids)) {
143 foreach ($ref_ids as $ref_id)
144 {
145 $ref_id = trim($ref_id);
146 if (!is_numeric($ref_id)){
147 return $this->__raiseError('Reference ID has to be numeric. Value: '.$ref_id, 'Client');
148 }
149
151 if (!$obj_id){
152 return $this->__raiseError('No object found for reference ID. Value: '.$ref_id, 'Client');
153 }
155 return $this->__raiseError('No untrashed reference found for reference ID. Value: '.$ref_id, 'Client');
156 }
157 $obj_ids[] = $obj_id;
158 }
159 }
160 return $obj_ids;
161 }
static _lookupObjectId($a_ref_id)
lookup object id
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash

References $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_hasUntrashedReference(), ilObject\_lookupObjectId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getPathForRefId()

ilSoapObjectAdministration::getPathForRefId (   $sid,
  $ref_id 
)

Definition at line 1260 of file class.ilSoapObjectAdministration.php.

1261 {
1262 $this->initAuth($sid);
1263 $this->initIlias();
1264
1265 if(!$this->__checkSession($sid))
1266 {
1267 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1268 }
1269
1270 global $ilAccess, $objDefinition, $rbacsystem, $lng, $ilUser;
1271
1272 if(!$rbacsystem->checkAccess('read', $ref_id))
1273 {
1274 return $this->__raiseError("Missing read permissions for object with reference id ".$ref_id, 'Client');
1275 }
1276
1278 {
1279 return $this->__raiseError("Object is in Trash", 'Client');
1280 }
1281 global $tree, $lng;
1282 $items = $tree->getPathFull($ref_id);
1283
1284 include_once 'webservice/soap/classes/class.ilXMLResultSet.php';
1285 include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
1286 include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
1287
1288 $xmlResultSet = new ilXMLResultSet();
1289 $xmlResultSet->addColumn("ref_id");
1290 $xmlResultSet->addColumn("type");
1291 $xmlResultSet->addColumn("title");
1292
1293 $writer = new ilXMLResultSetWriter($xmlResultSet);
1294 foreach ($items as $item) {
1295 if ($item["ref_id"] == $ref_id)
1296 continue;
1297 if ($item["title"] == "ILIAS" && $item["type"] == "root")
1298 {
1299 $item["title"] = $lng->txt("repository");
1300 }
1301
1302 $row = new ilXMLResultSetRow();
1303 $xmlResultSet->addRow($row);
1304 $row->setValue("ref_id", $item["ref_id"]);
1305 $row->setValue("type", $item["type"]);
1306 $row->setValue("title", $item["title"]);
1307 }
1308 $writer->start();
1309 return $writer->getXML();
1310 }
XML Writer for XMLResultSet.

References $ilUser, $lng, $ref_id, $row, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getRefIdsByImportId()

ilSoapObjectAdministration::getRefIdsByImportId (   $sid,
  $import_id 
)

Definition at line 61 of file class.ilSoapObjectAdministration.php.

62 {
63 $this->initAuth($sid);
64 $this->initIlias();
65
66 if(!$this->__checkSession($sid))
67 {
68 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
69 }
70 if(!$import_id)
71 {
72 return $this->__raiseError('No import id given.',
73 'Client');
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 {
85 // only get non deleted reference ids
86 if ($tree->isInTree($ref_id))
87 {
88 $new_refs[] = $ref_id;
89 }
90 }
91 return $new_refs ? $new_refs : array();
92 }
static _getAllReferences($a_id)
get all reference ids of object

References $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_lookupObjIdByImportId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getRefIdsByObjId()

ilSoapObjectAdministration::getRefIdsByObjId (   $sid,
  $obj_id 
)

Definition at line 94 of file class.ilSoapObjectAdministration.php.

95 {
96 $this->initAuth($sid);
97 $this->initIlias();
98
99 if(!$this->__checkSession($sid))
100 {
101 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
102 }
103 if(!$obj_id)
104 {
105 return $this->__raiseError('No object id given.',
106 'Client');
107 }
108
109 $ref_ids = ilObject::_getAllReferences($obj_id);
110 foreach($ref_ids as $ref_id)
111 {
112 $new_refs[] = $ref_id;
113 }
114 return $new_refs ? $new_refs : array();
115 }

References $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getTreeChilds()

ilSoapObjectAdministration::getTreeChilds (   $sid,
  $ref_id,
  $types,
  $user_id 
)

Definition at line 430 of file class.ilSoapObjectAdministration.php.

431 {
432 $this->initAuth($sid);
433 $this->initIlias();
434
435 if(!$this->__checkSession($sid))
436 {
437 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
438 }
439
440 $all = false;
441
442 global $tree;
443
444 if(!$target_obj =& ilObjectFactory::getInstanceByRefId($ref_id,false))
445 {
446 return $this->__raiseError('No valid reference id given.',
447 'Client');
448 }
449 if (intval($ref_id) == SYSTEM_FOLDER_ID) {
450 return $this->__raiseError('No valid reference id given.',
451 'Client');
452 }
453
454 if(!$types)
455 {
456 $all = true;
457 }
458
459 $objs = array();
460
461 // begin-patch filemanager
462 include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
463 if(in_array('parent', (array) $types))
464 {
465 $objs[] = $target_obj;
466 }
467 // end-patch filemanager
468
469 foreach($tree->getChilds($ref_id,'title') as $child)
470 {
471 if($all or in_array($child['type'],$types))
472 {
473 if($tmp = ilObjectFactory::getInstanceByRefId($child['ref_id'],false))
474 {
475 $objs[] = $tmp;
476 }
477 }
478 }
479
480 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
481
482 $xml_writer = new ilObjectXMLWriter();
483 // begin-patch filemanager
484 if(ilFMSettings::getInstance()->isEnabled())
485 {
486 $xml_writer->enableReferences(false);
487 }
488 // end-patch filemanager
489 $xml_writer->enablePermissionCheck(true);
490 $xml_writer->setObjects($objs);
491 $xml_writer->enableOperations(true);
492 if($user_id)
493 {
494 $xml_writer->setUserId($user_id);
495 }
496
497 if ($xml_writer->start())
498 {
499 #$GLOBALS['ilLog']->write(__METHOD__.': '.$xml_writer->getXML());
500 return $xml_writer->getXML();
501 }
502
503 return $this->__raiseError('Cannot create object xml !','Server');
504 }
static getInstance()
Get singleton instance.

References $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilFMSettings\getInstance(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getXMLTree()

ilSoapObjectAdministration::getXMLTree (   $sid,
  $ref_id,
  $types,
  $user_id 
)

Definition at line 506 of file class.ilSoapObjectAdministration.php.

507 {
508 $this->initAuth($sid);
509 $this->initIlias();
510
511 if(!$this->__checkSession($sid))
512 {
513 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
514 }
515
516 global $tree;
517
518 $nodedata = $tree->getNodeData($ref_id);
519 $nodearray = $tree->getSubTree($nodedata);
520
521
522 $filter = (array) $types;
523
524 global $objDefinition;
525 foreach($nodearray as $node)
526 {
527 if(!$objDefinition->isAdministrationObject($node['type']) && !$objDefinition->isSystemObject($node['type']))
528 {
529 if(!in_array($node['type'], $filter))
530 {
531 if($tmp = ilObjectFactory::getInstanceByRefId($node['ref_id'], false))
532 {
533 $nodes[] = $tmp;
534 }
535 }
536 }
537 }
538
539
540 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
541
542 $xml_writer = new ilObjectXMLWriter();
543 $xml_writer->enablePermissionCheck(true);
544 $xml_writer->setObjects($nodes);
545 $xml_writer->enableOperations(false);
546
547 if($user_id)
548 {
549 $xml_writer->setUserId($user_id);
550 }
551
552 if($xml_writer->start())
553 {
554 return $xml_writer->getXML();
555 }
556
557 return $this->__raiseError('Cannot create object xml !', 'Server');
558 }

References $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ moveObject()

ilSoapObjectAdministration::moveObject (   $sid,
  $ref_id,
  $target_id 
)

Definition at line 1102 of file class.ilSoapObjectAdministration.php.

1103 {
1104 $this->initAuth($sid);
1105 $this->initIlias();
1106
1107 if(!$this->__checkSession($sid))
1108 {
1109 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
1110 }
1111
1112 include_once './webservice/soap/classes/class.ilSoapUtils.php';
1113 global $rbacreview, $rbacadmin, $objDefinition, $rbacsystem, $lng, $ilUser, $tree;
1114
1115 // does source object exist
1116 if(!$source_object_type = ilObjectFactory::getTypeByRefId($ref_id, false))
1117 {
1118 return $this->__raiseError('No valid source given.', 'Client');
1119 }
1120
1121 // does target object exist
1122 if(!$target_object_type = ilObjectFactory::getTypeByRefId($target_id, false))
1123 {
1124 return $this->__raiseError('No valid target given.', 'Client');
1125 }
1126
1127 // check for trash
1129 {
1130 return $this->__raiseError('Object is trashed.', 'Client');
1131 }
1132
1134 {
1135 return $this->__raiseError('Object is trashed.', 'Client');
1136 }
1137
1138 $canAddType = $this->canAddType($source_object_type, $target_object_type, $target_id);
1139 if ($this->isFault($canAddType))
1140 {
1141 return $canAddType;
1142 }
1143
1144 // check if object already linked to target
1145 $possibleChilds = $tree->getChildsByType($target_id, $ref_id);
1146 foreach ($possibleChilds as $child)
1147 {
1148 if ($child["obj_id"] == $ref_id)
1149 return $this->__raiseError("Object already exists in target.","Client");
1150 }
1151
1152 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1153 if ($tree->isGrandChild($ref_id,$target_id))
1154 {
1155 return $this->__raiseError("Cannot move object into itself.","Client");
1156 }
1157
1158 $old_parent = $tree->getParentId($ref_id);
1159 $tree->moveTree($ref_id,$target_id);
1160 $rbacadmin->adjustMovedObjectPermissions($ref_id,$old_parent);
1161
1162 include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
1164 return true;
1165 }
static _adjustMovedObjectConditions($a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...

References $ilUser, $lng, $ref_id, $target_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilConditionHandler\_adjustMovedObjectConditions(), ilObject\_isInTrash(), canAddType(), ilObjectFactory\getTypeByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\isFault().

+ Here is the call graph for this function:

◆ removeFromSystemByImportId()

ilSoapObjectAdministration::removeFromSystemByImportId (   $sid,
  $import_id 
)

Definition at line 895 of file class.ilSoapObjectAdministration.php.

896 {
897 $this->initAuth($sid);
898 $this->initIlias();
899
900 if(!$this->__checkSession($sid))
901 {
902 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
903 }
904 if(!strlen($import_id))
905 {
906 return $this->__raiseError('No import id given. Aborting!',
907 'Client');
908 }
909 global $rbacsystem, $tree, $ilLog;
910
911 // get obj_id
912 if(!$obj_id = ilObject::_lookupObjIdByImportId($import_id))
913 {
914 return $this->__raiseError('No object found with import id: '.$import_id,
915 'Client');
916 }
917
918 // Check access
919 $permission_ok = false;
920 foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
921 {
922 if($rbacsystem->checkAccess('delete',$ref_id))
923 {
924 $permission_ok = true;
925 break;
926 }
927 }
928 if(!$permission_ok)
929 {
930 return $this->__raiseError('No permission to delete the object with import id: '.$import_id,
931 'Server');
932 }
933
934 // Delete all references (delete permssions and entries in object_reference)
935 foreach($ref_ids as $ref_id)
936 {
937 // All subnodes
938 $node_data = $tree->getNodeData($ref_id);
939 $subtree_nodes = $tree->getSubtree($node_data);
940
941 foreach($subtree_nodes as $node)
942 {
943 $ilLog->write('Soap: removeFromSystemByImportId(). Deleting object with title id: '.$node['title']);
944 $tmp_obj = ilObjectFactory::getInstanceByRefId($node['ref_id']);
945 if(!is_object($tmp_obj))
946 {
947 return $this->__raiseError('Cannot create instance of reference id: '.$node['ref_id'],
948 'Server');
949 }
950 $tmp_obj->delete();
951 }
952 // Finally delete tree
953 $tree->deleteTree($node_data);
954
955 }
956
957 return true;
958 }

References $ilLog, $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_lookupObjIdByImportId(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ searchObjects()

ilSoapObjectAdministration::searchObjects (   $sid,
  $types,
  $key,
  $combination,
  $user_id 
)

Definition at line 292 of file class.ilSoapObjectAdministration.php.

293 {
294 $this->initAuth($sid);
295 $this->initIlias();
296
297 if(!$this->__checkSession($sid))
298 {
299 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
300 }
301 if(!is_array($types))
302 {
303 return $this->__raiseError('Types must be an array of object types.',
304 'Client');
305 }
306 if($combination != 'and' and $combination != 'or')
307 {
308 return $this->__raiseError('No valid combination given. Must be "and" or "or".',
309 'Client');
310 }
311
312 // begin-patch fm
313 include_once './Services/Search/classes/class.ilSearchSettings.php';
314 if(ilSearchSettings::getInstance()->enabledLucene()) {
315
316 ilSearchSettings::getInstance()->setMaxHits(25);
317
318 include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
319 $query_parser = new ilLuceneQueryParser($key);
320 $query_parser->parse();
321
322 include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
323 $searcher = ilLuceneSearcher::getInstance($query_parser);
324 $searcher->search();
325
326 include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
327 include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
328 $filter = ilLuceneSearchResultFilter::getInstance($user_id);
329 $filter->setCandidates($searcher->getResult());
330 $filter->filter();
331
332 $result_ids = $filter->getResults();
333 $objs = array();
334 $objs[ROOT_FOLDER_ID] = ilObjectFactory::getInstanceByRefId(ROOT_FOLDER_ID,false);
335 foreach ((array) $result_ids as $ref_id => $obj_id) {
336
338 if($obj instanceof ilObject)
339 {
340 $objs[] = $obj;
341 }
342 }
343 include_once './Services/Search/classes/Lucene/class.ilLuceneHighlighterResultParser.php';
344 $highlighter = new ilLuceneHighlighterResultParser();
345 if($filter->getResultObjIds())
346 {
347 $highlighter = $searcher->highlight($filter->getResultObjIds());
348 }
349 }
350 else
351 {
352
353 include_once './Services/Search/classes/class.ilQueryParser.php';
354
355 $query_parser = new ilQueryParser($key);
356 #$query_parser->setMinWordLength(3);
357 $query_parser->setCombination($combination == 'and' ? QP_COMBINATION_AND : QP_COMBINATION_OR);
358 $query_parser->parse();
359 if(!$query_parser->validate())
360 {
361 return $this->__raiseError($query_parser->getMessage(),
362 'Client');
363 }
364
365 #include_once './Services/Search/classes/class.ilObjectSearchFactory.php';
366 #$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
367
368 include_once './Services/Search/classes/Like/class.ilLikeObjectSearch.php';
369 $object_search = new ilLikeObjectSearch($query_parser);
370
371 $object_search->setFilter($types);
372
373 $res =& $object_search->performSearch();
374 if($user_id)
375 {
376 $res->setUserId($user_id);
377 }
378 // begin-patch fm
379 $res->setMaxHits(100);
380 // begin-patch fm
381 $res->filter(ROOT_FOLDER_ID,$combination == 'and' ? true : false);
382
383 $counter = 0;
384 $objs = array();
385 foreach($res->getUniqueResults() as $entry)
386 {
387 $obj = ilObjectFactory::getInstanceByRefId($entry['ref_id'],false);
388 if($obj instanceof ilObject)
389 {
390 $objs[] = $obj;
391 }
392 }
393 }
394
395 if(!count($objs))
396 {
397 return '';
398 }
399
400 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
401
402 $xml_writer = new ilObjectXMLWriter();
403
404 // begin-patch fm
405 if(ilSearchSettings::getInstance()->enabledLucene())
406 {
407 $xml_writer->enableReferences(false);
408 $xml_writer->setMode(ilObjectXmlWriter::MODE_SEARCH_RESULT);
409 $xml_writer->setHighlighter($highlighter);
410 }
411
412 $xml_writer->enablePermissionCheck(true);
413
414 if($user_id)
415 {
416 $xml_writer->setUserId($user_id);
417 $xml_writer->enableOperations(true);
418 }
419
420 $xml_writer->setObjects($objs);
421 if($xml_writer->start())
422 {
423 #$GLOBALS['ilLog']->write(__METHOD__.': '.$xml_writer->xmlDumpMem(true));
424 return $xml_writer->getXML();
425 }
426
427 return $this->__raiseError('Cannot create object xml !','Server');
428 }
const QP_COMBINATION_OR
Parses result XML from lucene search highlight.
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
Class ilObject Basic functions for all objects.
$counter

References $counter, $ref_id, $res, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilLuceneSearchResultFilter\getInstance(), ilSearchSettings\getInstance(), ilLuceneSearcher\getInstance(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), QP_COMBINATION_AND, and QP_COMBINATION_OR.

+ Here is the call graph for this function:

◆ updateObjects()

ilSoapObjectAdministration::updateObjects (   $sid,
  $a_xml 
)

Definition at line 961 of file class.ilSoapObjectAdministration.php.

962 {
963 $this->initAuth($sid);
964 $this->initIlias();
965
966 if(!$this->__checkSession($sid))
967 {
968 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
969 }
970 if(!strlen($a_xml))
971 {
972 return $this->__raiseError('No valid xml string given.',
973 'Client');
974 }
975
976 global $rbacreview, $rbacsystem, $lng,$ilAccess;
977
978 include_once './webservice/soap/classes/class.ilObjectXMLParser.php';
979 $xml_parser = new ilObjectXMLParser($a_xml, true);
980 try
981 {
982 $xml_parser->startParsing();
983 }
984 catch (ilSaxParserException $se){
985 return $this->__raiseError($se->getMessage(),'Client');
986 }
987 catch(ilObjectXMLException $e) {
988 return $this->__raiseError($e->getMessage(),'Client');
989 }
990
991
992 // Validate incoming data
993 $object_datas = $xml_parser->getObjectData();
994 foreach($object_datas as & $object_data)
995 {
996 $res = $this->validateReferences('update',$object_data);
997 if($this->isFault($res))
998 {
999 return $res;
1000 }
1001
1002
1003 if(!$object_data["obj_id"])
1004 {
1005 return $this->__raiseError('No obj_id in xml found.', 'Client');
1006 }
1007 elseif ((int) $object_data["obj_id"] == -1 && count($object_data["references"])>0)
1008 {
1009 // object id might be unknown, resolve references instead to determine object id
1010 // all references should point to the same object, so using the first one is ok.
1011 foreach ($object_data["references"] as $refid)
1012 {
1013 if(ilObject::_isInTrash($refid))
1014 {
1015 continue;
1016 }
1017 break;
1018 }
1019
1020 $obj_id_from_refid = ilObject::_lookupObjectId($object_data["references"][0], false);
1021 if (!$obj_id_from_refid)
1022 {
1023 return $this->__raiseError('No obj_id found for reference id '.$object_data["references"][0], 'CLIENT_OBJECT_NOT_FOUND');
1024 } else
1025 {
1026 $tmp_obj = ilObjectFactory::getInstanceByObjId($object_data['obj_id'], false);
1027 $object_data["obj_id"] = $obj_id_from_refid;
1028 }
1029 }
1030
1031 $tmp_obj = ilObjectFactory::getInstanceByObjId($object_data['obj_id'], false);
1032 if ($tmp_obj == null)
1033 {
1034 return $this->__raiseError('No object for id '.$object_data['obj_id'].'!', 'CLIENT_OBJECT_NOT_FOUND');
1035 }
1036 else
1037 {
1038 $object_data["instance"] = $tmp_obj;
1039 }
1040
1041 if($object_data['type'] == 'role')
1042 {
1043 $rolf_ids = $rbacreview->getFoldersAssignedToRole($object_data['obj_id'],true);
1044 $rolf_id = $rolf_ids[0];
1045
1046 if(!$rbacsystem->checkAccess('write',$rolf_id))
1047 {
1048 return $this->__raiseError('No write permission for object with id '.$object_data['obj_id'].'!', 'Client');
1049 }
1050 }
1051 else
1052 {
1053 $permission_ok = false;
1054 foreach(ilObject::_getAllReferences($object_data['obj_id']) as $ref_id)
1055 {
1056 if($ilAccess->checkAccess('write','',$ref_id))
1057 {
1058 $permission_ok = true;
1059 break;
1060 }
1061 }
1062 if(!$permission_ok)
1063 {
1064 return $this->__raiseError('No write permission for object with id '.$object_data['obj_id'].'!', 'Client');
1065 }
1066 }
1067 }
1068 // perform update
1069 if (count ($object_datas) > 0)
1070 {
1071 foreach($object_datas as $object_data)
1072 {
1073 $this->updateReferences($object_data);
1074
1075 $tmp_obj = $object_data["instance"];
1076 $tmp_obj->setTitle($object_data['title']);
1077 $tmp_obj->setDescription($object_data['description']);
1078
1079 #$GLOBALS['ilLog']->write(__METHOD__.': type is '. $object_data['type']);
1080 #$GLOBALS['ilLog']->write(__METHOD__.': type is '. $a_xml);
1081
1082
1083 switch ($object_data['type'])
1084 {
1085 case 'cat':
1086 $tmp_obj->updateTranslation($object_data["title"],$object_data["description"], $lng->getLangKey(), $lng->getLangKey());
1087 break;
1088 }
1089 $tmp_obj->update();
1090 if(strlen($object_data['owner']) && is_numeric($object_data['owner']))
1091 {
1092 $tmp_obj->setOwner($object_data['owner']);
1093 $tmp_obj->updateOwner();
1094 }
1095
1096 }
1097 return true;
1098 }
1099 return false;
1100 }

References $lng, $ref_id, $res, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ilSoapAdministration\isFault(), updateReferences(), and validateReferences().

+ Here is the call graph for this function:

◆ updateReferences()

ilSoapObjectAdministration::updateReferences (   $a_object_data)
private

Definition at line 1410 of file class.ilSoapObjectAdministration.php.

1411 {
1412 global $tree,$ilLog;
1413
1414 if(!isset($a_object_data['references']) or !count($a_object_data['references']))
1415 {
1416 return true;
1417 }
1418
1419 foreach($a_object_data['references'] as $ref_data)
1420 {
1421 if(isset($ref_data['time_target']) /* and ($crs_ref_id = $tree->checkForParentType($ref_data['ref_id'],'crs')) */)
1422 {
1423 include_once('./webservice/soap/classes/class.ilObjectXMLWriter.php');
1424 include_once('./Services/Object/classes/class.ilObjectActivation.php');
1425 $old = ilObjectActivation::getItem($ref_data['ref_id']);
1426
1427 $items = new ilObjectActivation();
1428 $items->toggleChangeable(isset($ref_data['time_target']['changeable']) ? $ref_data['time_target']['changeable'] : $old['changeable']);
1429 $items->setTimingStart(isset($ref_data['time_target']['starting_time']) ? $ref_data['time_target']['starting_time'] : $old['timing_start']);
1430 $items->setTimingEnd(isset($ref_data['time_target']['ending_time']) ? $ref_data['time_target']['ending_time'] : $old['timing_end']);
1431 $items->toggleVisible(isset($ref_data['time_target']['timing_visibility']) ? $ref_data['time_target']['timing_visibility'] : $old['visible']);
1432 $items->setSuggestionStart(isset($ref_data['time_target']['suggestion_start']) ? $ref_data['time_target']['suggestion_start'] : $old['suggestion_start']);
1433 $items->setSuggestionEnd(isset($ref_data['time_target']['suggestion_end']) ? $ref_data['time_target']['suggestion_end'] : $old['suggestion_end']);
1434 $items->setEarliestStart(isset($ref_data['time_target']['earliest_start']) ? $ref_data['time_target']['earliest_start'] : $old['earliest_start']);
1435 $items->setLatestEnd(isset($ref_data['time_target']['latest_end']) ? $ref_data['time_target']['latest_end'] : $old['latest_end']);
1436
1437 switch($ref_data['time_target']['timing_type'])
1438 {
1440 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_DEACTIVATED.' '.$ref_data['time_target']['timing_type']);
1441 $items->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED);
1442 break;
1443
1445 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_ACTIVATION.' '.$ref_data['time_target']['timing_type']);
1446 $items->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION);
1447 break;
1448
1450 $ilLog->write(__METHOD__.ilObjectActivation::TIMINGS_PRESETTING.' '.$ref_data['time_target']['timing_type']);
1451 $items->setTimingType(ilObjectActivation::TIMINGS_PRESETTING);
1452 break;
1453 }
1454 $items->update($ref_data['ref_id']);
1455 }
1456 }
1457 return true;
1458 }
static getItem($a_ref_id)
Get item data.
$old

References $ilLog, $old, ilObjectActivation\getItem(), ilObjectXMLWriter\TIMING_DEACTIVATED, ilObjectXMLWriter\TIMING_PRESETTING, ilObjectXMLWriter\TIMING_TEMPORARILY_AVAILABLE, ilObjectActivation\TIMINGS_ACTIVATION, ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by updateObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateReferences()

ilSoapObjectAdministration::validateReferences (   $a_action,
  $a_object_data,
  $a_target_id = 0 
)
private

Definition at line 1347 of file class.ilSoapObjectAdministration.php.

1348 {
1349 global $ilAccess;
1350
1351 if(!isset($a_object_data['references']) or !count($a_object_data['references']))
1352 {
1353 return true;
1354 }
1355 if($a_action == 'create')
1356 {
1357 if(count($a_object_data['references']) > 1)
1358 {
1359 if(in_array($a_object_data['type'],array('cat','crs','grp','fold')))
1360 {
1361 return $this->__raiseError("Cannot create references for type ".$a_object_data['type'],
1362 'Client');
1363 }
1364 }
1365 if(count($a_object_data['references']) == 1)
1366 {
1367 if($a_target_id != $a_object_data['references'][0]['parent_id'])
1368 {
1369 return $this->__raiseError("Cannot create references for type ".$a_object_data['type'],
1370 'Client');
1371 }
1372 }
1373
1374 foreach($a_object_data['references'] as $ref_data)
1375 {
1376 if(!$ref_data['parent_id'])
1377 {
1378 return $this->__raiseError('Element References: No parent Id given!','Client');
1379 }
1380
1382 $can_add_type = $this->canAddType($a_object_data['type'],$target_type,$ref_data['parent_id']);
1383 if($this->isFault($can_add_type))
1384 {
1385 return $can_add_type;
1386 }
1387 }
1388 return true;
1389 }
1390
1391 if($a_action == 'update')
1392 {
1393 foreach($a_object_data['references'] as $ref_data)
1394 {
1395 if(!$ref_data['ref_id'])
1396 {
1397 return $this->__raiseError('Element References: No reference id given!','Client');
1398 }
1399 // check permissions
1400 if(!$ilAccess->checkAccess('write','',$ref_data['ref_id']))
1401 {
1402 return $this->__raiseError('No write permission for object with reference id '.$ref_data['ref_id'].'!', 'Client');
1403 }
1404 // TODO: check if all references belong to the same object
1405 }
1406 return true;
1407 }
1408 }
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type

References $target_type, ilSoapAdministration\__raiseError(), ilObject\_lookupObjId(), ilObject\_lookupType(), canAddType(), and ilSoapAdministration\isFault().

Referenced by addObject(), and updateObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: