]> git.mjollnir.org Git - moodle.git/commitdiff
More cleanups and separation of printing the grades menu into a new function
authormoodler <moodler>
Mon, 18 Aug 2003 05:28:30 +0000 (05:28 +0000)
committermoodler <moodler>
Mon, 18 Aug 2003 05:28:30 +0000 (05:28 +0000)
lib/moodlelib.php
lib/weblib.php
mod/assignment/mod.html
mod/forum/lib.php
mod/forum/mod.html

index 8c57b8e54c5df928a5cce920fa016f212d909853..7bd1ceb6e6f91bed7701ec1dfe8356586db888e0 100644 (file)
@@ -1675,7 +1675,7 @@ function make_grades_menu($gradingtype) {
         }
     } else if ($gradingtype > 0) {
         for ($i=$gradingtype; $i>=0; $i--) {
-            $grades[$i] = $i;
+            $grades[$i] = "$i / $gradingtype";
         }
         return $grades;
     }
index 7b70c1f3a17ecbe402c0aff98c194e72b721e6cd..3bdb3272daae12662e317a862352ec6df5c0db01 100644 (file)
@@ -1275,8 +1275,38 @@ function print_time_selector($hour, $minute, $currenttime=0) {
     choose_from_menu($minutes, $minute, $currentdate['minutes'], "");
 }
 
+function print_grade_menu($courseid, $name, $current) {
+/// Prints a grade menu (as part of an existing form) with help
+/// Showing all possible numerical grades and scales
+
+    global $CFG, $THEME;
+
+    $strscale = get_string("scale");
+    $strscales = get_string("scales");
+
+    $scales = get_scales_menu($course->id);
+    foreach ($scales as $i => $scalename) {
+        $grades[-$i] = "$strscale: $scalename";
+    }
+    $grades[0] = get_string("nograde");
+    for ($i=100; $i>=1; $i--) {
+        $grades[$i] = $i;
+    }
+    choose_from_menu($grades, "$name", "$current", "");
+
+    if (empty($THEME->custompix)) {
+        $helpicon = "$CFG->wwwroot/pix/help.gif";
+    } else {
+        $helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
+    }
+    $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
+    link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales", 
+                          $linkobject, 400, 500, $strscales);
+}
+
 function print_scale_menu($courseid, $name, $current) {
 /// Prints a scale menu (as part of an existing form) including help button
+/// Just like print_grade_menu but without the numerical grades
 
     global $CFG, $THEME;
 
index 7bcea693f1e1714b249ff60ed900d79276da6481..224c612f2de7f8e54996db62303331d5eac53393 100644 (file)
     <td align=right><p><b><?php print_string("grade") ?>:</b></p></td>
     <td>
         <?php
-        $scales = get_scales_menu($course->id);
-        $strscale = get_string("scale");
-        foreach ($scales as $i => $scalename) {
-            $grades[-$i] = "$strscale: $scalename";
-        }
-        $grades[0] = get_string("nograde");
-        for ($i=100; $i>=1; $i--) {
-            $grades[$i] = $i;
-        }
-        choose_from_menu($grades, "grade", "$form->grade", "");
+        print_grade_menu($course->id, "grade", "$form->grade");
         ?>
     </td>
 </tr>
index 88436d584116e2fb40557ac644d201d672d00dfc..8ad181a40e746fa8ce2c656656a54b562af134c2 100644 (file)
@@ -16,9 +16,6 @@ $FORUM_TYPES   = array ("general"    => get_string("generalforum", "forum"),
                         "eachuser"   => get_string("eachuserforum", "forum"),
                         "single"     => get_string("singleforum", "forum") );
 
-$FORUM_POST_RATINGS = array ("3" => get_string("postrating3", "forum"),
-                             "2" => get_string("postrating2", "forum"),
-                             "1" => get_string("postrating1", "forum") );
 
 $FORUM_OPEN_MODES   = array ("2" => get_string("openmode2", "forum"),
                              "1" => get_string("openmode1", "forum"),
index 449a7f08f4d46fc968c345902f84cd145b655a30..3d3cc7fed7696c02ecbe8f101e379136bd5ad9f0 100644 (file)
 
             choose_from_menu($options, "assessed", $form->assessed, "");
             helpbutton("ratings", get_string("allowratings", "forum"), "forum");
-            echo "<p><b>";
-            print_string("scale");
-            echo ":</b> ";
+            echo "<br />";
             print_scale_menu($course->id, "scale", $form->scale);
-            echo "</p>";
-
         ?>
     </td>
 </tr>