ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDidacticTemplateUtils.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
13  public static function switchTemplate($a_ref_id, $a_new_tpl_id)
14  {
15  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
17  $a_ref_id
18  );
19 
20  ilLoggerFactory::getLogger('dtpl')->debug('Current template id: ' . $current_tpl_id);
21 
22  // Revert current template
23  if ($current_tpl_id) {
24  ilLoggerFactory::getLogger('dtpl')->debug('Reverting template with id: ' . $current_tpl_id);
25 
26  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
28  $action->setRefId($a_ref_id);
29  $action->revert();
30  }
31  }
32 
33  include_once './Services/Object/classes/class.ilObjectFactory.php';
34  $factory = new ilObjectFactory();
35  $obj = $factory->getInstanceByRefId($a_ref_id, false);
36  if ($obj instanceof ilObject) {
37  $obj->applyDidacticTemplate($a_new_tpl_id);
38  }
39  return true;
40  }
41 }
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
Class ilObjectFactory.
$action
$factory
Definition: metadata.php:43
Utilities for didactic templates.
static switchTemplate($a_ref_id, $a_new_tpl_id)
static getLogger($a_component_id)
Get component logger.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.