ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilNotificationSettingsTable.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Services/Table/classes/class.ilTable2GUI.php';
4 
6 {
7  private $channels;
8  private $userdata = array();
9 
10  private $adminMode = false;
11  private $editable = true;
12 
13  public function __construct($a_ref, $title, $channels, $userdata, $adminMode = false)
14  {
15  global $lng, $ilCtrl;
16 
17  $lng->loadLanguageModule('notification');
18 
19  $this->channels = $channels;
20  $this->userdata = $userdata;
21  $this->adminMode = $adminMode;
22 
23  parent::__construct($a_ref, $title);
24  $this->setTitle($lng->txt('notification_options'));
25 
26  $this->setId('notifications_settings');
27 
28  $this->addColumn($lng->txt('notification_target'), '', '');
29 
30  foreach ($channels as $key => $channel) {
31  $this->addColumn($lng->txt('notc_' . $channel['title']), '', '20%', false, ($channel['config_type'] == 'set_by_user' && false ? 'optionSetByUser' : ''));
32  }
33 
34  $this->setRowTemplate('tpl.type_line.html', 'Services/Notifications');
35  $this->setSelectAllCheckbox('');
36  }
37 
38  public function setEditable($editable)
39  {
40  $this->editable = $editable;
41  }
42 
43  public function isEditable()
44  {
45  return (bool) $this->editable;
46  }
47 
48  public function fillRow($type)
49  {
50  global $ilCtrl, $lng;
51  $this->tpl->setVariable('NOTIFICATION_TARGET', $lng->txt('nott_' . $type['title']));
52 
53  foreach ($this->channels as $channeltype => $channel) {
54  if (array_key_exists($type['name'], $this->userdata) && in_array($channeltype, $this->userdata[$type['name']])) {
55  $this->tpl->touchBlock('notification_cell_checked');
56  }
57 
58  if (!$this->isEditable()) {
59  $this->tpl->touchBlock('notification_cell_disabled');
60  }
61 
62  $this->tpl->setCurrentBlock('notification_cell');
63 
64  if ($this->adminMode && $channel['config_type'] == 'set_by_user' && $type['config_type'] == 'set_by_user') {
65  $this->tpl->setVariable('NOTIFICATION_SET_BY_USER_CELL', 'optionSetByUser');
66  }
67 
68  $this->tpl->setVariable('CHANNEL', $channeltype);
69  $this->tpl->setVariable('TYPE', $type['name']);
70 
71  $this->tpl->parseCurrentBlock();
72  }
73  }
74 }
$type
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
__construct($a_ref, $title, $channels, $userdata, $adminMode=false)
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
$key
Definition: croninfo.php:18