Skip to content

Commit

Permalink
MDL-11715, export form should follow sortorder
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Oct 12, 2007
1 parent 0741bdc commit 3ffbc9a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion grade/export/grade_export_form.php
Expand Up @@ -114,7 +114,19 @@ function definition() {

$mform->addElement('header', 'gradeitems', get_string('gradeitemsinc', 'grades'));

if ($grade_items = grade_item::fetch_all(array('courseid'=>$COURSE->id))) {
if ($all_grade_items = grade_item::fetch_all(array('courseid'=>$COURSE->id))) {
// follow proper sort order, MDL-11715
$grade_items = array();
foreach ($all_grade_items as $item) {
$grade_items[$item->sortorder] = $item;
}
unset($all_grade_items);
ksort($grade_items);

// Put course total at the end
$total = $grade_items[1];
unset($grade_items[1]);
$grade_items[] = $total;
foreach ($grade_items as $grade_item) {
if (!empty($features['idnumberrequired']) and empty($grade_item->idnumber)) {
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), get_string('noidnumber', 'grades'));
Expand Down

0 comments on commit 3ffbc9a

Please sign in to comment.