ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 33 of file class.ilDateList.php.

Constructor & Destructor Documentation

◆ __construct()

ilDateList::__construct ( int  $a_type)

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

44  {
45  $this->type = $a_type;
46  $this->list_item = [];
47  }

Member Function Documentation

◆ __toString()

ilDateList::__toString ( )

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

References $out, and IL_CAL_DATETIME.

131  : string
132  {
133  $out = '<br />';
134  foreach ($this->get() as $date) {
135  $out .= $date->get(IL_CAL_DATETIME, '', 'Europe/Berlin') . '<br/>';
136  }
137 
138  return $out;
139  }
const IL_CAL_DATETIME
$out
Definition: buildRTE.php:24

◆ add()

ilDateList::add ( ilDateTime  $date)

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

References ilDateTime\get(), and IL_CAL_UNIX.

Referenced by merge().

97  : void
98  {
99  $this->list_item[(string) $date->get(IL_CAL_UNIX)] = clone $date;
100  }
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
const IL_CAL_UNIX
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count()

ilDateList::count ( )

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

74  : int
75  {
76  return count($this->list_item);
77  }

◆ current()

ilDateList::current ( )

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

54  : ilDateTime
55  {
56  return current($this->list_item);
57  }

◆ get()

◆ getAtPosition()

ilDateList::getAtPosition ( int  $a_pos)

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

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

85  : ?ilDateTime
86  {
87  $counter = 1;
88  foreach ($this->get() as $item) {
89  if ($counter++ == $a_pos) {
90  return $item;
91  }
92  }
93 
94  return null;
95  }
+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

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

Referenced by valid().

59  : string
60  {
61  return key($this->list_item);
62  }
+ Here is the caller graph for this function:

◆ merge()

ilDateList::merge ( ilDateList  $other_list)

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

References add(), and get().

102  : void
103  {
104  foreach ($other_list->get() as $new_date) {
105  $this->add($new_date);
106  }
107  }
add(ilDateTime $date)
+ Here is the call graph for this function:

◆ next()

ilDateList::next ( )

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

64  : void
65  {
66  next($this->list_item);
67  }

◆ remove()

ilDateList::remove ( ilDateTime  $remove)

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

References IL_CAL_UNIX.

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

109  : void
110  {
111  $unix_remove = (string) $remove->get(IL_CAL_UNIX);
112  if (isset($this->list_item[$unix_remove])) {
113  unset($this->list_item[$unix_remove]);
114  }
115  }
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
const IL_CAL_UNIX
+ Here is the caller graph for this function:

◆ removeByDAY()

ilDateList::removeByDAY ( ilDateTime  $remove)

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

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

117  : void
118  {
119  foreach ($this->list_item as $key => $dt) {
120  if (ilDateTime::_equals($remove, $dt, IL_CAL_DAY, ilTimeZone::UTC)) {
121  unset($this->list_item[$key]);
122  }
123  }
124  }
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
+ Here is the call graph for this function:

◆ rewind()

ilDateList::rewind ( )

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

49  : void
50  {
51  reset($this->list_item);
52  }

◆ sort()

ilDateList::sort ( )

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

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

126  : void
127  {
128  ksort($this->list_item, SORT_NUMERIC);
129  }
+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

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

References key().

69  : bool
70  {
71  return key($this->list_item) !== null;
72  }
+ Here is the call graph for this function:

Field Documentation

◆ $list_item

array ilDateList::$list_item = []
protected

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

Referenced by get().

◆ $type

int ilDateList::$type
protected

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