ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDidacticTemplateUtils Class Reference

Utilities for didactic templates. More...

+ Collaboration diagram for ilDidacticTemplateUtils:

Static Public Member Functions

static switchTemplate (int $a_ref_id, int $a_new_tpl_id)
 

Detailed Description

Utilities for didactic templates.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Member Function Documentation

◆ switchTemplate()

static ilDidacticTemplateUtils::switchTemplate ( int  $a_ref_id,
int  $a_new_tpl_id 
)
static

Definition at line 27 of file class.ilDidacticTemplateUtils.php.

27 : bool
28 {
29 global $DIC;
30
31 $logger = $DIC->logger()->otpl();
33 $a_ref_id
34 );
35 $logger->debug('Current template id: ' . $current_tpl_id);
36 // Revert current template
37 if ($current_tpl_id) {
38 $logger->debug('Reverting template with id: ' . $current_tpl_id);
39 foreach (ilDidacticTemplateActionFactory::getActionsByTemplateId($current_tpl_id) as $action) {
40 $action->setRefId($a_ref_id);
41 $action->revert();
42 }
43 }
44
45 $obj = ilObjectFactory::getInstanceByRefId($a_ref_id, false);
46 if ($obj instanceof ilObject) {
47 $obj->applyDidacticTemplate($a_new_tpl_id);
48 }
49
50 return true;
51 }
static getActionsByTemplateId(int $a_tpl_id)
Get actions of one template.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
global $DIC
Definition: shib_login.php:26

References $DIC, ilDidacticTemplateActionFactory\getActionsByTemplateId(), ilObjectFactory\getInstanceByRefId(), and ilDidacticTemplateObjSettings\lookupTemplateId().

Referenced by ilDidacticTemplateGUI\switchTemplate(), ilObjGroupGUI\updateGroupTypeObject(), and ilObjSessionGUI\updateSessionTypeObject().

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

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