Some defaults applied to paramenters was preventing defaults based

on formats to work properly.
This commit is contained in:
stronk7
2006-04-09 10:45:14 +00:00
parent 2cf1011b25
commit f7f735b877
2 changed files with 22 additions and 8 deletions
+4 -6
View File
@@ -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
+18 -2
View File
@@ -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';