ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUserActionAdmin.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
14  protected static $loaded = false;
15  protected static $data = array();
16 
26  public static function activateAction($a_context_comp, $a_context_id, $a_action_comp, $a_action_type, $a_active)
27  {
28  global $DIC;
29 
30  $db = $DIC->database();
31  $db->replace(
32  "user_action_activation",
33  array(
34  "context_comp" => array("text", $a_context_comp),
35  "context_id" => array("text", $a_context_id),
36  "action_comp" => array("text", $a_action_comp),
37  "action_type" => array("text", $a_action_type),
38  ),
39  array(
40  "active" => array("integer", $a_active))
41  );
42 
43  self::$loaded = false;
44  }
45 
55  public static function lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
56  {
57  if (!self::$loaded) {
58  self::loadData();
59  }
60  return (bool) self::$data[$a_context_comp][$a_context_id][$a_action_comp][$a_action_type];
61  }
62 
69  protected static function loadData()
70  {
71  global $DIC;
72 
73  $db = $DIC->database();
74 
75  $set = $db->query("SELECT * FROM user_action_activation");
76  self::$data = array();
77  while ($rec = $db->fetchAssoc($set)) {
78  self::$data[$rec["context_comp"]][$rec["context_id"]][$rec["action_comp"]][$rec["action_type"]] = (bool) $rec["active"];
79  }
80 
81  self::$loaded = true;
82  }
83 }
global $DIC
Definition: saml.php:7
$a_context_id
Definition: workflow.php:97
static lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
Is activated?
User action administration.
static loadData()
Load data.
static activateAction($a_context_comp, $a_context_id, $a_action_comp, $a_action_type, $a_active)
Activate action.
$data
Definition: bench.php:6