ILIAS  release_8 Revision v8.24
class.ilDidacticTemplateActionFactory.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
5
11{
12 public static function factoryByType(int $a_action_type): ilDidacticTemplateAction
13 {
14 switch ($a_action_type) {
17
20
23
24 default:
25 throw new InvalidArgumentException('Unknown action type given: ' . $a_action_type);
26 }
27 }
28
29 public static function factoryByTypeAndId(int $a_action_id, int $a_action_type): ilDidacticTemplateAction
30 {
31 switch ($a_action_type) {
33 return new ilDidacticTemplateLocalPolicyAction($a_action_id);
34
36 return new ilDidacticTemplateLocalRoleAction($a_action_id);
37
39 return new ilDidacticTemplateBlockRoleAction($a_action_id);
40
41 default:
42 throw new InvalidArgumentException('Unknown action type given: ' . $a_action_type);
43 }
44 }
45
51 public static function getActionsByTemplateId(int $a_tpl_id): array
52 {
53 global $DIC;
54
55 $ilDB = $DIC->database();
56
57 $query = 'SELECT id, type_id FROM didactic_tpl_a ' .
58 'WHERE tpl_id = ' . $ilDB->quote($a_tpl_id, \ilDBConstants::T_INTEGER);
59 $res = $ilDB->query($query);
60
61 $actions = [];
62 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
63 $actions[] = self::factoryByTypeAndId((int) $row->id, (int) $row->type_id);
64 }
65 return $actions;
66 }
67}
Factory for didactic template actions.
static factoryByTypeAndId(int $a_action_id, int $a_action_type)
static getActionsByTemplateId(int $a_tpl_id)
Get actions of one template.
Abstract class for template actions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
represents a creation of local roles action
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query