diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php
index d7cbd2e181..ff8ec4e3c2 100755
--- a/calendar/inc/class.bocalendar.inc.php
+++ b/calendar/inc/class.bocalendar.inc.php
@@ -1696,6 +1696,59 @@
}
}
+ function remove_doubles_in_cache($firstday,$lastday)
+ {
+ for($v=$firstday;$v<=$lastday;$v += 1)
+ {
+ $daily = $this->cached_events[$v];
+
+ if($this->debug)
+ {
+ echo "
count(day $v)=".count($daily)."
\n";
+ }
+ if (!is_array($daily))
+ {
+ continue;
+ }
+
+ @reset($daily);
+ while (list($g,$event) = each($daily))
+ {
+ if($this->debug)
+ {
+ echo "Event:
"; print_r($event); echo "
";
+ }
+ $start = sprintf('%04d%02d%02d',$event['start']['year'],$event['start']['month'],$event['start']['mday']);
+
+ if($this->debug)
+ {
+ echo "start='$start', v='$v'";
+ }
+
+ if ($start != $v) // this is an enddate-entry --> remove it
+ {
+ unset($this->cached_events[$v][$g]);
+ if ($start < $firstday) // start before period --> move it to the beginning
+ {
+ $this->cached_events[$firstday][] = $event;
+ if($this->debug)
+ {
+ echo "moved
\n";
+ }
+ }
+ elseif($this->debug)
+ {
+ echo "removed\n";
+ }
+ }
+ elseif($this->debug)
+ {
+ echo "ok\n";
+ }
+ }
+ }
+ }
+
function _debug_array($data)
{
echo '
UI:';
diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php
index 1a642f90c5..f4ae0f4ee9 100755
--- a/calendar/inc/class.uicalendar.inc.php
+++ b/calendar/inc/class.uicalendar.inc.php
@@ -859,6 +859,9 @@
$firstday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
$lastday = intval(date('Ymd',mktime(0,0,0,$this->bo->month + 1,0,$this->bo->year)));
+ $this->bo->remove_doubles_in_cache($firstday,$lastday);
+
+ $rows = array();
for($v=$firstday;$v<=$lastday;$v += 1)
{
$daily = $this->bo->cached_events[$v];
@@ -870,8 +873,6 @@
for($g=0;$gbo->datetime->gmtdate($this->bo->maketime($event['start']));
- $end = $this->bo->datetime->gmtdate($this->bo->maketime($event['end']));
$view = $html->link('/index.php',
array(
@@ -880,10 +881,10 @@
)
);
- $start_cell = $intervals_per_day * (intval(substr($v,6,2)) - 1);
+ $start_cell = $intervals_per_day * ($event['start']['mday'] - 1);
$start_cell += $interval[$event['start']['hour']];
- $end_cell = $interval_per_day = $intervals_per_day * (intval(substr($v,6,2))-1);
+ $end_cell = $intervals_per_day * ($event['end']['mday'] - 1);
$end_cell += $interval[$event['end']['hour']];
$i = 0; // search for row of parent category
@@ -939,7 +940,7 @@
if ($bgcolor=$cat['color'])
{
- $opt .= " bgcolor=$bgcolor";
+ $opt .= ' bgcolor="'.$bgcolor.'"';
}
$opt .= ' title="'.$event['title'];
if ($event['description'])
@@ -950,21 +951,19 @@
$cel = '';
if ($event['priority'] == 3)
{
- $cel .= $html->image('calendar','mini-calendar-bar.gif','','border=0');
+ $cel .= $html->image('calendar','mini-calendar-bar.gif','','border="0"');
}
- $cel .= $html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border=0');
+ $cel .= $html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"');
$cel .= '';
$akt_cell = $end_cell + 1;
}
- reset($rows);
ksort($rows);
- reset($rows);
while (list($k,$r) = each($rows))
{
if (is_array($r))
{
- $rows['.'.$k] = 'bgcolor='.$phpgw->nextmatchs->alternate_row_color();
+ $rows['.'.$k] = 'bgcolor="'.$phpgw->nextmatchs->alternate_row_color().'"';
$row = &$rows[$k];
$akt_cell = &$rows['.nr_'.$k];
if ($akt_cell <= $last_cell)
@@ -975,7 +974,7 @@
}
}
}
- $bgcolor = 'bgcolor='.$phpgw_info['theme']['th_bg'];
+ $bgcolor = 'bgcolor="'.$phpgw_info['theme']['th_bg'].'"';
echo $html->table(
array(
'_h' => $header,