From: Reini U. <ru...@us...> - 2004-12-06 18:33:06
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19781 Modified Files: CalendarList.php Log Message: added order=reverse: feature request from #981109 Index: CalendarList.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/CalendarList.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -2 -b -p -d -r1.3 -r1.4 --- CalendarList.php 22 Sep 2004 13:36:45 -0000 1.3 +++ CalendarList.php 6 Dec 2004 18:32:39 -0000 1.4 @@ -6,5 +6,5 @@ define('SECONDS_PER_DAY', 24 * 3600); /** - * This is a list of calendar appoinments. + * This is a list of calendar appointments. * Same arguments as Calendar, so no one is confused * Uses <dl><dd>DATE<dt>page contents... @@ -30,4 +30,5 @@ extends WikiPlugin return array('prefix' => '[pagename]', 'date_format' => '%Y-%m-%d', + 'order' => 'normal', // or reverse (counting backwards) 'year' => '', 'month' => '', @@ -90,5 +91,7 @@ extends WikiPlugin $now['tm_mday'] - $args['last_n_days'], $args['year']); - } elseif ($args['next_n_days'] || $args['next_n']/* || $args['last_n']*/) { + } elseif ($args['next_n_days'] or $args['next_n'] + or ($args['order'] == 'reverse') + /* or $args['last_n']*/) { $time = mktime(0, 0, 0, // hh, mm, ss, $args['month'] + $args['month_offset'], // month (1-12) @@ -111,9 +114,18 @@ extends WikiPlugin $done = false; - $n = 0; $max = (180 * SECONDS_PER_DAY) + $time; + $n = 0; + if ($args['order'] == "reverse") + $max = $time - (180 * SECONDS_PER_DAY); + else + $max = $time + (180 * SECONDS_PER_DAY); while (!$done) { $success = $cal->pushContent($this->__date($dbi, $time)); + if ($args['order'] == "reverse") { + $time -= SECONDS_PER_DAY; + if ($time <= $max) return $cal; + } else { $time += SECONDS_PER_DAY; if ($time >= $max) return $cal; + } $t = localtime($time, 1); @@ -127,6 +139,6 @@ extends WikiPlugin } elseif ($args['last_n_days']) { $done = ($t['tm_mday'] == $now['tm_mday']); - } else { - $done = ($t['tm_mday'] == 1); + } else { // stop at next/prev month + $done = ($t['tm_mon'] != $now['tm_mon']); } } @@ -137,4 +149,7 @@ extends WikiPlugin // $Log$ +// Revision 1.4 2004/12/06 18:32:39 rurban +// added order=reverse: feature request from #981109 +// // Revision 1.3 2004/09/22 13:36:45 rurban // Support ranges, based on a simple patch by JoshWand |