ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
54 
55  $ilCtrl = $DIC['ilCtrl'];
56 
57  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
58 
60 
61  $this->setRowTemplate('tpl.log_component_row.html', 'Services/Logging');
62  $this->addColumn($this->lng->txt('log_component_col_component'), 'component_sortable');
63  $this->addColumn($this->lng->txt('log_component_col_level'), 'level');
64 
65  $this->setDefaultOrderField('component_sortable');
66 
67  if ($this->isEditable()) {
68  $this->addCommandButton('saveComponentLevels', $this->lng->txt('save'));
69  $this->addCommandButton('resetComponentLevels', $this->lng->txt('log_component_btn_reset'));
70  }
71 
72  $this->setShowRowsSelector(false);
73  $this->setLimit(500);
74  }
75 
80  public function getSettings()
81  {
82  return $this->settings;
83  }
84 
88  public function parse()
89  {
90  include_once './Services/Logging/classes/class.ilLogComponentLevels.php';
91  $components = ilLogComponentLevels::getInstance()->getLogComponents();
92 
93  ilLoggerFactory::getLogger('log')->dump($components, ilLogLevel::DEBUG);
94 
95 
96  $rows = array();
97  foreach ($components as $component) {
98  $row['id'] = $component->getComponentId();
99 
100  if ($component->getComponentId() == 'log_root') {
101  $row['component'] = 'Root';
102  $row['component_sortable'] = '_' . $row['component'];
103  } else {
104  include_once './Services/Component/classes/class.ilComponent.php';
105  $row['component'] = ilComponent::lookupComponentName($component->getComponentId());
106  $row['component_sortable'] = $row['component'];
107  }
108 
109  ilLoggerFactory::getLogger('log')->debug($component->getComponentId());
110  $row['level'] = (int) $component->getLevel();
111 
112  $rows[] = $row;
113  }
114 
116 
117 
118  $this->setMaxCount(count($rows));
119  $this->setData($rows);
120  }
121 
126  public function fillRow($a_set)
127  {
128  $this->tpl->setVariable('CNAME', $a_set['component']);
129 
130  ilLoggerFactory::getLogger('log')->debug('Component Id : ' . $a_set['component_id']);
131  if ($a_set['id'] == 'log_root') {
132  $this->tpl->setVariable('TXT_DESC', $GLOBALS['DIC']['lng']->txt('log_component_root_desc'));
133  }
134 
135  $default_option_value = ilLoggingDBSettings::getInstance()->getLevel();
136  $array_options = ilLogLevel::getLevelOptions();
137  $default_option = array( 0 => $GLOBALS['DIC']['lng']->txt('default') . " (" . $array_options[$default_option_value] . ")");
138  $array_options = $default_option + $array_options;
139 
140  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
141  $levels = new ilSelectInputGUI('', 'level[' . $a_set['id'] . ']');
142  $levels->setOptions($array_options);
143  $levels->setValue((int) $a_set['level']);
144 
145  $this->tpl->setVariable('C_SELECT_LEVEL', $levels->render());
146  }
147 }
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.
settings()
Definition: settings.php:2
This class represents a selection list property in a property form.
global $DIC
Definition: saml.php:7
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.
static getInstance()
Get instance.
$row
$rows
Definition: xhr_table.php:10
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
setLimit($a_limit=0, $a_default_limit=0)