]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text...
authorskodak <skodak>
Sun, 30 Jul 2006 22:22:22 +0000 (22:22 +0000)
committerskodak <skodak>
Sun, 30 Jul 2006 22:22:22 +0000 (22:22 +0000)
mod/glossary/edit.php
mod/glossary/exportentry.php
mod/glossary/import.php
mod/glossary/lib.php

index aeadee0f9f816fd6559c25117f663a1b68f77fa4..6f5b9cfeedab10430a17dc9709d2b33608042536 100644 (file)
@@ -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;
             }
         }
index 88e9e0fdb619a054baca9fd95e4a4605a02e3ffa..6797bd9db5288d8427f46c278fc656ec0eee97ad 100644 (file)
@@ -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;
                 }
index 0285eda2fd061949e0f82ff32ebf7d0cc92272a3..dbd09c1e87e049cb473cc8b0e19d30a65293d945 100644 (file)
                         $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) {
index 35ee04efa34f666888f7413702f162f96216dc5d..39582c9e8fa16bfd031e7655666def0e6efb74ea 100644 (file)
@@ -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;