ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDidacticTemplateAction Class Reference

Abstract class for template actions. More...

+ Inheritance diagram for ilDidacticTemplateAction:
+ Collaboration diagram for ilDidacticTemplateAction:

Public Member Functions

 __construct ($action_id=0)
 Constructor.
 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.
 save ()
 write action to db overwrite for filling additional db fields
 delete ()
 Delete didactic template action overwrite for filling additional db fields.
 read ()
 ilDB $ilDB
 getType ()
 Get type of template.
 apply ()
 Apply action.
 revert ()
 Implement everthing that is necessary to revert a didactic template.
 __clone ()
 Clone method.
 toXml (ilXmlWriter $writer)
 Write xml for export.

Data Fields

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

 initSourceObject ()
 Init the source object.
 filterRoles (ilObject $source)
 Filter roles.

Private Attributes

 $action_id = 0
 $tpl_id = 0
 $type = 0
 $ref_id = 0

Detailed Description

Abstract class for template actions.

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

Definition at line 10 of file class.ilDidacticTemplateAction.php.

Constructor & Destructor Documentation

ilDidacticTemplateAction::__construct (   $action_id = 0)

Constructor.

Reimplemented in ilDidacticTemplateLocalPolicyAction, ilDidacticTemplateBlockRoleAction, and ilDidacticTemplateLocalRoleAction.

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

References $action_id, read(), and setActionId().

