MDL-10723 Removed all uses of print_navigation() throughout moodle, the function...
[moodle-pu.git] / course / request.php
blob9af3d0ced372b30ee35c3092a5eff5914ffcf03f
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 $navlinks = array();
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'));
41 } else {
42 notice(get_string('courserequestfailed'));
45 } else {
47 $requestform->display();
50 print_footer();