]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #6087 - alphabetic problem in glossary; merged from MOODLE_16_STABLE
authorskodak <skodak>
Wed, 12 Jul 2006 20:29:18 +0000 (20:29 +0000)
committerskodak <skodak>
Wed, 12 Jul 2006 20:29:18 +0000 (20:29 +0000)
mod/glossary/sql.php

index 1d9a8228607c08c6221c167390763f4c7645186a..cfa9dc38faf7f6eb5ca85b8deed2e7e240988775 100644 (file)
@@ -12,6 +12,7 @@
 /// Initialise some variables
     $sqlorderby = '';
     $sqlsortkey = NULL;
+    $textlib = textlib_get_instance();
 
 /// Pivot is the field that set the break by groups (category, initial, author name, etc)
 
@@ -94,7 +95,7 @@
             } else {
                 $usernamefield = "u.lastname || ' ' || u.firstname";
             }
-            $where = "AND substr(upper($usernamefield),1," .  strlen($hook) . ") = '" . strtoupper($hook) . "'";
+            $where = "AND substr(upper($usernamefield),1," .  $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'";
         break;
         case 'mysql':
             if ( $sqlsortkey == 'FIRSTNAME' ) {
             } else {
                 $usernamefield = "CONCAT(CONCAT(u.lastname,' '), u.firstname)";
             }
-            $where = "AND left(ucase($usernamefield)," .  strlen($hook) . ") = '$hook'";
+            $where = "AND left(ucase($usernamefield)," .  $textlib->strlen($hook, current_charset()) . ") = '$hook'";
         break;
         }
         if ( $hook == 'ALL' ) {
         if ($hook != 'ALL' and $hook != 'SPECIAL') {
             switch ($CFG->dbtype) {
             case 'postgres7':
-                $where = 'AND substr(upper(concept),1,' .  strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+                $where = 'AND substr(upper(concept),1,' .  $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
             break;
             case 'mysql':
-                $where = 'AND left(ucase(concept),' .  strlen($hook) . ") = '$hook'";
+                $where = 'AND left(ucase(concept),' .  $textlib->strlen($hook, current_charset()) . ") = '$hook'";
             break;
             }
         }
             if ($hook != 'ALL' and $hook != 'SPECIAL') {
                 switch ($CFG->dbtype) {
                 case 'postgres7':
-                    $where = 'AND substr(upper(concept),1,' .  strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+                    $where = 'AND substr(upper(concept),1,' .  $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
                 break;
                 case 'mysql':
-                    $where = 'AND left(ucase(concept),' .  strlen($hook) . ") = '" . strtoupper($hook) . "'";
+                    $where = 'AND left(ucase(concept),' .  $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'";
                 break;
                 }
             }
                 }
                 switch ($CFG->dbtype) {
                 case 'postgres7':
-                    $where = 'AND substr(upper(concept),1,1) NOT IN (' . strtoupper($sqlalphabet) . ')';
+                    $where = 'AND substr(upper(concept),1,1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')';
                 break;
                 case 'mysql':
-                    $where = 'AND left(ucase(concept),1) NOT IN (' . strtoupper($sqlalphabet) . ')';
+                    $where = 'AND left(ucase(concept),1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')';
                 break;
                 }
             }
         break;
         }    
     }
-
     $allentries = get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby $sqllimit");
-
 ?>