ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Component\VEvent Class Reference

VEvent component. More...

+ Inheritance diagram for Sabre\VObject\Component\VEvent:
+ Collaboration diagram for Sabre\VObject\Component\VEvent:

Public Member Functions

 isInTimeRange (DateTimeInterface $start, DateTimeInterface $end)
 Returns true or false depending on if the event falls in the specified time-range. More...
 
 getValidationRules ()
 
- Public Member Functions inherited from Sabre\VObject\Component
 __construct (Document $root, $name, array $children=[], $defaults=true)
 Creates a new component. More...
 
 add ()
 Adds a new property or component, and returns the new item. More...
 
 remove ($item)
 This method removes a component or property from this component. More...
 
 children ()
 Returns a flat list of all the properties and components in this component. More...
 
 getComponents ()
 This method only returns a list of sub-components. More...
 
 select ($name)
 Returns an array with elements that match the specified name. More...
 
 serialize ()
 Turns the object back into a serialized blob. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 __isset ($name)
 This method checks if a sub-element with the specified name exists. More...
 
 __set ($name, $value)
 Using the setter method you can add properties or subcomponents. More...
 
 __unset ($name)
 Removes all properties and components within this component with the specified name. More...
 
 __clone ()
 This method is automatically called when the object is cloned. More...
 
 getValidationRules ()
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
- Public Member Functions inherited from Sabre\VObject\Node
 serialize ()
 Serializes the node into a mimedir format. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
 getIterator ()
 Returns the iterator for this object. More...
 
 setIterator (ElementList $iterator)
 Sets the overridden iterator. More...
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 count ()
 Returns the number of elements. More...
 
 offsetExists ($offset)
 Checks if an item exists through ArrayAccess. More...
 
 offsetGet ($offset)
 Gets an item through ArrayAccess. More...
 
 offsetSet ($offset, $value)
 Sets an item through ArrayAccess. More...
 
 offsetUnset ($offset)
 Sets an item through ArrayAccess. More...
 
- Public Member Functions inherited from Sabre\Xml\XmlSerializable
 xmlSerialize (Writer $writer)
 The xmlSerialize method is called during xml writing. More...
 

Protected Member Functions

 getDefaults ()
 This method should return a list of default property values. More...
 
- Protected Member Functions inherited from Sabre\VObject\Component
 getDefaults ()
 This method should return a list of default property values. More...
 

Additional Inherited Members

- Data Fields inherited from Sabre\VObject\Component
 $name
 
- Data Fields inherited from Sabre\VObject\Node
const REPAIR = 1
 The following constants are used by the validate() method. More...
 
const PROFILE_CARDDAV = 2
 If this option is set, the validator will operate on the vcards on the assumption that the vcards need to be valid for CardDAV. More...
 
const PROFILE_CALDAV = 4
 If this option is set, the validator will operate on iCalendar objects on the assumption that the vcards need to be valid for CalDAV. More...
 
 $parent
 
- Protected Attributes inherited from Sabre\VObject\Component
 $children = []
 
- Protected Attributes inherited from Sabre\VObject\Node
 $iterator = null
 
 $root
 

Detailed Description

VEvent component.

This component contains some additional functionality specific for VEVENT's.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 19 of file VEvent.php.

Member Function Documentation

◆ getDefaults()

Sabre\VObject\Component\VEvent::getDefaults ( )
protected

This method should return a list of default property values.

Returns
array

Definition at line 90 of file VEvent.php.

References Sabre\VObject\UUIDUtil\getUUID().

90  {
91 
92  return [
93  'UID' => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
94  'DTSTAMP' => date('Ymd\\THis\\Z'),
95  ];
96 
97  }
static getUUID()
Returns a pseudo-random v4 UUID.
Definition: UUIDUtil.php:27
+ Here is the call graph for this function:

◆ getValidationRules()

Sabre\VObject\Component\VEvent::getValidationRules ( )

Definition at line 114 of file VEvent.php.

114  {
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  }

◆ isInTimeRange()

Sabre\VObject\Component\VEvent::isInTimeRange ( DateTimeInterface  $start,
DateTimeInterface  $end 
)

Returns true or false depending on if the event falls in the specified time-range.

This is used for filtering purposes.

The rules used to determine if an event falls within the specified time-range is based on the CalDAV specification.

Parameters
DateTimeInterface$start
DateTimeInterface$end
Returns
bool

Definition at line 33 of file VEvent.php.

References $start, Sabre\VObject\Recur\EventIterator\fastForward(), and Sabre\VObject\DateTimeParser\parseDuration().

Referenced by Sabre\VObject\Component\VEventTest\testInTimeRange().

33  {
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  }
$start
Definition: bench.php:8
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: