]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/VObject/Component/VJournal.php
Merge remote branch 'friendica/master'
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / VObject / Component / VJournal.php
1 <?php
2
3 /**
4  * VJournal component
5  *
6  * This component contains some additional functionality specific for VJOURNALs.
7  * 
8  * @package Sabre
9  * @subpackage VObject
10  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
11  * @author Evert Pot (http://www.rooftopsolutions.nl/) 
12  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
13  */
14 class Sabre_VObject_Component_VJournal extends Sabre_VObject_Component {
15
16     /**
17      * Returns true or false depending on if the event falls in the specified 
18      * time-range. This is used for filtering purposes. 
19      *
20      * The rules used to determine if an event falls within the specified 
21      * time-range is based on the CalDAV specification.
22      *
23      * @param DateTime $start
24      * @param DateTime $end 
25      * @return bool 
26      */
27     public function isInTimeRange(DateTime $start, DateTime $end) {
28
29         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
30         if ($dtstart) {
31             $effectiveEnd = clone $dtstart;
32             if ($this->DTSTART->getDateType() == Sabre_VObject_Property_DateTime::DATE) {
33                 $effectiveEnd->modify('+1 day');
34             }
35
36             return ($start <= $effectiveEnd && $end > $dtstart);
37
38         }
39         return false;
40
41
42     }
43
44 }