ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilSoapObjectAdministration Class Reference
+ Inheritance diagram for ilSoapObjectAdministration:
+ Collaboration diagram for ilSoapObjectAdministration:

Public Member Functions

 ilSoapObjectAdministration ()
 
 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
 ilSoapAdministration ($use_nusoap=true)
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 
 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 35 of file class.ilSoapObjectAdministration.php.

Member Function Documentation

◆ addObject()

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

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

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

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 729 of file class.ilSoapObjectAdministration.php.

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

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 1460 of file class.ilSoapObjectAdministration.php.

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

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

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 1173 of file class.ilSoapObjectAdministration.php.

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

References $ilUser, $lng, $options, $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 843 of file class.ilSoapObjectAdministration.php.

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

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

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 213 of file class.ilSoapObjectAdministration.php.

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

43 {
44 $this->initAuth($sid);
45 $this->initIlias();
46
47 if(!$this->__checkSession($sid))
48 {
49 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
50 }
51 if(!$import_id)
52 {
53 return $this->__raiseError('No import id given.',
54 'Client');
55 }
56
57 global $ilLog;
58
59 $obj_id = ilObject::_lookupObjIdByImportId($import_id);
60 $ilLog->write("SOAP getObjIdByImportId(): import_id = ".$import_id.' obj_id = '.$obj_id);
61
62 return $obj_id ? $obj_id : "0";
63 }

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 129 of file class.ilSoapObjectAdministration.php.

130 {
131 $this->initAuth($sid);
132 $this->initIlias();
133
134 if(!$this->__checkSession($sid))
135 {
136 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
137 }
138
139
140 if(!count($ref_ids) || !is_array ($ref_ids))
141 {
142 return $this->__raiseError('No reference id(s) given.', 'Client');
143 }
144
145 $obj_ids = array();
146 if (count($ref_ids)) {
147 foreach ($ref_ids as $ref_id)
148 {
149 $ref_id = trim($ref_id);
150 if (!is_numeric($ref_id)){
151 return $this->__raiseError('Reference ID has to be numeric. Value: '.$ref_id, 'Client');
152 }
153
155 if (!$obj_id){
156 return $this->__raiseError('No object found for reference ID. Value: '.$ref_id, 'Client');
157 }
159 return $this->__raiseError('No untrashed reference found for reference ID. Value: '.$ref_id, 'Client');
160 }
161 $obj_ids[] = $obj_id;
162 }
163 }
164 return $obj_ids;
165 }
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

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 1259 of file class.ilSoapObjectAdministration.php.

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

66 {
67 $this->initAuth($sid);
68 $this->initIlias();
69
70 if(!$this->__checkSession($sid))
71 {
72 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
73 }
74 if(!$import_id)
75 {
76 return $this->__raiseError('No import id given.',
77 'Client');
78 }
79
80 global $tree;
81
82 $obj_id = ilObject::_lookupObjIdByImportId($import_id);
83
84
85 $ref_ids = ilObject::_getAllReferences($obj_id);
86
87 foreach($ref_ids as $ref_id)
88 {
89 // only get non deleted reference ids
90 if ($tree->isInTree($ref_id))
91 {
92 $new_refs[] = $ref_id;
93 }
94 }
95 return $new_refs ? $new_refs : array();
96 }
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 98 of file class.ilSoapObjectAdministration.php.

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

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 434 of file class.ilSoapObjectAdministration.php.

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

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

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

+ Here is the call graph for this function:

◆ ilSoapObjectAdministration()

ilSoapObjectAdministration::ilSoapObjectAdministration ( )

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

38 {
39 parent::ilSoapAdministration();
40 }

◆ moveObject()

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

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

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

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

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 296 of file class.ilSoapObjectAdministration.php.

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

References $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 962 of file class.ilSoapObjectAdministration.php.

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

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 1409 of file class.ilSoapObjectAdministration.php.

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

References $ilLog, 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 1346 of file class.ilSoapObjectAdministration.php.

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