ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 11 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 13 of file class.ilDidacticTemplateUtils.php.

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

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

13  : bool
14  {
15  global $DIC;
16 
17  $logger = $DIC->logger()->otpl();
19  $a_ref_id
20  );
21  $logger->debug('Current template id: ' . $current_tpl_id);
22  // Revert current template
23  if ($current_tpl_id) {
24  $logger->debug('Reverting template with id: ' . $current_tpl_id);
25  foreach (ilDidacticTemplateActionFactory::getActionsByTemplateId($current_tpl_id) as $action) {
26  $action->setRefId($a_ref_id);
27  $action->revert();
28  }
29  }
30 
31  $obj = ilObjectFactory::getInstanceByRefId($a_ref_id, false);
32  if ($obj instanceof ilObject) {
33  $obj->applyDidacticTemplate($a_new_tpl_id);
34  }
35 
36  return true;
37  }
global $DIC
Definition: feed.php:28
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getActionsByTemplateId(int $a_tpl_id)
Get actions of one template.
+ 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: