2006-04-12 16:41:10 +00:00
|
|
|
<?php // $Id$
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2005-08-16 06:15:49 +00:00
|
|
|
/// this allows a student to request a course be created for them.
|
|
|
|
|
2006-04-12 16:41:10 +00:00
|
|
|
require_once('../config.php');
|
2006-11-09 22:16:44 +00:00
|
|
|
require_once('request_form.php');
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2005-08-16 06:15:49 +00:00
|
|
|
require_login();
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2006-04-12 16:41:10 +00:00
|
|
|
if (isguest()) {
|
2008-05-07 06:02:51 +00:00
|
|
|
print_error("noguest");
|
2006-04-12 16:41:10 +00:00
|
|
|
}
|
|
|
|
|
2005-08-16 06:15:49 +00:00
|
|
|
if (empty($CFG->enablecourserequests)) {
|
2007-03-19 03:02:14 +00:00
|
|
|
print_error('courserequestdisabled');
|
2005-08-16 06:15:49 +00:00
|
|
|
}
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2006-12-28 15:43:47 +00:00
|
|
|
$requestform = new course_request_form();
|
2005-08-16 06:15:49 +00:00
|
|
|
|
|
|
|
$strtitle = get_string('courserequest');
|
2007-08-17 19:09:11 +00:00
|
|
|
$navlinks = array();
|
|
|
|
$navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
|
|
|
|
$navigation = build_navigation($navlinks);
|
|
|
|
|
|
|
|
print_header($strtitle, $strtitle, $navigation, $requestform->focus());
|
2005-08-16 06:15:49 +00:00
|
|
|
|
2006-11-09 21:58:12 +00:00
|
|
|
print_simple_box_start('center');
|
2006-10-17 11:38:46 +00:00
|
|
|
print_string('courserequestintro');
|
2005-08-16 06:15:49 +00:00
|
|
|
print_simple_box_end();
|
2006-10-17 11:38:46 +00:00
|
|
|
|
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
if ($requestform->is_cancelled()){
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
redirect($CFG->wwwroot);
|
|
|
|
|
2008-06-09 16:53:30 +00:00
|
|
|
}elseif ($data = $requestform->get_data()) {
|
2006-10-17 11:08:13 +00:00
|
|
|
$data->requester = $USER->id;
|
2005-08-16 06:15:49 +00:00
|
|
|
|
2008-06-02 21:25:40 +00:00
|
|
|
if ($DB->insert_record('course_request', $data)) {
|
2006-10-17 11:08:13 +00:00
|
|
|
notice(get_string('courserequestsuccess'));
|
2006-10-17 11:38:46 +00:00
|
|
|
} else {
|
2006-10-17 11:08:13 +00:00
|
|
|
notice(get_string('courserequestfailed'));
|
2005-08-16 06:15:49 +00:00
|
|
|
}
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
} else {
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2006-12-19 07:03:08 +00:00
|
|
|
$requestform->display();
|
|
|
|
}
|
2006-10-17 11:08:13 +00:00
|
|
|
|
|
|
|
print_footer();
|
2006-10-17 11:38:46 +00:00
|
|
|
|
2007-03-19 03:02:14 +00:00
|
|
|
?>
|