ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilNotificationAdminSettingsForm.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
4 
9 {
10  public static function getTypeForm($types)
11  {
12  global $lng;
13 
14  $lng->loadLanguageModule('notification');
15 
16  $form = new ilPropertyFormGUI();
17 
18  $options = array(
19  'set_by_user' => $lng->txt('set_by_user'),
20  'set_by_admin' => $lng->txt('set_by_admin'),
21  'disabled' => $lng->txt('disabled'),
22  );
23 
24  foreach ($types as $type) {
25  $select = new ilSelectInputGUI($lng->txt('nott_' . $type['name']), 'notifications[' . $type['name'] . ']');
26  $select->setOptions($options);
27  $select->setValue($type['config_type']);
28  $form->addItem($select);
29  }
30 
31  return $form;
32  }
33 
34  public static function getChannelForm($types)
35  {
36  global $lng;
37 
38  $form = new ilPropertyFormGUI();
39 
40  $options = array(
41  'set_by_user' => $lng->txt('set_by_user'),
42  'set_by_admin' => $lng->txt('set_by_admin'),
43  'disabled' => $lng->txt('disabled'),
44  );
45 
46  foreach ($types as $type) {
47  $select = new ilSelectInputGUI($lng->txt('notc_' . $type['name']), 'notifications[' . $type['name'] . ']');
48  $select->setOptions($options);
49  $select->setValue($type['config_type']);
50  $form->addItem($select);
51  }
52 
53  return $form;
54  }
55 
56  public static function getGeneralSettingsForm()
57  {
58  global $lng;
59  $form = new ilPropertyFormGUI();
60 
61  require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
62 
64 
65  $options = array(
66  'set_by_user' => $lng->txt('set_by_user'),
67  'set_by_admin' => $lng->txt('set_by_admin'),
68  //'disabled' => $lng->txt('disabled'),
69  );
73  $form->restored_values = array();
74  $store_values = array();
75  foreach ($channels as $channel) {
76  $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']);
77 
78  $store_values[] = 'enable_' . $channel['name'];
79 
80  $select = new ilSelectInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']');
81  $select->setOptions($options);
82  $select->setValue($channel['config_type']);
83  $chb->addSubItem($select);
84 
88  $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type'];
89  require_once $channel['include'];
90 
91  // let the channel display their own settings below the "enable channel"
92  // checkbox
93  $result = call_user_func(array($channel['handler'], 'showSettings'), $chb);
94  if ($result) {
95  $store_values = array_merge($result, $store_values);
96  }
97 
98 
99  $form->addItem($chb);
100  }
101 
105  $form->store_values = $store_values;
106 
107  return $form;
108  }
109 }
This class represents a selection list property in a property form.
$result
This class represents a property form user interface.
$type
This class represents a checkbox property in a property form.
if(isset($_POST['submit'])) $form
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
Methods for building the administration forms.
global $lng
Definition: privfeed.php:17
static getAvailableChannels($config_types=array(), $includeDisabled=false)
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20