aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_calendar.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions_calendar.inc.php')
-rw-r--r--include/functions_calendar.inc.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php
index 1c86c679e..3bc79cddc 100644
--- a/include/functions_calendar.inc.php
+++ b/include/functions_calendar.inc.php
@@ -259,9 +259,18 @@ WHERE id IN (' . implode(',',$page['items']) .')';
}
else
{
+ if ( count($page['chronology_date'])==0
+ or in_array('any', $page['chronology_date']) )
+ {// selected period is very big so we show newest first
+ $order = ' DESC, ';
+ }
+ else
+ {// selected period is small (month,week) so we show oldest first
+ $order = ' ASC, ';
+ }
$order_by = str_replace(
'ORDER BY ',
- 'ORDER BY '.$calendar->date_field.' DESC,', $conf['order_by']
+ 'ORDER BY '.$calendar->date_field.$order, $conf['order_by']
);
$query .= '
'.$order_by;