From 0dafa92b4d742f15aa65997a4ae27396fd6b6fb8 Mon Sep 17 00:00:00 2001 From: willcast Date: Wed, 19 Nov 2003 17:36:00 +0000 Subject: [PATCH] - Case sensitive search when click on a letter, fixed. - Adding a display format manager. It controls the behavior of the display format when the user enter the glossary and when an auto-link is shown. - Adding support to the new fullname function. --- mod/glossary/view.php | 55 ++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 49adb9526d..ec29dcff7c 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -3,12 +3,12 @@ require_once("../../config.php"); require_once("lib.php"); $debug = 0; -// $CFG->startpagetime = microtime(); + $CFG->startpagetime = microtime(); require_variable($id); // Course Module ID optional_variable($tab,GLOSSARY_NO_VIEW); // browsing entries by categories? - optional_variable($mode,"letter"); // [ "term" | "entry" | "cat" | "date" | + optional_variable($mode,""); // [ "term" | "entry" | "cat" | "date" | // "letter" | "search" | "author" | "approval" ] optional_variable($hook,""); // the term, entry, cat, etc... to look for based on mode @@ -24,11 +24,6 @@ optional_variable($show,""); // [ concept | alias ] => mode=term hook=$show optional_variable($displayformat,-1); // override of the glossary display format - if ( $show ) { - $mode = 'term'; - $hook = $show; - $show = ''; - } if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); } @@ -51,11 +46,32 @@ $entriesbypage = $CFG->glossary_entbypage; } -/// setting the right fram for a "Continuous" glossary - if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) { +/// 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_displayformats","fid", $glossary->displayformat) ) { + $printpivot = $dp->showgroup; + if ( $mode == '' and $hook == '' and $show == '') { + $mode = $dp->defaultmode; + $hook = $dp->defaulthook; + $sortkey = $dp->sortkey; + $sortorder = $dp->sortorder; + } + } else { + $printpivot = 1; + } + + if ( $displayformat == -1 ) { + $displayformat = $glossary->displayformat; + } + if ( $displayformat == GLOSSARY_FORMAT_CONTINUOUS ) { $mode = 'date'; } + if ( $show ) { + $mode = 'term'; + $hook = $show; + $show = ''; + } /// Processing standard security processes $navigation = ""; if ($course->category) { @@ -98,6 +114,11 @@ case 'entry': /// Looking for a certain entry id $tab = GLOSSARY_STANDARD_VIEW; + if ( $dp = get_record("glossary_displayformats","fid", $glossary->displayformat) ) { + if ( $dp->relatedview >= 0 ) { + $displayformat = $dp->relatedview; + } + } break; case 'cat': /// Looking for a certain cat @@ -187,7 +208,7 @@ /// Info box if ( $glossary->intro ) { - echo '
'; + echo '
'; echo format_text($glossary->intro); print_simple_box_end(); } @@ -259,10 +280,6 @@ } echo $paging; - if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) { - $printpivot = 0; - } - foreach ($allentries as $entry) { /// Setting the pivot for the current entry $pivot = $entry->pivot; @@ -278,7 +295,7 @@ /// the letter we are look for. $showentry = 1; if ( $mode == 'letter' and $hook != 'SPECIAL' and $hook != 'ALL' ) { - if ( substr($entry->concept, 0, strlen($hook)) != $hook ) { + if ( strtoupper(substr($entry->concept, 0, strlen($hook))) != strtoupper($hook) ) { $showentry = 0; } } @@ -337,7 +354,7 @@ $user = get_record("user","id",$entry->uid); print_user_picture($user->id, $course->id, $user->picture); - $pivottoshow = $entry->uname; + $pivottoshow = fullname($user, isteacher($course->id));; } else { echo ''; } @@ -393,18 +410,18 @@ echo '

'; echo ''; glossary_print_tabbed_table_end(); - if ( $debug ) { + if ( $debug and isadmin() ) { echo '

'; print_simple_box("$sqlselect
$sqlfrom
$sqlwhere
$sqlorderby
$sqllimit","center","85%"); } /// Finish the page print_footer($course); -/* + if (isadmin()) { echo "

"; echo microtime_diff($CFG->startpagetime, microtime()); echo "

"; } -*/ + ?> \ No newline at end of file -- 2.39.5