ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 127 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

128  {
129  $this->xmlEndTag('Roles');
130  }
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 116 of file class.ilSoapRoleObjectXMLWriter.php.

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

Referenced by start().

117  {
118  $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_role_object_3_10.dtd\">");
119  $this->xmlSetGenCmt("Roles information of ilias system");
120  $this->xmlHeader();
121 
122  $this->xmlStartTag('Roles');
123 
124  return true;
125  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
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 110 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

111  {
112  return $this->xmlDumpMem(false);
113  }
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.

References $type.

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

◆ start()

ilSoapRoleObjectXMLWriter::start ( )

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

References __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 
63  $this->__buildHeader();
64 
65  include_once './Services/AccessControl/classes/class.ilObjRole.php';
66  include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
67 
68  foreach ($this->roles as $role) {
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  continue;
72  }
73  if ($rbacreview->isRoleDeleted($role["obj_id"])) {
74  continue;
75  }
76 
77  $attrs = array( 'role_type' => ucwords($role["role_type"]),
78  'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]);
79 
80  // open tag
81  $this->xmlStartTag("Role", $attrs);
82 
83 
84  $this->xmlElement('Title', null, $role["title"]);
85  $this->xmlElement('Description', null, $role["description"]);
86  $this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"]));
87 
88  if ($ref_id = ilUtil::__extractRefId($role["title"])) {
89  $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
90 
91  if (is_object($ownerObj)) {
92  $attrs = array("obj_id" =>
93  "il_" . IL_INST_ID . "_" . $ownerObj->getType() . "_" . $ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
94  $this->xmlStartTag('AssignedObject', $attrs);
95  $this->xmlElement('Title', null, $ownerObj->getTitle());
96  $this->xmlElement('Description', null, $ownerObj->getDescription());
98  $this->xmlEndTag('AssignedObject', $attrs);
99  }
100  }
101 
102  $this->xmlEndTag("Role");
103  }
104 
105  $this->__buildFooter();
106 
107  return true;
108  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
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.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ 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: