ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ?>