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 if (!is_array($this->roles))
00080 return false;
00081
00082 $this->__buildHeader();
00083
00084 include_once './classes/class.ilObjRole.php';
00085
00086 foreach ($this->roles as $role)
00087 {
00088
00089 if (!empty($this->role_type) && strcasecmp ($this->role_type, $role["role_type"]) != 0 )
00090 {
00091 continue;
00092 }
00093
00094 $attrs = array( 'role_type' => ucwords($role["role_type"]), 'id' => $role["obj_id"]);
00095
00096
00097 $this->xmlStartTag("Role", $attrs);
00098
00099
00100 $this->xmlElement('Title',null, $role["title"]);
00101 $this->xmlElement('Description',null, $role["description"]);
00102 $this->xmlElement('Translation',null,ilObjRole::_getTranslation($role["title"]));
00103
00104 if ($ref_id = ilUtil::__extractRefId($role["title"]))
00105 {
00106
00107 $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
00108
00109 if (is_object($ownerObj))
00110 {
00111 $attrs = array ("obj_id" => $ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
00112 $this->xmlStartTag('AssignedObject', $attrs);
00113 $this->xmlElement ('Title', null, $ownerObj->getTitle());
00114 $this->xmlElement ('Description', null, $ownerObj->getDescription());
00115 $this->xmlEndTag ('AssignedObject', $attrs);
00116 }
00117 }
00118
00119 $this->xmlEndTag ("Role");
00120
00121 }
00122
00123 $this->__buildFooter();
00124
00125 return true;
00126 }
00127
00128 function getXML()
00129 {
00130 return $this->xmlDumpMem(FALSE);
00131 }
00132
00133
00134 function __buildHeader()
00135 {
00136 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_role_object_3_7.dtd\">");
00137 $this->xmlSetGenCmt("Roles information of ilias system");
00138 $this->xmlHeader();
00139
00140 $this->xmlStartTag('Roles');
00141
00142 return true;
00143 }
00144
00145 function __buildFooter()
00146 {
00147 $this->xmlEndTag('Roles');
00148 }
00149
00150
00151 }
00152
00153
00154 ?>