ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  global $lng;
12 
13  $lng->loadLanguageModule('notification');
14 
15  $form = new ilPropertyFormGUI();
16 
17  $options = array(
18  'set_by_user' => $lng->txt('set_by_user'),
19  'set_by_admin' => $lng->txt('set_by_admin'),
20  'disabled' => $lng->txt('disabled'),
21  );
22 
23  foreach ($types as $type) {
24  $select = new ilSelectInputGUI($lng->txt('nott_' . $type['name']), 'notifications[' . $type['name'] . ']');
25  $select->setOptions($options);
26  $select->setValue($type['config_type']);
27  $form->addItem($select);
28  }
29 
30  return $form;
31  }
32 
33  public static function getChannelForm($types) {
34  global $lng;
35 
36  $form = new ilPropertyFormGUI();
37 
38  $options = array(
39  'set_by_user' => $lng->txt('set_by_user'),
40  'set_by_admin' => $lng->txt('set_by_admin'),
41  'disabled' => $lng->txt('disabled'),
42  );
43 
44  foreach ($types as $type) {
45  $select = new ilSelectInputGUI($lng->txt('notc_' . $type['name']), 'notifications[' . $type['name'] . ']');
46  $select->setOptions($options);
47  $select->setValue($type['config_type']);
48  $form->addItem($select);
49  }
50 
51  return $form;
52  }
53 
54  public static function getGeneralSettingsForm() {
55  global $lng;
56  $form = new ilPropertyFormGUI();
57 
58  require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
59 
60  $channels = ilNotificationDatabaseHandler::getAvailableChannels(array(), true);
61 
62  $options = array(
63  'set_by_user' => $lng->txt('set_by_user'),
64  'set_by_admin' => $lng->txt('set_by_admin'),
65  //'disabled' => $lng->txt('disabled'),
66  );
70  $form->restored_values = array();
71  $store_values = array();
72  foreach ($channels as $channel) {
73 
74  $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']);
75 
76  $store_values[] = 'enable_' . $channel['name'];
77 
78  $select = new ilSelectInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']');
79  $select->setOptions($options);
80  $select->setValue($channel['config_type']);
81  $chb->addSubItem($select);
82 
86  $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type'];
87  require_once $channel['include'];
88 
89  // let the channel display their own settings below the "enable channel"
90  // checkbox
91  $result = call_user_func(array($channel['handler'], 'showSettings'), $chb);
92  if ($result) {
93  $store_values = array_merge($result, $store_values);
94  }
95 
96 
97  $form->addItem($chb);
98  }
99 
103  $form->store_values = $store_values;
104 
105  return $form;
106  }
107 
108 }
109 
110 ?>