ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRoleXmlExport Class Reference

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

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

Public Member Functions

 __construct ()
 Constructor.
 setRoles ($a_roles)
 Set roles Format is: array(role_id => array(role_folder_id))
 getRoles ()
 Get roles.
 addRole ($a_role_id, $a_rolf_id)
 Add one role.
 setMode ($a_mode)
 getMode ()
 writeHeader ()
 Write xml header.
 write ()
 Write xml presentation of chosen roles.
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor
 _ilXmlWriter ()
 destructor public
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition.
 xmlSetStSheet ($stSheet)
 Sets stylesheet.
 xmlSetGenCmt ($genCmt)
 Sets generated comment.
 _xmlEscapeData ($data)
 Escapes reserved characters.
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding.
 xmlFormatData ($data)
 Indents text for better reading.
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly.
 xmlHeader ()
 Writes xml header public.
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag.
 xmlEndTag ($tag)
 Writes an endtag.
 xmlComment ($comment)
 Writes a comment.
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data.
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content)
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file.
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory.
 appendXML ($a_str)
 append xml string to document
 xmlClear ()
 clears xmlStr public

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.
 initRbacOperations ()
 Cache rbac operations.

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

ilRoleXmlExport::__construct ( )

Constructor.

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

References initRbacOperations().

+ Here is the call graph for this function:

Member Function Documentation

ilRoleXmlExport::addRole (   $a_role_id,
  $a_rolf_id 
)

Add one role.

Parameters
int$a_role_id
int$a_rolf_id

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

{
$this->roles[$a_role_id][] = $a_rolf_id;
}
ilRoleXmlExport::getMode ( )

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

References $mode.

Referenced by write().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilRoleXmlExport::getRoles ( )

Get roles.

Returns
array

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

References $roles.

Referenced by write().

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

+ Here is the caller graph for this function:

ilRoleXmlExport::initRbacOperations ( )
private

Cache rbac operations.

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

Referenced by __construct().

{
global $rbacreview;
foreach($rbacreview->getOperations() as $operation)
{
$this->operations[$operation['ops_id']] = $operation['operation'];
}
return true;
}

+ Here is the caller graph for this function:

ilRoleXmlExport::setMode (   $a_mode)

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

{
$this->mode = $a_mode;
}
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.

{
$this->roles = (array) $a_roles;
}
ilRoleXmlExport::write ( )

Write xml presentation of chosen roles.

Returns
bool

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

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

{
if($this->getMode() != self::MODE_DTPL)
{
$this->xmlStartTag('roles');
}
foreach($this->getRoles() as $role_id => $role_folder_ids)
{
foreach((array) $role_folder_ids as $rolf)
{
$this->writeRole($role_id, $rolf);
}
}
if($this->getMode() != self::MODE_DTPL)
{
$this->xmlEndTag('roles');
}
}

+ Here is the call graph for this function:

ilRoleXmlExport::writeHeader ( )

Write xml header.

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

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

{
$this->xmlSetDtdDef("<!DOCTYPE Roles PUBLIC \"-//ILIAS//DTD ILIAS Roles//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_role_definition_4_2.dtd\">");
$this->xmlSetGenCmt("Role Definition");
$this->xmlHeader();
return true;
}

+ Here is the call graph for this function:

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.

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

Referenced by write().

{
global $rbacreview;
$attributes = array(
'type' => ilObject::_lookupType($a_role_id),
'id' => 'il_'.IL_INST_ID.'_'.ilObject::_lookupType($a_role_id).'_'.$a_role_id,
'protected' => ($GLOBALS['rbacreview']->isProtected($a_rolf,$a_role_id) ? 1 : 0)
);
$this->xmlStartTag('role',$attributes);
$this->xmlElement('title',array(),ilObject::_lookupTitle($a_role_id));
$this->xmlElement('description', array(), ilObject::_lookupDescription($a_role_id));
$this->xmlStartTag('operations');
foreach($rbacreview->getAllOperationsOfRole($a_role_id, $a_rolf) as $obj_group => $operations)
{
foreach($operations as $ops_id)
{
$this->xmlElement('operation', array('group' => $obj_group), trim($this->operations[$ops_id]));
}
}
$this->xmlEndTag('operations');
$this->xmlEndTag('role');
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilRoleXmlExport::$mode = 0
private

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

Referenced by getMode().

ilRoleXmlExport::$operations = array()
private

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

Referenced by writeRole().

ilRoleXmlExport::$roles = array()
private

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

Referenced by getRoles().

const ilRoleXmlExport::MODE_DTPL = 1

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