]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12397, gradebook sort by names should start with ASC
authortoyomoyo <toyomoyo>
Mon, 3 Dec 2007 02:03:38 +0000 (02:03 +0000)
committertoyomoyo <toyomoyo>
Mon, 3 Dec 2007 02:03:38 +0000 (02:03 +0000)
grade/report/grader/lib.php

index b927977297322adadbd6b8ecc2b370839d47f597..d01e8ca059e4a3482ee0fef32f771a644817f105 100644 (file)
@@ -227,11 +227,19 @@ class grade_report_grader extends grade_report {
 
         if ($this->sortitemid) {
             if (!isset($SESSION->gradeuserreport->sort)) {
-                $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') {
+                    $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
+                } else {
+                    $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                }
             } else {
                 // this is the first sort, i.e. by last name
                 if (!isset($SESSION->gradeuserreport->sortitemid)) {
-                    $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                    if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') {
+                        $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';    
+                    } else {
+                        $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                    }
                 } else if ($SESSION->gradeuserreport->sortitemid == $this->sortitemid) {
                     // same as last sort
                     if ($SESSION->gradeuserreport->sort == 'ASC') {
@@ -240,7 +248,11 @@ class grade_report_grader extends grade_report {
                         $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
                     }
                 } else {
-                    $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                    if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') {
+                        $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
+                    } else {
+                        $this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
+                    }
                 }
             }
             $SESSION->gradeuserreport->sortitemid = $this->sortitemid;