Activity module's settings form redirects to the management screen when advanced grading method was selected to use

This commit is contained in:
David Mudrak 2011-10-14 14:34:12 +02:00
parent 3bd217aaa4
commit 03d448e5ff
2 changed files with 39 additions and 2 deletions

View file

@ -383,6 +383,8 @@ class grading_manager {
/**
* Returns the controller for the active method if it is available
*
* @return null|grading_controller
*/
public function get_active_controller() {
if ($gradingmethod = $this->get_active_method()) {
@ -394,6 +396,29 @@ class grading_manager {
return null;
}
/**
* Returns the URL of the grading area management page
*
* @param moodle_url $returnurl optional URL of the page where the user should be sent back to
* @return moodle_url
*/
public function get_management_url(moodle_url $returnurl = null) {
$this->ensure_isset(array('context', 'component'));
if ($this->areacache) {
$params = array('areaid' => $this->areacache->id);
} else {
$params = array('contextid' => $this->context->id, 'component' => $this->component);
}
if (!is_null($returnurl)) {
$params['returnurl'] = $returnurl->out(false);
}
return new moodle_url('/grade/grading/management.php', $params);
}
////////////////////////////////////////////////////////////////////////////
/**