3 /// this allows a student to request a course be created for them.
5 require_once('../config.php');
6 require_once('request_form.php');
11 error("No guests here!");
14 if (empty($CFG->enablecourserequests
)) {
15 print_error('courserequestdisabled');
18 $requestform = new course_request_form();
20 $strtitle = get_string('courserequest');
22 $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
23 $navigation = build_navigation($navlinks);
25 print_header($strtitle, $strtitle, $navigation, $requestform->focus());
27 print_simple_box_start('center');
28 print_string('courserequestintro');
29 print_simple_box_end();
32 if ($requestform->is_cancelled()){
34 redirect($CFG->wwwroot
);
36 }elseif ($data = $requestform->get_data()) {
37 $data->requester
= $USER->id
;
39 if (insert_record('course_request', $data)) {
40 notice(get_string('courserequestsuccess'));
42 notice(get_string('courserequestfailed'));
47 $requestform->display();