ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilNotificationAdminSettingsForm.php
Go to the documentation of this file.
1<?php
2
3require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
4
9{
10 public static function getTypeForm($types)
11 {
12 global $DIC;
13
14 $lng = $DIC->language();
15
16 $lng->loadLanguageModule('notification');
17
18 $form = new ilPropertyFormGUI();
19
20 $options = array(
21 'set_by_user' => $lng->txt('set_by_user'),
22 'set_by_admin' => $lng->txt('set_by_admin'),
23 'disabled' => $lng->txt('disabled'),
24 );
25
26 foreach ($types as $type) {
27 $select = new ilSelectInputGUI($lng->txt('nott_' . $type['name']), 'notifications[' . $type['name'] . ']');
28 $select->setOptions($options);
29 $select->setValue($type['config_type']);
30 $form->addItem($select);
31 }
32
33 return $form;
34 }
35
36 public static function getChannelForm($types)
37 {
38 global $DIC;
39 $lng = $DIC->language();
40
41 $form = new ilPropertyFormGUI();
42
43 $options = array(
44 'set_by_user' => $lng->txt('set_by_user'),
45 'set_by_admin' => $lng->txt('set_by_admin'),
46 'disabled' => $lng->txt('disabled'),
47 );
48
49 foreach ($types as $type) {
50 $select = new ilSelectInputGUI($lng->txt('notc_' . $type['name']), 'notifications[' . $type['name'] . ']');
51 $select->setOptions($options);
52 $select->setValue($type['config_type']);
53 $form->addItem($select);
54 }
55
56 return $form;
57 }
58
59 public static function getGeneralSettingsForm()
60 {
61 global $DIC;
62 $lng = $DIC->language();
63
64 $form = new ilPropertyFormGUI();
65
66 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
67
69
70 $options = array(
71 'set_by_user' => $lng->txt('set_by_user'),
72 'set_by_admin' => $lng->txt('set_by_admin'),
73 //'disabled' => $lng->txt('disabled'),
74 );
78 $form->restored_values = array();
79 $store_values = array();
80 foreach ($channels as $channel) {
81 $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']);
82 if ($lng->txt('enable_' . $channel['name'] . '_info') != '-enable_' . $channel['name'] . '_info-') {
83 $chb->setInfo($lng->txt('enable_' . $channel['name'] . '_info'));
84 }
85
86 $store_values[] = 'enable_' . $channel['name'];
87
88 $mode = new ilRadioGroupInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']');
89 foreach ($options as $key => $translation) {
90 $option = new ilRadioOption($translation, $key);
91 $mode->addOption($option);
92 }
93 $mode->setValue($channel['config_type']);
94 $chb->addSubItem($mode);
95
99 $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type'];
100 require_once $channel['include'];
101
102 // let the channel display their own settings below the "enable channel"
103 // checkbox
104 $inst = new $channel['handler']();
105 $result = $inst->{'showSettings'}($chb);
106 if ($result) {
107 $store_values = array_merge($result, $store_values);
108 }
109
110
111 $form->addItem($chb);
112 }
113
117 $form->store_values = $store_values;
118
119 return $form;
120 }
121}
$result
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
Methods for building the administration forms.
static getAvailableChannels($config_types=array(), $includeDisabled=false)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
global $DIC
Definition: goto.php:24
$type
$lng