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