Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-31633 grades: Fixing incorrect redirect when trying to edit grade…

… letters from admin settings
  • Loading branch information...
commit a8dfc4837e0bf86baa676db42e36ac0cbb893bb7 1 parent d71c486
@ankitagarwal ankitagarwal authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 grade/lib.php
View
9 grade/lib.php
@@ -2610,6 +2610,7 @@ public static function get_info_edit_structure($courseid) {
* @return array
*/
public static function get_info_letters($courseid) {
+ global $SITE;
if (self::$letterinfo !== null) {
return self::$letterinfo;
}
@@ -2617,9 +2618,15 @@ public static function get_info_letters($courseid) {
$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;
Please sign in to comment.
Something went wrong with that request. Please try again.