ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 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.

References $out, and IL_CAL_DATETIME.

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  }
const IL_CAL_DATETIME
$out
Definition: buildRTE.php:24

◆ add()

ilDateList::add ( ilDateTime  $date)

add a date to the date list

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

References ilDateTime\get(), and IL_CAL_UNIX.

Referenced by merge().

111  : void
112  {
113  $this->list_item[(string) $date->get(IL_CAL_UNIX)] = clone $date;
114  }
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:

◆ current()

ilDateList::current ( )

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

Referenced by valid().

59  {
60  return current($this->list_item);
61  }
+ 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.

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

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  }
+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

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

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

◆ merge()

ilDateList::merge ( ilDateList  $other_list)

Merge two lists.

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

References add(), and get().

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
+ Here is the call graph for this function:

◆ next()

ilDateList::next ( )

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

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

◆ remove()

ilDateList::remove ( ilDateTime  $remove)

remove from list

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

References IL_CAL_UNIX.

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

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

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

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
string $key
Consumer key/client ID value.
Definition: System.php:193
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 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.

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

149  : void
150  {
151  ksort($this->list_item, SORT_NUMERIC);
152  }
+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

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

References current().

82  : bool
83  {
84  return $this->current() !== false;
85  }
+ 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: