ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilLogComponentTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Logging/classes/class.ilLoggingDBSettings.php';
5include_once './Services/Table/classes/class.ilTable2GUI.php';
6
16{
17 protected $settings = null;
18
19
20
21
22 public function __construct($a_parent_obj, $a_parent_cmd = "")
23 {
24 $this->setId('il_log_component');
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26
27 }
28
32 public function init()
33 {
34 global $ilCtrl;
35
36 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
37
38 $this->settings = ilLoggingDBSettings::getInstance();
39
40 $this->setRowTemplate('tpl.log_component_row.html','Services/Logging');
41 $this->addColumn($this->lng->txt('log_component_col_component'), 'component_sortable');
42 $this->addColumn($this->lng->txt('log_component_col_level'), 'level');
43
44 $this->setDefaultOrderField('component_sortable');
45
46 $this->addCommandButton('saveComponentLevels', $this->lng->txt('save'));
47 $this->addCommandButton('resetComponentLevels', $this->lng->txt('log_component_btn_reset'));
48
49 $this->setShowRowsSelector(FALSE);
50 $this->setLimit(500);
51 }
52
57 public function getSettings()
58 {
59 return $this->settings;
60 }
61
65 public function parse()
66 {
67
68 include_once './Services/Logging/classes/class.ilLogComponentLevels.php';
69 $components = ilLogComponentLevels::getInstance()->getLogComponents();
70
71 ilLoggerFactory::getLogger('log')->dump($components, ilLogLevel::DEBUG);
72
73
74 $rows = array();
75 foreach($components as $component)
76 {
77 $row['id'] = $component->getComponentId();
78
79 if($component->getComponentId() == 'log_root')
80 {
81 $row['component'] = 'Root';
82 $row['component_sortable'] = '_'.$row['component'];
83 }
84 else
85 {
86 include_once './Services/Component/classes/class.ilComponent.php';
87 $row['component'] = ilComponent::lookupComponentName($component->getComponentId());
88 $row['component_sortable'] = $row['component'];
89 }
90
91 ilLoggerFactory::getLogger('log')->debug($component->getComponentId());
92 $row['level'] = ($component->getLevel() ? $component->getLevel() : $this->getSettings()->getLevel());
93
94 $rows[] = $row;
95 }
96
98
99
100 $this->setMaxCount(count($rows));
101 $this->setData($rows);
102 }
103
108 public function fillRow($a_set)
109 {
110 $this->tpl->setVariable('CNAME',$a_set['component']);
111
112 ilLoggerFactory::getLogger('log')->debug('Component Id : ' . $a_set['component_id']);
113 if($a_set['id'] == 'log_root')
114 {
115 $this->tpl->setVariable('TXT_DESC', $GLOBALS['lng']->txt('log_component_root_desc'));
116 }
117
118 include_once './Services/Form/classes/class.ilSelectInputGUI.php';
119 $levels = new ilSelectInputGUI('', 'level['.$a_set['id'].']');
120 $levels->setOptions(ilLogLevel::getLevelOptions());
121 $levels->setValue($a_set['level']);
122
123 $this->tpl->setVariable('C_SELECT_LEVEL',$levels->render());
124
125
126 }
127
128}
129?>
static lookupComponentName($a_component_id)
lookup component name @global type $ilDB
Component logger with individual log levels by component id.
__construct($a_parent_obj, $a_parent_cmd="")
static getLevelOptions()
Get log level options.
static getLogger($a_component_id)
Get component logger.
static getInstance()
Get instance.
This class represents a selection list property in a property form.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setMaxCount($a_max_count)
set max.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18