ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilRoleXmlExport Class Reference

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

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 setRoles ($a_roles)
 Set roles Format is: array(role_id => array(role_folder_id)) More...
 
 getRoles ()
 Get roles. More...
 
 addRole ($a_role_id, $a_rolf_id)
 Add one role. More...
 
 setMode ($a_mode)
 
 getMode ()
 
 writeHeader ()
 Write xml header. More...
 
 write ()
 Write xml presentation of chosen roles. More...
 
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor @access public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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 @access 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 @access public More...
 

Data Fields

const MODE_DTPL = 1
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Private Member Functions

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

Private Attributes

 $roles = array()
 
 $operations = array()
 
 $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 12 of file class.ilRoleXmlExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilRoleXmlExport::__construct ( )

Constructor.

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

27 {
28 parent::__construct();
29
30 $this->initRbacOperations();
31 }
initRbacOperations()
Cache rbac operations.

References initRbacOperations().

+ Here is the call graph for this function:

Member Function Documentation

◆ addRole()

ilRoleXmlExport::addRole (   $a_role_id,
  $a_rolf_id 
)

Add one role.

Parameters
int$a_role_id
int$a_ref_idof source object

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

61 {
62 $this->roles[$a_role_id][] = $a_rolf_id;
63 }

◆ getMode()

ilRoleXmlExport::getMode ( )

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

71 {
72 return $this->mode;
73 }

References $mode.

Referenced by write().

+ Here is the caller graph for this function:

◆ getRoles()

ilRoleXmlExport::getRoles ( )

Get roles.

Returns
array

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

51 {
52 return (array) $this->roles;
53 }

References $roles.

Referenced by write().

+ Here is the caller graph for this function:

◆ initRbacOperations()

ilRoleXmlExport::initRbacOperations ( )
private

Cache rbac operations.

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

150 {
151 global $rbacreview;
152
153 foreach($rbacreview->getOperations() as $operation)
154 {
155 $this->operations[$operation['ops_id']] = $operation['operation'];
156 }
157 return true;
158 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setMode()

ilRoleXmlExport::setMode (   $a_mode)

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

66 {
67 $this->mode = $a_mode;
68 }

◆ setRoles()

ilRoleXmlExport::setRoles (   $a_roles)

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

Parameters
array$a_roles
Returns
void

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

42 {
43 $this->roles = (array) $a_roles;
44 }

◆ write()

ilRoleXmlExport::write ( )

Write xml presentation of chosen roles.

Returns
bool

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

92 {
93
94 if($this->getMode() != self::MODE_DTPL)
95 {
96 $this->xmlStartTag('roles');
97 }
98
99 foreach($this->getRoles() as $role_id => $role_folder_ids)
100 {
101 foreach((array) $role_folder_ids as $rolf)
102 {
103 $this->writeRole($role_id, $rolf);
104 }
105 }
106
107 if($this->getMode() != self::MODE_DTPL)
108 {
109 $this->xmlEndTag('roles');
110 }
111 }
writeRole($a_role_id, $a_rolf)
Write xml presentation of one role.
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $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 79 of file class.ilRoleXmlExport.php.

80 {
81 $this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_role_definition_4_2.dtd\">");
82 $this->xmlSetGenCmt("Role Definition");
83 $this->xmlHeader();
84 return true;
85 }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlHeader()
Writes xml header @access public.
xmlSetDtdDef($dtdDef)
Sets dtd definition.

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

+ Here is the call graph for this function:

◆ writeRole()

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

Write xml presentation of one role.

Parameters
int$a_role_id
int$a_rolf

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

119 {
120 global $rbacreview;
121
122 $attributes = array(
123 'type' => ilObject::_lookupType($a_role_id),
124 'id' => 'il_'.IL_INST_ID.'_'.ilObject::_lookupType($a_role_id).'_'.$a_role_id,
125 'protected' => ($GLOBALS['rbacreview']->isProtected($a_rolf,$a_role_id) ? 1 : 0)
126 );
127
128 $this->xmlStartTag('role',$attributes);
129
130 $this->xmlElement('title',array(),ilObject::_lookupTitle($a_role_id));
131 $this->xmlElement('description', array(), ilObject::_lookupDescription($a_role_id));
132
133 $this->xmlStartTag('operations');
134 foreach($rbacreview->getAllOperationsOfRole($a_role_id, $a_rolf) as $obj_group => $operations)
135 {
136 foreach($operations as $ops_id)
137 {
138 $this->xmlElement('operation', array('group' => $obj_group), trim($this->operations[$ops_id]));
139 }
140 }
141 $this->xmlEndTag('operations');
142 $this->xmlEndTag('role');
143 return true;
144 }
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
static _lookupType($a_id, $a_reference=false)
lookup object type
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, $operations, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilObject\_lookupType(), 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

ilRoleXmlExport::$mode = 0
private

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

Referenced by getMode().

◆ $operations

ilRoleXmlExport::$operations = array()
private

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

Referenced by writeRole().

◆ $roles

ilRoleXmlExport::$roles = array()
private

Definition at line 17 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: