ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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. More...
 
 getActionId ()
 Get action id. More...
 
 setActionId ($a_action_id)
 Set action id. More...
 
 setType ($a_type_id)
 Set type id. More...
 
 setTemplateId ($a_id)
 Set template id. More...
 
 getTemplateId ()
 Get template id. More...
 
 setRefId ($a_ref_id)
 Set ref id of target object. More...
 
 getRefId ()
 Get ref id of target object. More...
 
 save ()
 write action to db overwrite for filling additional db fields More...
 
 delete ()
 Delete didactic template action overwrite for filling additional db fields. More...
 
 read ()
 @global ilDB $ilDB More...
 
 getType ()
 Get type of template. More...
 
 apply ()
 Apply action. More...
 
 revert ()
 Implement everthing that is necessary to revert a didactic template. More...
 
 __clone ()
 Clone method. More...
 
 toXml (ilXmlWriter $writer)
 Write xml for export. More...
 

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. More...
 
 filterRoles (ilObject $source)
 Filter roles. More...
 

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

◆ __construct()

ilDidacticTemplateAction::__construct (   $action_id = 0)

Constructor.

Reimplemented in ilDidacticTemplateLocalRoleAction, ilDidacticTemplateBlockRoleAction, and ilDidacticTemplateLocalPolicyAction.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilDidacticTemplateAction::__clone ( )

Clone method.

Reimplemented in ilDidacticTemplateBlockRoleAction, and ilDidacticTemplateLocalPolicyAction.

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

186 {
187 $this->setActionId(0);
188 }

References setActionId().

+ Here is the call graph for this function:

◆ apply()

ilDidacticTemplateAction::apply ( )
abstract

◆ delete()

ilDidacticTemplateAction::delete ( )

Delete didactic template action overwrite for filling additional db fields.

Returns
bool

Reimplemented in ilDidacticTemplateBlockRoleAction, ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateLocalRoleAction.

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

135 {
136 global $ilDB;
137
138 $query = 'DELETE FROM didactic_tpl_a '.
139 'WHERE id = '.$ilDB->quote($this->getActionId(),'integer');
140 $ilDB->manipulate($query);
141 }
global $ilDB

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

+ Here is the call graph for this function:

◆ filterRoles()

ilDidacticTemplateAction::filterRoles ( ilObject  $source)
protected

Filter roles.

Parameters
ilObject$object

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

214 {
215 global $rbacreview;
216
217 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
219 $this->getActionId(),
220 self::PATTERN_PARENT_TYPE
221 );
222
223 $filtered = array();
224 foreach($rbacreview->getParentRoleIds($source->getRefId()) as $role_id => $role)
225 {
226 foreach($patterns as $pattern)
227 {
228 if($pattern->valid(ilObject::_lookupTitle($role_id)))
229 {
230 ilLoggerFactory::getLogger('otpl')->debug('Role is valid: '. ilObject::_lookupTitle($role_id));
231 $filtered[$role_id] = $role;
232 }
233 }
234 }
235 return $filtered;
236 }
static lookupPatternsByParentId($a_parent_id, $a_parent_type)
Get patterns by template id.
static getLogger($a_component_id)
Get component logger.
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public

References ilObject\_lookupTitle(), getActionId(), ilLoggerFactory\getLogger(), ilObject\getRefId(), and ilDidacticTemplateFilterPatternFactory\lookupPatternsByParentId().

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

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

◆ getActionId()

◆ getRefId()

ilDidacticTemplateAction::getRefId ( )

Get ref id of target object.

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

References $ref_id.

Referenced by ilDidacticTemplateLocalRoleAction\apply(), and initSourceObject().

+ Here is the caller graph for this function:

◆ getTemplateId()

ilDidacticTemplateAction::getTemplateId ( )

Get template id.

Returns
int

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

References $tpl_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getType()

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:

◆ initSourceObject()

