ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 getLogger ()
 Get logger. 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 FILTER_PARENT_ROLES = 3
 
const PATTERN_PARENT_TYPE = 'action'
 

Protected Member Functions

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

Private Attributes

 $logger = null
 
 $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 38 of file class.ilDidacticTemplateAction.php.

39 {
40 $this->logger = $GLOBALS['DIC']->logger()->otpl();
41
42 $this->setActionId($action_id);
43 $this->read();
44 }
setActionId($a_action_id)
Set action id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $action_id, $GLOBALS, 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 200 of file class.ilDidacticTemplateAction.php.

201 {
202 $this->setActionId(0);
203 }

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 150 of file class.ilDidacticTemplateAction.php.

151 {
152 global $ilDB;
153
154 $query = 'DELETE FROM didactic_tpl_a ' .
155 'WHERE id = ' . $ilDB->quote($this->getActionId(), 'integer');
156 $ilDB->manipulate($query);
157 }
$query
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 228 of file class.ilDidacticTemplateAction.php.

229 {
230 global $rbacreview;
231
232 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
234 $this->getActionId(),
235 self::PATTERN_PARENT_TYPE
236 );
237
238 $filtered = array();
239 foreach ($rbacreview->getParentRoleIds($source->getRefId()) as $role_id => $role) {
240 switch ($this->getFilterType()) {
242
243 ilLoggerFactory::getLogger('dtpl')->dump($role);
244 if (
245 ($role['parent'] == $source->getRefId()) &&
246 ($role['assign'] == 'y')
247 ) {
248 ilLoggerFactory::getLogger('dtpl')->debug('Excluding local role: ' . $role['title']);
249 break;
250 }
251 foreach ($patterns as $pattern) {
252 if ($pattern->valid(ilObject::_lookupTitle($role_id))) {
253 ilLoggerFactory::getLogger('otpl')->debug('Role is valid: ' . ilObject::_lookupTitle($role_id));
254 $filtered[$role_id] = $role;
255 }
256 }
257 break;
258
259 default:
261 foreach ($patterns as $pattern) {
262 if ($pattern->valid(ilObject::_lookupTitle($role_id))) {
263 ilLoggerFactory::getLogger('otpl')->debug('Role is valid: ' . ilObject::_lookupTitle($role_id));
264 $filtered[$role_id] = $role;
265 }
266 }
267 break;
268 }
269 }
270 return $filtered;
271 }
$source
Definition: linkback.php:22
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

References $source, ilObject\_lookupTitle(), FILTER_PARENT_ROLES, FILTER_SOURCE_TITLE, getActionId(), ilLoggerFactory\getLogger(), 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()

◆ getLogger()

ilDidacticTemplateAction::getLogger ( )

Get logger.

Returns
type

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

References $logger.

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

+ Here is the caller graph for this function:

◆ getRefId()

ilDidacticTemplateAction::getRefId ( )

Get ref id of target object.

Definition at line 114 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 96 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 217 of file class.ilDidacticTemplateAction.php.

218 {
219 include_once './Services/Object/classes/class.ilObjectFactory.php';
221 return $s;
222 }
getRefId()
Get ref id of target object.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$s
Definition: pwgen.php:45

References $s, 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 163 of file class.ilDidacticTemplateAction.php.

164 {
165 global $ilDB;
166
167 $query = 'SELECT * FROM didactic_tpl_a ' .
168 'WHERE id = ' . $ilDB->quote($this->getActionId(), 'integer');
169 $res = $ilDB->query($query);
170 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
171 $this->setTemplateId($row->tpl_id);
172 }
173 return true;
174 }
foreach($_POST as $key=> $value) $res

References $ilDB, $query, $res, $row, ilDBConstants\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 125 of file class.ilDidacticTemplateAction.php.

126 {
127 global $ilDB;
128
129 if ($this->getActionId()) {
130 return false;
131 }
132
133 $this->setActionId($ilDB->nextId('didactic_tpl_a'));
134 $query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) ' .
135 'VALUES( ' .
136 $ilDB->quote($this->getActionId(), 'integer') . ', ' .
137 $ilDB->quote($this->getTemplateId(), 'integer') . ', ' .
138 $ilDB->quote($this->getType(), 'integer') .
139 ')';
140 $ilDB->manipulate($query);
141 return $this->getActionId();
142 }
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 68 of file class.ilDidacticTemplateAction.php.

69 {
70 $this->action_id = $a_action_id;
71 }

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 106 of file class.ilDidacticTemplateAction.php.

107 {
108 $this->ref_id = $a_ref_id;
109 }

◆ setTemplateId()

ilDidacticTemplateAction::setTemplateId (   $a_id)

Set template id.

Parameters
int$a_id

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

88 {
89 $this->tpl_id = $a_id;
90 }

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 78 of file class.ilDidacticTemplateAction.php.

79 {
80 $this->type = $a_type_id;
81 }

◆ toXml()

ilDidacticTemplateAction::toXml ( ilXmlWriter  $writer)
abstract

Field Documentation

◆ $action_id

ilDidacticTemplateAction::$action_id = 0
private

◆ $logger

ilDidacticTemplateAction::$logger = null
private

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

Referenced by getLogger().

◆ $ref_id

ilDidacticTemplateAction::$ref_id = 0
private

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

Referenced by getRefId().

◆ $tpl_id

ilDidacticTemplateAction::$tpl_id = 0
private

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

Referenced by getTemplateId().

◆ $type

ilDidacticTemplateAction::$type = 0
private

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

◆ FILTER_PARENT_ROLES

const ilDidacticTemplateAction::FILTER_PARENT_ROLES = 3

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

Referenced by filterRoles().

◆ 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 20 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: