ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilLogComponentTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
5
6
11{
13 protected ?ilLoggingDBSettings $settings = null;
14 protected bool $editable = true;
15
16 public function __construct(object $a_parent_obj, string $a_parent_cmd = "")
17 {
18 global $DIC;
19 $this->component_repo = $DIC["component.repository"];
20
21 $this->setId('il_log_component');
22 parent::__construct($a_parent_obj, $a_parent_cmd);
23 }
24
28 public function setEditable(bool $a_status): void
29 {
30 $this->editable = $a_status;
31 }
32
36 public function isEditable(): bool
37 {
38 return $this->editable;
39 }
40
44 public function init(): void
45 {
46 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
48
49 $this->setRowTemplate('tpl.log_component_row.html', 'Services/Logging');
50 $this->addColumn($this->lng->txt('log_component_col_component'), 'component_sortable');
51 $this->addColumn($this->lng->txt('log_component_col_level'), 'level');
52
53 $this->setDefaultOrderField('component_sortable');
54
55 if ($this->isEditable()) {
56 $this->addCommandButton('saveComponentLevels', $this->lng->txt('save'));
57 $this->addCommandButton('resetComponentLevels', $this->lng->txt('log_component_btn_reset'));
58 }
59
60 $this->setShowRowsSelector(false);
61 $this->setLimit(500);
62 }
63
68 {
69 return $this->settings;
70 }
71
75 public function parse(): void
76 {
77 $components = ilLogComponentLevels::getInstance()->getLogComponents();
78 $rows = array();
79 foreach ($components as $component) {
80 $row['id'] = $component->getComponentId();
81 if ($component->getComponentId() == 'log_root') {
82 $row['component'] = 'Root';
83 $row['component_sortable'] = '_' . $row['component'];
84 } else {
85 if ($this->component_repo->hasComponentId(
86 $component->getComponentId()
87 )) {
88 $row['component'] = $this->component_repo->getComponentById(
89 $component->getComponentId()
90 )->getName();
91 } else {
92 $row['component'] = "Unknown (" . $component->getComponentId() . ")";
93 }
94 $row['component_sortable'] = $row['component'];
95 }
96 $row['level'] = (int) $component->getLevel();
97 $rows[] = $row;
98 }
99 $this->setMaxCount(count($rows));
100 $this->setData($rows);
101 }
102
106 protected function fillRow(array $a_set): void
107 {
108 $this->tpl->setVariable('CNAME', $a_set['component']);
109 if ($a_set['id'] == 'log_root') {
110 $this->tpl->setVariable('TXT_DESC', $this->lng->txt('log_component_root_desc'));
111 }
112
113 $default_option_value = ilLoggingDBSettings::getInstance()->getLevel();
114 $array_options = ilLogLevel::getLevelOptions();
115 $default_option = array( 0 => $this->lng->txt('default') . " (" . $array_options[$default_option_value] . ")");
116 $array_options = $default_option + $array_options;
117
118 $levels = new ilSelectInputGUI('', 'level[' . $a_set['id'] . ']');
119 $levels->setOptions($array_options);
120 $levels->setValue($a_set['level']);
121 $this->tpl->setVariable('C_SELECT_LEVEL', $levels->render());
122 }
123}
Component logger with individual log levels by component id.
ilComponentRepository $component_repo
__construct(object $a_parent_obj, string $a_parent_cmd="")
setEditable(bool $a_status)
Set ediatable (write permission granted)
fillRow(array $a_set)
@inheritDoc
isEditable()
Check if ediatable (write permission granted)
static getLevelOptions()
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
global $DIC
Definition: feed.php:28
Readable part of repository interface to ilComponentDataDB.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$rows
Definition: xhr_table.php:10