MDL-47146 core_grades: fix class names
authorMarina Glancy <marina@moodle.com>
Mon, 22 Sep 2014 04:37:37 +0000 (12:37 +0800)
committerAdrian Greeve <adrian@moodle.com>
Fri, 3 Oct 2014 05:54:38 +0000 (13:54 +0800)
Class names for grade categories were the same as for the columns in the table causing errors
when selecting All/None items

Part of: MDL-46576

grade/edit/tree/index.php
grade/edit/tree/lib.php
grade/lib.php

index 56eedf0..dcecfa7 100644 (file)
@@ -232,7 +232,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
         $elements = array();
 
         foreach ($data as $key => $value) {
-            if (preg_match('/select_(i[0-9]*)/', $key, $matches)) {
+            if (preg_match('/select_(ig[0-9]*)/', $key, $matches)) {
                 $elements[] = $matches[1];
             }
         }
index 0837e9c..3710f23 100644 (file)
@@ -477,7 +477,7 @@ class grade_edit_tree {
             $eids = array($eids);
         }
 
-        if(!$after_el = $this->gtree->locate_element("c$moveafter")) {
+        if(!$after_el = $this->gtree->locate_element("cg$moveafter")) {
             print_error('invalidelementid', '', $returnurl);
         }
 
index 1952522..b2a58c1 100644 (file)
@@ -1427,7 +1427,7 @@ class grade_structure {
      * @return string eid
      */
     public function get_item_eid($grade_item) {
-        return 'i'.$grade_item->id;
+        return 'ig'.$grade_item->id;
     }
 
     /**
@@ -1818,7 +1818,7 @@ class grade_seq extends grade_structure {
             $userid = $matches[2];
 
             //extra security check - the grade item must be in this tree
-            if (!$item_el = $this->locate_element('i'.$itemid)) {
+            if (!$item_el = $this->locate_element('ig'.$itemid)) {
                 return null;
             }
 
@@ -1834,7 +1834,7 @@ class grade_seq extends grade_structure {
                 return null;
             }
             //extra security check - the grade item must be in this tree
-            if (!$item_el = $this->locate_element('i'.$grade->itemid)) {
+            if (!$item_el = $this->locate_element('ig'.$grade->itemid)) {
                 return null;
             }
             $grade->grade_item =& $item_el['object']; // this may speedup grade_grade methods!
@@ -2032,9 +2032,9 @@ class grade_tree extends grade_structure {
 
         // prepare unique identifier
         if ($element['type'] == 'category') {
-            $element['eid'] = 'c'.$element['object']->id;
+            $element['eid'] = 'cg'.$element['object']->id;
         } else if (in_array($element['type'], array('item', 'courseitem', 'categoryitem'))) {
-            $element['eid'] = 'i'.$element['object']->id;
+            $element['eid'] = 'ig'.$element['object']->id;
             $this->items[$element['object']->id] =& $element['object'];
         }
 
@@ -2138,7 +2138,7 @@ class grade_tree extends grade_structure {
             $userid = $matches[2];
 
             //extra security check - the grade item must be in this tree
-            if (!$item_el = $this->locate_element('i'.$itemid)) {
+            if (!$item_el = $this->locate_element('ig'.$itemid)) {
                 return null;
             }
 
@@ -2154,7 +2154,7 @@ class grade_tree extends grade_structure {
                 return null;
             }
             //extra security check - the grade item must be in this tree
-            if (!$item_el = $this->locate_element('i'.$grade->itemid)) {
+            if (!$item_el = $this->locate_element('ig'.$grade->itemid)) {
                 return null;
             }
             $grade->grade_item =& $item_el['object']; // this may speedup grade_grade methods!