Overview

Packages

  • Date

Classes

  • Horde_Date
  • Horde_Date_Exception
  • Horde_Date_Recurrence
  • Horde_Date_Repeater
  • Horde_Date_Repeater_Day
  • Horde_Date_Repeater_DayName
  • Horde_Date_Repeater_DayPortion
  • Horde_Date_Repeater_Fortnight
  • Horde_Date_Repeater_Hour
  • Horde_Date_Repeater_Minute
  • Horde_Date_Repeater_Month
  • Horde_Date_Repeater_MonthName
  • Horde_Date_Repeater_Season
  • Horde_Date_Repeater_SeasonName
  • Horde_Date_Repeater_Second
  • Horde_Date_Repeater_Time
  • Horde_Date_Repeater_Week
  • Horde_Date_Repeater_Weekend
  • Horde_Date_Repeater_Year
  • Horde_Date_Span
  • Horde_Date_Translation
  • Horde_Date_Utils

Exceptions

  • Horde_Date_Repeater_Exception
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Date_Recurrence

The Horde_Date_Recurrence class implements algorithms for calculating recurrences of events, including several recurrence types, intervals, exceptions, and conversion from and to vCalendar and iCalendar recurrence rules.

All methods expecting dates as parameters accept all values that the Horde_Date constructor accepts, i.e. a timestamp, another Horde_Date object, an ISO time string or a hash.

Package: Date
Category: Horde
Author: Jan Schneider jan@horde.org
Located at Horde/Date/Recurrence.php
Methods summary
public
# __construct( Horde_Date $start )

Constructor.

Constructor.

Parameters

$start
Start of the recurring event.
public
# reset( )

Resets the class properties.

Resets the class properties.

public boolean
# recurOnDay( integer $dayMask )

Checks if this event recurs on a given day of the week.

Checks if this event recurs on a given day of the week.

Parameters

$dayMask
<p>A mask consisting of Horde_Date::MASK_* constants specifying the day(s) to check.</p>

Returns

boolean
True if this event recurs on the given day(s).
public
# setRecurOnDay( integer $dayMask )

Specifies the days this event recurs on.

Specifies the days this event recurs on.

Parameters

$dayMask
<p>A mask consisting of Horde_Date::MASK_* constants specifying the day(s) to recur on.</p>
public integer
# getRecurOnDays( )

Returns the days this event recurs on.

Returns the days this event recurs on.

Returns

integer

A mask consisting of Horde_Date::MASK_* constants specifying the day(s) this event recurs on.

public boolean
# hasRecurType( integer $recurrence )

Returns whether this event has a specific recurrence type.

Returns whether this event has a specific recurrence type.

Parameters

$recurrence
<p>RECUR_* constant of the recurrence type to check for.</p>

Returns

boolean
True if the event has the specified recurrence type.
public
# setRecurType( integer $recurrence )

Sets a recurrence type for this event.

Sets a recurrence type for this event.

Parameters

$recurrence
A RECUR_* constant.
public integer
# getRecurType( )

Returns recurrence type of this event.

Returns recurrence type of this event.

Returns

integer
A RECUR_* constant.
public string
# getRecurName( )

Returns a description of this event's recurring type.

Returns a description of this event's recurring type.

Returns

string
Human readable recurring type.
public
# setRecurInterval( integer $interval )

Sets the length of time between recurrences of this event.

Sets the length of time between recurrences of this event.

Parameters

$interval
The time between recurrences.
public integer
# getRecurInterval( )

Retrieves the length of time between recurrences of this event.

Retrieves the length of time between recurrences of this event.

Returns

integer
The number of seconds between recurrences.
public
# setRecurCount( integer $count )

Sets the number of recurrences of this event.

Sets the number of recurrences of this event.

Parameters

$count
The number of recurrences.
public integer
# getRecurCount( )

Retrieves the number of recurrences of this event.

Retrieves the number of recurrences of this event.

Returns

integer
The number recurrences.
public boolean
# hasRecurCount( )

Returns whether this event has a recurrence with a fixed count.

