Merge branch 'MDL-50529_dupe' of git://github.com/andyjdavis/moodle
authorDavid Monllao <davidm@moodle.com>
Wed, 2 Sep 2015 01:58:17 +0000 (09:58 +0800)
committerDavid Monllao <davidm@moodle.com>
Wed, 2 Sep 2015 01:58:17 +0000 (09:58 +0800)
1  2 
grade/lib.php

diff --combined grade/lib.php
@@@ -886,20 -886,6 +886,6 @@@ function grade_get_plugin_info($coursei
          }
      }
  
-     foreach ($plugin_info as $plugin_type => $plugins) {
-         if (!empty($plugins->id) && $active_plugin == $plugins->id) {
-             $plugin_info['strings']['active_plugin_str'] = $plugins->string;
-             break;
-         }
-         foreach ($plugins as $plugin) {
-             if (is_a($plugin, 'grade_plugin_info')) {
-                 if ($active_plugin == $plugin->id) {
-                     $plugin_info['strings']['active_plugin_str'] = $plugin->string;
-                 }
-             }
-         }
-     }
      return $plugin_info;
  }
  
@@@ -2887,12 -2873,6 +2873,12 @@@ abstract class grade_helper 
                  continue;
              }
  
 +            // Singleview doesn't doesn't accomodate for all cap combos yet, so this is hardcoded..
 +            if ($plugin === 'singleview' && !has_all_capabilities(array('moodle/grade:viewall',
 +                    'moodle/grade:edit'), $context)) {
 +                continue;
 +            }
 +
              $pluginstr = get_string('pluginname', 'gradereport_'.$plugin);
              $url = new moodle_url('/grade/report/'.$plugin.'/index.php', array('id'=>$courseid));
              $gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);