コード例 #1
0
 function getXMLTree($sid, $ref_id, $types, $user_id)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $tree;
     $nodedata = $tree->getNodeData($ref_id);
     $nodearray = $tree->getSubTree($nodedata);
     $filter = (array) $types;
     global $objDefinition;
     foreach ($nodearray as $node) {
         if (!$objDefinition->isAdministrationObject($node['type']) && !$objDefinition->isSystemObject($node['type'])) {
             if (!in_array($node['type'], $filter)) {
                 if ($tmp = ilObjectFactory::getInstanceByRefId($node['ref_id'], false)) {
                     $nodes[] = $tmp;
                 }
             }
         }
     }
     include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
     $xml_writer = new ilObjectXMLWriter();
     $xml_writer->enablePermissionCheck(true);
     $xml_writer->setObjects($nodes);
     $xml_writer->enableOperations(false);
     if ($user_id) {
         $xml_writer->setUserId($user_id);
     }
     if ($xml_writer->start()) {
         return $xml_writer->getXML();
     }
     return $this->__raiseError('Cannot create object xml !', 'Server');
 }
コード例 #2
0
 function getUserRoles($sid, $user_id)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacreview;
     if (!($tmp_user =& ilObjectFactory::getInstanceByObjId($user_id, false))) {
         return $this->__raiseError('No valid user id given. Please choose an existing id of an ILIAS user', 'Client');
     }
     foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
         if ($tmp_obj = ilObjectFactory::getInstanceByObjId($role_id, false)) {
             $objs[] = $tmp_obj;
         }
     }
     if (count($objs)) {
         include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
         $xml_writer = new ilObjectXMLWriter();
         $xml_writer->setObjects($objs);
         if ($xml_writer->start()) {
             return $xml_writer->getXML();
         }
     }
     return '';
 }