ILIAS  release_8 Revision v8.24
class.ilDidacticTemplateUtils.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6
12{
13 public static function switchTemplate(int $a_ref_id, int $a_new_tpl_id): 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 }
38}
static getActionsByTemplateId(int $a_tpl_id)
Get actions of one template.
Utilities for didactic templates.
static switchTemplate(int $a_ref_id, int $a_new_tpl_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28