19 declare(strict_types=1);
49 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference,
bool $a_prepare_output =
true)
56 $this->
lng = $DIC->language();
60 $this->
lng->loadLanguageModule(
'logging');
61 $this->
lng->loadLanguageModule(
'log');
74 $next_class = $this->
ctrl->getNextClass($this);
75 $cmd = $this->
ctrl->getCmd();
78 switch ($next_class) {
79 case 'ilpermissiongui':
80 $this->tabs_gui->setTabActive(
'perm_settings');
82 $this->
ctrl->forwardCommand($perm_gui);
86 if ($cmd ==
"" || $cmd ==
"view") {
98 if ($this->
access->checkAccess(
"read",
'', $this->object->getRefId())) {
99 $this->tabs_gui->addTarget(
100 static::SECTION_SETTINGS,
101 $this->
ctrl->getLinkTargetByClass(
'ilobjloggingsettingsgui',
"settings")
104 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
105 $this->tabs_gui->addTarget(
107 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
114 $this->tabs_gui->addSubTab(
115 static::SUB_SECTION_MAIN,
116 $this->
lng->txt(static::SUB_SECTION_MAIN),
117 $this->
ctrl->getLinkTarget($this,
'settings')
119 $this->tabs_gui->addSubTab(
120 static::SUB_SECTION_ERROR,
121 $this->
lng->txt(static::SUB_SECTION_ERROR),
122 $this->
ctrl->getLinkTarget($this,
'errorSettings')
124 $this->tabs_gui->addSubTab(
125 static::SUB_SECTION_COMPONENTS,
126 $this->
lng->txt(static::SUB_SECTION_COMPONENTS),
127 $this->
ctrl->getLinkTarget($this,
'components')
129 $this->tabs_gui->activateSubTab($a_section);
144 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
145 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
148 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
154 $this->tpl->setContent($form->getHTML());
161 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
162 $this->
ilias->raiseError($this->
lng->txt(
"permission_denied"), $this->
ilias->error_obj->MESSAGE);
165 if ($form->checkInput()) {
166 $this->
getSettings()->setLevel((
int) $form->getInput(
'level'));
167 $this->
getSettings()->enableCaching((
bool) $form->getInput(
'cache'));
168 $this->
getSettings()->setCacheLevel((
int) $form->getInput(
'cache_level'));
169 $this->
getSettings()->enableMemoryUsage((
bool) $form->getInput(
'memory'));
170 $this->
getSettings()->enableBrowserLog((
bool) $form->getInput(
'browser'));
171 $this->
getSettings()->setBrowserUsers($form->getInput(
'browser_users'));
173 $this->
getLogger()->info(print_r($form->getInput(
'browser_users'),
true));
177 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
178 $this->
ctrl->redirect($this,
'settings');
182 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
183 $form->setValuesByPost();
190 $form->setTitle($this->
lng->txt(
'logs_settings'));
191 $form->setFormAction($this->
ctrl->getFormAction($this));
193 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
194 $form->addCommandButton(
'updateSettings', $this->
lng->txt(
'save'));
199 $level->setValue($this->
getSettings()->getLevel());
200 $form->addItem($level);
203 $cache->setInfo($this->
lng->txt(
'log_cache_info'));
204 $cache->setValue(
'1');
205 $cache->setChecked($this->
getSettings()->isCacheEnabled());
206 $form->addItem($cache);
210 $cache_level->setValue($this->
getSettings()->getCacheLevel());
211 $cache->addSubItem($cache_level);
214 $memory->setValue(
'1');
215 $memory->setChecked($this->
getSettings()->isMemoryUsageEnabled());
216 $form->addItem($memory);
220 $browser->setValue(
'1');
221 $browser->setChecked($this->
getSettings()->isBrowserLogEnabled());
222 $form->addItem($browser);
225 $users =
new ilTextInputGUI($this->
lng->txt(
'log_browser_users'),
'browser_users');
226 $users->setValue(current($this->
getSettings()->getBrowserLogUsers()));
227 $users->setMulti(
true);
228 $users->setMultiValues($this->
getSettings()->getBrowserLogUsers());
230 $browser->addSubItem($users);
240 $this->tabs_gui->activateTab(static::SECTION_SETTINGS);
241 $this->
setSubTabs(static::SUB_SECTION_COMPONENTS);
247 $this->tpl->setContent($table->getHTML());
258 if ($this->
http->wrapper()->post()->has(
'level')) {
259 $levels = $this->
http->wrapper()->post()->retrieve(
261 $this->
refinery->custom()->transformation(
266 static function ($k, $v): array {
267 return [$k, (
int) $v];
279 foreach ($levels as $component_id => $value) {
283 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
284 $this->
ctrl->redirect($this,
'components');
291 $component->setLevel(
null);
292 $component->update();
294 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
295 $this->
ctrl->redirect($this,
'components');
301 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
307 $this->tpl->setContent($form->getHTML());
314 if ($form->checkInput()) {
318 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'error_settings_saved'),
true);
319 $this->
ctrl->redirect($this,
'errorSettings');
321 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
322 $form->setValuesByPost();
329 $form->setTitle($this->
lng->txt(
'logs_settings'));
330 $form->setFormAction($this->
ctrl->getFormAction($this));
332 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
333 $form->addCommandButton(
'updateErrorSettings', $this->
lng->txt(
'save'));
338 $form->addItem($folder);
342 $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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObjForumAdministration.
individual log levels for components
ilLoggingDBSettings $log_settings
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
saveComponentLevels()
Save form.
settings(?ilPropertyFormGUI $form=null)
errorSettings(?ilPropertyFormGUI $form=null)
__construct(Container $dic, ilPlugin $plugin)
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)