semi-fix for repeating events

This commit is contained in:
skeeter 2001-01-22 17:48:51 +00:00
parent db8884dfe7
commit f9f160b3eb

View File

@ -522,23 +522,21 @@
$this->checked_re = 0;
if(!$this->re) return False;
$link = Array();
$date = $this->gmtdate($datetime);
// $date = $this->gmtdate($datetime);
$date = $this->localdates($datetime);
for ($i=0;$i<$this->re;$i++) {
$rep_events = $this->repeated_events[$i];
$start = $this->localdates($rep_events->datetime);
if($rep_events->rpt_use_end)
$end = $rep_events->rpt_end;
$enddate = $this->gmtdate($rep_events->rpt_end);
else
$end = mktime(0,0,0,1,1,2007) - ((60 * 60) * $phpgw_info["users"]["preferences"]["common"]["tz_offset"]);
$enddate = $this->localdates($end);
// only repeat after the beginning, and if there is an end
// before the end
$enddate = $this->makegmttime(0,0,0,1,1,2007);
// only repeat after the beginning, and if there is an rpt_end before the end date
if ($rep_events->rpt_use_end && ($date["full"] > $enddate["full"])) {
continue;
}
if ($date["full"] < $start["full"]) {
if ($date["full"] <= $start["full"]) {
continue;
}
@ -546,8 +544,9 @@
$link[$this->checked_re] = $i;
$this->checked_re++;
} elseif ($rep_events->rpt_type == 'daily') {
if (floor(($date["raw"] - $start["raw"])/86400) % intval($rep_events->rpt_freq))
if (floor(($date["raw"] - $start["raw"])/86400) % intval($rep_events->rpt_freq)) {
continue;
}
$link[$this->checked_re] = $i;
$this->checked_re++;
} elseif ($rep_events->rpt_type == 'weekly') {
@ -556,13 +555,18 @@
/*if ( (floor($diff/86400) % $this->rep_events->rpt_freq) ) // Whats this for ?
** continue;
*/
if (floor(($date["raw"] - $start["raw"])/604800) % intval($rep_events->rpt_freq)) continue;
if (floor(($date["raw"] - $start["raw"])/604800) % intval($rep_events->rpt_freq)) {
continue;
}
if (strcmp($isDay,"Y") == 0) {
$link[$this->checked_re] = $i;
$this->checked_re++;
}
} elseif ($rep_events->rpt_type == 'monthlybyday') {
if ((($date["year"] - $start["year"]) * 12 + $date["month"] - $start["month"]) % intval($rep_events->rpt_freq)) continue;
if ((($date["year"] - $start["year"]) * 12 + $date["month"] - $start["month"]) % intval($rep_events->rpt_freq)) {
continue;
}
if (($start["dow"] == $date["dow"]) &&
(ceil($start["day"]/7) == ceil($date["day"]/7))) {
@ -570,13 +574,17 @@
$this->checked_re++;
}
} elseif ($rep_events->rpt_type == 'monthlybydate') {
if ((($date["year"] - $start["year"]) * 12 + $date["month"] - $start["month"]) % intval($rep_events->rpt_freq)) continue;
if ((($date["year"] - $start["year"]) * 12 + $date["month"] - $start["month"]) % intval($rep_events->rpt_freq)) {
continue;
}
if ($date["day"] == $start["day"]) {
$link[$this->checked_re] = $i;
$this->checked_re++;
}
} elseif ($rep_events->rpt_type == 'yearly') {
if (($date["year"] - $start["year"]) % intval($rep_events->rpt_freq)) continue;
if (($date["year"] - $start["year"]) % intval($rep_events->rpt_freq)) {
continue;
}
if ($date["dm"] == $start["dm"]) {
$link[$this->checked_re] = $i;
$this->checked_re++;
@ -770,7 +778,7 @@
} else {
$format = "H:i";
}
if($lr_events->datetime < $date["raw"]) {
if($lr_events->datetime < $date["raw"] && $lr_events->rpt_type=="none") {
$temp_time = $this->makegmttime(0,0,0,$date["month"],$date["day"],$date["year"]);
$start_time = $phpgw->common->show_date($temp_time["raw"],$format);
} else {