ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLogComponentLevels.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/Logging/classes/class.ilLogComponentLevel.php';
6 
7 
16 {
17  protected static $instance = null;
18  protected $components = array();
19 
23  protected function __construct()
24  {
25  $this->read();
26  }
27 
32  public static function getInstance()
33  {
34  if (!self::$instance) {
35  self::$instance = new self();
36  }
37  return self::$instance;
38  }
39 
45  public static function updateFromXML($a_component_id)
46  {
47  global $DIC;
48 
49  $ilDB = $DIC['ilDB'];
50 
51  if (!$a_component_id) {
52  return false;
53  }
54 
55  $query = 'SELECT * FROM log_components ' .
56  'WHERE component_id = ' . $ilDB->quote($a_component_id, 'text');
57  $res = $ilDB->query($query);
58  if (!$res->numRows()) {
59  $query = 'INSERT INTO log_components (component_id) ' .
60  'VALUES (' .
61  $ilDB->quote($a_component_id, 'text') .
62  ')';
63  $ilDB->manipulate($query);
64  }
65  return true;
66  }
67 
72  public function getLogComponents()
73  {
74  return $this->components;
75  }
76 
77  public function read()
78  {
79  global $DIC;
80 
81  $ilDB = $DIC['ilDB'];
82 
83  $query = 'SELECT * FROM log_components ';
84  $res = $ilDB->query($query);
85 
86  $this->components = array();
87  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
88  $this->components[] = new ilLogComponentLevel($row->component_id, $row->log_level);
89  }
90  }
91 }
global $DIC
Definition: saml.php:7
static updateFromXML($a_component_id)
type $ilDB
foreach($_POST as $key=> $value) $res
individual log levels for components
individual log levels for components
$query
$row
global $ilDB
getLogComponents()
Get compponent level.