ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDateList Class Reference

List of dates. More...

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

Public Member Functions

 __construct ($a_type)
 Constructor.
 rewind ()
 Iterator Rewind.
 current ()
 Iterator Current.
 key ()
 Iterator key.
 next ()
 Iterator next.
 valid ()
 Iterator valid.
 get ()
 get
 getAtPosition ($a_pos)
 get item at specific position
 add ($date)
 add a date to the date list
 merge (ilDateList $other_list)
 Merge two lists.
 remove (ilDateTime $remove)
 remove from list
 removeByDAY (ilDateTime $remove)
 sort ()
 Sort list.
 __toString ()
 to string

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

ilDateList::__construct (   $a_type)

Constructor.

public

Parameters
typelist of TYPE_DATE or type TYPE_DATETIME

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

{
$this->type = $a_type;
$this->list_item = array();
}

Member Function Documentation

ilDateList::__toString ( )

to string

public

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

References $out, and IL_CAL_DATETIME.

{
$out = '<br />';
foreach($this->get() as $date)
{
$out .= $date->get(IL_CAL_DATETIME,'','Europe/Berlin').'<br/>';
}
return $out;
}
ilDateList::add (   $date)

add a date to the date list

public

Parameters
objectilDateTime

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

References IL_CAL_UNIX.

Referenced by merge().

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

+ Here is the caller graph for this function:

ilDateList::current ( )

Iterator Current.

Returns

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

Referenced by valid().

{
return current($this->list_item);
}

+ Here is the caller graph for this function:

ilDateList::getAtPosition (   $a_pos)

get item at specific position

public

Parameters
intposition (first position is 1)

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

Referenced by ilCalendarRecurrenceCalculator\applyBYSETPOSRules().

{
$counter = 1;
foreach($this->get() as $item)
{
if($counter++ == $a_pos)
{
return $item;
}
}
return null;
}

+ Here is the caller graph for this function:

ilDateList::key ( )

Iterator key.

Returns

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

{
return key($this->list_item);
}
ilDateList::merge ( ilDateList  $other_list)

Merge two lists.

public

Parameters
objectilDateList

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

References add(), and get().

{
foreach($other_list->get() as $new_date)
{
$this->add($new_date);
}
}

+ Here is the call graph for this function:

ilDateList::next ( )

Iterator next.

Returns

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

{
return next($this->list_item);
}
ilDateList::remove ( ilDateTime  $remove)

remove from list

public

Parameters
objectilDateTime

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

References IL_CAL_UNIX.

Referenced by ilCalendarRecurrenceCalculator\applyLimits().

{
$unix_remove = $remove->get(IL_CAL_UNIX);
if(isset($this->list_item[$unix_remove]))
{
unset($this->list_item[$unix_remove]);
}
return true;
}

+ Here is the caller graph for this function:

ilDateList::removeByDAY ( ilDateTime  $remove)

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

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

{
foreach($this->list_item as $key => $dt)
{
{
unset($this->list_item[$key]);
}
}
return true;
}

+ Here is the call graph for this function:

ilDateList::rewind ( )

Iterator Rewind.

Returns

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

{
reset($this->list_item);
}
ilDateList::sort ( )

Sort list.

public

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

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

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

+ Here is the caller graph for this function:

ilDateList::valid ( )

Iterator valid.

Returns

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

References current().

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

+ Here is the call graph for this function:

Field Documentation

ilDateList::$list_item = array()
protected

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

ilDateList::$type
protected

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

const ilDateList::TYPE_DATETIME = 2

The documentation for this class was generated from the following file: