MDL-14018 fixed searching when date order selected; merged from MODOLE_19_STABLE

This commit is contained in:
skodak
2008-04-16 15:08:03 +00:00
parent 593b02295f
commit fb9d1e0942
+6 -4
View File
@@ -400,12 +400,14 @@
}
/// Find the field we are sorting on
if ($sort == DATA_FIRSTNAME or $sort == DATA_LASTNAME) {
if ($sort == DATA_FIRSTNAME or $sort == DATA_LASTNAME or empty($sort)) {
if ($sort == DATA_LASTNAME) {
if ($sort == DATA_LASTNAME) {
$ordering = "u.lastname $order, u.firstname $order";
} else {
} else if ($sort == DATA_LASTNAME) {
$ordering = "u.firstname $order, u.lastname $order";
} else {
$ordering = "r.timecreated $order";
}
$what = ' DISTINCT r.id, r.approved, r.timecreated, r.timemodified, r.userid, u.firstname, u.lastname';
@@ -440,7 +442,7 @@
$searchselect = ' ';
}
} else if ($sort and $sortfield = data_get_field_from_id($sort, $data)) {
} else if ($sort > 0 and $sortfield = data_get_field_from_id($sort, $data)) {
$sortcontent = $sortfield->get_sort_field();
$sortcontentfull = $sortfield->get_sort_sql('c.'.$sortcontent);