mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-31633 grades: Fixing incorrect redirect when trying to edit grade letters from admin settings
This commit is contained in:
parent
d71c486507
commit
a8dfc4837e
@ -2610,6 +2610,7 @@ abstract class grade_helper {
|
||||
* @return array
|
||||
*/
|
||||
public static function get_info_letters($courseid) {
|
||||
global $SITE;
|
||||
if (self::$letterinfo !== null) {
|
||||
return self::$letterinfo;
|
||||
}
|
||||
@ -2617,9 +2618,15 @@ abstract class grade_helper {
|
||||
$canmanage = has_capability('moodle/grade:manage', $context);
|
||||
$canmanageletters = has_capability('moodle/grade:manageletters', $context);
|
||||
if ($canmanage || $canmanageletters) {
|
||||
// Redirect to system context when report is accessed from admin settings MDL-31633
|
||||
if ($context->instanceid == $SITE->id) {
|
||||
$param = array('edit' => 1);
|
||||
} else {
|
||||
$param = array('edit' => 1,'id' => $context->id);
|
||||
}
|
||||
self::$letterinfo = array(
|
||||
'view' => new grade_plugin_info('view', new moodle_url('/grade/edit/letter/index.php', array('id'=>$context->id)), get_string('view')),
|
||||
'edit' => new grade_plugin_info('edit', new moodle_url('/grade/edit/letter/index.php', array('edit'=>1,'id'=>$context->id)), get_string('edit'))
|
||||
'edit' => new grade_plugin_info('edit', new moodle_url('/grade/edit/letter/index.php', $param), get_string('edit'))
|
||||
);
|
||||
} else {
|
||||
self::$letterinfo = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user