Returns whether this event has a recurrence with a fixed count.

Returns

boolean
True if this recurrence has a fixed count.
public
# setRecurStart( Horde_Date $start )

Sets the start date of the recurrence interval.

Sets the start date of the recurrence interval.

Parameters

$start
The recurrence start.
public Horde_Date
# getRecurStart( )

Retrieves the start date of the recurrence interval.

Retrieves the start date of the recurrence interval.

Returns

Horde_Date
The recurrence start.
public
# setRecurEnd( Horde_Date $end )

Sets the end date of the recurrence interval.

Sets the end date of the recurrence interval.

Parameters

$end
The recurrence end.
public Horde_Date
# getRecurEnd( )

Retrieves the end date of the recurrence interval.

Retrieves the end date of the recurrence interval.

Returns

Horde_Date
The recurrence end.
public boolean
# hasRecurEnd( )

Returns whether this event has a recurrence end.

Returns whether this event has a recurrence end.

Returns

boolean
True if this recurrence ends.
public Horde_Date|boolean
# nextRecurrence( Horde_Date|string $after )

Finds the next recurrence of this event that's after $afterDate.

Finds the next recurrence of this event that's after $afterDate.

Parameters

$after
Return events after this date.

Returns

Horde_Date|boolean

The date of the next recurrence or false if the event does not recur after $afterDate.

public boolean
# hasActiveRecurrence( )

Returns whether this event has any date that matches the recurrence rules and is not an exception.

Returns whether this event has any date that matches the recurrence rules and is not an exception.

Returns

boolean
True if an active recurrence exists.
public Horde_Date|boolean
# nextActiveRecurrence( Horde_Date $afterDate )

Returns the next active recurrence.

Returns the next active recurrence.

Parameters

$afterDate
Return events after this date.

Returns

Horde_Date|boolean

The date of the next active recurrence or false if the event has no active recurrence after $afterDate.

public
# addException( integer $year, integer $month, integer $mday )

Adds an exception to a recurring event.

Adds an exception to a recurring event.

Parameters

$year
The year of the execption.
$month
The month of the execption.
$mday
The day of the month of the exception.
public
# deleteException( integer $year, integer $month, integer $mday )

Deletes an exception from a recurring event.

Deletes an exception from a recurring event.

Parameters

$year
The year of the execption.
$month
The month of the execption.
$mday
The day of the month of the exception.
public boolean
# hasException( integer $year, integer $month, integer $mday )

Checks if an exception exists for a given reccurence of an event.

Checks if an exception exists for a given reccurence of an event.

Parameters

$year
The year of the reucrance.
$month
The month of the reucrance.
$mday
The day of the month of the reucrance.

Returns

boolean
True if an exception exists for the given date.
public array
# getExceptions( )

Retrieves all the exceptions for this event.

Retrieves all the exceptions for this event.

Returns

array

Array containing the dates of all the exceptions in YYYYMMDD form.

public
# addCompletion( integer $year, integer $month, integer $mday )

Adds a completion to a recurring event.

Adds a completion to a recurring event.

Parameters

$year
The year of the execption.
$month
The month of the execption.
$mday
The day of the month of the completion.
public
# deleteCompletion( integer $year, integer $month, integer $mday )

Deletes a completion from a recurring event.

Deletes a completion from a recurring event.

Parameters

$year
The year of the execption.
$month
The month of the execption.
$mday
The day of the month of the completion.
public boolean
# hasCompletion( integer $year, integer $month, integer $mday )

Checks if a completion exists for a given reccurence of an event.

Checks if a completion exists for a given reccurence of an event.

Parameters

$year
The year of the reucrance.
$month
The month of the recurrance.
$mday
The day of the month of the recurrance.

Returns

boolean
True if a completion exists for the given date.
public array
# getCompletions( )

Retrieves all the completions for this event.

Retrieves all the completions for this event.

Returns

array

Array containing the dates of all the completions in YYYYMMDD form.

public
# fromRRule10( string $rrule )

Parses a vCalendar 1.0 recurrence rule.

