ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDateList Class Reference

List of dates. More...

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

Public Member Functions

 __construct (int $a_type)
 
 rewind ()
 
 current ()
 
 key ()
 
 next ()
 
 valid ()
 
 count ()
 
 get ()
 
 getAtPosition (int $a_pos)
 
 add (ilDateTime $date)
 
 merge (ilDateList $other_list)
 
 remove (ilDateTime $remove)
 
 removeByDAY (ilDateTime $remove)
 
 sort ()
 
 __toString ()
 

Data Fields

const TYPE_DATE = 1
 
const TYPE_DATETIME = 2
 

Protected Attributes

array $list_item = []
 
int $type
 

Detailed Description

List of dates.

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

<string, ilDateTime>

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

Constructor & Destructor Documentation

◆ __construct()

ilDateList::__construct ( int  $a_type)

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

38 {
39 $this->type = $a_type;
40 $this->list_item = [];
41 }

Member Function Documentation

◆ __toString()

ilDateList::__toString ( )

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

125 : string
126 {
127 $out = '<br />';
128 foreach ($this->get() as $date) {
129 $out .= $date->get(IL_CAL_DATETIME, '', 'Europe/Berlin') . '<br/>';
130 }
131
132 return $out;
133 }
$out
Definition: buildRTE.php:24
const IL_CAL_DATETIME

References $out, and IL_CAL_DATETIME.

◆ add()

ilDateList::add ( ilDateTime  $date)

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

91 : void
92 {
93 $this->list_item[(string) $date->get(IL_CAL_UNIX)] = clone $date;
94 }
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:

◆ count()

ilDateList::count ( )

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

68 : int
69 {
70 return count($this->list_item);
71 }

References count().

Referenced by count().

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

◆ current()

ilDateList::current ( )

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

49 {
50 return current($this->list_item);
51 }
@classDescription Date and time handling

References current().

Referenced by current().

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

◆ get()

◆ getAtPosition()

ilDateList::getAtPosition ( int  $a_pos)

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

79 : ?ilDateTime
80 {
81 $counter = 1;
82 foreach ($this->get() as $item) {
83 if ($counter++ == $a_pos) {
84 return $item;
85 }
86 }
87
88 return null;
89 }
$counter

References $counter.

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

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

53 : string
54 {
55 return key($this->list_item);
56 }

References key().

Referenced by key(), and valid().

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

◆ merge()

ilDateList::merge ( ilDateList  $other_list)

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

96 : void
97 {
98 foreach ($other_list->get() as $new_date) {
99 $this->add($new_date);
100 }
101 }
add(ilDateTime $date)

References add(), and get().

+ Here is the call graph for this function:

◆ next()

ilDateList::next ( )

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

58 : void
59 {
60 next($this->list_item);
61 }

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)

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

103 : void
104 {
105 $unix_remove = (string) $remove->get(IL_CAL_UNIX);
106 if (isset($this->list_item[$unix_remove])) {
107 unset($this->list_item[$unix_remove]);
108 }
109 }

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 111 of file class.ilDateList.php.

111 : void
112 {
113 foreach ($this->list_item as $key => $dt) {
114 if (ilDateTime::_equals($remove, $dt, IL_CAL_DAY, ilTimeZone::UTC)) {
115 unset($this->list_item[$key]);
116 }
117 }
118 }
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.

References ilDateTime\_equals(), IL_CAL_DAY, and ilTimeZone\UTC.

+ Here is the call graph for this function:

◆ rewind()

ilDateList::rewind ( )

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

43 : void
44 {
45 reset($this->list_item);
46 }

◆ sort()

ilDateList::sort ( )

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

120 : void
121 {
122 ksort($this->list_item, SORT_NUMERIC);
123 }

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

+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

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

63 : bool
64 {
65 return key($this->list_item) !== null;
66 }

References key().

+ Here is the call graph for this function:

Field Documentation

◆ $list_item

array ilDateList::$list_item = []
protected

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

Referenced by get().

◆ $type

int ilDateList::$type
protected

Definition at line 35 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: