ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDidacticTemplateLocalPolicyAction Class Reference

Description of class. More...

+ Inheritance diagram for ilDidacticTemplateLocalPolicyAction:
+ Collaboration diagram for ilDidacticTemplateLocalPolicyAction:

Public Member Functions

 __construct ($action_id=0)
 Constructor. More...
 
 addFilterPattern (ilDidacticTemplateFilterPattern $pattern)
 Add filter. More...
 
 setFilterPatterns (array $patterns)
 Set filter patterns. More...
 
 getFilterPattern ()
 Get filter pattern. More...
 
 setFilterType ($a_type)
 Set filter type. More...
 
 getFilterType ()
 Get filter type. More...
 
 setRoleTemplateType ($a_tpl_type)
 Set Role template type. More...
 
 getRoleTemplateType ()
 Get role template type. More...
 
 setRoleTemplateId ($a_id)
 Set role template id. More...
 
 getRoleTemplateId ()
 Get role template id. More...
 
 save ()
 Save action. More...
 
 delete ()
 delete action filter ilDB $ilDB More...
 
 apply ()
 Apply action. More...
 
 revert ()
 Revert action. More...
 
 getType ()
 Get action type. More...
 
 toXml (ilXmlWriter $writer)
 Export to xml. More...
 
 __clone ()
 clone method More...
 
 read ()
 
- Public Member Functions inherited from ilDidacticTemplateAction
 __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 ()
 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 TPL_ACTION_OVERWRITE = 1
 
const TPL_ACTION_INTERSECT = 2
 
const TPL_ACTION_ADD = 3
 
const TPL_ACTION_SUBTRACT = 4
 
const TPL_ACTION_UNION = 5
 
- 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 FILTER_PARENT_ROLES = 3
 
const FILTER_LOCAL_ROLES = 4
 
const PATTERN_PARENT_TYPE = 'action'
 

Protected Member Functions

 createLocalPolicy (ilObject $source, $role)
 Create local policy. More...
 
 revertLocalPolicy (ilObject $source, $role)
 
- Protected Member Functions inherited from ilDidacticTemplateAction
 initSourceObject ()
 Init the source object. More...
 
 filterRoles (ilObject $source)
 Filter roles. More...
 

Private Attributes

 $pattern = array()
 
 $filter_type = self::FILTER_SOURCE_TITLE
 
 $role_template_type = self::TPL_ACTION_OVERWRITE
 
 $role_template_id = 0
 

Detailed Description

Description of class.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateLocalPolicyAction::__construct (   $action_id = 0)

Constructor.

Parameters
int$action_id

Definition at line 31 of file class.ilDidacticTemplateLocalPolicyAction.php.

References ilDidacticTemplateAction\$action_id.

32  {
33  parent::__construct($action_id);
34  }

Member Function Documentation

◆ __clone()

ilDidacticTemplateLocalPolicyAction::__clone ( )

clone method

Definition at line 341 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $pattern, getFilterPattern(), and setFilterPatterns().

342  {
343  parent::__clone();
344 
345  // Clone patterns
346  $cloned = array();
347  foreach ($this->getFilterPattern() as $pattern) {
348  $clones[] = clone $pattern;
349  }
350  $this->setFilterPatterns($clones);
351  }
+ Here is the call graph for this function:

◆ addFilterPattern()

ilDidacticTemplateLocalPolicyAction::addFilterPattern ( ilDidacticTemplateFilterPattern  $pattern)

Add filter.

Parameters
ilDidacticTemplateFilterPatter$pattern

Definition at line 40 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $pattern.

Referenced by read().

+ Here is the caller graph for this function:

◆ apply()

ilDidacticTemplateLocalPolicyAction::apply ( )

Apply action.

Definition at line 173 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $GLOBALS, $source, createLocalPolicy(), ilDidacticTemplateAction\filterRoles(), ilDidacticTemplateAction\getLogger(), and ilDidacticTemplateAction\initSourceObject().

174  {
175  $rbacreview = $GLOBALS['DIC']->rbac()->review();
176 
177  $source = $this->initSourceObject();
178  // Create a role folder for the new local policies
179 
180  $roles = $this->filterRoles($source);
181 
182  // Create local policy for filtered roles
183  foreach ($roles as $role_id => $role) {
184  $this->getLogger()->debug('Apply to role: ' . $role['title']);
185  $this->getLogger()->debug('Role parent: ' . $role['parent']);
186  $this->getLogger()->debug('Source ref_id: ' . $source->getRefId());
187 
188  // No local policies for protected roles of higher context
189  if (
190  $rbacreview->isProtected($role['parent'], $role_id) &&
191  $role['parent'] != $source->getRefId()
192  ) {
193  $this->getLogger()->debug('Ignoring protected role.');
194  continue;
195  }
196  $this->createLocalPolicy($source, $role);
197  }
198  return true;
199  }
filterRoles(ilObject $source)
Filter roles.
createLocalPolicy(ilObject $source, $role)
Create local policy.
initSourceObject()
Init the source object.
$source
Definition: linkback.php:22
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ createLocalPolicy()

ilDidacticTemplateLocalPolicyAction::createLocalPolicy ( ilObject  $source,
  $role 
)
protected

Create local policy.

Parameters
ilObject$source
array$role
Returns
bool

Definition at line 386 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $DIC, $GLOBALS, ilDidacticTemplateAction\getLogger(), ilLoggerFactory\getLogger(), ilObject\getRefId(), getRoleTemplateId(), getRoleTemplateType(), ilObjRole\MODE_PROTECTED_DELETE_LOCAL_POLICIES, and ilObjRole\MODE_UNPROTECTED_DELETE_LOCAL_POLICIES.

Referenced by apply().

387  {
388  global $DIC;
389 
390  $rbacreview = $DIC->rbac()->review();
391  $rbacadmin = $DIC->rbac()->admin();
392 
393  // fetch role information
394  $role_data = array();
395  foreach ($rbacreview->getParentRoleIds($source->getRefId()) as $role_id => $tmp_role) {
396  if ($role_id == $role['obj_id']) {
397  $role_data = $tmp_role;
398  }
399  }
400 
401  // Add local policy
402  if (!$rbacreview->isRoleAssignedToObject($role['obj_id'], $source->getRefId())) {
403  $GLOBALS['DIC']->rbac()->admin()->assignRoleToFolder(
404  $role['obj_id'],
405  $source->getRefId(),
406  'n'
407  );
408  }
409 
410 
411  // do nothing if role is protected in higher context
412  if (
413  $rbacreview->isProtected($source->getRefId(),$role['obj_id']) &&
414  $role['parent'] != $source->getRefId()
415  ) {
416  $this->getLogger()->info('Ignoring protected role: ' . $role['title']);
417  return true;
418  }
419 
420  switch ($this->getRoleTemplateType()) {
421  case self::TPL_ACTION_UNION:
422 
423  ilLoggerFactory::getLogger('otpl')->info('Using ilRbacAdmin::copyRolePermissionUnion()');
424  $rbacadmin->copyRolePermissionUnion(
425  $role_data['obj_id'],
426  $role_data['parent'],
427  $this->getRoleTemplateId(),
428  ROLE_FOLDER_ID,
429  $role_data['obj_id'],
430  $source->getRefId()
431  );
432  break;
433 
434  case self::TPL_ACTION_OVERWRITE:
435 
436  ilLoggerFactory::getLogger('otpl')->info('Using ilRbacAdmin::copyRoleTemplatePermission()');
437  $rbacadmin->copyRoleTemplatePermissions(
438  $this->getRoleTemplateId(),
439  ROLE_FOLDER_ID,
440  $source->getRefId(),
441  $role_data['obj_id'],
442  true
443  );
444  break;
445 
446  case self::TPL_ACTION_INTERSECT:
447 
448  ilLoggerFactory::getLogger('otpl')->info('Using ilRbacAdmin::copyRolePermissionIntersection()' . $this->getRoleTemplateId());
449  $rbacadmin->copyRolePermissionIntersection(
450  $role_data['obj_id'],
451  $role_data['parent'],
452  $this->getRoleTemplateId(),
453  ROLE_FOLDER_ID,
454  $source->getRefId(),
455  $role_data['obj_id']
456  );
457  break;
458 
459  }
460 
461  // Change existing object
462  include_once './Services/AccessControl/classes/class.ilObjRole.php';
463  $role_obj = new ilObjRole($role_data['obj_id']);
464  $role_obj->changeExistingObjects(
465  $source->getRefId(),
467  array('all')
468  );
469 
470  return true;
471  }
Class ilObjRole.
global $DIC
Definition: saml.php:7
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
getRefId()
get reference id public
static getLogger($a_component_id)
Get component logger.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilDidacticTemplateLocalPolicyAction::delete ( )

delete action filter ilDB $ilDB

Returns
bool

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

References $DIC, $ilDB, $pattern, $query, ilDidacticTemplateAction\getActionId(), and getFilterPattern().

150  {
151  global $DIC;
152 
153  $ilDB = $DIC['ilDB'];
154 
155  parent::delete();
156 
157  $query = 'DELETE FROM didactic_tpl_alp ' .
158  'WHERE action_id = ' . $ilDB->quote($this->getActionId(), 'integer');
159  $ilDB->manipulate($query);
160 
161  foreach ($this->getFilterPattern() as $pattern) {
162  $pattern->delete();
163  }
164  return true;
165  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

◆ getFilterPattern()

ilDidacticTemplateLocalPolicyAction::getFilterPattern ( )

Get filter pattern.

Returns
array

Definition at line 58 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $pattern.

Referenced by __clone(), delete(), save(), and toXml().

+ Here is the caller graph for this function:

◆ getFilterType()

ilDidacticTemplateLocalPolicyAction::getFilterType ( )

Get filter type.

Returns
int

Definition at line 76 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $filter_type.

Referenced by save(), and toXml().

+ Here is the caller graph for this function:

◆ getRoleTemplateId()

ilDidacticTemplateLocalPolicyAction::getRoleTemplateId ( )

Get role template id.

Returns
int

Definition at line 111 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $role_template_id.

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

+ Here is the caller graph for this function:

◆ getRoleTemplateType()

ilDidacticTemplateLocalPolicyAction::getRoleTemplateType ( )

Get role template type.

Definition at line 93 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $role_template_type.

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

+ Here is the caller graph for this function:

◆ getType()

ilDidacticTemplateLocalPolicyAction::getType ( )

Get action type.

Returns
int

Definition at line 252 of file class.ilDidacticTemplateLocalPolicyAction.php.

253  {
254  return self::TYPE_LOCAL_POLICY;
255  }

◆ read()

ilDidacticTemplateLocalPolicyAction::read ( )

Definition at line 353 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $DIC, $ilDB, $pattern, $query, $res, $row, addFilterPattern(), ilDBConstants\FETCHMODE_OBJECT, ilDidacticTemplateAction\getActionId(), ilDidacticTemplateFilterPatternFactory\lookupPatternsByParentId(), setFilterType(), setRoleTemplateId(), and setRoleTemplateType().

354  {
355  global $DIC;
356 
357  $ilDB = $DIC['ilDB'];
358 
359  if (!parent::read()) {
360  return false;
361  }
362 
363  $query = 'SELECT * FROM didactic_tpl_alp ' .
364  'WHERE action_id = ' . $ilDB->quote($this->getActionId());
365  $res = $ilDB->query($query);
366  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
367  $this->setFilterType($row->filter_type);
368  $this->setRoleTemplateType($row->template_type);
369  $this->setRoleTemplateId($row->template_id);
370  }
371 
372  // Read filter
373  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
374  foreach (ilDidacticTemplateFilterPatternFactory::lookupPatternsByParentId($this->getActionId(), self::PATTERN_PARENT_TYPE) as $pattern) {
375  $this->addFilterPattern($pattern);
376  }
377  }
static lookupPatternsByParentId($a_parent_id, $a_parent_type)
Get patterns by template id.
global $DIC
Definition: saml.php:7
addFilterPattern(ilDidacticTemplateFilterPattern $pattern)
Add filter.
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:

◆ revert()

ilDidacticTemplateLocalPolicyAction::revert ( )

Revert action.

ilRbacReview

Definition at line 206 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $DIC, $GLOBALS, $source, $tree, ilDidacticTemplateAction\filterRoles(), ilDidacticTemplateAction\getLogger(), ilDidacticTemplateAction\initSourceObject(), ilObjRole\MODE_PROTECTED_DELETE_LOCAL_POLICIES, ilObjRole\MODE_UNPROTECTED_DELETE_LOCAL_POLICIES, and revertLocalPolicy().

207  {
208  global $DIC;
209 
210  $rbacadmin = $DIC['rbacadmin'];
211  $tree = $DIC['tree'];
212  $rbacreview = $GLOBALS['DIC']->rbac()->review();
213 
214  $source = $this->initSourceObject();
215  $roles = $this->filterRoles($source);
216 
217  // Delete local policy for filtered roles
218  foreach ($roles as $role_id => $role) {
219  // Do not delete local policies of auto generated roles
220  if (!$rbacreview->isGlobalRole($role['obj_id']) and
221  $rbacreview->isAssignable($role['obj_id'], $source->getRefId()) and
222  $rbacreview->isSystemGeneratedRole($role['obj_id'])) {
223  $this->getLogger()->debug('Reverting local policy of auto generated role: ' . $role['title']);
224  $this->revertLocalPolicy($source, $role);
225  } else {
226  $this->getLogger()->debug('Reverting local policy and deleting local role: ' . $role['title']);
227 
228  // delete local role and change exiting objects
229  $rbacadmin->deleteLocalRole($role_id, $source->getRefId());
230  // Change existing object
231  include_once './Services/AccessControl/classes/class.ilObjRole.php';
232  $role_obj = new ilObjRole($role_id);
233 
234  $protected = $rbacreview->isProtected($role['parent'], $role['rol_id']);
235 
236  $role_obj->changeExistingObjects(
237  $source->getRefId(),
238  $protected ?
241  array('all')
242  );
243  }
244  }
245  return true;
246  }
Class ilObjRole.
global $DIC
Definition: saml.php:7
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
filterRoles(ilObject $source)
Filter roles.
initSourceObject()
Init the source object.
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
$source
Definition: linkback.php:22
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ revertLocalPolicy()

ilDidacticTemplateLocalPolicyAction::revertLocalPolicy ( ilObject  $source,
  $role 
)
protected

Definition at line 473 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilLoggerFactory\getLogger(), ilObject\getRefId(), ilObjRole\MODE_PROTECTED_DELETE_LOCAL_POLICIES, and ilObjRole\MODE_UNPROTECTED_DELETE_LOCAL_POLICIES.

Referenced by revert().

474  {
475  global $DIC;
476 
477  $rbacadmin = $DIC['rbacadmin'];
478  $rbacreview = $DIC['rbacreview'];
479  $ilDB = $DIC['ilDB'];
480 
481  ilLoggerFactory::getLogger('otpl')->info('Reverting policy for role ' . $role['title']);
482  // Local policies can only be reverted for auto generated roles. Otherwise the
483  // original role settings are unknown
484  if (substr($role['title'], 0, 3) != 'il_') {
485  ilLoggerFactory::getLogger('otpl')->warning('Cannot revert local policy for role ' . $role['title']);
486  return false;
487  }
488 
489 
490  // No local policies
491  if (!$rbacreview->getLocalPolicies($source->getRefId())) {
492  return false;
493  }
494 
495  $exploded_title = explode('_', $role['title']);
496  $rolt_title = $exploded_title[0] . '_' . $exploded_title[1] . '_' . $exploded_title[2];
497 
498  // Lookup role template
499  $query = 'SELECT obj_id FROM object_data ' .
500  'WHERE title = ' . $ilDB->quote($rolt_title, 'text') . ' ' .
501  'AND type = ' . $ilDB->quote('rolt', 'text');
502  $res = $ilDB->query($query);
503  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
504  $rolt_id = $row->obj_id;
505  }
506 
507  // No template found
508  if (!$rolt_id) {
509  return false;
510  }
511 
512  $rbacadmin->copyRoleTemplatePermissions(
513  $rolt_id,
514  ROLE_FOLDER_ID,
515  $source->getRefId(),
516  $role['obj_id'],
517  true
518  );
519 
520  // Change existing object
521  include_once './Services/AccessControl/classes/class.ilObjRole.php';
522  $role_obj = new ilObjRole($role['obj_id']);
523  $role_obj->changeExistingObjects(
524  $source->getRefId(),
526  array('all')
527  );
528  }
Class ilObjRole.
global $DIC
Definition: saml.php:7
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
foreach($_POST as $key=> $value) $res
$query
$row
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
global $ilDB
getRefId()
get reference id public
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDidacticTemplateLocalPolicyAction::save ( )

Save action.

Definition at line 119 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $DIC, $ilDB, $pattern, $query, ilDidacticTemplateAction\getActionId(), getFilterPattern(), getFilterType(), getRoleTemplateId(), and getRoleTemplateType().

120  {
121  global $DIC;
122 
123  $ilDB = $DIC['ilDB'];
124 
125  parent::save();
126 
127  $query = 'INSERT INTO didactic_tpl_alp (action_id,filter_type,template_type,template_id) ' .
128  'VALUES( ' .
129  $ilDB->quote($this->getActionId(), 'integer') . ', ' .
130  $ilDB->quote($this->getFilterType(), 'integer') . ', ' .
131  $ilDB->quote($this->getRoleTemplateType(), 'integer') . ', ' .
132  $ilDB->quote($this->getRoleTemplateId(), 'integer') . ' ' .
133  ')';
134  $ilDB->manipulate($query);
135 
136  foreach ($this->getFilterPattern() as $pattern) {
137  /* @var ilDidacticTemplateFilterPattern $pattern */
138  $pattern->setParentId($this->getActionId());
139  $pattern->setParentType(self::PATTERN_PARENT_TYPE);
140  $pattern->save();
141  }
142  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:

◆ setFilterPatterns()

ilDidacticTemplateLocalPolicyAction::setFilterPatterns ( array  $patterns)

Set filter patterns.

Parameters
array$patterns

Definition at line 49 of file class.ilDidacticTemplateLocalPolicyAction.php.

Referenced by __clone().

50  {
51  $this->pattern = $patterns;
52  }
+ Here is the caller graph for this function:

◆ setFilterType()

ilDidacticTemplateLocalPolicyAction::setFilterType (   $a_type)

Set filter type.

Parameters
int$a_type

Definition at line 67 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $a_type.

Referenced by read().

68  {
69  $this->filter_type = $a_type;
70  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setRoleTemplateId()

ilDidacticTemplateLocalPolicyAction::setRoleTemplateId (   $a_id)

Set role template id.

Parameters
int$a_id

Definition at line 102 of file class.ilDidacticTemplateLocalPolicyAction.php.

Referenced by read().

103  {
104  $this->role_template_id = $a_id;
105  }
+ Here is the caller graph for this function:

◆ setRoleTemplateType()

ilDidacticTemplateLocalPolicyAction::setRoleTemplateType (   $a_tpl_type)

Set Role template type.

Parameters
int$a_tpl_type

Definition at line 85 of file class.ilDidacticTemplateLocalPolicyAction.php.

Referenced by read().

86  {
87  $this->role_template_type = $a_tpl_type;
88  }
+ Here is the caller graph for this function:

◆ toXml()

ilDidacticTemplateLocalPolicyAction::toXml ( ilXmlWriter  $writer)

Export to xml.

Parameters
ilXmlWriter$writer
Returns
void

Definition at line 262 of file class.ilDidacticTemplateLocalPolicyAction.php.

References $pattern, ilObject\_lookupType(), ilXmlWriter\appendXML(), getFilterPattern(), getFilterType(), getRoleTemplateId(), getRoleTemplateType(), ilRoleXmlExport\MODE_DTPL, ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

263  {
264  $writer->xmlStartTag('localPolicyAction');
265 
266  switch ($this->getFilterType()) {
267  case self::FILTER_SOURCE_TITLE:
268  $writer->xmlStartTag('roleFilter', ['source' => 'title']);
269  break;
270 
271  case self::FILTER_SOURCE_OBJ_ID:
272  $writer->xmlStartTag('roleFilter', ['source' => 'objId']);
273  break;
274 
275  case self::FILTER_PARENT_ROLES:
276  $writer->xmlStartTag('roleFilter', ['source' => 'parentRoles']);
277  break;
278 
279  case self::FILTER_LOCAL_ROLES:
280  $writer->xmlStartTag('roleFilter', ['source' => 'localRoles']);
281  break;
282 
283  default:
284  $writer->xmlStartTag('roleFilter', ['source' => 'title']);
285  break;
286  }
287 
288  foreach ($this->getFilterPattern() as $pattern) {
289  $pattern->toXml($writer);
290  }
291  $writer->xmlEndTag('roleFilter');
292 
293  $il_role_id = 'il_' . IL_INST_ID . '_' . ilObject::_lookupType($this->getRoleTemplateId()) . '_' . $this->getRoleTemplateId();
294 
295  switch ($this->getRoleTemplateType()) {
296  case self::TPL_ACTION_OVERWRITE:
297  $writer->xmlStartTag(
298  'localPolicyTemplate',
299  array(
300  'type' => 'overwrite',
301  'id' => $il_role_id
302  )
303  );
304  break;
305 
306  case self::TPL_ACTION_INTERSECT:
307  $writer->xmlStartTag(
308  'localPolicyTemplate',
309  array(
310  'type' => 'intersect',
311  'id' => $il_role_id
312  )
313  );
314  break;
315 
316  case self::TPL_ACTION_UNION:
317  $writer->xmlStartTag(
318  'localPolicyTemplate',
319  array(
320  'type' => 'union',
321  'id' => $il_role_id
322  )
323  );
324  break;
325  }
326 
327  include_once './Services/AccessControl/classes/class.ilRoleXmlExport.php';
328  $exp = new ilRoleXmlExport();
329  $exp->setMode(ilRoleXmlExport::MODE_DTPL);
330  $exp->addRole($this->getRoleTemplateId(), ROLE_FOLDER_ID);
331  $exp->write();
332  $writer->appendXML($exp->xmlDumpMem(false));
333  $writer->xmlEndTag('localPolicyTemplate');
334  $writer->xmlEndTag('localPolicyAction');
335  return;
336  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
static _lookupType($a_id, $a_reference=false)
lookup object type
Xml export of roles and role templates.
appendXML($a_str)
append xml string to document
+ Here is the call graph for this function:

Field Documentation

◆ $filter_type

ilDidacticTemplateLocalPolicyAction::$filter_type = self::FILTER_SOURCE_TITLE
private

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

Referenced by getFilterType().

◆ $pattern

ilDidacticTemplateLocalPolicyAction::$pattern = array()
private

◆ $role_template_id

ilDidacticTemplateLocalPolicyAction::$role_template_id = 0
private

Definition at line 24 of file class.ilDidacticTemplateLocalPolicyAction.php.

Referenced by getRoleTemplateId().

◆ $role_template_type

ilDidacticTemplateLocalPolicyAction::$role_template_type = self::TPL_ACTION_OVERWRITE
private

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

Referenced by getRoleTemplateType().

◆ TPL_ACTION_ADD

const ilDidacticTemplateLocalPolicyAction::TPL_ACTION_ADD = 3

◆ TPL_ACTION_INTERSECT

const ilDidacticTemplateLocalPolicyAction::TPL_ACTION_INTERSECT = 2

◆ TPL_ACTION_OVERWRITE

const ilDidacticTemplateLocalPolicyAction::TPL_ACTION_OVERWRITE = 1

◆ TPL_ACTION_SUBTRACT

const ilDidacticTemplateLocalPolicyAction::TPL_ACTION_SUBTRACT = 4

◆ TPL_ACTION_UNION

const ilDidacticTemplateLocalPolicyAction::TPL_ACTION_UNION = 5

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