ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilDateList Class Reference

List of dates. More...

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

Public Member Functions

 __construct ($a_type)
 Constructor. More...
 
 rewind ()
 Iterator Rewind. More...
 
 current ()
 Iterator Current. More...
 
 key ()
 Iterator key. More...
 
 next ()
 Iterator next. More...
 
 valid ()
 Iterator valid. More...
 
 get ()
 get More...
 
 getAtPosition ($a_pos)
 get item at specific position More...
 
 add ($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 ()
 to string More...
 

Data Fields

const TYPE_DATE = 1
 
const TYPE_DATETIME = 2
 

Protected Attributes

 $list_item = array()
 
 $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 34 of file class.ilDateList.php.

Constructor & Destructor Documentation

◆ __construct()

ilDateList::__construct (   $a_type)

Constructor.

@access public

Parameters
typelist of TYPE_DATE or type TYPE_DATETIME

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

51 {
52 $this->type = $a_type;
53 $this->list_item = array();
54 }

Member Function Documentation

◆ __toString()

ilDateList::__toString ( )

to string

@access public

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

210 {
211 $out = '<br />';
212 foreach($this->get() as $date)
213 {
214 $out .= $date->get(IL_CAL_DATETIME,'','Europe/Berlin').'<br/>';
215 }
216 return $out;
217 }
const IL_CAL_DATETIME

References $out, and IL_CAL_DATETIME.

◆ add()

ilDateList::add (   $date)

add a date to the date list

@access public

Parameters
objectilDateTime

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

141 {
142 // the unix time is the key.
143 // It's casted to string because array_merge overwrites only string keys
144 // @see merge
145 $this->list_item[(string) $date->get(IL_CAL_UNIX)] = clone $date;
146 }
const IL_CAL_UNIX

References IL_CAL_UNIX.

Referenced by merge().

+ Here is the caller graph for this function:

◆ current()

ilDateList::current ( )

Iterator Current.

Returns

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

71 {
72 return current($this->list_item);
73 }
current()
Iterator Current.

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 (   $a_pos)

get item at specific position

@access public

Parameters
intposition (first position is 1)

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

122 {
123 $counter = 1;
124 foreach($this->get() as $item)
125 {
126 if($counter++ == $a_pos)
127 {
128 return $item;
129 }
130 }
131 return null;
132 }

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

+ Here is the caller graph for this function:

◆ key()

ilDateList::key ( )

Iterator key.

Returns

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

80 {
81 return key($this->list_item);
82 }
key()
Iterator key.

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.

@access public

Parameters
objectilDateList

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

156 {
157 foreach($other_list->get() as $new_date)
158 {
159 $this->add($new_date);
160 }
161 }
add($date)
add a date to the date list

References add(), and get().

+ Here is the call graph for this function:

◆ next()

ilDateList::next ( )

Iterator next.

Returns

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

89 {
90 return next($this->list_item);
91 }
next()
Iterator next.

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

@access public

Parameters
objectilDateTime

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

171 {
172 $unix_remove = $remove->get(IL_CAL_UNIX);
173 if(isset($this->list_item[$unix_remove]))
174 {
175 unset($this->list_item[$unix_remove]);
176 }
177 return true;
178 }
get($a_format, $a_format_str='', $a_tz='')
get formatted date

References IL_CAL_UNIX.

Referenced by ilCalendarRecurrenceCalculator\applyLimits().

+ Here is the caller graph for this function:

◆ removeByDAY()

ilDateList::removeByDAY ( ilDateTime  $remove)

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

181 {
182 foreach($this->list_item as $key => $dt)
183 {
185 {
186 unset($this->list_item[$key]);
187 }
188 }
189 return true;
190 }
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $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 ( )

Iterator Rewind.

Returns

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

62 {
63 reset($this->list_item);
64 }

◆ sort()

ilDateList::sort ( )

Sort list.

@access public

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

199 {
200 return ksort($this->list_item,SORT_NUMERIC);
201 }

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

+ Here is the caller graph for this function:

◆ valid()

ilDateList::valid ( )

Iterator valid.

Returns

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

98 {
99 return $this->current() !== false;
100 }

References current().

+ Here is the call graph for this function:

Field Documentation

◆ $list_item

ilDateList::$list_item = array()
protected

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

◆ $type

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: