ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSoapRoleObjectXMLWriter Class Reference

XML writer class. More...

+ Inheritance diagram for ilSoapRoleObjectXMLWriter:
+ Collaboration diagram for ilSoapRoleObjectXMLWriter:

Public Member Functions

 __construct ()
 constructor More...
 
 setObjects (& $roles)
 
 setType ($type)
 
 start ()
 
 getXML ()
 
 __buildHeader ()
 
 __buildFooter ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatData ($data)
 Indents text for better reading. More...
 
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlHeader ()
 Writes xml header public. More...
 
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag. More...
 
 xmlEndTag ($tag)
 Writes an endtag. More...
 
 xmlComment ($comment)
 Writes a comment. More...
 
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data. More...
 
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory. More...
 
 appendXML ($a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr public More...
 

Data Fields

 $ilias
 
 $xml
 
 $roles
 
 $role_type
 
 $user_id = 0
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 

Detailed Description

XML writer class.

Class to simplify manual writing of xml documents. It only supports writing xml sequentially, because the xml document is saved in a string with no additional structure information. The author is responsible for well-formedness and validity of the xml document.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilObjectXMLWriter.php,v 1.3 2005/11/04 12:50:24 smeyer Exp

Definition at line 19 of file class.ilSoapRoleObjectXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilSoapRoleObjectXMLWriter::__construct ( )

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

Definition at line 34 of file class.ilSoapRoleObjectXMLWriter.php.

References $ilias, and $ilUser.

35  {
36  global $ilias,$ilUser;
37 
38  parent::__construct();
39 
40  $this->ilias =& $ilias;
41  $this->user_id = $ilUser->getId();
42  }
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...

Member Function Documentation

◆ __buildFooter()

ilSoapRoleObjectXMLWriter::__buildFooter ( )

Definition at line 133 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

134  {
135  $this->xmlEndTag('Roles');
136  }
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildHeader()

ilSoapRoleObjectXMLWriter::__buildHeader ( )

Definition at line 122 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), ilXmlWriter\xmlSetGenCmt(), and ilXmlWriter\xmlStartTag().

Referenced by start().

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  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getXML()

ilSoapRoleObjectXMLWriter::getXML ( )

Definition at line 116 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

117  {
118  return $this->xmlDumpMem(FALSE);
119  }
xmlDumpMem($format=TRUE)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ setObjects()

ilSoapRoleObjectXMLWriter::setObjects ( $roles)

Definition at line 45 of file class.ilSoapRoleObjectXMLWriter.php.

References $roles.

46  {
47  $this->roles = & $roles;
48  }

◆ setType()

ilSoapRoleObjectXMLWriter::setType (   $type)

Definition at line 50 of file class.ilSoapRoleObjectXMLWriter.php.

51  {
52  $this->role_type = $type;
53  }

◆ start()

ilSoapRoleObjectXMLWriter::start ( )

Definition at line 56 of file class.ilSoapRoleObjectXMLWriter.php.

References $ref_id, __buildFooter(), __buildHeader(), ilUtil\__extractRefId(), ilObjRole\_getTranslation(), ilObjectXMLWriter\appendPathToObject(), array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

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  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
xmlEndTag($tag)
Writes an endtag.
static __extractRefId($role_title)
extract ref id from role title, e.g.
static appendPathToObject($writer, $refid)
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

Field Documentation

◆ $ilias

ilSoapRoleObjectXMLWriter::$ilias

Definition at line 21 of file class.ilSoapRoleObjectXMLWriter.php.

Referenced by __construct().

◆ $role_type

ilSoapRoleObjectXMLWriter::$role_type

Definition at line 24 of file class.ilSoapRoleObjectXMLWriter.php.

◆ $roles

ilSoapRoleObjectXMLWriter::$roles

Definition at line 23 of file class.ilSoapRoleObjectXMLWriter.php.

Referenced by setObjects().

◆ $user_id

ilSoapRoleObjectXMLWriter::$user_id = 0

Definition at line 25 of file class.ilSoapRoleObjectXMLWriter.php.

◆ $xml

ilSoapRoleObjectXMLWriter::$xml

Definition at line 22 of file class.ilSoapRoleObjectXMLWriter.php.


The documentation for this class was generated from the following file: