ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 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.

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

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

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 getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
global $DIC
Definition: shib_login.php:22
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: