ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  protected $editable = true;
20 
21 
22 
23 
24  public function __construct($a_parent_obj, $a_parent_cmd = "")
25  {
26  $this->setId('il_log_component');
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28  }
29 
34  public function setEditable($a_status)
35  {
36  $this->editable = $a_status;
37  }
38 
43  public function isEditable()
44  {
45  return $this->editable;
46  }
47 
51  public function init()
52  {
53  global $ilCtrl;
54 
55  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
56 
58 
59  $this->setRowTemplate('tpl.log_component_row.html', 'Services/Logging');
60  $this->addColumn($this->lng->txt('log_component_col_component'), 'component_sortable');
61  $this->addColumn($this->lng->txt('log_component_col_level'), 'level');
62 
63  $this->setDefaultOrderField('component_sortable');
64 
65  if ($this->isEditable()) {
66  $this->addCommandButton('saveComponentLevels', $this->lng->txt('save'));
67  $this->addCommandButton('resetComponentLevels', $this->lng->txt('log_component_btn_reset'));
68  }
69 
70  $this->setShowRowsSelector(false);
71  $this->setLimit(500);
72  }
73 
78  public function getSettings()
79  {
80  return $this->settings;
81  }
82 
86  public function parse()
87  {
88  include_once './Services/Logging/classes/class.ilLogComponentLevels.php';
89  $components = ilLogComponentLevels::getInstance()->getLogComponents();
90 
91  ilLoggerFactory::getLogger('log')->dump($components, ilLogLevel::DEBUG);
92 
93 
94  $rows = array();
95  foreach ($components as $component) {
96  $row['id'] = $component->getComponentId();
97 
98  if ($component->getComponentId() == 'log_root') {
99  $row['component'] = 'Root';
100  $row['component_sortable'] = '_' . $row['component'];
101  } else {
102  include_once './Services/Component/classes/class.ilComponent.php';
103  $row['component'] = ilComponent::lookupComponentName($component->getComponentId());
104  $row['component_sortable'] = $row['component'];
105  }
106 
107  ilLoggerFactory::getLogger('log')->debug($component->getComponentId());
108  $row['level'] = (int) $component->getLevel();
109 
110  $rows[] = $row;
111  }
112 
114 
115 
116  $this->setMaxCount(count($rows));
117  $this->setData($rows);
118  }
119 
124  public function fillRow($a_set)
125  {
126  $this->tpl->setVariable('CNAME', $a_set['component']);
127 
128  ilLoggerFactory::getLogger('log')->debug('Component Id : ' . $a_set['component_id']);
129  if ($a_set['id'] == 'log_root') {
130  $this->tpl->setVariable('TXT_DESC', $GLOBALS['lng']->txt('log_component_root_desc'));
131  }
132 
133  $default_option_value = ilLoggingDBSettings::getInstance()->getLevel();
134  $array_options = ilLogLevel::getLevelOptions();
135  $default_option = array( 0 => $GLOBALS['lng']->txt('default') . " (" . $array_options[$default_option_value] . ")");
136  $array_options = $default_option + $array_options;
137 
138  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
139  $levels = new ilSelectInputGUI('', 'level[' . $a_set['id'] . ']');
140  $levels->setOptions($array_options);
141  $levels->setValue((int) $a_set['level']);
142 
143  $this->tpl->setVariable('C_SELECT_LEVEL', $levels->render());
144  }
145 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setEditable($a_status)
Set ediatable (write permission granted)
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.
isEditable()
Check if ediatable (write permission granted)
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.
$rows
Definition: xhr_table.php:10
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
settings()
Definition: settings.php:2
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.
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.
setLimit($a_limit=0, $a_default_limit=0)