ILIAS  release_8 Revision v8.24
ilDateList Class Reference

List of dates. More...

+ Inheritance diagram for ilDateList:
+ Collaboration diagram for ilDateList:

Public Member Functions

 __construct (int $a_type)
 
 rewind ()
 @inheritDoc More...
 
 current ()
 @inheritDoc More...
 
 key ()
 @inheritDoc More...
 
 next ()
 @inheritDoc More...
 
 valid ()
 @inheritDoc More...
 
 get ()
 
 getAtPosition (int $a_pos)
 get item at specific position More...
 
 add (ilDateTime $date)
 add a date to the date list More...
 
 merge (ilDateList $other_list)
 Merge two lists. More...
 
 remove (ilDateTime $remove)
 remove from list More...
 
 removeByDAY (ilDateTime $remove)
 
 sort ()
 Sort list. More...
 
 __toString ()
 

Data Fields

const TYPE_DATE = 1
 
const TYPE_DATETIME = 2
 

Protected Attributes

array $list_item = array()
 
int $type
 

Detailed Description

List of dates.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 32 of file class.ilDateList.php.

Constructor & Destructor Documentation

◆ __construct()

ilDateList::__construct ( int  $a_type)

Definition at line 41 of file class.ilDateList.php.

42 {
43 $this->type = $a_type;
44 $this->list_item = array();
45 }

Member Function Documentation

◆ __toString()

ilDateList::__toString ( )

Definition at line 154 of file class.ilDateList.php.

154 : string
155 {
156 $out = '<br />';
157 foreach ($this->get() as $date) {
158 $out .= $date->get(IL_CAL_DATETIME, '', 'Europe/Berlin') . '<br/>';
159 }
160 return $out;
161 }
$out
Definition: buildRTE.php:24
const IL_CAL_DATETIME

References $out, and IL_CAL_DATETIME.

◆ add()

ilDateList::add ( ilDateTime  $date)

add a date to the date list

Definition at line 111 of file class.ilDateList.php.

111 : void
112 {
113 $this->list_item[(string) $date->get(IL_CAL_UNIX)] = clone $date;
114 }
const IL_CAL_UNIX
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date

References ilDateTime\get(), and IL_CAL_UNIX.

Referenced by merge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ current()

ilDateList::current ( )

@inheritDoc

Definition at line 58 of file class.ilDateList.php.

59 {
60 return current($this->list_item);
61 }
current()
@inheritDoc

References current().

Referenced by current(), and valid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get()

◆ getAtPosition()

ilDateList::getAtPosition ( int  $a_pos)

get item at specific position

Definition at line 97 of file class.ilDateList.php.

97 : ?ilDateTime
98 {
99 $counter = 1;
100 foreach ($this->get() as $item) {
101 if ($counter++ == $a_pos) {
102 return $item;
103 }
104 }
105 return null;
106 }
@classDescription Date and time handling

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

@inheritDoc

Definition at line 66 of file class.ilDateList.php.

67 {
68 return key($this->list_item);
69 }
key()
@inheritDoc

References key().

Referenced by key().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ merge()

ilDateList::merge ( ilDateList  $other_list)

Merge two lists.

Definition at line 119 of file class.ilDateList.php.

119 : void
120 {
121 foreach ($other_list->get() as $new_date) {
122 $this->add($new_date);
123 }
124 }
add(ilDateTime $date)
add a date to the date list

References add(), and get().

+ Here is the call graph for this function:

◆ next()

ilDateList::next ( )

@inheritDoc

Definition at line 74 of file class.ilDateList.php.

75 {
76 return next($this->list_item);
77 }
next()
@inheritDoc

References next().

Referenced by next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

ilDateList::remove ( ilDateTime  $remove)

remove from list

Definition at line 129 of file class.ilDateList.php.

129 : void
130 {
131 $unix_remove = $remove->get(IL_CAL_UNIX);
132 if (isset($this->list_item[$unix_remove])) {
133 unset($this->list_item[$unix_remove]);
134 }
135 }

References IL_CAL_UNIX.

Referenced by ilCalendarRecurrenceCalculator\applyDurationPeriod(), and ilCalendarRecurrenceCalculator\applyLimits().

+ Here is the caller graph for this function:

◆ removeByDAY()

ilDateList::removeByDAY ( ilDateTime  $remove)

Definition at line 137 of file class.ilDateList.php.

137 : void
138 {
139 foreach ($this->list_item as $key => $dt) {
140 if (ilDateTime::_equals($remove, $dt, IL_CAL_DAY, ilTimeZone::UTC)) {
141 unset($this->list_item[$key]);
142 }
143 }
144 }
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, ilDateTime\_equals(), IL_CAL_DAY, and ilTimeZone\UTC.

+ Here is the call graph for this function:

◆ rewind()

ilDateList::rewind ( )

@inheritDoc

Definition at line 50 of file class.ilDateList.php.

51 {
52 reset($this->list_item);
53 }

◆ sort()

ilDateList::sort ( )

Sort list.

Definition at line 149 of file class.ilDateList.php.

149 : void
150 {
151 ksort($this->list_item, SORT_NUMERIC);
152 }

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules(), and ilCalendarRecurrenceCalculator\applyLimits().

+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

@inheritDoc

Definition at line 82 of file class.ilDateList.php.

82 : bool
83 {
84 return $this->current() !== false;
85 }

References current().

+ Here is the call graph for this function:

Field Documentation

◆ $list_item

array ilDateList::$list_item = array()
protected

Definition at line 37 of file class.ilDateList.php.

◆ $type

int ilDateList::$type
protected

Definition at line 39 of file class.ilDateList.php.

◆ TYPE_DATE

◆ TYPE_DATETIME

const ilDateList::TYPE_DATETIME = 2

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