• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

webservice/soap/classes/class.ilSoapRoleObjectXMLWriter.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004     +-----------------------------------------------------------------------------+
00005     | ILIAS open source                                                           |
00006         +-----------------------------------------------------------------------------+
00007     | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00008     |                                                                             |
00009     | This program is free software; you can redistribute it and/or               |
00010     | modify it under the terms of the GNU General Public License                 |
00011     | as published by the Free Software Foundation; either version 2              |
00012     | of the License, or (at your option) any later version.                      |
00013     |                                                                             |
00014     | This program is distributed in the hope that it will be useful,             |
00015     | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00016     | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00017     | GNU General Public License for more details.                                |
00018     |                                                                             |
00019     | You should have received a copy of the GNU General Public License           |
00020     | along with this program; if not, write to the Free Software                 |
00021     | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00022     +-----------------------------------------------------------------------------+
00023 */
00024 
00038 include_once "./classes/class.ilXmlWriter.php";
00039 
00040 class ilSoapRoleObjectXMLWriter extends ilXmlWriter
00041 {
00042         var $ilias;
00043         var $xml;
00044         var $roles;
00045         var $role_type;
00046         var $user_id = 0;
00047 
00055         function ilSoapRoleObjectXMLWriter()
00056         {
00057                 global $ilias,$ilUser;
00058 
00059                 parent::ilXmlWriter();
00060 
00061                 $this->ilias =& $ilias;
00062                 $this->user_id = $ilUser->getId();
00063         }
00064 
00065 
00066         function setObjects(&  $roles)
00067         {
00068                 $this->roles = & $roles;
00069         }
00070 
00071         function setType ($type)
00072         {
00073                 $this->role_type = $type;
00074         }
00075 
00076 
00077         function start()
00078         {
00079                 global $rbacreview;
00080                 if (!is_array($this->roles))
00081                         return false;
00082 
00083                 $this->__buildHeader();
00084 
00085                 include_once './classes/class.ilObjRole.php';
00086                 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
00087 
00088                 foreach ($this->roles as $role)
00089                 {
00090                         // if role type is not empty and does not match, then continue;
00091                         if (!empty($this->role_type) && strcasecmp ($this->role_type, $role["role_type"]) != 0 )
00092                         {
00093                                 continue;                               
00094                         }
00095                         if ($rbacreview->isRoleDeleted($role["obj_id"]))
00096                         {
00097                                 continue;
00098                         }
00099                         
00100                         $attrs = array( 'role_type' => ucwords($role["role_type"]), 
00101                                 'id' => "il_".IL_INST_ID."_role_".$role["obj_id"]);
00102 
00103                         // open tag
00104                         $this->xmlStartTag("Role", $attrs);
00105 
00106 
00107                         $this->xmlElement('Title',null, $role["title"]);
00108                         $this->xmlElement('Description',null, $role["description"]);
00109                         $this->xmlElement('Translation',null,ilObjRole::_getTranslation($role["title"]));
00110 
00111                         if ($ref_id = ilUtil::__extractRefId($role["title"]))
00112                         {
00113 
00114                                 $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
00115 
00116                                 if (is_object($ownerObj))
00117                                 {
00118                                         $attrs = array ("obj_id" => 
00119                                                 "il_".IL_INST_ID."_".$ownerObj->getType()."_".$ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
00120                                         $this->xmlStartTag('AssignedObject', $attrs);
00121                                         $this->xmlElement ('Title', null, $ownerObj->getTitle());
00122                                         $this->xmlElement ('Description', null, $ownerObj->getDescription());
00123                                         $this->xmlEndTag ('AssignedObject', $attrs);
00124                                 }
00125                         }
00126 
00127                         $this->xmlEndTag ("Role");
00128 
00129                 }
00130 
00131                 $this->__buildFooter();
00132 
00133                 return true;
00134         }
00135 
00136         function getXML()
00137         {
00138                 return $this->xmlDumpMem(FALSE);
00139         }
00140 
00141 
00142         function __buildHeader()
00143         {
00144                 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_role_object_3_7.dtd\">");
00145                 $this->xmlSetGenCmt("Roles information of ilias system");
00146                 $this->xmlHeader();
00147 
00148                 $this->xmlStartTag('Roles');
00149 
00150                 return true;
00151         }
00152 
00153         function __buildFooter()
00154         {
00155                 $this->xmlEndTag('Roles');
00156         }
00157 
00158 
00159 }
00160 
00161 
00162 ?>

Generated on Fri Dec 13 2013 17:57:03 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1