-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnotificationspage.class.php
171 lines (142 loc) · 8.86 KB
/
notificationspage.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package local_elisprogram
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote Learner.net Inc http://www.remote-learner.net
*
*/
defined('MOODLE_INTERNAL') || die();
require_once elispm::lib('page.class.php');
require_once elispm::lib('lib.php');
require_once elispm::file('/form/notificationform.class.php');
require_once elispm::file('configpage.class.php');
class notifications extends pm_page {
var $pagename = 'ntf';
var $section = 'admn';
var $form_class = 'pmnotificationform';
function can_do_default() {
$context = context_system::instance();
return has_capability('local/elisprogram:config', $context);
}
function build_navbar_default($who = null) { // was build_navigation_default
global $CFG;
parent::build_navbar_default($who);
$page = $this->get_new_page(array('action' => 'default'), true);
//$this->navbar->add(get_string('learningplan', 'local_elisprogram'), "{$CFG->wwwroot}/local/elisprogram/");
$this->navbar->add(get_string('notifications', 'local_elisprogram'), $page->url);
}
function get_title_default() {
return get_string('notifications', 'local_elisprogram');
}
function do_default() {
$target = $this->get_new_page(array('action' => 'default'));
$form = new $this->form_class($target->url);
if ($form->is_cancelled()) {
$target = $this->get_new_page(array('action' => 'default'), true);
redirect($target->url);
return;
}
$this->display('default');
}
/**
* handler for the default display action. Prints the edit form.
*/
function display_default() {
$target = $this->get_new_page(array('action' => 'default'));
$configform = new $this->form_class($target->url);
$configform->set_data(elis::$config->local_elisprogram);
if ($configdata = $configform->get_data()) {
/// Notifications section:
configpage::config_set_value($configdata, 'notify_classenrol_user', 0);
configpage::config_set_value($configdata, 'notify_classenrol_role', 0);
configpage::config_set_value($configdata, 'notify_classenrol_supervisor', 0);
if (empty($configdata->notify_classenrol_message)) {
$configdata->notify_classenrol_message = get_string('notifyclassenrolmessagedef', 'local_elisprogram');
}
pm_set_config('notify_classenrol_message', $configdata->notify_classenrol_message);
configpage::config_set_value($configdata, 'notify_classcompleted_user', 0);
configpage::config_set_value($configdata, 'notify_classcompleted_role', 0);
configpage::config_set_value($configdata, 'notify_classcompleted_supervisor', 0);
if (empty($configdata->notify_classcompleted_message)) {
$configdata->notify_classcompleted_message = get_string('notifyclasscompletedmessagedef', 'local_elisprogram');
}
pm_set_config('notify_classcompleted_message', $configdata->notify_classcompleted_message);
configpage::config_set_value($configdata, 'notify_classnotstarted_user', 0);
configpage::config_set_value($configdata, 'notify_classnotstarted_role', 0);
configpage::config_set_value($configdata, 'notify_classnotstarted_supervisor', 0);
if (empty($configdata->notify_classnotstarted_message)) {
$configdata->notify_classnotstarted_message = get_string('notifyclassnotstartedmessagedef', 'local_elisprogram');
}
pm_set_config('notify_classnotstarted_message', $configdata->notify_classnotstarted_message);
configpage::config_set_value($configdata, 'notify_classnotstarted_days', 0);
configpage::config_set_value($configdata, 'notify_classnotcompleted_user', 0);
configpage::config_set_value($configdata, 'notify_classnotcompleted_role', 0);
configpage::config_set_value($configdata, 'notify_classnotcompleted_supervisor', 0);
if (empty($configdata->notify_classnotcompleted_message)) {
$configdata->notify_classnotcompleted_message = get_string('notifyclassnotcompletedmessagedef', 'local_elisprogram');
}
pm_set_config('notify_classnotcompleted_message', $configdata->notify_classnotcompleted_message);
configpage::config_set_value($configdata, 'notify_classnotcompleted_days', 0);
configpage::config_set_value($configdata, 'notify_curriculumcompleted_user', 0);
configpage::config_set_value($configdata, 'notify_curriculumcompleted_role', 0);
configpage::config_set_value($configdata, 'notify_curriculumcompleted_supervisor', 0);
if (empty($configdata->notify_curriculumcompleted_message)) {
$configdata->notify_curriculumcompleted_message = get_string('notifycurriculumcompletedmessagedef', 'local_elisprogram');
}
pm_set_config('notify_curriculumcompleted_message', $configdata->notify_curriculumcompleted_message);
configpage::config_set_value($configdata, 'notify_curriculumnotcompleted_user', 0);
configpage::config_set_value($configdata, 'notify_curriculumnotcompleted_role', 0);
configpage::config_set_value($configdata, 'notify_curriculumnotcompleted_supervisor', 0);
if (empty($configdata->notify_curriculumnotcompleted_message)) {
$configdata->notify_curriculumnotcompleted_message = get_string('notifycurriculumnotcompletedmessagedef', 'local_elisprogram');
}
pm_set_config('notify_curriculumnotcompleted_message', $configdata->notify_curriculumnotcompleted_message);
configpage::config_set_value($configdata, 'notify_curriculumnotcompleted_days', 0);
configpage::config_set_value($configdata, 'notify_trackenrol_user', 0);
configpage::config_set_value($configdata, 'notify_trackenrol_role', 0);
configpage::config_set_value($configdata, 'notify_trackenrol_supervisor', 0);
if (empty($configdata->notify_trackenrol_message)) {
$configdata->notify_trackenrol_message = get_string('notifytrackenrolmessagedef', 'local_elisprogram');
}
pm_set_config('notify_trackenrol_message', $configdata->notify_trackenrol_message);
configpage::config_set_value($configdata, 'notify_courserecurrence_user', 0);
configpage::config_set_value($configdata, 'notify_courserecurrence_role', 0);
configpage::config_set_value($configdata, 'notify_courserecurrence_supervisor', 0);
if (empty($configdata->notify_courserecurrence_message)) {
$configdata->notify_courserecurrence_message = get_string('notifycourserecurrencemessagedef', 'local_elisprogram');
}
pm_set_config('notify_courserecurrence_message', $configdata->notify_courserecurrence_message);
configpage::config_set_value($configdata, 'notify_courserecurrence_days', 0);
configpage::config_set_value($configdata, 'notify_curriculumrecurrence_user', 0);
configpage::config_set_value($configdata, 'notify_curriculumrecurrence_role', 0);
configpage::config_set_value($configdata, 'notify_curriculumrecurrence_supervisor', 0);
if (empty($configdata->notify_curriculumrecurrence_message)) {
$configdata->notify_curriculumrecurrence_message = get_string('notifycurriculumrecurrencemessagedef', 'local_elisprogram');
}
pm_set_config('notify_curriculumrecurrence_message', $configdata->notify_curriculumrecurrence_message);
configpage::config_set_value($configdata, 'notify_curriculumrecurrence_days', 0);
configpage::config_set_value($configdata, 'notify_addedtowaitlist_user', 1);
configpage::config_set_value($configdata, 'notify_enroledfromwaitlist_user', 1);
configpage::config_set_value($configdata, 'notify_incompletecourse_user', 1);
}
$configform->display();
}
}
?>