mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup; merged from MOODLE_16_STABLE
This commit is contained in:
parent
36259d1bd3
commit
95d5682927
@ -31,9 +31,9 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) {
|
||||
}
|
||||
|
||||
if ($CFG->dbtype == 'postgres7' ) {
|
||||
$ucase = 'upper';
|
||||
$lcase = 'lower';
|
||||
} else {
|
||||
$ucase = 'ucase';
|
||||
$lcase = 'lcase';
|
||||
}
|
||||
|
||||
if (!$glossary->studentcanpost && !isteacher($glossary->course)) {
|
||||
@ -132,7 +132,7 @@ if ( $confirm ) {
|
||||
|
||||
$permissiongranted = 1;
|
||||
if ( !$glossary->allowduplicatedentries ) {
|
||||
if ($dupentries = get_records("glossary_entries","$ucase(concept)", strtoupper($newentry->concept))) {
|
||||
if ($dupentries = get_records("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept))) {
|
||||
foreach ($dupentries as $curentry) {
|
||||
if ( $glossary->id == $curentry->glossaryid ) {
|
||||
if ( $curentry->id != $e ) {
|
||||
@ -172,7 +172,7 @@ if ( $confirm ) {
|
||||
|
||||
$permissiongranted = 1;
|
||||
if ( !$glossary->allowduplicatedentries ) {
|
||||
if ($dupentries = get_record("glossary_entries","$ucase(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
|
||||
if ($dupentries = get_record("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) {
|
||||
$permissiongranted = 0;
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
}
|
||||
|
||||
if ($CFG->dbtype == 'postgres7' ) {
|
||||
$ucase = 'upper';
|
||||
$lcase = 'lower';
|
||||
} else {
|
||||
$ucase = 'ucase';
|
||||
$lcase = 'lcase';
|
||||
}
|
||||
|
||||
if ( !isteacher($cm->course) ) {
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
} else {
|
||||
if ( ! $mainglossary->allowduplicatedentries ) {
|
||||
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $ucase.'(concept)',strtoupper(addslashes($entry->concept)));
|
||||
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $lcase.'(concept)',moodle_strtolower(addslashes($entry->concept)));
|
||||
if ( $dupentry ) {
|
||||
$PermissionGranted = 0;
|
||||
}
|
||||
|
@ -227,9 +227,9 @@
|
||||
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
|
||||
} else {
|
||||
if ($CFG->dbtype == 'postgres7') {
|
||||
$dupentry = get_record("glossary_entries","upper(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
|
||||
$dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
|
||||
}else {
|
||||
$dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
|
||||
$dupentry = get_record("glossary_entries","lcase(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
|
||||
}
|
||||
}
|
||||
if ($dupentry) {
|
||||
|
@ -505,7 +505,7 @@ function glossary_get_entries_search($concept, $courseid) {
|
||||
$bypassteacher = 0; //This means YES
|
||||
}
|
||||
|
||||
$conceptupper = strtoupper(trim($concept));
|
||||
$conceptlower = moodle_strtolower(trim($concept));
|
||||
|
||||
return get_records_sql("SELECT e.*, g.name as glossaryname, cm.id as cmid, cm.course as courseid
|
||||
FROM {$CFG->prefix}glossary_entries e,
|
||||
@ -518,7 +518,7 @@ function glossary_get_entries_search($concept, $courseid) {
|
||||
(cm.course = '$courseid' AND cm.visible = $bypassteacher)) AND
|
||||
g.id = cm.instance AND
|
||||
e.glossaryid = g.id AND
|
||||
( (e.casesensitive != 0 AND UPPER(concept) = '$conceptupper') OR
|
||||
( (e.casesensitive != 0 AND LOWER(concept) = '$conceptlower') OR
|
||||
(e.casesensitive = 0 and concept = '$concept')) AND
|
||||
(g.course = '$courseid' OR g.globalglossary = 1) AND
|
||||
e.usedynalink != 0 AND
|
||||
@ -1495,9 +1495,10 @@ global $CFG;
|
||||
}
|
||||
|
||||
function glossary_sort_entries ( $entry0, $entry1 ) {
|
||||
if ( strtolower(ltrim($entry0->concept)) < strtolower(ltrim($entry1->concept)) ) {
|
||||
|
||||
if ( moodle_strtolower(ltrim($entry0->concept)) < moodle_strtolower(ltrim($entry1->concept)) ) {
|
||||
return -1;
|
||||
} elseif ( strtolower(ltrim($entry0->concept)) > strtolower(ltrim($entry1->concept)) ) {
|
||||
} elseif ( moodle_strtolower(ltrim($entry0->concept)) > moodle_strtolower(ltrim($entry1->concept)) ) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user