Parses a vCalendar 1.0 recurrence rule.

Parameters

$rrule
A vCalendar 1.0 conform RRULE value.

Link

http://www.imc.org/pdi/vcal-10.txt
http://www.shuchow.com/vCalAddendum.html
public string
# toRRule10( Horde_Icalendar $calendar )

Creates a vCalendar 1.0 recurrence rule.

Creates a vCalendar 1.0 recurrence rule.

Parameters

$calendar
A Horde_Icalendar object instance.

Returns

string
A vCalendar 1.0 conform RRULE value.

Link

http://www.imc.org/pdi/vcal-10.txt
http://www.shuchow.com/vCalAddendum.html
public
# fromRRule20( string $rrule )

Parses an iCalendar 2.0 recurrence rule.

Parses an iCalendar 2.0 recurrence rule.

Parameters

$rrule
An iCalendar 2.0 conform RRULE value.

Link

http://rfc.net/rfc2445.html#s4.3.10
http://rfc.net/rfc2445.html#s4.8.5
http://www.shuchow.com/vCalAddendum.html
public string
# toRRule20( Horde_Icalendar $calendar )

Creates an iCalendar 2.0 recurrence rule.

Creates an iCalendar 2.0 recurrence rule.

Parameters

$calendar
A Horde_Icalendar object instance.

Returns

string
An iCalendar 2.0 conform RRULE value.

Link

http://rfc.net/rfc2445.html#s4.3.10
http://rfc.net/rfc2445.html#s4.8.5
http://www.shuchow.com/vCalAddendum.html
public boolean
# fromHash( array $hash )

Parses the recurrence data from a hash.

Parses the recurrence data from a hash.

Parameters

$hash
The hash to convert.

Returns

boolean
True if the hash seemed valid, false otherwise.
public array
# toHash( )

Export this object into a hash.

Export this object into a hash.

Returns

array
The recurrence hash.
public object
# toJson( )

Returns a simple object suitable for json transport representing this object.

Returns a simple object suitable for json transport representing this object.

Possible properties are: - t: type - i: interval - e: end date - c: count - d: data - co: completions - ex: exceptions

Returns

object
A simple object.
Constants summary
integer RECUR_NONE

No Recurrence *

No Recurrence *

# 0
integer RECUR_DAILY

Recurs daily.

Recurs daily.

# 1
integer RECUR_WEEKLY

Recurs weekly.

Recurs weekly.

# 2
integer RECUR_MONTHLY_DATE

Recurs monthly on the same date.

Recurs monthly on the same date.

# 3
integer RECUR_MONTHLY_WEEKDAY

Recurs monthly on the same week day.

Recurs monthly on the same week day.

# 4
integer RECUR_YEARLY_DATE

Recurs yearly on the same date.

Recurs yearly on the same date.

# 5
integer RECUR_YEARLY_DAY

Recurs yearly on the same day of the year.

Recurs yearly on the same day of the year.

# 6
integer RECUR_YEARLY_WEEKDAY

Recurs yearly on the same week day.

Recurs yearly on the same week day.

# 7
Properties summary
public Horde_Date $start

The start time of the event.

The start time of the event.

#
public Horde_Date $recurEnd

The end date of the recurrence interval.

The end date of the recurrence interval.

# null
public integer $recurCount

The number of recurrences.

The number of recurrences.

# null
public integer $recurType

The type of recurrence this event follows. RECUR_* constant.

The type of recurrence this event follows. RECUR_* constant.

# Horde_Date_Recurrence::RECUR_NONE
public integer $recurInterval

The length of time between recurrences. The time unit depends on the recurrence type.

The length of time between recurrences. The time unit depends on the recurrence type.

# 1
public integer $recurData

Any additional recurrence data.

Any additional recurrence data.

# null
public array $exceptions

All the exceptions from recurrence for this event.

All the exceptions from recurrence for this event.

# array()
public array $completions

All the dates this recurrence has been marked as completed.

All the dates this recurrence has been marked as completed.

# array()
API documentation generated by ApiGen