]> git.mjollnir.org Git - moodle.git/commitdiff
- Initial changes to categorize the entries..
authorwillcast <willcast>
Thu, 18 Sep 2003 23:36:06 +0000 (23:36 +0000)
committerwillcast <willcast>
Thu, 18 Sep 2003 23:36:06 +0000 (23:36 +0000)
- A new function in lib that perhaps could be used in other modules:
   print_tabbed_table_start and print_tabbed_table_end

mod/glossary/view.php

index d2b864a27da7b552e7b2c5746b4fe3c24dd33eb2..2b5119dda49552fa16aec31bd5b1fc149e8491aa 100644 (file)
     optional_variable($search, "");  // search string
     optional_variable($includedefinition);  // include definition in search function?
 
+    optional_variable($currentview);  // browsing entries by categories?
+    optional_variable($cat);  // categoryID
+
     if ($l == "" and $search == "" and $eid == "") {
                $l = "A";
     }
+    
+    if ( $currentview ) {
+          $currentview = strtolower($currentview);
+          if ( !$currentview ) {
+               $currentview = "";
+          } else {
+               if ( !$cat ) {
+                    $cat = 1;
+               }
+               $category = get_record("glossary_categories","id",$cat);
+          }
+    }
 
     $search = trim(strip_tags($search));
 
                echo get_string("search") . ": $search";
        }
 
+     $data[0]->link = "view.php?id=$id&l=$l&eid=$eid&search=$search&includedefinition=$includedefinition";
+     $data[0]->caption = get_string("standardview","glossary");
+     
+     $data[1]->link = "view.php?id=$id&l=$l&eid=$eid&search=$search&includedefinition=$includedefinition&currentview=categories&cat=$cat";
+     $data[1]->caption = get_string("categoryview","glossary");
+     
+     $tCFG->TabTableBGColor = $THEME->cellcontent2;
+     $tCFG->TabTableWidth = "70%";
+     $tCFG->ActiveTabColor = $THEME->cellcontent2;
+     $tCFG->InactiveTabColor = $THEME->cellheading2;
+     $tCFG->TabsPerRow = 5;
+     $tCFG->TabSeparation = 4;
+     
+     if ( $cat ) {
+          $CurrentTab = 1;
+     } else {
+          $CurrentTab = 0;
+     }
+     print_tabbed_table_start($data, $CurrentTab, $tCFG);
+     echo "<center>";
+     if ( $cat ) {
+          echo "<b>$category->name</b><hr>";
+     }
 /// Printing the entries
 
        if ( $search ) {        // looking for a term
                          $CurrentLetter = $FirstLetter;
 
                            if ( $glossary->displayformat == 0 ) {
-                               if ( $DumpedDefinitions != 1) {
+                               if ( $DumpedDefinitions > 0) {
                                    echo "</table></center><p>";
                                }
-                               echo "\n<center><TABLE BORDER=0 CELLSPACING=0 width=70% valign=top cellpadding=10><tr><td align=center BGCOLOR=\"$THEME->cellheading\"><b>";
+                               echo "\n<center><TABLE BORDER=0 CELLSPACING=0 width=95% valign=top cellpadding=10><tr><td align=center BGCOLOR=\"$THEME->cellheading2\">";
                            }
-                           echo $CurrentLetter;
+                           echo "<b>$CurrentLetter</b>";
 
                            if ( $glossary->displayformat == 0 ) {
-                               echo "\n</b></center></td></tr></TABLE></center>";
-                               if ( $DumpedDefinitions != 1) {
-                                       echo "\n<center><TABLE BORDER=1 CELLSPACING=0 width=70% valign=top cellpadding=10>";
+                               echo "\n</center></td></tr></TABLE></center>";
+                               if ( $DumpedDefinitions > 0) {
+                                       echo "\n<center><TABLE BORDER=1 CELLSPACING=0 width=95% valign=top cellpadding=10>";
                                }
                            }
                        }
 
                  if ( $DumpedDefinitions == 1 ) {
                         if ( $glossary->displayformat == 0 ) {
-                           echo "\n<center><TABLE BORDER=1 CELLSPACING=0 width=70% valign=top cellpadding=10>";
+                           echo "\n<center><TABLE BORDER=1 CELLSPACING=0 width=95% valign=top cellpadding=10>";
                         }
                  }
                  if ($search) {
                  }
                     glossary_print_entry($course, $cm, $glossary, $entry);
 
-                                if ( $glossary->displayformat != 0 ) {
+                 if ( $glossary->displayformat != 0 ) {
                        echo "<p>";
                  }
             }
            }
        }
 
+     echo "</center>";
+     print_tabbed_table_end();
+
 /// Finish the page
     print_footer($course);