steffen: server/kolab-resource-handlers/kolab-resource-handlers/freebusy recurrence.class.php, 1.13, 1.14
cvs at intevation.de
cvs at intevation.de
Wed Feb 9 12:03:38 CET 2005
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv20691/kolab-resource-handlers/freebusy
Modified Files:
recurrence.class.php
Log Message:
neverending story about getting recurrences right... (issue243)
Index: recurrence.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/recurrence.class.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- recurrence.class.php 26 Jan 2005 08:23:20 -0000 1.13
+++ recurrence.class.php 9 Feb 2005 11:03:35 -0000 1.14
@@ -53,9 +53,14 @@
function setRangetype( $type ) { $this->range_type = $type; }
function setRange( $range ) { $this->range = $range; }
+
+ function ts2string($ts) {
+ return gmdate("D, M d Y H:i:s",$ts);
+ }
function expand( $startstamp, $endstamp ) {
- myLog( "Recurrence::expand( $startstamp, $endstamp ), cycletype=".$this->cycle_type,
+ myLog( 'Recurrence::expand( '.Recurrence::ts2string($startstamp).", "
+ .Recurrence::ts2string($endstamp).' ), cycletype='.$this->cycle_type,
RM_LOG_DEBUG);
switch( $this->cycle_type ) {
case 'daily':
@@ -134,14 +139,18 @@
if( !$this->interval ) $this->interval = 1;
$count = 0;
$delta_days = (int)gmdate('d',$this->initial_start);
- for( $t = strtotime( '-'.($delta_days+15).' days', $this->initial_start );
+ myLog("initial_start=".Recurrence::ts2string($this->initial_start), RM_LOG_DEBUG);
+ $offset = 0;
+ $first_of_month = gmdate("M 1 Y H:i:s+0000", $this->initial_start);
+ for( $t = strtotime( $first_of_month );
$t < $endstamp; $t = strtotime( '+'.$this->interval.' months', $t)) {
- //myLog('t = '.gmdate('M d Y H:i:s',strtotime('-15 days', $t)), RM_LOG_DEBUG);
if( $this->type == 'daynumber') {
// On numbered days
+ myLog('t = '.gmdate('M d Y H:i:s',$t), RM_LOG_DEBUG);
foreach( $this->daynumber as $dayno ) {
- $t_month = gmdate('m',strtotime('-15 days', $t));
- $tmp = strtotime( '+'.($dayno-16).' days', $t);
+ $t_month = gmdate('m',strtotime("-$offset days", $t));
+ $tmp = strtotime( '+'.($dayno-$offset-1).' days', $t);
+ myLog('tmp = '.gmdate('M d Y H:i:s',$tmp), RM_LOG_DEBUG);
$tmp_month = gmdate('m',$tmp); // make sure same month
if( $tmp >= $this->initial_start && $tmp < $endstamp &&
$t_month == $tmp_month &&
@@ -158,7 +167,7 @@
// On named weekdays
// Find beginning of first week
- $tmp = strtotime('-15 days',$t);
+ $tmp = strtotime('-$offset days',$t);
$firstday = (int)gmdate('w',$tmp);
for( $i = 0; $i < count($this->day); $i++ ) {
$dayno = $this->daynumber[$i];
@@ -181,7 +190,7 @@
if( $this->range_type == 'number' && $count > $this->range ) {
break;
} else if( $this->range_type == 'date'
- && strtotime('-15 days',$t) > strtotime( '+1 day',$this->range ) ) {
+ && strtotime('-$offset days',$t) > strtotime( '+1 day',$this->range ) ) {
break;
}
}
More information about the commits
mailing list