ILIAS  release_8 Revision v8.24
class.ilLogComponentLevel.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
5
14{
15 private string $compontent_id = '';
16 private ?int $component_level = null;
17
18 protected ilDBInterface $db;
19
20 public function __construct(string $a_component_id, int $a_level = null)
21 {
22 global $DIC;
23
24 $this->db = $DIC->database();
25 $this->compontent_id = $a_component_id;
26 if ($a_level === null) {
27 $this->read();
28 } else {
29 $this->setLevel($a_level);
30 }
31 }
32
33 public function getComponentId(): string
34 {
36 }
37
38 public function setLevel(?int $a_level): void
39 {
40 $this->component_level = $a_level;
41 }
42
43 public function getLevel(): ?int
44 {
46 }
47
48 public function update(): void
49 {
50 $this->db->replace(
51 'log_components',
52 array('component_id' => array('text',$this->getComponentId())),
53 array('log_level' => array('integer',$this->getLevel()))
54 );
55 }
56
57 public function read(): void
58 {
59 $query = 'SELECT * FROM log_components ' .
60 'WHERE component_id = ' . $this->db->quote($this->getComponentId(), 'text');
61
62 $res = $this->db->query($query);
63 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
64 $this->component_level = (int) $row->log_level;
65 }
66 }
67}
individual log levels for components
__construct(string $a_component_id, int $a_level=null)
global $DIC
Definition: feed.php:28
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
$query