3 declare(strict_types=1);
36 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference,
bool $a_prepare_output =
true)
43 $this->
lng = $DIC->language();
47 $this->
lng->loadLanguageModule(
'logging');
48 $this->
lng->loadLanguageModule(
'log');
51 $this->
http = $DIC->http();
62 $next_class = $this->
ctrl->getNextClass($this);
63 $cmd = $this->
ctrl->getCmd();
66 switch ($next_class) {
67 case 'ilpermissiongui':
68 $this->tabs_gui->setTabActive(
'perm_settings');
70 $this->
ctrl->forwardCommand($perm_gui);
74 if ($cmd ==
"" || $cmd ==
"view") {
86 if ($this->
access->checkAccess(
"read",
'', $this->object->getRefId())) {
87 $this->tabs_gui->addTarget(
88 static::SECTION_SETTINGS,
89 $this->
ctrl->getLinkTargetByClass(
'ilobjloggingsettingsgui',
"settings")
92 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
93 $this->tabs_gui->addTarget(
95 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
102 $this->tabs_gui->addSubTab(
103 static::SUB_SECTION_MAIN,
104 $this->
lng->txt(static::SUB_SECTION_MAIN),
105 $this->
ctrl->getLinkTarget($this,
'settings')
107 $this->tabs_gui->addSubTab(
108 static::SUB_SECTION_ERROR,
109 $this->
lng->txt(static::SUB_SECTION_ERROR),
110 $this->
ctrl->getLinkTarget($this,
'errorSettings')
112 $this->tabs_gui->addSubTab(
113 static::SUB_SECTION_COMPONENTS,
114 $this->
lng->txt(static::SUB_SECTION_COMPONENTS),
115 $this->
ctrl->getLinkTarget($this,
'components')
117 $this->tabs_gui->activateSubTab($a_section);
132 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
133 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
136 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
142 $this->tpl->setContent($form->getHTML());
149 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
150 $this->
ilias->raiseError($this->
lng->txt(
"permission_denied"), $this->
ilias->error_obj->MESSAGE);
153 if ($form->checkInput()) {
154 $this->
getSettings()->setLevel((
int) $form->getInput(
'level'));
155 $this->
getSettings()->enableCaching((
bool) $form->getInput(
'cache'));
156 $this->
getSettings()->setCacheLevel((
int) $form->getInput(
'cache_level'));
157 $this->
getSettings()->enableMemoryUsage((
bool) $form->getInput(
'memory'));
158 $this->
getSettings()->enableBrowserLog((
bool) $form->getInput(
'browser'));
159 $this->
getSettings()->setBrowserUsers($form->getInput(
'browser_users'));
161 $this->
getLogger()->info(print_r($form->getInput(
'browser_users'),
true));
165 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
166 $this->
ctrl->redirect($this,
'settings');
170 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
171 $form->setValuesByPost();
178 $form->setTitle($this->
lng->txt(
'logs_settings'));
179 $form->setFormAction($this->
ctrl->getFormAction($this));
181 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
182 $form->addCommandButton(
'updateSettings', $this->
lng->txt(
'save'));
187 $level->setValue($this->
getSettings()->getLevel());
188 $form->addItem($level);
191 $cache->
setInfo($this->
lng->txt(
'log_cache_info'));
192 $cache->setValue(
'1');
193 $cache->setChecked($this->
getSettings()->isCacheEnabled());
194 $form->addItem($cache);
198 $cache_level->setValue($this->
getSettings()->getCacheLevel());
199 $cache->addSubItem($cache_level);
203 $memory->setChecked($this->
getSettings()->isMemoryUsageEnabled());
204 $form->addItem($memory);
209 $browser->setChecked($this->
getSettings()->isBrowserLogEnabled());
210 $form->addItem($browser);
213 $users =
new ilTextInputGUI($this->
lng->txt(
'log_browser_users'),
'browser_users');
214 $users->setValue(current($this->
getSettings()->getBrowserLogUsers()));
215 $users->setMulti(
true);
216 $users->setMultiValues($this->
getSettings()->getBrowserLogUsers());
218 $browser->addSubItem($users);
228 $this->tabs_gui->activateTab(static::SECTION_SETTINGS);
229 $this->
setSubTabs(static::SUB_SECTION_COMPONENTS);
235 $this->tpl->setContent($table->getHTML());
246 if ($this->
http->wrapper()->post()->has(
'level')) {
247 $levels = $this->
http->wrapper()->post()->retrieve(
249 $this->
refinery->custom()->transformation(
254 static function ($k, $v): array {
255 return [$k, (
int) $v];
267 foreach ($levels as $component_id => $value) {
271 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
272 $this->
ctrl->redirect($this,
'components');
279 $component->setLevel(null);
280 $component->update();
282 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
283 $this->
ctrl->redirect($this,
'components');
289 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
295 $this->tpl->setContent($form->getHTML());
302 if ($form->checkInput()) {
306 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'error_settings_saved'),
true);
307 $this->
ctrl->redirect($this,
'errorSettings');
309 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
310 $form->setValuesByPost();
317 $form->setTitle($this->
lng->txt(
'logs_settings'));
318 $form->setFormAction($this->
ctrl->getFormAction($this));
320 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
321 $form->addCommandButton(
'updateErrorSettings', $this->
lng->txt(
'save'));
326 $form->addItem($folder);
330 $form->addItem($mail);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLogger(string $a_component_id)
Get component logger.
const SUB_SECTION_COMPONENTS
prepareOutput(bool $show_sub_objects=true)
components()
Show components.
ilLoggingErrorSettings $error_settings
setSubTabs(string $a_section)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
Class ilObjectGUI Basic methods of all Output classes.
header include for all ilias files.
settings(ilPropertyFormGUI $form=null)
individual log levels for components
ilLoggingDBSettings $log_settings
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
saveComponentLevels()
Save form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
errorSettings(?ilPropertyFormGUI $form=null)
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Component logger with individual log levels by component id.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
__construct($a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output=true)