本文整理汇总了PHP中grade_helper::get_plugins_reports方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_helper::get_plugins_reports方法的具体用法?PHP grade_helper::get_plugins_reports怎么用?PHP grade_helper::get_plugins_reports使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_helper
的用法示例。
在下文中一共展示了grade_helper::get_plugins_reports方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grade_extend_settings
/**
* This method adds settings to the settings block for the grade system and its
* plugins
*
* @global moodle_page $PAGE
*/
function grade_extend_settings($plugininfo, $courseid)
{
global $PAGE;
$gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER);
$strings = array_shift($plugininfo);
if ($reports = grade_helper::get_plugins_reports($courseid)) {
foreach ($reports as $report) {
$gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
}
}
if ($imports = grade_helper::get_plugins_import($courseid)) {
$importnode = $gradenode->add($strings['import'], null, navigation_node::TYPE_CONTAINER);
foreach ($imports as $import) {
$importnode->add($import->string, $import->link, navigation_node::TYPE_SETTING, null, $import->id, new pix_icon('i/import', ''));
}
}
if ($exports = grade_helper::get_plugins_export($courseid)) {
$exportnode = $gradenode->add($strings['export'], null, navigation_node::TYPE_CONTAINER);
foreach ($exports as $export) {
$exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
}
}
if ($setting = grade_helper::get_info_manage_settings($courseid)) {
$gradenode->add(get_string('coursegradesettings', 'grades'), $setting->link, navigation_node::TYPE_SETTING, null, $setting->id, new pix_icon('i/settings', ''));
}
if ($preferences = grade_helper::get_plugins_report_preferences($courseid)) {
$preferencesnode = $gradenode->add(get_string('myreportpreferences', 'grades'), null, navigation_node::TYPE_CONTAINER);
foreach ($preferences as $preference) {
$preferencesnode->add($preference->string, $preference->link, navigation_node::TYPE_SETTING, null, $preference->id, new pix_icon('i/settings', ''));
}
}
if ($letters = grade_helper::get_info_letters($courseid)) {
$letters = array_shift($letters);
$gradenode->add($strings['letter'], $letters->link, navigation_node::TYPE_SETTING, null, $letters->id, new pix_icon('i/settings', ''));
}
if ($outcomes = grade_helper::get_info_outcomes($courseid)) {
$outcomes = array_shift($outcomes);
$gradenode->add($strings['outcome'], $outcomes->link, navigation_node::TYPE_SETTING, null, $outcomes->id, new pix_icon('i/outcomes', ''));
}
if ($scales = grade_helper::get_info_scales($courseid)) {
$gradenode->add($strings['scale'], $scales->link, navigation_node::TYPE_SETTING, null, $scales->id, new pix_icon('i/scales', ''));
}
if ($categories = grade_helper::get_info_edit_structure($courseid)) {
$categoriesnode = $gradenode->add(get_string('categoriesanditems', 'grades'), null, navigation_node::TYPE_CONTAINER);
foreach ($categories as $category) {
$categoriesnode->add($category->string, $category->link, navigation_node::TYPE_SETTING, null, $category->id, new pix_icon('i/report', ''));
}
}
if ($gradenode->contains_active_node()) {
// If the gradenode is active include the settings base node (gradeadministration) in
// the navbar, typcially this is ignored.
$PAGE->navbar->includesettingsbase = true;
// If we can get the course admin node make sure it is closed by default
// as in this case the gradenode will be opened
if ($coursenode = $PAGE->settingsnav->get('courseadmin', navigation_node::TYPE_COURSE)) {
$coursenode->make_inactive();
$coursenode->forceopen = false;
}
}
}
示例2: grade_extend_settings
/**
* This method adds settings to the settings block for the grade system and its
* plugins
*
* @global moodle_page $PAGE
*/
function grade_extend_settings($plugininfo, $courseid)
{
global $PAGE;
$nav = new Navigation();
$roleid = $nav->get_user_role();
$gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER);
$strings = array_shift($plugininfo);
if ($reports = grade_helper::get_plugins_reports($courseid)) {
foreach ($reports as $report) {
if ($roleid == 4) {
//echo "Report link: ". $report->link."<br>";
if ($report->id != 'history' && $report->id != 'outcomes' && $report->id != 'user') {
$gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
}
// end if
} else {
$gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
}
// end else
}
// end foreach
}
if ($settings = grade_helper::get_info_manage_settings($courseid)) {
$settingsnode = $gradenode->add($strings['settings'], null, navigation_node::TYPE_CONTAINER);
foreach ($settings as $setting) {
$settingsnode->add($setting->string, $setting->link, navigation_node::TYPE_SETTING, null, $setting->id, new pix_icon('i/settings', ''));
}
}
if ($imports = grade_helper::get_plugins_import($courseid)) {
$importnode = $gradenode->add($strings['import'], null, navigation_node::TYPE_CONTAINER);
foreach ($imports as $import) {
$importnode->add($import->string, $import->link, navigation_node::TYPE_SETTING, null, $import->id, new pix_icon('i/import', ''));
}
}
if ($exports = grade_helper::get_plugins_export($courseid)) {
$exportnode = $gradenode->add($strings['export'], null, navigation_node::TYPE_CONTAINER);
foreach ($exports as $export) {
if ($roleid == 4) {
if ($export->id != 'ods' && $export->id != 'xml') {
$exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
}
// end if
} else {
$exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
}
// end else
}
// end foreach
}
if ($letters = grade_helper::get_info_letters($courseid)) {
$letters = array_shift($letters);
$gradenode->add($strings['letter'], $letters->link, navigation_node::TYPE_SETTING, null, $letters->id, new pix_icon('i/settings', ''));
}
if ($outcomes = grade_helper::get_info_outcomes($courseid)) {
$outcomes = array_shift($outcomes);
$gradenode->add($strings['outcome'], $outcomes->link, navigation_node::TYPE_SETTING, null, $outcomes->id, new pix_icon('i/outcomes', ''));
}
if ($scales = grade_helper::get_info_scales($courseid)) {
$gradenode->add($strings['scale'], $scales->link, navigation_node::TYPE_SETTING, null, $scales->id, new pix_icon('i/scales', ''));
}
if ($gradenode->contains_active_node()) {
// If the gradenode is active include the settings base node (gradeadministration) in
// the navbar, typcially this is ignored.
$PAGE->navbar->includesettingsbase = true;
// If we can get the course admin node make sure it is closed by default
// as in this case the gradenode will be opened
if ($coursenode = $PAGE->settingsnav->get('courseadmin', navigation_node::TYPE_COURSE)) {
$coursenode->make_inactive();
$coursenode->forceopen = false;
}
// end if
}
$setionsnode = $PAGE->settingsnav->prepend('Navigation', null, navigation_node::TYPE_CONTAINER);
$pageid = $nav->get_page_id();
if ($pageid > 0) {
$link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/page/view.php?id={$pageid}";
$setionsnode->add('Assignment', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
}
$forumid = $nav->get_forum_id();
if ($forumid > 0) {
$link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/forum/view.php?id={$forumid}";
$setionsnode->add('Discussion board', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
}
$quizid = $nav->get_quiz_id();
if ($quizid > 0) {
$link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/quiz/view.php?id={$quizid}";
$setionsnode->add('Quiz', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
}
}