ilDidacticTemplateAction::initSourceObject ( )
protected

Init the source object.

Returns
ilObject $obj

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

203 {
204 include_once './Services/Object/classes/class.ilObjectFactory.php';
206 return $s;
207 }
getRefId()
Get ref id of target object.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

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

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

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

◆ read()

ilDidacticTemplateAction::read ( )

@global ilDB $ilDB

Reimplemented in ilDidacticTemplateBlockRoleAction, ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateLocalRoleAction.

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

148 {
149 global $ilDB;
150
151 $query = 'SELECT * FROM didactic_tpl_a '.
152 'WHERE id = '.$ilDB->quote($this->getActionId(), 'integer');
153 $res = $ilDB->query($query);
154 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
155 {
156 $this->setTemplateId($row->tpl_id);
157 }
158 return true;
159 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

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

Referenced by __construct().

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

◆ revert()

ilDidacticTemplateAction::revert ( )
abstract

Implement everthing that is necessary to revert a didactic template.

return bool

Reimplemented in ilDidacticTemplateBlockRoleAction, ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateLocalRoleAction.

◆ save()

ilDidacticTemplateAction::save ( )

write action to db overwrite for filling additional db fields

Returns
bool

Reimplemented in ilDidacticTemplateBlockRoleAction, ilDidacticTemplateLocalPolicyAction, and ilDidacticTemplateLocalRoleAction.

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

109 {
110 global $ilDB;
111
112 if($this->getActionId())
113 {
114 return false;
115 }
116
117 $this->setActionId($ilDB->nextId('didactic_tpl_a'));
118 $query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) '.
119 'VALUES( '.
120 $ilDB->quote($this->getActionId(),'integer').', '.
121 $ilDB->quote($this->getTemplateId(),'integer').', '.
122 $ilDB->quote($this->getType(),'integer').
123 ')';
124 $ilDB->manipulate($query);
125 return $this->getActionId();
126 }
getType()
Get type of template.

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

+ Here is the call graph for this function:

◆ setActionId()

ilDidacticTemplateAction::setActionId (   $a_action_id)

Set action id.

Parameters
int$a_action_id

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

52 {
53 $this->action_id = $a_action_id;
54 }

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

+ Here is the caller graph for this function:

◆ setRefId()

ilDidacticTemplateAction::setRefId (   $a_ref_id)

Set ref id of target object.

Parameters
intref id @reteurn void

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

90 {
91 $this->ref_id = $a_ref_id;
92 }

◆ setTemplateId()

ilDidacticTemplateAction::setTemplateId (   $a_id)

Set template id.

Parameters
int$a_id

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

71 {
72 $this->tpl_id = $a_id;
73 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilDidacticTemplateAction::setType (   $a_type_id)

Set type id.

Parameters
intref id

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

62 {
63 $this->type = $a_type_id;
64 }

◆ toXml()

ilDidacticTemplateAction::toXml ( ilXmlWriter  $writer)
abstract

Field Documentation

◆ $action_id

ilDidacticTemplateAction::$action_id = 0
private

◆ $ref_id

ilDidacticTemplateAction::$ref_id = 0
private

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

Referenced by getRefId().

◆ $tpl_id

ilDidacticTemplateAction::$tpl_id = 0
private

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

Referenced by getTemplateId().

◆ $type

ilDidacticTemplateAction::$type = 0
private

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

◆ FILTER_SOURCE_OBJ_ID

const ilDidacticTemplateAction::FILTER_SOURCE_OBJ_ID = 2

◆ FILTER_SOURCE_TITLE

const ilDidacticTemplateAction::FILTER_SOURCE_TITLE = 1

◆ PATTERN_PARENT_TYPE

const ilDidacticTemplateAction::PATTERN_PARENT_TYPE = 'action'

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

◆ TYPE_BLOCK_ROLE

◆ TYPE_LOCAL_POLICY

◆ TYPE_LOCAL_ROLE


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