ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC, $ilias, and $ilUser.

35  {
36  global $DIC;
37 
38  $ilias = $DIC['ilias'];
39  $ilUser = $DIC['ilUser'];
40 
41  parent::__construct();
42 
43  $this->ilias =&$ilias;
44  $this->user_id = $ilUser->getId();
45  }
global $DIC
Definition: saml.php:7
$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 132 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

133  {
134  $this->xmlEndTag('Roles');
135  }
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 121 of file class.ilSoapRoleObjectXMLWriter.php.

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

Referenced by start().

122  {
123  $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_role_object_3_10.dtd\">");
124  $this->xmlSetGenCmt("Roles information of ilias system");
125  $this->xmlHeader();
126 
127  $this->xmlStartTag('Roles');
128 
129  return true;
130  }
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 115 of file class.ilSoapRoleObjectXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

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

◆ setObjects()

ilSoapRoleObjectXMLWriter::setObjects ( $roles)

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

References $roles.

49  {
50  $this->roles = &$roles;
51  }

◆ setType()

ilSoapRoleObjectXMLWriter::setType (   $type)

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

References $type.

54  {
55  $this->role_type = $type;
56  }
$type

◆ start()

ilSoapRoleObjectXMLWriter::start ( )

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

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

60  {
61  global $DIC;
62 
63  $rbacreview = $DIC['rbacreview'];
64  if (!is_array($this->roles)) {
65  return false;
66  }
67 
68  $this->__buildHeader();
69 
70  include_once './Services/AccessControl/classes/class.ilObjRole.php';
71  include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
72 
73  foreach ($this->roles as $role) {
74  // if role type is not empty and does not match, then continue;
75  if (!empty($this->role_type) && strcasecmp($this->role_type, $role["role_type"]) != 0) {
76  continue;
77  }
78  if ($rbacreview->isRoleDeleted($role["obj_id"])) {
79  continue;
80  }
81 
82  $attrs = array( 'role_type' => ucwords($role["role_type"]),
83  'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]);
84 
85  // open tag
86  $this->xmlStartTag("Role", $attrs);
87 
88 
89  $this->xmlElement('Title', null, $role["title"]);
90  $this->xmlElement('Description', null, $role["description"]);
91  $this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"]));
92 
93  if ($ref_id = ilUtil::__extractRefId($role["title"])) {
94  $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
95 
96  if (is_object($ownerObj)) {
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  $this->__buildFooter();
111 
112  return true;
113  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
global $DIC
Definition: saml.php:7
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)
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: