MDL-9136: Added a $selected attribute to the profile_field_menu object, which gets...
[moodle-pu.git] / course / request.php
blob4858759f8f7b0ebfcaa5c6400e57ea662e46b856
1 <?php // $Id$
3 /// this allows a student to request a course be created for them.
5 require_once('../config.php');
6 require_once('request_form.php');
8 require_login();
10 if (isguest()) {
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');
21 print_header($strtitle, $strtitle, $strtitle, $requestform->focus());
23 print_simple_box_start('center');
24 print_string('courserequestintro');
25 print_simple_box_end();
28 if ($requestform->is_cancelled()){
30 redirect($CFG->wwwroot);
32 }elseif ($data = $requestform->get_data()) {
33 $data->requester = $USER->id;
35 if (insert_record('course_request', $data)) {
36 notice(get_string('courserequestsuccess'));
37 } else {
38 notice(get_string('courserequestfailed'));
41 } else {
43 $requestform->display();
46 print_footer();