ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
VEvent.php
Go to the documentation of this file.
1 <?php
2 
4 
6 use Sabre\VObject;
9 
19 class VEvent extends VObject\Component {
20 
34 
35  if ($this->RRULE) {
36 
37  try {
38 
39  $it = new EventIterator($this, null, $start->getTimezone());
40 
41  } catch (NoInstancesException $e) {
42 
43  // If we've catched this exception, there are no instances
44  // for the event that fall into the specified time-range.
45  return false;
46 
47  }
48 
49  $it->fastForward($start);
50 
51  // We fast-forwarded to a spot where the end-time of the
52  // recurrence instance exceeded the start of the requested
53  // time-range.
54  //
55  // If the starttime of the recurrence did not exceed the
56  // end of the time range as well, we have a match.
57  return ($it->getDTStart() < $end && $it->getDTEnd() > $start);
58 
59  }
60 
61  $effectiveStart = $this->DTSTART->getDateTime($start->getTimezone());
62  if (isset($this->DTEND)) {
63 
64  // The DTEND property is considered non inclusive. So for a 3 day
65  // event in july, dtstart and dtend would have to be July 1st and
66  // July 4th respectively.
67  //
68  // See:
69  // http://tools.ietf.org/html/rfc5545#page-54
70  $effectiveEnd = $this->DTEND->getDateTime($end->getTimezone());
71 
72  } elseif (isset($this->DURATION)) {
73  $effectiveEnd = $effectiveStart->add(VObject\DateTimeParser::parseDuration($this->DURATION));
74  } elseif (!$this->DTSTART->hasTime()) {
75  $effectiveEnd = $effectiveStart->modify('+1 day');
76  } else {
77  $effectiveEnd = $effectiveStart;
78  }
79  return (
80  ($start < $effectiveEnd) && ($end > $effectiveStart)
81  );
82 
83  }
84 
90  protected function getDefaults() {
91 
92  return [
93  'UID' => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
94  'DTSTAMP' => date('Ymd\\THis\\Z'),
95  ];
96 
97  }
98 
114  function getValidationRules() {
115 
116  $hasMethod = isset($this->parent->METHOD);
117  return [
118  'UID' => 1,
119  'DTSTAMP' => 1,
120  'DTSTART' => $hasMethod ? '?' : '1',
121  'CLASS' => '?',
122  'CREATED' => '?',
123  'DESCRIPTION' => '?',
124  'GEO' => '?',
125  'LAST-MODIFIED' => '?',
126  'LOCATION' => '?',
127  'ORGANIZER' => '?',
128  'PRIORITY' => '?',
129  'SEQUENCE' => '?',
130  'STATUS' => '?',
131  'SUMMARY' => '?',
132  'TRANSP' => '?',
133  'URL' => '?',
134  'RECURRENCE-ID' => '?',
135  'RRULE' => '?',
136  'DTEND' => '?',
137  'DURATION' => '?',
138 
139  'ATTACH' => '*',
140  'ATTENDEE' => '*',
141  'CATEGORIES' => '*',
142  'COMMENT' => '*',
143  'CONTACT' => '*',
144  'EXDATE' => '*',
145  'REQUEST-STATUS' => '*',
146  'RELATED-TO' => '*',
147  'RESOURCES' => '*',
148  'RDATE' => '*',
149  ];
150 
151  }
152 
153 }
VEvent component.
Definition: VEvent.php:19
$start
Definition: bench.php:8
This class is used to determine new for a recurring event, when the next events occur.
This exception gets thrown when a recurrence iterator produces 0 instances.
getDefaults()
This method should return a list of default property values.
Definition: VEvent.php:90
fastForward(DateTimeInterface $dateTime)
Quickly jump to a date in the future.
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
static getUUID()
Returns a pseudo-random v4 UUID.
Definition: UUIDUtil.php:27
isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
Returns true or false depending on if the event falls in the specified time-range.
Definition: VEvent.php:33