{
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilDidacticTemplateAction::__clone ( )

Clone method.

Reimplemented in ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateBlockRoleAction.

Definition at line 185 of file class.ilDidacticTemplateAction.php.

References setActionId().

{
$this->setActionId(0);
}

+ Here is the call graph for this function:

ilDidacticTemplateAction::apply ( )
abstract
ilDidacticTemplateAction::delete ( )

Delete didactic template action overwrite for filling additional db fields.

Returns
bool

Reimplemented in ilDidacticTemplateLocalPolicyAction, ilDidacticTemplateLocalRoleAction, and ilDidacticTemplateBlockRoleAction.

Definition at line 134 of file class.ilDidacticTemplateAction.php.

References $ilDB, $query, and getActionId().

{
global $ilDB;
$query = 'DELETE FROM didactic_tpl_a '.
'WHERE id = '.$ilDB->quote($this->getActionId(),'integer');
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilDidacticTemplateAction::filterRoles ( ilObject  $source)
protected

Filter roles.

Parameters
ilObject$object

Definition at line 213 of file class.ilDidacticTemplateAction.php.

References $GLOBALS, ilObject\_lookupTitle(), getActionId(), ilObject\getRefId(), and ilDidacticTemplateFilterPatternFactory\lookupPatternsByParentId().

Referenced by ilDidacticTemplateBlockRoleAction\apply(), ilDidacticTemplateLocalPolicyAction\apply(), ilDidacticTemplateBlockRoleAction\revert(), and ilDidacticTemplateLocalPolicyAction\revert().

{
global $rbacreview;
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
$this->getActionId(),
self::PATTERN_PARENT_TYPE
);
$filtered = array();
foreach($rbacreview->getParentRoleIds($source->getRefId(),false,true) as $role_id => $role)
{
// no actions for system role id
if($role_id == SYSTEM_ROLE_ID)
{
#$GLOBALS['ilLog']->write(__METHOD__.' no action for system role '.print_r($role,true));
continue;
}
foreach($patterns as $pattern)
{
if($pattern->valid(ilObject::_lookupTitle($role_id)))
{
$GLOBALS['ilLog']->write(__METHOD__.' Role is valid: '. ilObject::_lookupTitle($role_id));
$filtered[$role_id] = $role;
}
}
}
return $filtered;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateAction::getRefId ( )

Get ref id of target object.

Definition at line 97 of file class.ilDidacticTemplateAction.php.

References $ref_id.

Referenced by initSourceObject().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateAction::getTemplateId ( )

Get template id.

Returns
int

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

References $tpl_id.

Referenced by save().

{
return $this->tpl_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateAction::getType ( )
abstract

Get type of template.

Returns
int $type

Reimplemented in ilDidacticTemplateBlockRoleAction, ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateLocalRoleAction.

Referenced by save().

+ Here is the caller graph for this function:

ilDidacticTemplateAction::initSourceObject ( )
protected

Init the source object.

Returns
ilObject $obj

Definition at line 202 of file class.ilDidacticTemplateAction.php.

References ilObjectFactory\getInstanceByRefId(), and getRefId().

Referenced by ilDidacticTemplateLocalRoleAction\apply(), ilDidacticTemplateBlockRoleAction\apply(), ilDidacticTemplateLocalPolicyAction\apply(), ilDidacticTemplateBlockRoleAction\revert(), and ilDidacticTemplateLocalPolicyAction\revert().

{
include_once './classes/class.ilObjectFactory.php';
return $s;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateAction::read ( )

ilDB $ilDB

Reimplemented in ilDidacticTemplateLocalPolicyAction, ilDidacticTemplateBlockRoleAction, and ilDidacticTemplateLocalRoleAction.

Definition at line 147 of file class.ilDidacticTemplateAction.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getActionId(), and setTemplateId().

Referenced by __construct().

{
global $ilDB;
$query = 'SELECT * FROM didactic_tpl_a '.
'WHERE id = '.$ilDB->quote($this->getActionId(), 'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setTemplateId($row->tpl_id);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateAction::revert ( )
abstract

Implement everthing that is necessary to revert a didactic template.

return bool

Reimplemented in ilDidacticTemplateLocalPolicyAction, ilDidacticTemplateBlockRoleAction, and ilDidacticTemplateLocalRoleAction.

ilDidacticTemplateAction::save ( )

write action to db overwrite for filling additional db fields

Returns
bool

Reimplemented in ilDidacticTemplateLocalPolicyAction, ilDidacticTemplateLocalRoleAction, and ilDidacticTemplateBlockRoleAction.

Definition at line 108 of file class.ilDidacticTemplateAction.php.

References $ilDB, $query, getActionId(), getTemplateId(), getType(), and setActionId().

{
global $ilDB;
if($this->getActionId())
{
return false;
}
$this->setActionId($ilDB->nextId('didactic_tpl_a'));
$query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) '.
'VALUES( '.
$ilDB->quote($this->getActionId(),'integer').', '.
$ilDB->quote($this->getTemplateId(),'integer').', '.
$ilDB->quote($this->getType(),'integer').
')';
$ilDB->manipulate($query);
return $this->getActionId();
}

+ Here is the call graph for this function:

ilDidacticTemplateAction::setActionId (   $a_action_id)

Set action id.

Parameters
int$a_action_id

Definition at line 51 of file class.ilDidacticTemplateAction.php.

Referenced by __clone(), __construct(), and save().

{
$this->action_id = $a_action_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateAction::setRefId (   $a_ref_id)

Set ref id of target object.

Parameters
intref id void

Definition at line 89 of file class.ilDidacticTemplateAction.php.

{
$this->ref_id = $a_ref_id;
}
ilDidacticTemplateAction::setTemplateId (   $a_id)

Set template id.

Parameters
int$a_id

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

Referenced by read().

{
$this->tpl_id = $a_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateAction::setType (   $a_type_id)

Set type id.

Parameters
intref id

Definition at line 61 of file class.ilDidacticTemplateAction.php.

{
$this->type = $a_type_id;
}
ilDidacticTemplateAction::toXml ( ilXmlWriter  $writer)
abstract

Field Documentation

ilDidacticTemplateAction::$action_id = 0
private
ilDidacticTemplateAction::$ref_id = 0
private

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

Referenced by getRefId().

ilDidacticTemplateAction::$tpl_id = 0
private

Definition at line 22 of file class.ilDidacticTemplateAction.php.

Referenced by getTemplateId().

ilDidacticTemplateAction::$type = 0
private

Definition at line 23 of file class.ilDidacticTemplateAction.php.

const ilDidacticTemplateAction::FILTER_SOURCE_OBJ_ID = 2

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

const ilDidacticTemplateAction::FILTER_SOURCE_TITLE = 1
const ilDidacticTemplateAction::PATTERN_PARENT_TYPE = 'action'

Definition at line 19 of file class.ilDidacticTemplateAction.php.


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