mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Activity module's settings form redirects to the management screen when advanced grading method was selected to use
This commit is contained in:
parent
3bd217aaa4
commit
03d448e5ff
@ -594,11 +594,18 @@ if ($mform->is_cancelled()) {
|
||||
require_once($CFG->dirroot.'/grade/grading/lib.php');
|
||||
$context = get_context_instance(CONTEXT_MODULE, $fromform->coursemodule);
|
||||
$gradingman = get_grading_manager($context, 'mod_'.$fromform->modulename);
|
||||
$showgradingmanagement = false;
|
||||
foreach ($gradingman->get_available_areas() as $areaname => $aretitle) {
|
||||
$formfield = 'advancedgradingmethod_'.$areaname;
|
||||
if (isset($fromform->{$formfield})) {
|
||||
$gradingman->set_area($areaname);
|
||||
$gradingman->set_active_method($fromform->{$formfield});
|
||||
$methodchanged = $gradingman->set_active_method($fromform->{$formfield});
|
||||
if (empty($fromform->{$formfield})) {
|
||||
// going back to the simple direct grading is not a reason
|
||||
// to open the management screen
|
||||
$methodchanged = false;
|
||||
}
|
||||
$showgradingmanagement = $showgradingmanagement || $methodchanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -608,7 +615,12 @@ if ($mform->is_cancelled()) {
|
||||
plagiarism_save_form_elements($fromform); //save plagiarism settings
|
||||
|
||||
if (isset($fromform->submitbutton)) {
|
||||
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
|
||||
if (empty($showgradingmanagement)) {
|
||||
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
|
||||
} else {
|
||||
$returnurl = new moodle_url("/mod/$module->name/view.php", array('id' => $fromform->coursemodule));
|
||||
redirect($gradingman->get_management_url($returnurl));
|
||||
}
|
||||
} else {
|
||||
redirect("$CFG->wwwroot/course/view.php?id={$course->id}#section-{$cw->section}");
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user