From 3122e8f391553d45b88ff683e51b763533e08017 Mon Sep 17 00:00:00 2001 From: willcast Date: Mon, 29 Sep 2003 13:44:07 +0000 Subject: [PATCH] - Not Categorized is now the default view for category tab. --- mod/glossary/lib.php | 38 ++++++++++++++++++++++---------------- mod/glossary/view.php | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 91f07af166..9b00916df9 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -711,33 +711,39 @@ global $CFG, $THEME; echo ""; echo ""; + + $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 ""; echo ""; - $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); diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 10bf3d280b..72e45d1ff6 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -137,7 +137,7 @@ $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, -- 2.39.5