]> git.mjollnir.org Git - moodle.git/commitdiff
Was trying Eloy's suggestion here http://moodle.org/mod/forum/discuss.php?d=43041
authormoodler <moodler>
Thu, 13 Apr 2006 01:34:26 +0000 (01:34 +0000)
committermoodler <moodler>
Thu, 13 Apr 2006 01:34:26 +0000 (01:34 +0000)
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

index 10ad143a1e0432cd3693b54be6a741ef0d93beb7..8034e0d6d211bf554dc004aafb00e82ae937d79d 100755 (executable)
                      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 {
         $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 {
     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' ";