]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18004 Added a new "Settings tab" which includes course settings and report prefer...
authornicolasconnault <nicolasconnault>
Wed, 11 Feb 2009 14:27:22 +0000 (14:27 +0000)
committernicolasconnault <nicolasconnault>
Wed, 11 Feb 2009 14:27:22 +0000 (14:27 +0000)
grade/edit/settings/index.php
grade/lib.php
grade/report/grader/index.php
grade/report/grader/preferences.php

index c11c3c467cd3a3e9e9f2bec310bb0ca61db1198a..4a58d55dbfc287fd60197b8ff1f9341cbc80e571 100644 (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();
 
index 0fc3150582e8c87aceabcf30c8bfa593be04ecb7..033ada524641b9debb5a4080ab83cf3829178130 100644 (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
index fa55d4307fecc8ae4479518d3d935c9e7f0d0f0c..8d8b837277d04e287d2a3d6d5edf0e21c78b1d08 100644 (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')
     ||
index 0233ce4db9a9912c744dd924cfe5f65f50f1015e..31b3706753aae2023aca0fc2abde06d06f2b14ab 100644 (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)) {