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

VTodo component. More...

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

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 ()
 
 validate ($options=0)
 Validates the node for correctness. More...
 
- 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

VTodo component.

This component contains some additional functionality specific for VTODOs.

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

Definition at line 17 of file VTodo.php.

Member Function Documentation

◆ getDefaults()

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

This method should return a list of default property values.

Returns
array

Definition at line 184 of file VTodo.php.

References Sabre\VObject\UUIDUtil\getUUID().

184  {
185 
186  return [
187  'UID' => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
188  'DTSTAMP' => date('Ymd\\THis\\Z'),
189  ];
190 
191  }
static getUUID()
Returns a pseudo-random v4 UUID.
Definition: UUIDUtil.php:27
+ Here is the call graph for this function:

◆ getValidationRules()

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

Definition at line 84 of file VTodo.php.

84  {
85 
86  return [
87  'UID' => 1,
88  'DTSTAMP' => 1,
89 
90  'CLASS' => '?',
91  'COMPLETED' => '?',
92  'CREATED' => '?',
93  'DESCRIPTION' => '?',
94  'DTSTART' => '?',
95  'GEO' => '?',
96  'LAST-MODIFIED' => '?',
97  'LOCATION' => '?',
98  'ORGANIZER' => '?',
99  'PERCENT' => '?',
100  'PRIORITY' => '?',
101  'RECURRENCE-ID' => '?',
102  'SEQUENCE' => '?',
103  'STATUS' => '?',
104  'SUMMARY' => '?',
105  'URL' => '?',
106 
107  'RRULE' => '?',
108  'DUE' => '?',
109  'DURATION' => '?',
110 
111  'ATTACH' => '*',
112  'ATTENDEE' => '*',
113  'CATEGORIES' => '*',
114  'COMMENT' => '*',
115  'CONTACT' => '*',
116  'EXDATE' => '*',
117  'REQUEST-STATUS' => '*',
118  'RELATED-TO' => '*',
119  'RESOURCES' => '*',
120  'RDATE' => '*',
121  ];
122 
123  }

◆ isInTimeRange()

Sabre\VObject\Component\VTodo::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 31 of file VTodo.php.

References COMPLETED, and Sabre\VObject\DateTimeParser\parseDuration().

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

31  {
32 
33  $dtstart = isset($this->DTSTART) ? $this->DTSTART->getDateTime() : null;
34  $duration = isset($this->DURATION) ? VObject\DateTimeParser::parseDuration($this->DURATION) : null;
35  $due = isset($this->DUE) ? $this->DUE->getDateTime() : null;
36  $completed = isset($this->COMPLETED) ? $this->COMPLETED->getDateTime() : null;
37  $created = isset($this->CREATED) ? $this->CREATED->getDateTime() : null;
38 
39  if ($dtstart) {
40  if ($duration) {
41  $effectiveEnd = $dtstart->add($duration);
42  return $start <= $effectiveEnd && $end > $dtstart;
43  } elseif ($due) {
44  return
45  ($start < $due || $start <= $dtstart) &&
46  ($end > $dtstart || $end >= $due);
47  } else {
48  return $start <= $dtstart && $end > $dtstart;
49  }
50  }
51  if ($due) {
52  return ($start < $due && $end >= $due);
53  }
54  if ($completed && $created) {
55  return
56  ($start <= $created || $start <= $completed) &&
57  ($end >= $created || $end >= $completed);
58  }
59  if ($completed) {
60  return ($start <= $completed && $end >= $completed);
61  }
62  if ($created) {
63  return ($end > $created);
64  }
65  return true;
66 
67  }
$start
Definition: bench.php:8
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
const COMPLETED
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

Sabre\VObject\Component\VTodo::validate (   $options = 0)

Validates the node for correctness.

The following options are supported: Node::REPAIR - May attempt to automatically repair the problem.

This method returns an array with detected problems. Every element has the following properties:

  • level - problem level.
  • message - A human-readable string describing the issue.
  • node - A reference to the problematic node.

The level means: 1 - The issue was repaired (only happens if REPAIR was turned on) 2 - An inconsequential issue 3 - A severe issue.

Parameters
int$options
Returns
array

Definition at line 147 of file VTodo.php.

References PHPMailer\PHPMailer\$options, and $result.

147  {
148 
149  $result = parent::validate($options);
150  if (isset($this->DUE) && isset($this->DTSTART)) {
151 
152  $due = $this->DUE;
153  $dtStart = $this->DTSTART;
154 
155  if ($due->getValueType() !== $dtStart->getValueType()) {
156 
157  $result[] = [
158  'level' => 3,
159  'message' => 'The value type (DATE or DATE-TIME) must be identical for DUE and DTSTART',
160  'node' => $due,
161  ];
162 
163  } elseif ($due->getDateTime() < $dtStart->getDateTime()) {
164 
165  $result[] = [
166  'level' => 3,
167  'message' => 'DUE must occur after DTSTART',
168  'node' => $due,
169  ];
170 
171  }
172 
173  }
174 
175  return $result;
176 
177  }
$result

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