Permalink
Browse files

Some defaults applied to paramenters was preventing defaults based

on formats to work properly.
  • Loading branch information...
1 parent 2cf1011 commit f7f735b877f8f72a2f558e01ac087f83211241d1 stronk7 committed Apr 9, 2006
Showing with 22 additions and 8 deletions.
  1. +4 −6 mod/glossary/tabs.html
  2. +18 −2 mod/glossary/view.php
View
@@ -44,15 +44,13 @@
$hiddenentries = get_records_select("glossary_entries","glossaryid = $glossary->id and approved = 0");
if ($hiddenentries) {
$data[GLOSSARY_APPROVAL_VIEW]->caption .= " (" . count($hiddenentries) . " " . get_string("entries","glossary") . ")";
- $data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_APPROVAL_VIEW;
-
$data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&mode=approval";
- } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- $tab = $framebydefault;
+ } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { //Teachers going to approval view and without entries->go to defaulttab
+ $tab = $defaulttab;
}
- } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- $tab = $framebydefault;
+ } elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) { //Non-teachers going to approval view go to defaulttab
+ $tab = $defaulttab;
}
/// printing header of the current tab
View
@@ -10,8 +10,8 @@
$tab = optional_param('tab', GLOSSARY_NO_VIEW, PARAM_ALPHA); // browsing entries by categories?
$displayformat = optional_param('displayformat',-1, PARAM_INT); // override of the glossary display format
- $mode = optional_param('mode', 'approval', PARAM_ALPHA); // term entry cat date letter search author approval
- $hook = optional_param('hook', 'ALL', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode
+ $mode = optional_param('mode', '', PARAM_ALPHA); // term entry cat date letter search author approval
+ $hook = optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode
$fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching?
$sortkey = optional_param('sortkey', 'CREATION', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
$sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC)
@@ -70,6 +70,21 @@
/// setting the default values for the display mode of the current glossary
/// only if the glossary is viewed by the first time
if ( $dp = get_record('glossary_formats','name', addslashes($glossary->displayformat)) ) {
+ /// Based on format->defaultmode, we build the defaulttab to be showed sometimes
+ switch ($dp->defaultmode) {
+ case 'cat':
+ $defaulttab = GLOSSARY_CATEGORY_VIEW;
+ break;
+ case 'date':
+ $defaulttab = GLOSSARY_DATE_VIEW;
+ break;
+ case 'author':
+ $defaulttab = GLOSSARY_AUTHOR_VIEW;
+ break;
+ default:
+ $defaulttab = GLOSSARY_STANDARD_VIEW;
+ }
+ /// Fetch the rest of variables
$printpivot = $dp->showgroup;
if ( $mode == '' and $hook == '' and $show == '') {
$mode = $dp->defaultmode;
@@ -78,6 +93,7 @@
$sortorder = $dp->sortorder;
}
} else {
+ $defaulttab = GLOSSARY_STANDARD_VIEW;
$printpivot = 1;
if ( $mode == '' and $hook == '' and $show == '') {
$mode = 'letter';

0 comments on commit f7f735b

Please sign in to comment.