ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDateList Class Reference

List of dates. More...

+ Collaboration diagram for ilDateList:

Public Member Functions

 __construct ($a_type)
 Constructor.
 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
 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 smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
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 150 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 93 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::getAtPosition (   $a_pos)

get item at specific position

public

Parameters
intposition (first position is 1)

Definition at line 74 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::merge ( ilDateList  $other_list)

Merge two lists.

public

Parameters
objectilDateList

Definition at line 108 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::remove ( ilDateTime  $remove)

remove from list

public

Parameters
objectilDateTime

Definition at line 123 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::sort ( )

Sort list.

public

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

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

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

Referenced by ilCalendarRecurrenceCalculator\initDateList().


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