From: willcast Date: Thu, 18 Sep 2003 23:36:06 +0000 (+0000) Subject: - Initial changes to categorize the entries.. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0a855df8f08eee2748ed7f6270c59a3ff03859a4;p=moodle.git - Initial changes to categorize the entries.. - A new function in lib that perhaps could be used in other modules: print_tabbed_table_start and print_tabbed_table_end --- diff --git a/mod/glossary/view.php b/mod/glossary/view.php index d2b864a27d..2b5119dda4 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -12,9 +12,24 @@ 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)); @@ -133,6 +148,29 @@ 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¤tview=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 "
"; + if ( $cat ) { + echo "$category->name
"; + } /// Printing the entries if ( $search ) { // looking for a term @@ -154,17 +192,17 @@ $CurrentLetter = $FirstLetter; if ( $glossary->displayformat == 0 ) { - if ( $DumpedDefinitions != 1) { + if ( $DumpedDefinitions > 0) { echo "

"; } - echo "\n

cellheading\">"; + echo "\n
cellheading2\">"; } - echo $CurrentLetter; + echo "$CurrentLetter"; if ( $glossary->displayformat == 0 ) { - echo "\n
"; - if ( $DumpedDefinitions != 1) { - echo "\n
"; + echo "\n
"; + if ( $DumpedDefinitions > 0) { + echo "\n
"; } } } @@ -184,7 +222,7 @@ if ( $DumpedDefinitions == 1 ) { if ( $glossary->displayformat == 0 ) { - echo "\n
"; + echo "\n
"; } } if ($search) { @@ -193,7 +231,7 @@ } glossary_print_entry($course, $cm, $glossary, $entry); - if ( $glossary->displayformat != 0 ) { + if ( $glossary->displayformat != 0 ) { echo "

"; } } @@ -215,6 +253,9 @@ } } + echo ""; + print_tabbed_table_end(); + /// Finish the page print_footer($course);