本文整理汇总了PHP中grade_get_plugin_info函数的典型用法代码示例。如果您正苦于以下问题:PHP grade_get_plugin_info函数的具体用法?PHP grade_get_plugin_info怎么用?PHP grade_get_plugin_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grade_get_plugin_info函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_grade_page_head_local
/**
* Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
* (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
* in favour of the usual print_header(), print_header_simple(), print_heading() etc.
* !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
* the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
*
* @param int $courseid
* @param string $active_type The type of the current page (report, settings, import, export, scales, outcomes, letters)
* @param string $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string $heading The heading of the page. Tries to guess if none is given
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head_local($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $bodytags = '', $buttons = false, $extracss = array())
{
global $CFG, $COURSE;
$strgrades = get_string('grades');
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
$navlinks = array();
$first_link = '';
if ($active_type == 'settings' && $active_plugin != 'coursesettings') {
$first_link = $plugin_info['report'][$active_plugin]['link'];
} elseif ($active_type != 'report') {
$first_link = $CFG->wwwroot . '/grade/index.php?id=' . $COURSE->id;
}
if ($active_type == 'preferences') {
$CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
}
foreach ($extracss as $css_url) {
$CFG->stylesheets[] = $css_url;
}
$navlinks[] = array('name' => $strgrades, 'link' => $first_link, 'type' => 'misc');
$active_type_link = '';
if (!empty($plugin_info[$active_type]['link']) && $plugin_info[$active_type]['link'] != qualified_me()) {
$active_type_link = $plugin_info[$active_type]['link'];
}
if (!empty($plugin_info[$active_type]['parent']['link'])) {
$active_type_link = $plugin_info[$active_type]['parent']['link'];
$navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
}
if (empty($plugin_info[$active_type]['id'])) {
$navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
}
$navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$title = ': ' . $stractive_plugin;
if (empty($plugin_info[$active_type]['id']) || !empty($plugin_info[$active_type]['parent'])) {
$title = ': ' . $stractive_type . ': ' . $stractive_plugin;
}
$returnval = print_header_simple($strgrades . ': ' . $stractive_type, $title, $navigation, '', $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
$returnval .= print_grade_plugin_selector($plugin_info, $return);
}
$returnval .= print_heading($heading);
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
if ($return) {
return $returnval;
}
}
示例2: print_grade_page_head
/**
* Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
* (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
* in favour of the usual print_header(), print_header_simple(), print_heading() etc.
* !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
* the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
*
* @param int $courseid Course id
* @param string $active_type The type of the current page (report, settings,
* import, export, scales, outcomes, letters)
* @param string $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string $heading The heading of the page. Tries to guess if none is given
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
* @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $buttons = false, $shownavigation = true)
{
global $CFG, $OUTPUT, $PAGE;
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
$title = $PAGE->course->fullname . ': ' . $stractive_type . ': ' . $stractive_plugin;
} else {
$title = $PAGE->course->fullname . ': ' . $stractive_plugin;
}
if ($active_type == 'report') {
$PAGE->set_pagelayout('report');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
$PAGE->set_heading($title);
if ($buttons instanceof single_button) {
$buttons = $OUTPUT->render($buttons);
}
$PAGE->set_button($buttons);
grade_extend_settings($plugin_info, $courseid);
$returnval = $OUTPUT->header();
if (!$return) {
echo $returnval;
}
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if ($shownavigation) {
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
$returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
}
if ($return) {
$returnval .= $OUTPUT->heading($heading);
} else {
echo $OUTPUT->heading($heading);
}
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
}
if ($return) {
return $returnval;
}
}
示例3: print_grade_page_head
/**
* Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
* (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
* in favour of the usual print_header(), print_header_simple(), print_heading() etc.
* !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
* the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
*
* @param int $courseid Course id
* @param string $active_type The type of the current page (report, settings,
* import, export, scales, outcomes, letters)
* @param string $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string $heading The heading of the page. Tries to guess if none is given
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
* @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
* @param string $headerhelpidentifier The help string identifier if required.
* @param string $headerhelpcomponent The component for the help string.
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $buttons = false, $shownavigation = true, $headerhelpidentifier = null, $headerhelpcomponent = null)
{
global $CFG, $OUTPUT, $PAGE;
if ($active_type === 'preferences') {
// In Moodle 2.8 report preferences were moved under 'settings'. Allow backward compatibility for 3rd party grade reports.
$active_type = 'settings';
}
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
$title = $PAGE->course->fullname . ': ' . $stractive_type . ': ' . $stractive_plugin;
} else {
$title = $PAGE->course->fullname . ': ' . $stractive_plugin;
}
if ($active_type == 'report') {
$PAGE->set_pagelayout('report');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
$PAGE->set_heading($title);
if ($buttons instanceof single_button) {
$buttons = $OUTPUT->render($buttons);
}
$PAGE->set_button($buttons);
if ($courseid != SITEID) {
grade_extend_settings($plugin_info, $courseid);
}
$returnval = $OUTPUT->header();
if (!$return) {
echo $returnval;
}
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if ($shownavigation) {
if ($courseid != SITEID && ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN)) {
$returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
}
$output = '';
// Add a help dialogue box if provided.
if (isset($headerhelpidentifier)) {
$output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
} else {
$output = $OUTPUT->heading($heading);
}
if ($return) {
$returnval .= $output;
} else {
echo $output;
}
if ($courseid != SITEID && ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS)) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
}
$returnval .= print_natural_aggregation_upgrade_notice($courseid, context_course::instance($courseid), $PAGE->url, $return);
if ($return) {
return $returnval;
}
}
示例4: print_grade_page_head
/**
* Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
* (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
* in favour of the usual print_header(), print_header_simple(), print_heading() etc.
* !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
* the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
*
* @param int $courseid Course id
* @param string $active_type The type of the current page (report, settings,
* import, export, scales, outcomes, letters)
* @param string $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string $heading The heading of the page. Tries to guess if none is given
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
* @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
* @param string $headerhelpidentifier The help string identifier if required.
* @param string $headerhelpcomponent The component for the help string.
* @param stdClass $user The user object for use with the user context header.
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head($courseid, $active_type, $active_plugin=null,
$heading = false, $return=false,
$buttons=false, $shownavigation=true, $headerhelpidentifier = null, $headerhelpcomponent = null,
$user = null) {
global $CFG, $OUTPUT, $PAGE;
// Put a warning on all gradebook pages if the course has modules currently scheduled for background deletion.
require_once($CFG->dirroot . '/course/lib.php');
if (course_modules_pending_deletion($courseid)) {
\core\notification::add(get_string('gradesmoduledeletionpendingwarning', 'grades'),
\core\output\notification::NOTIFY_WARNING);
}
if ($active_type === 'preferences') {
// In Moodle 2.8 report preferences were moved under 'settings'. Allow backward compatibility for 3rd party grade reports.
$active_type = 'settings';
}
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
$title = $PAGE->course->fullname.': ' . $stractive_type . ': ' . $stractive_plugin;
} else {
$title = $PAGE->course->fullname.': ' . $stractive_plugin;
}
if ($active_type == 'report') {
$PAGE->set_pagelayout('report');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
$PAGE->set_heading($title);
if ($buttons instanceof single_button) {
$buttons = $OUTPUT->render($buttons);
}
$PAGE->set_button($buttons);
if ($courseid != SITEID) {
grade_extend_settings($plugin_info, $courseid);
}
// Set the current report as active in the breadcrumbs.
if ($active_plugin !== null && $reportnav = $PAGE->settingsnav->find($active_plugin, navigation_node::TYPE_SETTING)) {
$reportnav->make_active();
}
$returnval = $OUTPUT->header();
if (!$return) {
echo $returnval;
}
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if ($shownavigation) {
$navselector = null;
if ($courseid != SITEID &&
($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN)) {
// It's absolutely essential that this grade plugin selector is shown after the user header. Just ask Fred.
$navselector = print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, true);
if ($return) {
$returnval .= $navselector;
} else if (!isset($user)) {
echo $navselector;
}
}
$output = '';
// Add a help dialogue box if provided.
if (isset($headerhelpidentifier)) {
$output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
//.........这里部分代码省略.........