Now lcase() and ucase() are out from glossary

This commit is contained in:
stronk7 2006-10-30 18:01:10 +00:00
parent a91960b30f
commit 0db568393d
4 changed files with 8 additions and 24 deletions

View File

@ -32,12 +32,6 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
}
if ($CFG->dbtype == 'postgres7' ) {
$lcase = 'lower';
} else {
$lcase = 'lcase';
}
if ($e) { // if entry is sepcified
require_capability('mod/glossary:manageentries', $context);
} else { // new entry
@ -139,7 +133,7 @@ if ( $confirm ) {
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
if ($dupentries = get_records("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept))) {
if ($dupentries = get_records("glossary_entries","lower(concept)", moodle_strtolower($newentry->concept))) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $e ) {
@ -179,7 +173,7 @@ if ( $confirm ) {
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
if ($dupentries = get_record("glossary_entries","$lcase(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) {
if ($dupentries = get_record("glossary_entries","lower(concept)", moodle_strtolower($newentry->concept), "glossaryid", $glossary->id)) {
$permissiongranted = 0;
}
}

View File

@ -23,12 +23,6 @@
}
}
if ($CFG->dbtype == 'postgres7' ) {
$lcase = 'lower';
} else {
$lcase = 'lcase';
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/glossary:export', $context);
@ -61,7 +55,7 @@
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, $lcase.'(concept)',moodle_strtolower(addslashes($entry->concept)));
$dupentry = get_record('glossary_entries','glossaryid', $mainglossary->id, 'lower(concept)',moodle_strtolower(addslashes($entry->concept)));
if ( $dupentry ) {
$PermissionGranted = 0;
}

View File

@ -226,11 +226,7 @@
if ( $newentry->casesensitive ) {
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
} else {
if ($CFG->dbtype == 'postgres7') {
$dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
}else {
$dupentry = get_record("glossary_entries","lcase(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
}
$dupentry = get_record("glossary_entries","lower(concept)",moodle_strtolower($newentry->concept),"glossaryid",$glossary->id);
}
if ($dupentry) {
$permissiongranted = 0;

View File

@ -95,7 +95,7 @@
} else {
$usernamefield = sql_fullname('u.lastname' , 'u.firsttname');
}
$where = "AND left(ucase($usernamefield)," . $textlib->strlen($hook, current_charset()) . ") = '$hook'";
$where = "AND left(upper($usernamefield)," . $textlib->strlen($hook, current_charset()) . ") = '$hook'";
break;
}
if ( $hook == 'ALL' ) {
@ -121,7 +121,7 @@
$where = 'AND substr(upper(concept),1,' . $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . $textlib->strlen($hook, current_charset()) . ") = '$hook'";
$where = 'AND left(upper(concept),' . $textlib->strlen($hook, current_charset()) . ") = '$hook'";
break;
}
}
@ -251,7 +251,7 @@
$where = 'AND substr(upper(concept),1,' . $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'";
$where = 'AND left(upper(concept),' . $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'";
break;
}
}
@ -270,7 +270,7 @@
$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 (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')';
$where = 'AND left(upper(concept),1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')';
break;
}
}