MDL-18004 Added a new "Settings tab" which includes course settings and report preferences

This commit is contained in:
nicolasconnault 2009-02-11 14:27:22 +00:00
parent 4cc11ff992
commit b827784e59
4 changed files with 28 additions and 28 deletions

View File

@ -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();

View File

@ -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

View File

@ -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')
||

View File

@ -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)) {