]> git.mjollnir.org Git - moodle.git/commitdiff
- Not Categorized is now the default view for category tab.
authorwillcast <willcast>
Mon, 29 Sep 2003 13:44:07 +0000 (13:44 +0000)
committerwillcast <willcast>
Mon, 29 Sep 2003 13:44:07 +0000 (13:44 +0000)
mod/glossary/lib.php
mod/glossary/view.php

index 91f07af166f9687fdcc011a69a595179954a5cb0..9b00916df945ba5ad2806ade247b7f3ca651c149 100644 (file)
@@ -711,33 +711,39 @@ global $CFG, $THEME;
 
      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);
index 10bf3d280bb3121f498d322ddda1626544d19a32..72e45d1ff6ea3e88248b41f53a4688d355ac1128 100644 (file)
                $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,