Skip to content
Browse files

- Not Categorized is now the default view for category tab.

  • Loading branch information...
1 parent 60c3f4e commit 3122e8f391553d45b88ff683e51b763533e08017 willcast committed
Showing with 23 additions and 17 deletions.
  1. +22 −16 mod/glossary/lib.php
  2. +1 −1 mod/glossary/view.php
View
38 mod/glossary/lib.php
@@ -711,33 +711,39 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
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&currentview=categories&cat=", $menu, "catmenu", $selected, "",
"", "", false);
View
2 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,

0 comments on commit 3122e8f

Please sign in to comment.
Something went wrong with that request. Please try again.