本文整理匯總了PHP中grade_helper::gradereports方法的典型用法代碼示例。如果您正苦於以下問題:PHP grade_helper::gradereports方法的具體用法?PHP grade_helper::gradereports怎麽用?PHP grade_helper::gradereports使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類grade_helper
的用法示例。
在下文中一共展示了grade_helper::gradereports方法的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;
}
示例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;
}