From db87439af36e7a09afc077acd5b6e54d77b10983 Mon Sep 17 00:00:00 2001 From: willcast Date: Fri, 21 Nov 2003 02:50:08 +0000 Subject: [PATCH] - Fixing minor bugs... Nothing related with the problems the glossary is presenting right now in moodle.org... :( --- mod/glossary/lib.php | 2 +- mod/glossary/print.php | 11 ----------- mod/glossary/sql.php | 22 ++++++++++++++++------ mod/glossary/view.php | 26 +++++++------------------- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index cb989f16ba..558f59413b 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -988,7 +988,7 @@ function glossary_print_approval_menu($cm, $glossary,$mode, $hook, $sortkey = '' glossary_print_all_links($cm, $glossary, $mode, $hook); - glossary_print_sorting_links($cm, $mode, $sortkey, $sortorder); + glossary_print_sorting_links($cm, $mode, 'CREATION', 'asc'); } function glossary_print_addentry_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '') { diff --git a/mod/glossary/print.php b/mod/glossary/print.php index 69c600e8a7..36c14d5f82 100644 --- a/mod/glossary/print.php +++ b/mod/glossary/print.php @@ -105,17 +105,6 @@ break; } - switch ( $sortkey ) { - case "CREATION": - $sortkey = "timecreated"; - break; - - case "UPDATE": - $sortkey = "timemodified"; - default: - break; - } - include_once("sql.php"); $entriesshown = 0; diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 5b7ff5bc77..0694abb4ef 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -13,6 +13,16 @@ /// fullpivot indicate if the whole pivot should be compared agasint the db or just the first letter /// printpivot indicate if the pivot should be printed or not + switch ( $sortkey ) { + case "CREATION": + $sqlsortkey = "timecreated"; + break; + + case "UPDATE": + $sqlsortkey = "timemodified"; + break; + } + $fullpivot = 1; $userid = ''; @@ -68,7 +78,7 @@ switch ($CFG->dbtype) { case 'postgres7': $usernametoshow = "u.firstname || ' ' || u.lastname"; - if ( $sortkey == 'FIRSTNAME' ) { + if ( $sqlsortkey == 'FIRSTNAME' ) { $usernamefield = "u.firstname || ' ' || u.lastname"; } else { $usernamefield = "u.lastname || ' ' || u.firstname"; @@ -76,7 +86,7 @@ $where = "AND substr(ucase($usernamefield),1," . strlen($hook) . ") = '" . strtoupper($hook) . "'"; break; case 'mysql': - if ( $sortkey == 'FIRSTNAME' ) { + if ( $sqlsortkey == 'FIRSTNAME' ) { $usernamefield = "CONCAT(CONCAT(u.firstname,' '), u.lastname)"; } else { $usernamefield = "CONCAT(CONCAT(u.lastname,' '), u.firstname)"; @@ -94,7 +104,7 @@ (ge.approved != 0 $userid) $where AND (ge.glossaryid = $glossary->id OR ge.sourceglossaryid = $glossary->id)"; - $sqlorderby = "ORDER BY $usernamefield $sortorder, ge.concept"; + $sqlorderby = "ORDER BY $usernamefield $sqlsortorder, ge.concept"; break; case GLOSSARY_APPROVAL_VIEW: $fullpivot = 0; @@ -117,8 +127,8 @@ $sqlwhere = "WHERE (ge.glossaryid = $glossary->id OR ge.sourceglossaryid = $glossary->id) AND ge.approved = 0 $where"; - if ( $sortkey ) { - $sqlorderby = "ORDER BY $sortkey $sortorder"; + if ( $sqlsortkey ) { + $sqlorderby = "ORDER BY $sqlsortkey $sqlsortorder"; } else { $sqlorderby = "ORDER BY ge.concept"; } @@ -180,7 +190,7 @@ $where"; switch ( $tab ) { case GLOSSARY_DATE_VIEW: - $sqlorderby = "ORDER BY $sortkey $sortorder"; + $sqlorderby = "ORDER BY $sqlsortkey $sqlsortorder"; break; case GLOSSARY_STANDARD_VIEW: diff --git a/mod/glossary/view.php b/mod/glossary/view.php index adc93a6f3e..54923090a5 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -235,17 +235,6 @@ include("tabs.html"); - switch ( $sortkey ) { - case "CREATION": - $sortkey = "timecreated"; - break; - - case "UPDATE": - $sortkey = "timemodified"; - default: - break; - } - include_once("sql.php"); /// printing the entries @@ -256,13 +245,14 @@ } if ($allentries) { /// printing the paging links + $paging = get_string("allentries","glossary"); if ( $offset < 0 ) { $paging = '' . $paging . ''; } else { - $paging = "" . $paging . ''; + $paging = "" . $paging . ''; } - if ($count > $entriesbypage ) { + if ($count > $entriesbypage ) { for ($i = 0; ($i*$entriesbypage) < $count ; $i++ ) { if ( $paging != '' ) { if ($i % 20 == 0 and $i) { @@ -275,7 +265,7 @@ if ($offset / $entriesbypage == $i) { $paging .= '' . $pagenumber . ''; } else { - $paging .= "" . $pagenumber . ''; + $paging .= "" . $pagenumber . ''; } } $paging = "
" . get_string ("jumpto") . " $paging
"; @@ -417,15 +407,13 @@ 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 "

"; } +/// Finish the page + print_footer($course); + ?> \ No newline at end of file -- 2.39.5