ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  $this->editable = $editable;
40  }
41 
42  public function isEditable() {
43  return (bool) $this->editable;
44  }
45 
46  public function fillRow($type) {
47  global $ilCtrl, $lng;
48  $this->tpl->setVariable('NOTIFICATION_TARGET', $lng->txt('nott_' . $type['title']));
49 
50  foreach ($this->channels as $channeltype => $channel) {
51  if (array_key_exists($type['name'], $this->userdata) && in_array($channeltype, $this->userdata[$type['name']]))
52  $this->tpl->touchBlock ('notification_cell_checked');
53 
54  if (!$this->isEditable()) {
55  $this->tpl->touchBlock ('notification_cell_disabled');
56  }
57 
58  $this->tpl->setCurrentBlock('notification_cell');
59 
60  if ($this->adminMode && $channel['config_type'] == 'set_by_user' && $type['config_type'] == 'set_by_user')
61  $this->tpl->setVariable('NOTIFICATION_SET_BY_USER_CELL', 'optionSetByUser');
62 
63  $this->tpl->setVariable('CHANNEL', $channeltype);
64  $this->tpl->setVariable('TYPE', $type['name']);
65 
66  $this->tpl->parseCurrentBlock();
67  }
68  }
69 
70 }
71 
72 ?>
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)
global $lng
Definition: privfeed.php:17
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.