Bug #6087 - alphabetic problem in glossary; merged from MOODLE_16_STABLE
This commit is contained in:
+9
-10
@@ -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' ) {
|
||||
@@ -102,7 +103,7 @@
|
||||
} 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' ) {
|
||||
@@ -125,10 +126,10 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -262,10 +263,10 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -281,10 +282,10 @@
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -320,7 +321,5 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$allentries = get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby $sqllimit");
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user