From 572889f194929c2a18bc574e9154216beb6bcad9 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 24 Mar 2007 00:58:43 +0000 Subject: [PATCH] Fix a problem with glossary not being able to sort by firstname. Merged from MOODLE_18_STABLE --- mod/glossary/sql.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) 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'); -- 2.39.5