ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 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.

References $out, and IL_CAL_DATETIME.

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

◆ add()

ilDateList::add ( ilDateTime  $date)

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

References ilDateTime\get(), and IL_CAL_UNIX.

Referenced by merge().

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

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

◆ current()

ilDateList::current ( )

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

48  : ilDateTime
49  {
50  return current($this->list_item);
51  }

◆ get()

◆ getAtPosition()

ilDateList::getAtPosition ( int  $a_pos)

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

References null.

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

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

Referenced by valid().

53  : string
54  {
55  return key($this->list_item);
56  }
+ Here is the caller graph for this function:

◆ merge()

ilDateList::merge ( ilDateList  $other_list)

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

References add(), and get().

96  : void
97  {
98  foreach ($other_list->get() as $new_date) {
99  $this->add($new_date);
100  }
101  }
add(ilDateTime $date)
+ 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  }

◆ remove()

ilDateList::remove ( ilDateTime  $remove)

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

References IL_CAL_UNIX.

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

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

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

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.
+ 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.

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

120  : void
121  {
122  ksort($this->list_item, SORT_NUMERIC);
123  }
+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

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

References key(), and null.

63  : bool
64  {
65  return key($this->list_item) !== null;
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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: