Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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
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 ?>