19 declare(strict_types=1);
50 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference,
bool $a_prepare_output =
true)
57 $this->
lng = $DIC->language();
61 $this->
lng->loadLanguageModule(
'logging');
62 $this->
lng->loadLanguageModule(
'log');
65 $this->
http = $DIC->http();
76 $next_class = $this->
ctrl->getNextClass($this);
77 $cmd = $this->
ctrl->getCmd();
80 switch ($next_class) {
81 case 'ilpermissiongui':
82 $this->tabs_gui->setTabActive(
'perm_settings');
84 $this->
ctrl->forwardCommand($perm_gui);
88 if ($cmd ==
"" || $cmd ==
"view") {
100 if ($this->
access->checkAccess(
"read",
'', $this->object->getRefId())) {
101 $this->tabs_gui->addTarget(
102 static::SECTION_SETTINGS,
103 $this->
ctrl->getLinkTargetByClass(
'ilobjloggingsettingsgui',
"settings")
106 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
107 $this->tabs_gui->addTarget(
109 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
116 $this->tabs_gui->addSubTab(
117 static::SUB_SECTION_MAIN,
118 $this->
lng->txt(static::SUB_SECTION_MAIN),
119 $this->
ctrl->getLinkTarget($this,
'settings')
121 $this->tabs_gui->addSubTab(
122 static::SUB_SECTION_ERROR,
123 $this->
lng->txt(static::SUB_SECTION_ERROR),
124 $this->
ctrl->getLinkTarget($this,
'errorSettings')
126 $this->tabs_gui->addSubTab(
127 static::SUB_SECTION_COMPONENTS,
128 $this->
lng->txt(static::SUB_SECTION_COMPONENTS),
129 $this->
ctrl->getLinkTarget($this,
'components')
131 $this->tabs_gui->activateSubTab($a_section);
146 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
147 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
150 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
156 $this->tpl->setContent($form->getHTML());
163 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
164 $this->
ilias->raiseError($this->
lng->txt(
"permission_denied"), $this->
ilias->error_obj->MESSAGE);
167 if ($form->checkInput()) {
168 $this->
getSettings()->setLevel((
int) $form->getInput(
'level'));
169 $this->
getSettings()->enableCaching((
bool) $form->getInput(
'cache'));
170 $this->
getSettings()->setCacheLevel((
int) $form->getInput(
'cache_level'));
171 $this->
getSettings()->enableMemoryUsage((
bool) $form->getInput(
'memory'));
172 $this->
getSettings()->enableBrowserLog((
bool) $form->getInput(
'browser'));
173 $this->
getSettings()->setBrowserUsers($form->getInput(
'browser_users'));
175 $this->
getLogger()->info(print_r($form->getInput(
'browser_users'),
true));
179 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
180 $this->
ctrl->redirect($this,
'settings');
184 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
185 $form->setValuesByPost();
192 $form->setTitle($this->
lng->txt(
'logs_settings'));
193 $form->setFormAction($this->
ctrl->getFormAction($this));
195 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
196 $form->addCommandButton(
'updateSettings', $this->
lng->txt(
'save'));
201 $level->setValue($this->
getSettings()->getLevel());
202 $form->addItem($level);
205 $cache->setInfo($this->
lng->txt(
'log_cache_info'));
206 $cache->setValue(
'1');
207 $cache->setChecked($this->
getSettings()->isCacheEnabled());
208 $form->addItem($cache);
212 $cache_level->setValue($this->
getSettings()->getCacheLevel());
213 $cache->addSubItem($cache_level);
216 $memory->setValue(
'1');
217 $memory->setChecked($this->
getSettings()->isMemoryUsageEnabled());
218 $form->addItem($memory);
222 $browser->setValue(
'1');
223 $browser->setChecked($this->
getSettings()->isBrowserLogEnabled());
224 $form->addItem($browser);
227 $users =
new ilTextInputGUI($this->
lng->txt(
'log_browser_users'),
'browser_users');
228 $users->setValue(current($this->
getSettings()->getBrowserLogUsers()));
229 $users->setMulti(
true);
230 $users->setMultiValues($this->
getSettings()->getBrowserLogUsers());
232 $browser->addSubItem($users);
242 $this->tabs_gui->activateTab(static::SECTION_SETTINGS);
243 $this->
setSubTabs(static::SUB_SECTION_COMPONENTS);
249 $this->tpl->setContent($table->getHTML());
260 if ($this->
http->wrapper()->post()->has(
'level')) {
261 $levels = $this->
http->wrapper()->post()->retrieve(
263 $this->
refinery->custom()->transformation(
268 static function ($k, $v): array {
269 return [$k, (
int) $v];
281 foreach ($levels as $component_id => $value) {
285 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
286 $this->
ctrl->redirect($this,
'components');
293 $component->setLevel(
null);
294 $component->update();
296 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
297 $this->
ctrl->redirect($this,
'components');
303 $this->tabs_gui->setTabActive(static::SECTION_SETTINGS);
309 $this->tpl->setContent($form->getHTML());
316 if ($form->checkInput()) {
320 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'error_settings_saved'),
true);
321 $this->
ctrl->redirect($this,
'errorSettings');
323 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
324 $form->setValuesByPost();
331 $form->setTitle($this->
lng->txt(
'logs_settings'));
332 $form->setFormAction($this->
ctrl->getFormAction($this));
334 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
335 $form->addCommandButton(
'updateErrorSettings', $this->
lng->txt(
'save'));
340 $form->addItem($folder);
344 $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)