Skip to content

Commit

Permalink
MDL-47146 core_grades: fix class names
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marinaglancy authored and abgreeve committed Oct 3, 2014
1 parent b4087c3 commit ddb9c95
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion grade/edit/tree/index.php
Expand Up @@ -232,7 +232,7 @@
$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];
}
}
Expand Down
2 changes: 1 addition & 1 deletion grade/edit/tree/lib.php
Expand Up @@ -477,7 +477,7 @@ function move_elements($eids, $returnurl) {
$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);
}

Expand Down
14 changes: 7 additions & 7 deletions grade/lib.php
Expand Up @@ -1427,7 +1427,7 @@ public function get_grade_eid($grade_grade) {
* @return string eid
*/
public function get_item_eid($grade_item) {
return 'i'.$grade_item->id;
return 'ig'.$grade_item->id;
}

/**
Expand Down Expand Up @@ -1818,7 +1818,7 @@ public function locate_element($eid) {
$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;
}

Expand All @@ -1834,7 +1834,7 @@ public function locate_element($eid) {
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!
Expand Down Expand Up @@ -2032,9 +2032,9 @@ public function fill_levels(&$levels, &$element, $depth) {

// 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'];
}

Expand Down Expand Up @@ -2138,7 +2138,7 @@ public function locate_element($eid) {
$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;
}

Expand All @@ -2154,7 +2154,7 @@ public function locate_element($eid) {
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!
Expand Down

0 comments on commit ddb9c95

Please sign in to comment.