From de89899b1daadb8b5c752028aee7c0128bddacc5 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 13 Apr 2006 01:34:26 +0000 Subject: [PATCH] Was trying Eloy's suggestion here http://moodle.org/mod/forum/discuss.php?d=43041 but wasn't working for some reason ... checking in as commented to work on later. The lkudge seems to be working pretty well for now. --- mod/data/view.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mod/data/view.php b/mod/data/view.php index 10ad143a1e..8034e0d6d2 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -306,7 +306,7 @@ AND r.dataid = '.$data->id.' AND r.userid = u.id AND c1.recordid = r.id '; - $sortorder = ' ORDER BY '.$sortcontentfull.' '.$order.' '; + $sortorder = ' ORDER BY '.$sortcontentfull.' '.$order.' , r.id ASC'; if ($search) { $searchselect = ' AND (c1.content LIKE "%'.$search.'%") '; } else { @@ -320,7 +320,7 @@ $where = 'WHERE c.recordid = r.id AND r.userid = u.id AND r.dataid = '.$data->id; - $sortorder = ' ORDER BY r.id '; + $sortorder = ' ORDER BY r.id ASC'; $searchselect = ' AND (c.content LIKE "%'.$search.'%") '; } else { @@ -348,13 +348,17 @@ if ($record) { // We need to just show one, so where is it in context? $nowperpage = 1; $mode = 'single'; + +# Following code needs testing to make it work # if ($sort) { // We need to search by that field # if ($content = get_field('data_content', 'content', 'recordid', $record->id, 'fieldid', $sort)) { # $content = addslashes($content); # if ($order == 'ASC') { -# $lessthan = " AND $sortcontentfull < '$content' "; +# $lessthan = " AND $sortcontentfull < '$content' +# OR ($sortcontentfull = '$content' AND r.id < '$record->id') "; # } else { -# $lessthan = " AND $sortcontentfull > '$content' "; +# $lessthan = " AND $sortcontentfull > '$content' +# OR ($sortcontentfull = '$content' AND r.id < '$record->id') "; # } # } else { // Failed to find data (shouldn't happen), so fall back to something easy # $lessthan = " r.id < '$record->id' "; -- 2.39.5