* @param string $active_type type of plugin on current page - import, export, report or edit
* @param string $active_plugin active plugin type - grader, user, cvs, ...
* @param boolean $return return as string
- * @param string $preferences_page_url Unless false, the link to a preferences page to print in the second row of tabs next to the current link. If true, we are ON the preferences page
* @return nothing or string if $return true
*/
function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) {
return $plugin_info;
}
-function print_grade_page_head($courseid, $active_type, $active_plugin=null, $heading = false, $return=false, $meta='', $preferences_page_url=false, $buttons=false) {
+/**
+ * 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($courseid, $active_type, $active_plugin=null, $heading = false, $return=false, $bodytags='', $buttons=false) {
global $CFG, $COURSE;
$strgrades = get_string('grades');
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
$stractive_type = $plugin_info['strings'][$active_type];
$navlinks = array();
+ $first_link = '';
+
+ if ($active_type == 'settings') {
+ $first_link = $plugin_info['report'][$active_plugin]['link'];
+ } elseif ($active_type != 'report') {
+ $first_link = $CFG->wwwroot.'/grade/index.php?id='.$COURSE->id;
+ }
+
$navlinks[] = array('name' => $strgrades,
- 'link' => $CFG->wwwroot.'/grade/index.php?id='.$COURSE->id,
+ 'link' => $first_link,
'type' => 'misc');
$active_type_link = '';
- if (!empty($plugin_info[$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'];
}
$navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
-
- if ($preferences_page_url === true) {
- $navlinks[] = array('name' => $stractive_plugin, 'link' => $plugin_info[$active_type][$active_plugin]['link'], 'type' => 'misc');
- $navlinks[] = array('name' => get_string('preferences'), 'link' => null, 'type' => 'misc');
- } else {
- $navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
- }
+ $navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$returnval = print_header_simple($strgrades . ': ' . $stractive_type, ': ' . $stractive_type . ': ' . $stractive_plugin, $navigation, '',
- $meta, true, $buttons, navmenu($COURSE), false, '', $return);
+ $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
// Guess heading if not given explicitly
if (!$heading) {
$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, $preferences_page_url);
+ $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
if ($return) {