From: stronk7 Date: Sat, 24 Mar 2007 00:58:43 +0000 (+0000) Subject: Fix a problem with glossary not being able to sort by firstname. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=572889f194929c2a18bc574e9154216beb6bcad9;p=moodle.git Fix a problem with glossary not being able to sort by firstname. Merged from MOODLE_18_STABLE --- diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 7f59a5587e..75279803fd 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -14,22 +14,28 @@ $sqlsortkey = NULL; $textlib = textlib_get_instance(); +/// Calculate the SQL sortkey to be used by the SQL statements later + switch ( $sortkey ) { + case "CREATION": + $sqlsortkey = "timecreated"; + break; + case "UPDATE": + $sqlsortkey = "timemodified"; + break; + case "FIRSTNAME": + $sqlsortkey = "firstname"; + break; + case "LASTNAME": + $sqlsortkey = "lastname"; + break; + } + $sqlsortorder = $sortorder; + /// Pivot is the field that set the break by groups (category, initial, author name, etc) /// fullpivot indicate if the whole pivot should be compared agasint the db or just the first letter /// printpivot indicate if the pivot should be printed or not - switch ( $sortkey ) { - case "CREATION": - $sqlsortkey = "timecreated"; - break; - - case "UPDATE": - $sqlsortkey = "timemodified"; - break; - } - $sqlsortorder = $sortorder; - $fullpivot = 1; $userid = ''; @@ -80,7 +86,7 @@ $where = ''; - if ( $sqlsortkey == 'FIRSTNAME' ) { + if ( $sqlsortkey == 'firstname' ) { $usernamefield = sql_fullname('u.firstname' , 'u.lastname'); } else { $usernamefield = sql_fullname('u.lastname' , 'u.firstname');