]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12356 CSS classes implemented
authornicolasconnault <nicolasconnault>
Wed, 28 Nov 2007 05:16:09 +0000 (05:16 +0000)
committernicolasconnault <nicolasconnault>
Wed, 28 Nov 2007 05:16:09 +0000 (05:16 +0000)
lib/grade/grade_grade.php

index f50caf8bdfd0c18591ca24bce447340fdbdc09b2..3e08be1695fd91fe22273acea7a69acaf2a04d12 100644 (file)
@@ -681,5 +681,22 @@ class grade_grade extends grade_object {
 
         return array('unknown'=>$unknown, 'altered'=>$altered);
     }
+
+    /**
+     * Returns true if the grade's value is superior or equal to the grade item's gradepass value, false otherwise.
+     * @param object $grade_item An optional grade_item of which gradepass value we can use, saves having to load the grade_grade's grade_item
+     * @return boolean
+     */
+    function is_passed($grade_item = null) {
+        if (empty($grade_item)) {
+            if (!isset($this->grade_item)) {
+                $this->load_grade_item();
+            }
+        } else {
+            $this->grade_item = $grade_item;
+            $this->itemid = $grade_item->id;
+        }
+        return $this->finalgrade >= $this->grade_item->gradepass;
+    }
 }
 ?>