ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLogComponentLevel.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13  private $compontent_id = '';
14  private $component_level = null;
15 
16  public function __construct($a_component_id, $a_level = null)
17  {
18  $this->compontent_id = $a_component_id;
19  if ($a_level === null) {
20  $this->read();
21  } else {
22  $this->setLevel($a_level);
23  }
24  }
25 
26  public function getComponentId()
27  {
28  return $this->compontent_id;
29  }
30 
31  public function setLevel($a_level)
32  {
33  $this->component_level = $a_level;
34  }
35 
36  public function getLevel()
37  {
39  }
40 
41  public function update()
42  {
43  global $DIC;
44 
45  $ilDB = $DIC['ilDB'];
46 
47  ilLoggerFactory::getLogger('log')->debug('update called');
48 
49  $ilDB->replace(
50  'log_components',
51  array('component_id' => array('text',$this->getComponentId())),
52  array('log_level' => array('integer',$this->getLevel()))
53  );
54  }
55 
60  public function read()
61  {
62  global $DIC;
63 
64  $ilDB = $DIC['ilDB'];
65 
66  $query = 'SELECT * FROM log_components ' .
67  'WHERE component_id = ' . $ilDB->quote($this->getComponentId(), 'text');
68 
69  $res = $ilDB->query($query);
70  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
71  $this->component_level = $row->log_level;
72  }
73  }
74 }
global $DIC
Definition: saml.php:7
__construct($a_component_id, $a_level=null)
foreach($_POST as $key=> $value) $res
individual log levels for components
$query
$row
read()
Read entry type $ilDB.
global $ilDB
static getLogger($a_component_id)
Get component logger.