error("Course module is incorrect");
}
+if ($CFG->dbtype == 'postgres7' ) {
+ $ucase = 'upper';
+} else {
+ $ucase = 'ucase';
+}
+
if (!$glossary->studentcanpost && !isteacher($glossary->course)) {
error("You can't add/edit entries to this glossary!");
}
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
- if ($dupentries = get_records("glossary_entries","UCASE(concept)", strtoupper($newentry->concept))) {
+ if ($dupentries = get_records("glossary_entries","$ucase(concept)", strtoupper($newentry->concept))) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $e ) {
$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","$ucase(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
$permissiongranted = 0;
}
}
$PermissionGranted = 0;
}
}
+
+ if ($CFG->dbtype == 'postgres7' ) {
+ $ucase = 'upper';
+ } else {
+ $ucase = 'ucase';
+ }
if ( !isteacher($cm->course) ) {
$PermissionGranted = 0;
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
- $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
+ $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "$ucase(concept)",strtoupper($entry->concept));
if ( $dupentry ) {
$PermissionGranted = 0;
}
if ( $newentry->casesensitive ) {
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
} else {
- $dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ if ($CFG->dbtype == 'postgres7') {
+ $dupentry = get_record("glossary_entries","upper(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ }else {
+ $dupentry = get_record("glossary_entries","ucase(concept)",strtoupper($newentry->concept),"glossaryid",$glossary->id);
+ }
}
if ($dupentry) {
$permissiongranted = 0;
} else {
$usernamefield = "u.lastname || ' ' || u.firstname";
}
- $where = "AND substr(ucase($usernamefield),1," . strlen($hook) . ") = '" . strtoupper($hook) . "'";
+ $where = "AND substr(upper($usernamefield),1," . strlen($hook) . ") = '" . strtoupper($hook) . "'";
break;
case 'mysql':
if ( $sqlsortkey == 'FIRSTNAME' ) {
if ($hook != 'ALL' and $hook != 'SPECIAL') {
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+ $where = 'AND substr(upper(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '$hook'";
if ($hook != 'ALL' and $hook != 'SPECIAL') {
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
+ $where = 'AND substr(upper(concept),1,' . strlen($hook) . ') = \'' . strtoupper($hook) . '\'';
break;
case 'mysql':
$where = 'AND left(ucase(concept),' . strlen($hook) . ") = '" . strtoupper($hook) . "'";
}
switch ($CFG->dbtype) {
case 'postgres7':
- $where = 'AND substr(ucase(concept),1,1) NOT IN (' . strtoupper($sqlalphabet) . ')';
+ $where = 'AND substr(upper(concept),1,1) NOT IN (' . strtoupper($sqlalphabet) . ')';
break;
case 'mysql':
$where = 'AND left(ucase(concept),1) NOT IN (' . strtoupper($sqlalphabet) . ')';