ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLogComponentTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
24{
26 protected ?ilLoggingDBSettings $settings = null;
27 protected bool $editable = true;
28
29 public function __construct(object $a_parent_obj, string $a_parent_cmd = "")
30 {
31 global $DIC;
32 $this->component_repo = $DIC["component.repository"];
33
34 $this->setId('il_log_component');
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36 }
37
41 public function setEditable(bool $a_status): void
42 {
43 $this->editable = $a_status;
44 }
45
49 public function isEditable(): bool
50 {
51 return $this->editable;
52 }
53
57 public function init(): void
58 {
59 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
61
62 $this->setRowTemplate('tpl.log_component_row.html', 'components/ILIAS/Logging');
63 $this->addColumn($this->lng->txt('log_component_col_component'), 'component_sortable');
64 $this->addColumn($this->lng->txt('log_component_col_level'), 'level');
65
66 $this->setDefaultOrderField('component_sortable');
67
68 if ($this->isEditable()) {
69 $this->addCommandButton('saveComponentLevels', $this->lng->txt('save'));
70 $this->addCommandButton('resetComponentLevels', $this->lng->txt('log_component_btn_reset'));
71 }
72
73 $this->setShowRowsSelector(false);
74 $this->setLimit(500);
75 }
76
81 {
82 return $this->settings;
83 }
84
88 public function parse(): void
89 {
90 $components = ilLogComponentLevels::getInstance()->getLogComponents();
91 $rows = array();
92 foreach ($components as $component) {
93 $row['id'] = $component->getComponentId();
94 if ($component->getComponentId() == 'log_root') {
95 $row['component'] = 'Root';
96 $row['component_sortable'] = '_' . $row['component'];
97 } else {
98 if ($this->component_repo->hasComponentId(
99 $component->getComponentId()
100 )) {
101 $row['component'] = $this->component_repo->getComponentById(
102 $component->getComponentId()
103 )->getName();
104 } else {
105 $row['component'] = "Unknown (" . $component->getComponentId() . ")";
106 }
107 $row['component_sortable'] = $row['component'];
108 }
109 $row['level'] = (int) $component->getLevel();
110 $rows[] = $row;
111 }
112 $this->setMaxCount(count($rows));
113 $this->setData($rows);
114 }
115
119 protected function fillRow(array $a_set): void
120 {
121 $this->tpl->setVariable('CNAME', $a_set['component']);
122 if ($a_set['id'] == 'log_root') {
123 $this->tpl->setVariable('TXT_DESC', $this->lng->txt('log_component_root_desc'));
124 }
125
126 $default_option_value = ilLoggingDBSettings::getInstance()->getLevel();
127 $array_options = ilLogLevel::getLevelOptions();
128 $default_option = array( 0 => $this->lng->txt('default') . " (" . $array_options[$default_option_value] . ")");
129 $array_options = $default_option + $array_options;
130
131 $levels = new ilSelectInputGUI('', 'level[' . $a_set['id'] . ']');
132 $levels->setOptions($array_options);
133 $levels->setValue($a_set['level']);
134 $this->tpl->setVariable('C_SELECT_LEVEL', $levels->render());
135 }
136}
$components
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.
Readable part of repository interface to ilComponentDataDB.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26