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 = '') {
break;
}
- switch ( $sortkey ) {
- case "CREATION":
- $sortkey = "timecreated";
- break;
-
- case "UPDATE":
- $sortkey = "timemodified";
- default:
- break;
- }
-
include_once("sql.php");
$entriesshown = 0;
/// 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 = '';
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";
$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:
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