$GLOSSARY_CONCEPT_IS_ENTRY = 0;
$GLOSSARY_CONCEPT_IS_CATEGORY = 1;
+ switch ($CFG->dbtype) {
+ case 'postgres7':
+ $as = 'as';
+ break;
+ case 'mysql':
+ $as = '';
+ break;
+ }
$glossarieslist = get_records_select("glossary", "usedynalink != 0 and (course = $courseid or globalglossary != 0)","globalglossary, id");
if ( $glossarieslist ) {
break;
}
- $entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink != 0 and approved != 0 and concept != ''","$ebylenght glossaryid","id,glossaryid, concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
- $categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries) AND usedynalink != 0", "$cbylenght glossaryid","id,glossaryid, name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
+ $entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink != 0 and approved != 0 and concept != ''","$ebylenght glossaryid","id,glossaryid, concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY $as category,fullmatch");
+ $categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries) AND usedynalink != 0", "$cbylenght glossaryid","id,glossaryid, name $as concept, 1 $as casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY $as category, 1 $as fullmatch");
if ( $entries and $categories ) {
$concepts = array_merge($entries, $categories);
usort($concepts,'glossary_sort_entries_by_lenght');
/// fullpivot indicate if the whole pivot should be compared agasint the db or just the first letter
/// printpivot indicate if the pivot should be printed or not
+ switch ($CFG->dbtype) {
+ case 'postgres7':
+ $as = 'as';
+ break;
+ case 'mysql':
+ $as = '';
+ break;
+ }
+
switch ( $sortkey ) {
case "CREATION":
$sqlsortkey = "timecreated";
case GLOSSARY_CATEGORY_VIEW:
if ($hook == GLOSSARY_SHOW_ALL_CATEGORIES ) {
- $sqlselect = "SELECT gec.id, gc.name pivot, ge.*";
+ $sqlselect = "SELECT gec.id, gc.name $as pivot, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge,
{$CFG->prefix}glossary_entries_categories gec,
{$CFG->prefix}glossary_categories gc";
} elseif ($hook == GLOSSARY_SHOW_NOT_CATEGORISED ) {
$printpivot = 0;
- $sqlselect = "SELECT concept pivot, ge.*";
+ $sqlselect = "SELECT concept $as pivot, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge";
$sqlwhere = "WHERE (glossaryid = '$glossary->id' OR sourceglossaryid = '$glossary->id') AND
(ge.approved != 0 $userid)";
} else {
$printpivot = 0;
- $sqlselect = "SELECT ce.id, c.name pivot, ge.*";
+ $sqlselect = "SELECT ce.id, c.name $as pivot, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories ce, {$CFG->prefix}glossary_categories c";
$sqlwhere = "WHERE ge.id = ce.entryid AND ce.categoryid = $hook AND
ce.categoryid = c.id AND ge.approved != 0 AND
$where = '';
}
- $sqlselect = "SELECT ge.id, $usernamefield pivot, u.id uid, ge.*";
+ $sqlselect = "SELECT ge.id, $usernamefield $as pivot, u.id uid, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}user u";
$sqlwhere = "WHERE ge.userid = u.id AND
(ge.approved != 0 $userid)
}
}
- $sqlselect = "SELECT ge.concept pivot, ge.*";
+ $sqlselect = "SELECT ge.concept $as pivot, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge";
$sqlwhere = "WHERE (ge.glossaryid = $glossary->id OR ge.sourceglossaryid = $glossary->id) AND
ge.approved = 0 $where";
case GLOSSARY_DATE_VIEW:
case GLOSSARY_STANDARD_VIEW:
default:
- $sqlselect = "SELECT ge.concept pivot, ge.*";
+ $sqlselect = "SELECT ge.concept $as pivot, ge.*";
$sqlfrom = "FROM {$CFG->prefix}glossary_entries ge";
$where = '';