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

Xml export of roles and role templates. More...

+ Inheritance diagram for ilRoleXmlExport:
+ Collaboration diagram for ilRoleXmlExport:

Public Member Functions

 __construct ()
 
 setRoles (array $a_roles)
 Set roles Format is: array(role_id => array(role_folder_id)) More...
 
 getRoles ()
 
 addRole (int $a_role_id, int $a_rolf_id)
 
 setMode (int $a_mode)
 
 getMode ()
 
 writeHeader ()
 Write xml header. More...
 
 write ()
 Write xml presentation of chosen roles. More...
 
- 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

const MODE_DTPL = 1
 

Protected Attributes

ilRbacReview $rbacreview
 

Private Member Functions

 writeRole (int $a_role_id, int $a_rolf)
 Write xml presentation of one role. More...
 
 initRbacOperations ()
 Cache rbac operations. More...
 

Private Attributes

array $roles = []
 
array $operations = []
 
int $mode = 0
 

Detailed Description

Xml export of roles and role templates.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilRoleXmlExport::__construct ( )

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

36 {
37 global $DIC;
38
39 $this->rbacreview = $DIC->rbac()->review();
40
42 $this->initRbacOperations();
43 }
initRbacOperations()
Cache rbac operations.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addRole()

ilRoleXmlExport::addRole ( int  $a_role_id,
int  $a_rolf_id 
)

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

59 : void
60 {
61 $this->roles[$a_role_id][] = $a_rolf_id;
62 }

◆ getMode()

ilRoleXmlExport::getMode ( )

Definition at line 69 of file class.ilRoleXmlExport.php.

69 : int
70 {
71 return $this->mode;
72 }

References $mode.

Referenced by write().

+ Here is the caller graph for this function:

◆ getRoles()

ilRoleXmlExport::getRoles ( )

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

54 : array
55 {
56 return $this->roles;
57 }

References $roles.

Referenced by write().

+ Here is the caller graph for this function:

◆ initRbacOperations()

ilRoleXmlExport::initRbacOperations ( )
private

Cache rbac operations.

Definition at line 135 of file class.ilRoleXmlExport.php.

135 : void
136 {
137 foreach ($this->rbacreview->getOperations() as $operation) {
138 $this->operations[$operation['ops_id']] = $operation['operation'];
139 }
140 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setMode()

ilRoleXmlExport::setMode ( int  $a_mode)

Definition at line 64 of file class.ilRoleXmlExport.php.

64 : void
65 {
66 $this->mode = $a_mode;
67 }

◆ setRoles()

ilRoleXmlExport::setRoles ( array  $a_roles)

Set roles Format is: array(role_id => array(role_folder_id))

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

49 : void
50 {
51 $this->roles = $a_roles;
52 }

◆ write()

ilRoleXmlExport::write ( )

Write xml presentation of chosen roles.

Definition at line 87 of file class.ilRoleXmlExport.php.

87 : void
88 {
89 if ($this->getMode() != self::MODE_DTPL) {
90 $this->xmlStartTag('roles');
91 }
92
93 foreach ($this->getRoles() as $role_id => $role_folder_ids) {
94 foreach ((array) $role_folder_ids as $rolf) {
95 $this->writeRole($role_id, $rolf);
96 }
97 }
98
99 if ($this->getMode() != self::MODE_DTPL) {
100 $this->xmlEndTag('roles');
101 }
102 }
writeRole(int $a_role_id, int $a_rolf)
Write xml presentation of one role.
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References getMode(), getRoles(), writeRole(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ writeHeader()

ilRoleXmlExport::writeHeader ( )

Write xml header.

Definition at line 77 of file class.ilRoleXmlExport.php.

77 : void
78 {
79 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_role_definition_4_2.dtd\">");
80 $this->xmlSetGenCmt("Role Definition");
81 $this->xmlHeader();
82 }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.

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

+ Here is the call graph for this function:

◆ writeRole()

ilRoleXmlExport::writeRole ( int  $a_role_id,
int  $a_rolf 
)
private

Write xml presentation of one role.

Definition at line 107 of file class.ilRoleXmlExport.php.

107 : void
108 {
109 $attributes = [
110 'type' => ilObject::_lookupType($a_role_id),
111 'id' => 'il_' . IL_INST_ID . '_' . ilObject::_lookupType($a_role_id) . '_' . $a_role_id,
112 'protected' => ($GLOBALS['DIC']['rbacreview']->isProtected($a_rolf, $a_role_id) ? 1 : 0)
113 ];
114
115 $this->xmlStartTag('role', $attributes);
116
117 $this->xmlElement('title', [], ilObject::_lookupTitle($a_role_id));
118 $this->xmlElement('description', [], ilObject::_lookupDescription($a_role_id));
119
120 $this->xmlStartTag('operations');
121 foreach ($this->rbacreview->getAllOperationsOfRole($a_role_id, $a_rolf) as $obj_group => $operations) {
122 foreach ($operations as $ops_id) {
123 if (isset($this->operations[$ops_id])) {
124 $this->xmlElement('operation', ['group' => $obj_group], trim($this->operations[$ops_id]));
125 }
126 }
127 }
128 $this->xmlEndTag('operations');
129 $this->xmlEndTag('role');
130 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
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
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, $operations, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilObject\_lookupType(), IL_INST_ID, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by write().

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

Field Documentation

◆ $mode

int ilRoleXmlExport::$mode = 0
private

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

Referenced by getMode().

◆ $operations

array ilRoleXmlExport::$operations = []
private

Definition at line 30 of file class.ilRoleXmlExport.php.

Referenced by writeRole().

◆ $rbacreview

ilRbacReview ilRoleXmlExport::$rbacreview
protected

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

◆ $roles

array ilRoleXmlExport::$roles = []
private

Definition at line 29 of file class.ilRoleXmlExport.php.

Referenced by getRoles().

◆ MODE_DTPL

const ilRoleXmlExport::MODE_DTPL = 1

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