ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSoapRoleObjectXMLWriter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ()
 
 setObjects (array $roles)
 
 setType (string $type)
 
 start ()
 
 getXML ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Data Fields

string $xml = ''
 

Private Member Functions

 buildHeader ()
 
 buildFooter ()
 

Private Attributes

array $roles = []
 
string $role_type = ''
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 29 of file class.ilSoapRoleObjectXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilSoapRoleObjectXMLWriter::__construct ( )

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

36 {
37 global $DIC;
38
39 $ilUser = $DIC->user();
40
42 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildFooter()

ilSoapRoleObjectXMLWriter::buildFooter ( )
private

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

127 : void
128 {
129 $this->xmlEndTag('Roles');
130 }
xmlEndTag(string $tag)
Writes an endtag.

References ilXmlWriter\xmlEndTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilSoapRoleObjectXMLWriter::buildHeader ( )
private

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

119 : void
120 {
121 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_role_object_3_10.dtd\">");
122 $this->xmlSetGenCmt("Roles information of ilias system");
123 $this->xmlHeader();
124 $this->xmlStartTag('Roles');
125 }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

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

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getXML()

ilSoapRoleObjectXMLWriter::getXML ( )

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

114 : string
115 {
116 return $this->xmlDumpMem(false);
117 }
xmlDumpMem(bool $format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ Here is the call graph for this function:

◆ setObjects()

ilSoapRoleObjectXMLWriter::setObjects ( array  $roles)

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

44 : void
45 {
46 $this->roles = $roles;
47 }

References $roles.

◆ setType()

ilSoapRoleObjectXMLWriter::setType ( string  $type)

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

49 : void
50 {
51 $this->role_type = $type;
52 }

◆ start()

ilSoapRoleObjectXMLWriter::start ( )

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

54 : bool
55 {
56 global $DIC;
57
58 $rbacreview = $DIC['rbacreview'];
59 if ($this->roles === []) {
60 return false;
61 }
62
63 $this->buildHeader();
64
65 foreach ($this->roles as $role) {
66 // if role type is not empty and does not match, then continue;
67 if (!empty($this->role_type) && strcasecmp($this->role_type, $role["role_type"]) !== 0) {
68 continue;
69 }
70 if ($rbacreview->isRoleDeleted($role["obj_id"])) {
71 continue;
72 }
73
74 $attrs = [
75 'role_type' => ucwords($role["role_type"]),
76 'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]
77 ];
78
79 $this->xmlStartTag("Role", $attrs);
80 $this->xmlElement('Title', null, $role["title"]);
81 $this->xmlElement('Description', null, $role["description"]);
82 $this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"]));
83
84 if ($ref_id = ilUtil::__extractRefId($role["title"])) {
86
87 if (is_object($ownerObj)) {
88 $attrs = [
89 "obj_id" => implode(
90 '_',
91 [
92 "il",
94 $ownerObj->getType(),
95 $ownerObj->getId()
96 ]
97 ),
98 "ref_id" => $ownerObj->getRefId(),
99 "type" => $ownerObj->getType()
100 ];
101 $this->xmlStartTag('AssignedObject', $attrs);
102 $this->xmlElement('Title', null, $ownerObj->getTitle());
103 $this->xmlElement('Description', null, $ownerObj->getDescription());
105 $this->xmlEndTag('AssignedObject');
106 }
107 }
108 $this->xmlEndTag("Role");
109 }
110 $this->buildFooter();
111 return true;
112 }
static _getTranslation(string $a_role_title)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static appendPathToObject(ilXmlWriter $writer, int $refid)
static __extractRefId(string $role_title)
extract ref id from role title, e.g.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
const IL_INST_ID
Definition: constants.php:40
$ref_id
Definition: ltiauth.php:66

References $DIC, $ref_id, ilUtil\__extractRefId(), ilObjRole\_getTranslation(), ilObjectXMLWriter\appendPathToObject(), buildFooter(), buildHeader(), ilObjectFactory\getInstanceByRefId(), IL_INST_ID, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

Field Documentation

◆ $role_type

string ilSoapRoleObjectXMLWriter::$role_type = ''
private

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

◆ $roles

array ilSoapRoleObjectXMLWriter::$roles = []
private

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

Referenced by setObjects().

◆ $xml

string ilSoapRoleObjectXMLWriter::$xml = ''

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


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