ILIAS  release_8 Revision v8.24
class.ilUserActionAdmin.php
Go to the documentation of this file.
1<?php
2
24{
25 protected static bool $loaded = false;
26 protected static array $data = array();
27
28 public static function activateAction(
29 string $a_context_comp,
30 string $a_context_id,
31 string $a_action_comp,
32 string $a_action_type,
33 bool $a_active
34 ): void {
35 global $DIC;
36
37 $db = $DIC->database();
38 $db->replace(
39 "user_action_activation",
40 array(
41 "context_comp" => array("text", $a_context_comp),
42 "context_id" => array("text", $a_context_id),
43 "action_comp" => array("text", $a_action_comp),
44 "action_type" => array("text", $a_action_type),
45 ),
46 array(
47 "active" => array("integer", $a_active))
48 );
49
50 self::$loaded = false;
51 }
52
53 public static function lookupActive(
54 string $a_context_comp,
55 string $a_context_id,
56 string $a_action_comp,
57 string $a_action_type
58 ): bool {
59 if (!self::$loaded) {
60 self::loadData();
61 }
62 if (
63 !isset(self::$data[$a_context_comp])
64 || !isset(self::$data[$a_context_comp][$a_context_id])
65 || !isset(self::$data[$a_context_comp][$a_context_id][$a_action_comp])
66 || !isset(self::$data[$a_context_comp][$a_context_id][$a_action_comp][$a_action_type])
67 ) {
68 return false;
69 }
70 return (bool) self::$data[$a_context_comp][$a_context_id][$a_action_comp][$a_action_type];
71 }
72
73 protected static function loadData(): void
74 {
75 global $DIC;
76
77 $db = $DIC->database();
78
79 $set = $db->query("SELECT * FROM user_action_activation");
80 self::$data = array();
81 while ($rec = $db->fetchAssoc($set)) {
82 self::$data[$rec["context_comp"]][$rec["context_id"]][$rec["action_comp"]][$rec["action_type"]] = (bool) $rec["active"];
83 }
84
85 self::$loaded = true;
86 }
87}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static activateAction(string $a_context_comp, string $a_context_id, string $a_action_comp, string $a_action_type, bool $a_active)
static lookupActive(string $a_context_comp, string $a_context_id, string $a_action_comp, string $a_action_type)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
global $DIC
Definition: feed.php:28