ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilNotificationSettingsTable.php
Go to the documentation of this file.
1<?php
2
3require_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
14 private $language;
15
16 public function __construct(
17 $a_ref,
18 $title,
21 $adminMode = false,
22 \ilLanguage $language = null
23 ) {
24 if ($language === null) {
25 global $DIC;
26 $language = $DIC->language();
27 }
28 $this->language = $language;
29
30 $this->language->loadLanguageModule('notification');
31
32 $this->channels = $channels;
33 $this->userdata = $userdata;
34 $this->adminMode = $adminMode;
35
36 parent::__construct($a_ref, $title);
37 $this->setTitle($this->language->txt('notification_options'));
38
39 $this->setId('notifications_settings');
40
41 $this->addColumn($this->language->txt('notification_target'), '', '');
42
43 foreach ($channels as $key => $channel) {
44 $this->addColumn(
45 $this->language->txt(
46 'notc_' . $channel['title']
47 ),
48 '',
49 '20%',
50 false,
51 ($channel['config_type'] == 'set_by_user' && false ? 'optionSetByUser' : '')
52 );
53 }
54
55 $this->setRowTemplate('tpl.type_line.html', 'Services/Notifications');
56 $this->setSelectAllCheckbox('');
57 }
58
59 public function setEditable($editable)
60 {
61 $this->editable = $editable;
62 }
63
64 public function isEditable()
65 {
66 return (bool) $this->editable;
67 }
68
69 public function fillRow($type)
70 {
71 $this->tpl->setVariable('NOTIFICATION_TARGET', $this->language->txt('nott_' . $type['title']));
72
73 foreach ($this->channels as $channeltype => $channel) {
74 if (array_key_exists($type['name'], $this->userdata) && in_array($channeltype, $this->userdata[$type['name']])) {
75 $this->tpl->touchBlock('notification_cell_checked');
76 }
77
78 if (!$this->isEditable()) {
79 $this->tpl->touchBlock('notification_cell_disabled');
80 }
81
82 $this->tpl->setCurrentBlock('notification_cell');
83
84 if ($this->adminMode && $channel['config_type'] == 'set_by_user' && $type['config_type'] == 'set_by_user') {
85 $this->tpl->setVariable('NOTIFICATION_SET_BY_USER_CELL', 'optionSetByUser');
86 }
87
88 $this->tpl->setVariable('CHANNEL', $channeltype);
89 $this->tpl->setVariable('TYPE', $type['name']);
90
91 $this->tpl->parseCurrentBlock();
92 }
93 }
94}
An exception for terminatinating execution or to throw for unit testing.
language handling
__construct( $a_ref, $title, $channels, $userdata, $adminMode=false, \ilLanguage $language=null)
fillRow($type)
Standard Version of Fill Row.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
setId($a_val)
Set id.
$key
Definition: croninfo.php:18
$type
global $DIC
Definition: saml.php:7