[Pkg-owncloud-commits] [php-sabre-vobject] 54/106: fastForward takes the end time into consideration.

David Prévot taffit at moszumanska.debian.org
Fri Aug 22 15:11:02 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit 45537ab4df01d5249a23c1a9edad5df43436c8bb
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Aug 2 21:43:59 2014 -0400

    fastForward takes the end time into consideration.
---
 lib/Sabre/VObject/Component/VEvent.php   | 15 +++++++++++++++
 lib/Sabre/VObject/RecurrenceIterator.php | 18 +++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/lib/Sabre/VObject/Component/VEvent.php b/lib/Sabre/VObject/Component/VEvent.php
index 0a9a2e9..250e943 100644
--- a/lib/Sabre/VObject/Component/VEvent.php
+++ b/lib/Sabre/VObject/Component/VEvent.php
@@ -68,6 +68,21 @@ class VEvent extends VObject\Component {
     }
 
     /**
+     * This method should return a list of default property values.
+     *
+     * @return array
+     */
+    protected function getDefaults() {
+
+        return array(
+            'UID'     => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
+            'DTSTAMP' => date('Ymd\\THis\\Z'),
+        );
+
+    }
+
+
+    /**
      * A simple list of validation rules.
      *
      * This is simply a list of properties, and how many times they either
diff --git a/lib/Sabre/VObject/RecurrenceIterator.php b/lib/Sabre/VObject/RecurrenceIterator.php
index ee726aa..d0dd605 100644
--- a/lib/Sabre/VObject/RecurrenceIterator.php
+++ b/lib/Sabre/VObject/RecurrenceIterator.php
@@ -123,7 +123,7 @@ class RecurrenceIterator implements \Iterator {
 
         if (isset($this->masterEvent->EXDATE)) {
 
-            foreacH($this->masterEvent->EXDATE as $exDate) {
+            foreach($this->masterEvent->EXDATE as $exDate) {
 
                 foreach($exDate->getDateTimes() as $dt) {
                     $this->exceptions[$dt->getTimeStamp()] = true;
@@ -137,6 +137,13 @@ class RecurrenceIterator implements \Iterator {
             $this->eventDuration =
                 $this->masterEvent->DTEND->getDateTime()->getTimeStamp() -
                 $this->startDate->getTimeStamp();
+        } elseif (isset($this->masterEvent->DURATION)) {
+            $duration = $this->masterEvent->DURATION->getDateInterval();
+            $this->eventDuration =
+                $this->startDate->add($duration)->getTimeStamp() -
+                $this->startDate->getTimeStamp();
+        } elseif ($this->masterEvent->DTSTART->getValueType() === 'DATE') {
+            $this->eventDuration = 3600 * 24;
         }
 
         $this->rruleParser = new RRuleParser($rrule, $this->startDate);
@@ -183,7 +190,8 @@ class RecurrenceIterator implements \Iterator {
             return null;
         }
         $end = clone $this->currentDate;
-        return $end->modify('+' . $this->eventDuration . ' seconds');
+        $end->modify('+' . $this->eventDuration . ' seconds');
+        return $end;
 
     }
 
@@ -209,9 +217,9 @@ class RecurrenceIterator implements \Iterator {
             $event->EXRULE
         );
 
-        $event->DTSTART->setDateTime($this->getDTStart());
+        $event->DTSTART->setDateTime($this->getDtStart());
         if (isset($event->DTEND)) {
-            $event->DTEND->setDateTime($this->getDTEnd());
+            $event->DTEND->setDateTime($this->getDtEnd());
         }
         if ($this->rruleParser->key() > 0) {
             $event->{'RECURRENCE-ID'} = (string)$event->DTSTART;
@@ -329,7 +337,7 @@ class RecurrenceIterator implements \Iterator {
      */
     public function fastForward(DateTime $dateTime) {
 
-        while($this->valid() && $this->currentDate < $dateTime ) {
+        while($this->valid() && $this->getDtEnd() < $dateTime ) {
             $this->next();
         }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list