]> git.mjollnir.org Git - moodle.git/commitdiff
- Fixing minor bugs... Nothing related with the problems the glossary is presenting...
authorwillcast <willcast>
Fri, 21 Nov 2003 02:50:08 +0000 (02:50 +0000)
committerwillcast <willcast>
Fri, 21 Nov 2003 02:50:08 +0000 (02:50 +0000)
mod/glossary/lib.php
mod/glossary/print.php
mod/glossary/sql.php
mod/glossary/view.php

index cb989f16ba2ea99fb1dffb22653c342c0ba18f17..558f59413b184f4848c4ed14a776ef16ac4dbbb3 100644 (file)
@@ -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 = '') {
index 69c600e8a7c780b3136ff332a9310cef7b228a6d..36c14d5f827b1dfe7c9054c524369425efbadcdd 100644 (file)
     break;
     }  
 
-    switch ( $sortkey ) {    
-    case "CREATION": 
-        $sortkey = "timecreated";
-    break;
-    
-    case "UPDATE": 
-        $sortkey = "timemodified";
-    default:
-    break;
-    }
-
     include_once("sql.php");
     
     $entriesshown = 0;
index 5b7ff5bc773c5668710eee62d86e8959aa12b63d..0694abb4ef758003186daf258c2e8c4ccce2cb15 100644 (file)
 
 /// 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)";
                              (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;
         $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";
         }
                               $where";
         switch ( $tab ) {
         case GLOSSARY_DATE_VIEW: 
-            $sqlorderby = "ORDER BY $sortkey $sortorder";
+            $sqlorderby = "ORDER BY $sqlsortkey $sqlsortorder";
         break;
         
         case GLOSSARY_STANDARD_VIEW: 
index adc93a6f3e1d32eeff951b6a5ea489898caf416a..54923090a578afd4f020109317d56e124002eb20 100644 (file)
 
     include("tabs.html");
 
-    switch ( $sortkey ) {    
-    case "CREATION": 
-        $sortkey = "timecreated";
-    break;
-    
-    case "UPDATE": 
-        $sortkey = "timemodified";
-    default:
-    break;
-    }
-    
     include_once("sql.php");
 
 /// printing the entries
     }
     if ($allentries) {
         /// printing the paging links
+
         $paging = get_string("allentries","glossary");
         if ( $offset < 0 ) {
             $paging = '<strong>' . $paging . '</strong>';
         } else {
-            $paging = "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=-1\">" . $paging . '</a>';
+            $paging = "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=-1&sortkey=$sortkey&sortorder=$sortorder\">" . $paging . '</a>';
         }
-        if ($count > $entriesbypage ) {
+        if ($count > $entriesbypage ) {            
             for ($i = 0; ($i*$entriesbypage) < $count  ; $i++   ) {
                 if ( $paging != '' ) {
                     if ($i % 20 == 0 and $i) {
                 if ($offset / $entriesbypage == $i) {
                     $paging .= '<strong>' . $pagenumber . '</strong>';
                 } else {
-                    $paging .= "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=" . ($i*$entriesbypage) . "\">" . $pagenumber . '</a>';
+                    $paging .= "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=" . ($i*$entriesbypage) . "&sortkey=$sortkey&sortorder=$sortorder\">" . $pagenumber . '</a>';
                 }
             }
             $paging  = "<font size=1><center>" . get_string ("jumpto") . " $paging</center></font>";
     if ( $debug and isadmin() ) {
         echo '<p>';
         print_simple_box("$sqlselect<br> $sqlfrom<br> $sqlwhere<br> $sqlorderby<br> $sqllimit","center","85%");
-    }
-
-/// Finish the page
-    print_footer($course);
 
-    if (isadmin()) {
         echo "<p align=right><font size=-3>";
         echo microtime_diff($CFG->startpagetime, microtime());
         echo "</font></p>";
     }
 
+/// Finish the page
+    print_footer($course);
+
 ?>
\ No newline at end of file