Merge branch 'MDL-31633-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE

This commit is contained in:
Aparup Banerjee
2012-08-27 17:26:53 +08:00
+8 -1
View File
@@ -2516,6 +2516,7 @@ abstract class grade_helper {
* @return array
*/
public static function get_info_letters($courseid) {
global $SITE;
if (self::$letterinfo !== null) {
return self::$letterinfo;
}
@@ -2523,9 +2524,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;