forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.php
48 lines (31 loc) · 1.04 KB
/
request.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
<?php // $Id$
/// this allows a student to request a course be created for them.
require_once('../config.php');
require_once('request_form.php');
require_login();
if (isguest()) {
error("No guests here!");
}
if (empty($CFG->enablecourserequests)) {
error(get_string('courserequestdisabled'));
}
$requestform = new course_request_form();
$strtitle = get_string('courserequest');
print_header($strtitle, $strtitle, $strtitle, $requestform->focus());
print_simple_box_start('center');
print_string('courserequestintro');
print_simple_box_end();
if ($requestform->is_cancelled()){
redirect($CFG->wwwroot);
}elseif ($data = $requestform->data_submitted()) {
$data->requester = $USER->id;
if (insert_record('course_request', $data)) {
notice(get_string('courserequestsuccess'));
} else {
notice(get_string('courserequestfailed'));
}
} else {
$requestform->display();
}
print_footer();
?>