[prev in list] [next in list] [prev in thread] [next in thread]
List: kolab-commits
Subject: Branch 'dev/recurrence-exceptions' - plugins/calendar
From: Thomas_BrĂ¼derli <bruederli () kolabsys ! com>
Date: 2013-01-23 16:17:26
Message-ID: 20130123161726.424F51FBA9A () app01 ! kolabsys ! com
[Download RAW message or body]
plugins/calendar/drivers/kolab/kolab_calendar.php | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 1b4b6bb9659c2525f53b29d0186b8c817588cdb8
Author: Thomas Bruederli <bruederli@kolabsys.com>
Date: Wed Jan 23 17:17:05 2013 +0100
Skip regular recurrences on exception dates
diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php \
b/plugins/calendar/drivers/kolab/kolab_calendar.php index cfe46f9..53c47ad 100644
--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
@@ -421,6 +421,7 @@ class kolab_calendar
// add recurrence exceptions to output
$i = 0;
$events = array();
+ $exdates = array();
if (is_array($event['recurrence']['EXCEPTIONS'])) {
foreach ($event['recurrence']['EXCEPTIONS'] as $exception) {
$rec_event = $this->_to_rcube_event($exception);
@@ -429,10 +430,14 @@ class kolab_calendar
$rec_event['_instance'] = $i;
$events[] = $rec_event;
+ // found the specifically requested instance, exiting...
if ($rec_event['id'] == $event_id) {
$this->events[$rec_event['id']] = $rec_event;
return $events;
}
+
+ // remember this exception's date
+ $exdates[$rec_event['start']->format('Y-m-d')] = $rec_event['id'];
}
}
@@ -447,11 +452,12 @@ class kolab_calendar
}
while ($next_event = $recurrence->next_instance()) {
- $rec_start = $next_event['start']->format('U');
- $rec_end = $next_event['end']->format('U');
- $rec_id = $event['uid'] . '-' . ++$i;
+ // skip if there's an exception at this date
+ if ($exdates[$next_event['start']->format('Y-m-d')])
+ continue;
// add to output if in range
+ $rec_id = $event['uid'] . '-' . ++$i;
if (($next_event['start'] <= $end && $next_event['end'] >= $start) || \
($event_id && $rec_id == $event_id)) { $rec_event = \
$this->_to_rcube_event($next_event); $rec_event['id'] = $rec_id;
_______________________________________________
kolab-commits mailing list
kolab-commits@kolab.org
https://www.intevation.de/mailman/listinfo/kolab-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic