当前位置: 首页>>代码示例>>PHP>>正文


PHP grade_helper::gradereportpreferences方法代码示例

本文整理汇总了PHP中grade_helper::gradereportpreferences方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_helper::gradereportpreferences方法的具体用法?PHP grade_helper::gradereportpreferences怎么用?PHP grade_helper::gradereportpreferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grade_helper的用法示例。


在下文中一共展示了grade_helper::gradereportpreferences方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_plugins_reports

 /**
  * Returns an array of plugin reports as grade_plugin_info objects
  *
  * @param int $courseid
  * @return array
  */
 public static function get_plugins_reports($courseid)
 {
     global $SITE;
     if (self::$gradereports !== null) {
         return self::$gradereports;
     }
     $context = context_course::instance($courseid);
     $gradereports = array();
     $gradepreferences = array();
     foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
         //some reports make no sense if we're not within a course
         if ($courseid == $SITE->id && ($plugin == 'grader' || $plugin == 'user')) {
             continue;
         }
         // Remove ones we can't see
         if (!has_capability('gradereport/' . $plugin . ':view', $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);
         // Add link to preferences tab if such a page exists
         if (file_exists($plugindir . '/preferences.php')) {
             $url = new moodle_url('/grade/report/' . $plugin . '/preferences.php', array('id' => $courseid));
             $gradepreferences[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
         }
     }
     if (count($gradereports) == 0) {
         $gradereports = false;
         $gradepreferences = false;
     } else {
         if (count($gradepreferences) == 0) {
             $gradepreferences = false;
             asort($gradereports);
         } else {
             asort($gradereports);
             asort($gradepreferences);
         }
     }
     self::$gradereports = $gradereports;
     self::$gradereportpreferences = $gradepreferences;
     return self::$gradereports;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:49,代码来源:lib.php

示例2: get_plugins_reports

 /**
  * Returns an array of plugin reports as grade_plugin_info objects
  *
  * @param int $courseid
  * @return array
  */
 public static function get_plugins_reports($courseid)
 {
     global $SITE;
     if (self::$gradereports !== null) {
         return self::$gradereports;
     }
     $context = context_course::instance($courseid);
     $gradereports = array();
     $gradepreferences = array();
     foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
         //some reports make no sense if we're not within a course
         if ($courseid == $SITE->id && ($plugin == 'grader' || $plugin == 'user')) {
             continue;
         }
         // Remove ones we can't see
         if (!has_capability('gradereport/' . $plugin . ':view', $context)) {
             continue;
         }
         $pluginstr = get_string('pluginname', 'gradereport_' . $plugin);
         //@Harsha Added userid to the links if they changed from one to another
         $itemid = optional_param('itemid', 0, PARAM_INT);
         $userid = optional_param('userid', 0, PARAM_INT);
         if ($itemid > 0) {
             $userid = $itemid;
         }
         if ($plugin === 'user' and $userid > 0) {
             $url = new moodle_url('/grade/report/' . $plugin . '/index.php', array('id' => $courseid, 'userid' => $userid));
             $gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
         } else {
             if ($plugin === 'singleview' and $userid > 0) {
                 $url = new moodle_url('/grade/report/' . $plugin . '/index.php', array('id' => $courseid, 'userid' => $userid));
                 $gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
             } else {
                 $url = new moodle_url('/grade/report/' . $plugin . '/index.php', array('id' => $courseid));
                 $gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
             }
         }
         //End of code @Harsha
         //Default code starts
         //$url = new moodle_url('/grade/report/'.$plugin.'/index.php', array('id'=>$courseid));
         //$gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
         //Default code ends
         // Add link to preferences tab if such a page exists
         if (file_exists($plugindir . '/preferences.php')) {
             $url = new moodle_url('/grade/report/' . $plugin . '/preferences.php', array('id' => $courseid));
             $gradepreferences[$plugin] = new grade_plugin_info($plugin, $url, get_string('preferences', 'grades') . ': ' . $pluginstr);
         }
     }
     if (count($gradereports) == 0) {
         $gradereports = false;
         $gradepreferences = false;
     } else {
         if (count($gradepreferences) == 0) {
             $gradepreferences = false;
             asort($gradereports);
         } else {
             asort($gradereports);
             asort($gradepreferences);
         }
     }
     self::$gradereports = $gradereports;
     self::$gradereportpreferences = $gradepreferences;
     return self::$gradereports;
 }
开发者ID:harshasunny,项目名称:grade,代码行数:70,代码来源:lib.php


注:本文中的grade_helper::gradereportpreferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。