ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLogComponentLevel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
28{
29 private string $compontent_id = '';
30 private ?int $component_level = null;
31
32 protected ilDBInterface $db;
33
34 public function __construct(string $a_component_id, ?int $a_level = null)
35 {
36 global $DIC;
37
38 $this->db = $DIC->database();
39 $this->compontent_id = $a_component_id;
40 if ($a_level === null) {
41 $this->read();
42 } else {
43 $this->setLevel($a_level);
44 }
45 }
46
47 public function getComponentId(): string
48 {
50 }
51
52 public function setLevel(?int $a_level): void
53 {
54 $this->component_level = $a_level;
55 }
56
57 public function getLevel(): ?int
58 {
60 }
61
62 public function update(): void
63 {
64 $this->db->replace(
65 'log_components',
66 array('component_id' => array('text',$this->getComponentId())),
67 array('log_level' => array('integer',$this->getLevel()))
68 );
69 }
70
71 public function read(): void
72 {
73 $query = 'SELECT * FROM log_components ' .
74 'WHERE component_id = ' . $this->db->quote($this->getComponentId(), 'text');
75
76 $res = $this->db->query($query);
77 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
78 $this->component_level = (int) $row->log_level;
79 }
80 }
81}
individual log levels for components
__construct(string $a_component_id, ?int $a_level=null)
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26