ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSoapRoleObjectXMLWriter.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once "./Services/Xml/classes/class.ilXmlWriter.php";
6
20{
21 var $ilias;
22 var $xml;
23 var $roles;
25 var $user_id = 0;
26
35 {
36 global $ilias,$ilUser;
37
38 parent::ilXmlWriter();
39
40 $this->ilias =& $ilias;
41 $this->user_id = $ilUser->getId();
42 }
43
44
45 function setObjects(& $roles)
46 {
47 $this->roles = & $roles;
48 }
49
50 function setType ($type)
51 {
52 $this->role_type = $type;
53 }
54
55
56 function start()
57 {
58 global $rbacreview;
59 if (!is_array($this->roles))
60 return false;
61
62 $this->__buildHeader();
63
64 include_once './Services/AccessControl/classes/class.ilObjRole.php';
65 include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
66
67 foreach ($this->roles as $role)
68 {
69 // if role type is not empty and does not match, then continue;
70 if (!empty($this->role_type) && strcasecmp ($this->role_type, $role["role_type"]) != 0 )
71 {
72 continue;
73 }
74 if ($rbacreview->isRoleDeleted($role["obj_id"]))
75 {
76 continue;
77 }
78
79 $attrs = array( 'role_type' => ucwords($role["role_type"]),
80 'id' => "il_".IL_INST_ID."_role_".$role["obj_id"]);
81
82 // open tag
83 $this->xmlStartTag("Role", $attrs);
84
85
86 $this->xmlElement('Title',null, $role["title"]);
87 $this->xmlElement('Description',null, $role["description"]);
88 $this->xmlElement('Translation',null,ilObjRole::_getTranslation($role["title"]));
89
90 if ($ref_id = ilUtil::__extractRefId($role["title"]))
91 {
92
93 $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
94
95 if (is_object($ownerObj))
96 {
97 $attrs = array ("obj_id" =>
98 "il_".IL_INST_ID."_".$ownerObj->getType()."_".$ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
99 $this->xmlStartTag('AssignedObject', $attrs);
100 $this->xmlElement ('Title', null, $ownerObj->getTitle());
101 $this->xmlElement ('Description', null, $ownerObj->getDescription());
103 $this->xmlEndTag ('AssignedObject', $attrs);
104 }
105 }
106
107 $this->xmlEndTag ("Role");
108
109 }
110
111 $this->__buildFooter();
112
113 return true;
114 }
115
116 function getXML()
117 {
118 return $this->xmlDumpMem(FALSE);
119 }
120
121
122 function __buildHeader()
123 {
124 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_role_object_3_10.dtd\">");
125 $this->xmlSetGenCmt("Roles information of ilias system");
126 $this->xmlHeader();
127
128 $this->xmlStartTag('Roles');
129
130 return true;
131 }
132
133 function __buildFooter()
134 {
135 $this->xmlEndTag('Roles');
136 }
137
138
139}
140
141
142?>
_getTranslation($a_role_title)
static appendPathToObject($writer, $refid)
static __extractRefId($role_title)
extract ref id from role title, e.g.
XML writer class.
xmlEndTag($tag)
Writes an endtag.
xmlDumpMem($format=TRUE)
Returns xml document from memory.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlHeader()
Writes xml header @access public.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
redirection script todo: (a better solution should control the processing via a xml file)
$ref_id
Definition: sahs_server.php:39
global $ilUser
Definition: imgupload.php:15