ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once './Services/Logging/classes/class.ilLoggingDBSettings.php';
5 include_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 
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'] = (int) $component->getLevel();
93 
94  $rows[] = $row;
95  }
96 
97  ilLoggerFactory::getLogger('log')->dump($rows, ilLogLevel::DEBUG);
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  $default_option_value = ilLoggingDBSettings::getInstance()->getLevel();
119  $array_options = ilLogLevel::getLevelOptions();
120  $default_option = array( 0 => $GLOBALS['lng']->txt('default')." (".$array_options[$default_option_value].")");
121  $array_options = $default_option + $array_options;
122 
123  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
124  $levels = new ilSelectInputGUI('', 'level['.$a_set['id'].']');
125  $levels->setOptions($array_options);
126  $levels->setValue((int) $a_set['level']);
127 
128  $this->tpl->setVariable('C_SELECT_LEVEL',$levels->render());
129 
130  }
131 
132 }
133 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
This class represents a selection list property in a property form.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getLevelOptions()
Get log level options.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
static lookupComponentName($a_component_id)
lookup component name type $ilDB
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static getInstance()
Get instance.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
settings()
Definition: settings.php:2
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
static getLogger($a_component_id)
Get component logger.
__construct($a_parent_obj, $a_parent_cmd="")
setMaxCount($a_max_count)
set max.
Component logger with individual log levels by component id.
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.
setLimit($a_limit=0, $a_default_limit=0)