echo "<td align=center width=60%>";
echo "<b>";
+
+ $menu["-1"] = get_string("allcategories","glossary");
+ $menu["0"] = get_string("nocategorized","glossary");
+
+ $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
+ if ( $categories ) {
+ foreach ($categories as $currentcategory) {
+ $url = $currentcategory->id;
+ if ( $category ) {
+ if ($currentcategory->id == $category->id) {
+ $selected = $url;
+ }
+ }
+ $menu[$url] = $currentcategory->name;
+ }
+ }
+ if ( !$selected ) {
+ $selected = "0";
+ }
+
if ( $category ) {
echo $category->name;
} else {
if ( $cat < 0 ) {
- echo get_string("entrieswithoutcategory","glossary");
+ echo get_string("allcategories","glossary");
$selected = "-1";
} elseif ( $cat == 0 ) {
- echo get_string("allcategories","glossary");
+ echo get_string("entrieswithoutcategory","glossary");
$selected = "0";
}
}
echo "</b></td>";
echo "<td align=center width=20%>";
- $menu["0"] = get_string("allcategories","glossary");
- $menu["-1"] = get_string("nocategorized","glossary");
-// $menu[""] = "-----------------------------------------";
-
- $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
- if ( $categories ) {
- foreach ($categories as $currentcategory) {
- $url = $currentcategory->id;
- if ($currentcategory->id == $category->id) {
- $selected = $url;
- }
- $menu[$url] = $currentcategory->name;
- }
- }
echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id¤tview=categories&cat=", $menu, "catmenu", $selected, "",
"", "", false);
$allentries = glossary_search_entries($searchterms, $glossary, $includedefinition);
} elseif ( $eid ) { // looking for an entry
$allentries = get_records("glossary_entries", "id", $eid);
- } elseif ( $currentview and $cat == 0 ) { // Browsing all categories
+ } elseif ( $currentview and $cat == -1 ) { // Browsing all categories
$sql = "SELECT gec.id gecid, gc.name, gc.id CID, ge.*
FROM {$CFG->prefix}glossary_entries ge,
{$CFG->prefix}glossary_entries_categories gec,