ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDidacticTemplateLocalRoleAction Class Reference

represents a creation of local roles action More...

+ Inheritance diagram for ilDidacticTemplateLocalRoleAction:
+ Collaboration diagram for ilDidacticTemplateLocalRoleAction:

Public Member Functions

 __construct ($a_action_id=0)
 Constructor.
 getType ()
 Get action type.
 setRoleTemplateId ($a_role_template_id)
 Set role template id.
 getRoleTemplateId ()
 get role template id
 apply ()
 Apply action.
 revert ()
 Revert action.
 save ()
 Create new action.
 delete ()
 Delete ilDB $ilDB.
 toXml (ilXmlWriter $writer)
 Write xml of template action.
 read ()
 Read db entry ilDB $ilDB.
- Public Member Functions inherited from ilDidacticTemplateAction
 getActionId ()
 Get action id.
 setActionId ($a_action_id)
 Set action id.
 setType ($a_type_id)
 Set type id.
 setTemplateId ($a_id)
 Set template id.
 getTemplateId ()
 Get template id.
 setRefId ($a_ref_id)
 Set ref id of target object.
 getRefId ()
 Get ref id of target object.
 __clone ()
 Clone method.

Private Attributes

 $role_template_id = 0

Additional Inherited Members

- Data Fields inherited from ilDidacticTemplateAction
const TYPE_LOCAL_POLICY = 1
const TYPE_LOCAL_ROLE = 2
const TYPE_BLOCK_ROLE = 3
const FILTER_SOURCE_TITLE = 1
const FILTER_SOURCE_OBJ_ID = 2
const PATTERN_PARENT_TYPE = 'action'
- Protected Member Functions inherited from ilDidacticTemplateAction
 initSourceObject ()
 Init the source object.
 filterRoles (ilObject $source)
 Filter roles.

Detailed Description

represents a creation of local roles action

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 12 of file class.ilDidacticTemplateLocalRoleAction.php.

Constructor & Destructor Documentation

ilDidacticTemplateLocalRoleAction::__construct (   $a_action_id = 0)

Constructor.

Parameters
int$a_action_id

Reimplemented from ilDidacticTemplateAction.

Definition at line 21 of file class.ilDidacticTemplateLocalRoleAction.php.

{
parent::__construct($a_action_id);
}

Member Function Documentation

ilDidacticTemplateLocalRoleAction::apply ( )

Apply action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 56 of file class.ilDidacticTemplateLocalRoleAction.php.

References $GLOBALS, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilObjectFactory\getInstanceByRefId(), getRoleTemplateId(), and ilDidacticTemplateAction\initSourceObject().

{
global $rbacreview, $rbacadmin;
$source = $this->initSourceObject();
// Check if role folder already exists
$rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId());
if(!$rolf_id)
{
$source->createRoleFolder();
}
$rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId());
$GLOBALS['ilLog']->write(__METHOD__.': Current role folder id is: '.$rolf_id);
// Create role
$rolf = ilObjectFactory::getInstanceByRefId($rolf_id,false);
$role = $rolf->createRole(
);
$GLOBALS['ilLog']->write(__METHOD__.': Using rolt: '.$this->getRoleTemplateId().' with title "'.ilObject::_lookupTitle($this->getRoleTemplateId().'". '));
// Copy template permissions
$rbacadmin->copyRoleTemplatePermissions(
ROLE_FOLDER_ID,
$rolf->getRefId(),
$role->getId(),
true
);
// Set permissions
$ops = $rbacreview->getOperationsOfRole($role->getId(),$source->getType(),$rolf->getRefId());
$rbacadmin->grantPermission($role->getId(),$ops,$source->getRefId());
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateLocalRoleAction::delete ( )

Delete ilDB $ilDB.

Returns
bool

Reimplemented from ilDidacticTemplateAction.

Definition at line 131 of file class.ilDidacticTemplateLocalRoleAction.php.

References $query, and ilDidacticTemplateAction\getActionId().

{
global $ilDB;
$query = 'DELETE FROM didactic_tpl_alr '.
'WHERE action_id = '.$ilDB->quote($this->getActionId(),'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateLocalRoleAction::getRoleTemplateId ( )

get role template id

Returns
int

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

References $role_template_id.

Referenced by apply(), save(), and toXml().

+ Here is the caller graph for this function:

ilDidacticTemplateLocalRoleAction::getType ( )

Get action type.

Returns
int

Reimplemented from ilDidacticTemplateAction.

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

References ilDidacticTemplateAction\TYPE_LOCAL_ROLE.

{
}
ilDidacticTemplateLocalRoleAction::read ( )

Read db entry ilDB $ilDB.

Returns
bool

Reimplemented from ilDidacticTemplateAction.

Definition at line 178 of file class.ilDidacticTemplateLocalRoleAction.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, ilDidacticTemplateAction\getActionId(), and setRoleTemplateId().

{
global $ilDB;
$query = 'SELECT * FROM didactic_tpl_alr '.
'WHERE action_id = '.$ilDB->quote($this->getActionId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setRoleTemplateId($row->role_template_id);
}
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateLocalRoleAction::revert ( )

Revert action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 100 of file class.ilDidacticTemplateLocalRoleAction.php.

{
// @todo: revert could delete the generated local role. But on the other hand all users
// assigned to this local role would be deassigned. E.g. if course or group membership
// is handled by didactic templates, all members would get lost.
}
ilDidacticTemplateLocalRoleAction::save ( )

Create new action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 110 of file class.ilDidacticTemplateLocalRoleAction.php.

References $query, $res, ilDidacticTemplateAction\getActionId(), and getRoleTemplateId().

{
global $ilDB;
$query = 'INSERT INTO didactic_tpl_alr (action_id,role_template_id) '.
'VALUES ( '.
$ilDB->quote($this->getActionId(),'integer').', '.
$ilDB->quote($this->getRoleTemplateId(),'integer').' '.
') ';
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateLocalRoleAction::setRoleTemplateId (   $a_role_template_id)

Set role template id.

Parameters
int$a_role_template_id

Definition at line 39 of file class.ilDidacticTemplateLocalRoleAction.php.

Referenced by read().

{
$this->role_template_id = $a_role_template_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateLocalRoleAction::toXml ( ilXmlWriter  $writer)

Write xml of template action.

Parameters
ilXmlWriter$writer

Reimplemented from ilDidacticTemplateAction.

Definition at line 148 of file class.ilDidacticTemplateLocalRoleAction.php.

References ilObject\_lookupType(), ilXmlWriter\appendXML(), getRoleTemplateId(), ilRoleXmlExport\MODE_DTPL, ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
$writer->xmlStartTag('localRoleAction');
$il_id = 'il_'.IL_INST_ID.'_'.ilObject::_lookupType($this->getRoleTemplateId()).'_'.$this->getRoleTemplateId();
$writer->xmlStartTag(
'roleTemplate',
array(
'id' => $il_id
)
);
include_once './Services/AccessControl/classes/class.ilRoleXmlExport.php';
$exp = new ilRoleXmlExport();
$exp->addRole($this->getRoleTemplateId(), ROLE_FOLDER_ID);
$exp->write();
$writer->appendXML($exp->xmlDumpMem(FALSE));
$writer->xmlEndTag('roleTemplate');
$writer->xmlEndTag('localRoleAction');
}

+ Here is the call graph for this function:

Field Documentation

ilDidacticTemplateLocalRoleAction::$role_template_id = 0
private

Definition at line 15 of file class.ilDidacticTemplateLocalRoleAction.php.

Referenced by getRoleTemplateId().


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