MDL-31830 course: several management interface improvements

* Tidied up course detail permissions so that user is not shown information they couldn't access elsewhere.
* category link dimming now accounts for course creation as an action as well.
* category single select when in courses view mode is now limited to courses user can action in.
* There is now a check at the start of the management page to redirect to course/index.php if the user isn't able to manage in any category.
* Tweaked navigation again, to give the limited users a navbar structure similar to the system cap'd user.
* Cancelling a category delete now takes you back to the category you were viewing.
* Fixed undefined notice
* Improved placement of course request and approval links.
* Several styling tweaks/improvements to the base theme.
* Several styling tweaks/improvements to the bootstrapbase theme.
This commit is contained in:
Sam Hemelryk
2013-10-07 10:22:57 +13:00
parent c46996ea5a
commit 484c4c6cf3
14 changed files with 451 additions and 219 deletions
+15 -9
View File
@@ -27,13 +27,19 @@ require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->dirroot . '/course/lib.php');
require_once($CFG->dirroot . '/course/request_form.php');
$PAGE->set_url('/course/request.php');
// Where we came from. Used in a number of redirects.
$url = new moodle_url('/course/request.php');
$return = optional_param('return', null, PARAM_ALPHANUMEXT);
if ($return === 'management') {
$url->param('return', $return);
$returnurl = new moodle_url('/course/management.php', array('categoryid' => $CFG->defaultrequestcategory));
} else {
$returnurl = new moodle_url('/course/index.php');
}
/// Where we came from. Used in a number of redirects.
$returnurl = $CFG->wwwroot . '/course/index.php';
$PAGE->set_url($url);
/// Check permissions.
// Check permissions.
require_login();
if (isguestuser()) {
print_error('guestsarenotallowed', '', $returnurl);
@@ -45,23 +51,23 @@ $context = context_system::instance();
$PAGE->set_context($context);
require_capability('moodle/course:request', $context);
/// Set up the form.
// Set up the form.
$data = course_request::prepare();
$requestform = new course_request_form($CFG->wwwroot . '/course/request.php', compact('editoroptions'));
$requestform = new course_request_form($url, compact('editoroptions'));
$requestform->set_data($data);
$strtitle = get_string('courserequest');
$PAGE->set_title($strtitle);
$PAGE->set_heading($strtitle);
/// Standard form processing if statement.
// Standard form processing if statement.
if ($requestform->is_cancelled()){
redirect($returnurl);
} else if ($data = $requestform->get_data()) {
$request = course_request::create($data);
// and redirect back to the course listing.
// And redirect back to the course listing.
notice(get_string('courserequestsuccess'), $returnurl);
}