diff --git a/grade/edit/settings/index.php b/grade/edit/settings/index.php index c11c3c467cd..4a58d55dbfc 100644 --- a/grade/edit/settings/index.php +++ b/grade/edit/settings/index.php @@ -74,10 +74,7 @@ if ($mform->is_cancelled()) { redirect($returnurl); } -/// Print header -print_header_simple($strgrades.': '.$pagename, ': '.$strgrades, $navigation, '', '', true, '', navmenu($course)); -/// Print the plugin selector at the top -print_grade_plugin_selector($courseid, 'edit', 'settings'); +print_grade_page_head($courseid, 'settings', 'coursesettings', get_string('coursesettings', 'grades')); $mform->display(); diff --git a/grade/lib.php b/grade/lib.php index 0fc3150582e..033ada52464 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -355,7 +355,7 @@ function print_grade_plugin_selector($plugin_info, $return=false) { * @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, $preferences_page_url=false) { +function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) { global $CFG, $COURSE; if (!isset($currenttab)) { @@ -396,14 +396,6 @@ function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=fa $bottom_row[] = new tabobject($plugin['id'], $plugin['link'], $plugin['string']); if ($plugin['id'] == $active_plugin) { $inactive = array($plugin['id']); - - // Add preferences link if setup - if ($preferences_page_url) { - $bottom_row[] = new tabobject('preferences', $preferences_page_url, get_string('preferences')); - if ($preferences_page_url === true) { - $inactive = array('preferences'); - } - } } } } @@ -437,7 +429,21 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) { 'outcome' => get_string('outcomes', 'grades'), 'letter' => get_string('letters', 'grades'), 'export' => get_string('export', 'grades'), - 'import' => get_string('import')); + 'import' => get_string('import'), + 'settings' => get_string('settings')); + + // Settings tab first + if (has_capability('moodle/course:update', $context)) { + $url = $url_prefix.'edit/settings/index.php?id='.$courseid; + + if ($active_type == 'settings' and $active_plugin == 'course') { + $active = $url; + } + + $plugin_info['settings']['coursesettings'] = array('id' => 'coursesettings', 'link' => $url, 'string' => get_string('course')); + $count++; + } + /// report plugins with its special structure if ($reports = get_list_of_plugins('grade/report', 'CVS')) { // Get all installed reports @@ -447,7 +453,9 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) { } } } + $reportnames = array(); + if (!empty($reports)) { foreach ($reports as $plugin) { $url = $url_prefix.'report/'.$plugin.'/index.php?id='.$courseid; @@ -455,6 +463,13 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) { $active = $url; } $reportnames[$plugin] = array('id' => $plugin, 'link' => $url, 'string' => get_string('modulename', 'gradereport_'.$plugin)); + + // Add link to preferences tab if such a page exists + if (file_exists($CFG->dirroot . '/grade/report/'.$plugin.'/preferences.php')) { + $pref_url = $url_prefix.'report/'.$plugin.'/preferences.php?id='.$courseid; + $plugin_info['settings'][$plugin] = array('id' => $plugin, 'link' => $pref_url, 'string' => get_string('modulename', 'gradereport_'.$plugin)); + } + $count++; } asort($reportnames); @@ -537,18 +552,6 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) { $count++; } - /** - * Moving to Course settings - * - if (has_capability('moodle/grade:manage', $context)) { - $url = $url_prefix.'edit/settings/index.php?id='.$courseid; - if ($active_type == 'edit' and $active_plugin == 'settings' ) { - $active = $url; - } - $plugin_info['edit'][] = array('id' => $plugin, 'link' => $url, 'string' => get_string('coursesettings', 'grades')); - $count++; - } - */ } /// standard import plugins diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index fa55d4307fe..8d8b837277d 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -173,7 +173,7 @@ if ($USER->gradeediting[$course->id] and !$report->get_pref('enableajax')) { } echo $reporthtml; - +var_dump($report->get_pref('enableajax')); // print submit button if ($USER->gradeediting[$course->id] && ($report->get_pref('showquickfeedback') || diff --git a/grade/report/grader/preferences.php b/grade/report/grader/preferences.php index 0233ce4db9a..31b3706753a 100644 --- a/grade/report/grader/preferences.php +++ b/grade/report/grader/preferences.php @@ -66,7 +66,7 @@ if ($data = $mform->get_data()) { exit; } -print_grade_page_head($courseid, 'report', 'grader', get_string('preferences', 'gradereport_grader'), false, '', true); +print_grade_page_head($courseid, 'settings', 'grader', get_string('preferences', 'gradereport_grader')); // If USER has admin capability, print a link to the site config page for this report if (has_capability('moodle/site:config', $systemcontext)) {