PHP Class Horde_Date_Recurrence, horde

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.
Author: Jan Schneider ([email protected])
Mostra file Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$completions array All the dates this recurrence has been marked as completed.
$exceptions array All the exceptions from recurrence for this event.
$recurCount integer The number of recurrences.
$recurData integer Any additional recurrence data.
$recurEnd Horde_Date The end date of the recurrence interval.
$recurInterval integer The length of time between recurrences. The time unit depends on the recurrence type.
$recurType integer The type of recurrence this event follows. RECUR_* constant.
$start Horde_Date The start time of the event.

Public Methods

Method Description
__construct ( Horde_Date $start ) Constructor.
addCompletion ( integer $year, integer $month, integer $mday ) Adds a completion to a recurring event.
addException ( integer $year, integer $month, integer $mday ) Adds an exception to a recurring event.
deleteCompletion ( integer $year, integer $month, integer $mday ) Deletes a completion from a recurring event.
deleteException ( integer $year, integer $month, integer $mday ) Deletes an exception from a recurring event.
fromKolab ( array $hash ) : boolean Parses the recurrence data from a Kolab hash.
fromRRule10 ( string $rrule ) Parses a vCalendar 1.0 recurrence rule.
fromRRule20 ( string $rrule ) Parses an iCalendar 2.0 recurrence rule.
getCompletions ( ) : array Retrieves all the completions for this event.
getExceptions ( ) : array Retrieves all the exceptions for this event.
getRecurCount ( ) : integer Retrieves the number of recurrences of this event.
getRecurEnd ( ) : Horde_Date Retrieves the end date of the recurrence interval.
getRecurInterval ( ) : integer Retrieves the length of time between recurrences of this event.
getRecurName ( ) : string Returns a description of this event's recurring type.
getRecurOnDays ( ) : integer Returns the days this event recurs on.
getRecurStart ( ) : Horde_Date Retrieves the start date of the recurrence interval.
getRecurType ( ) : integer Returns recurrence type of this event.
hasActiveRecurrence ( ) : boolean Returns whether this event has any date that matches the recurrence rules and is not an exception.
hasCompletion ( integer $year, integer $month, integer $mday ) : boolean Checks if a completion exists for a given reccurence of an event.
hasException ( integer $year, integer $month, integer $mday ) : boolean Checks if an exception exists for a given reccurence of an event.
hasRecurCount ( ) : boolean Returns whether this event has a recurrence with a fixed count.
hasRecurEnd ( ) : boolean Returns whether this event has a recurrence end.
hasRecurType ( integer $recurrence ) : boolean Returns whether this event has a specific recurrence type.
isEqual ( Horde_Date_Recurrence $recurrence ) : boolean Return whether or not this object is equal to another recurrence object.
nextActiveRecurrence ( Horde_Date $afterDate ) : Horde_Date | boolean Returns the next active recurrence.
nextRecurrence ( Horde_Date | string $after ) : Horde_Date | boolean Finds the next recurrence of this event that's after $afterDate.
recurOnDay ( integer $dayMask ) : boolean Checks if this event recurs on a given day of the week.
reset ( ) Resets the class properties.
setRecurCount ( integer $count ) Sets the number of recurrences of this event.
setRecurEnd ( Horde_Date $end ) Sets the end date of the recurrence interval.
setRecurInterval ( integer $interval ) Sets the length of time between recurrences of this event.
setRecurOnDay ( integer $dayMask ) Specifies the days this event recurs on.
setRecurStart ( Horde_Date $start ) Sets the start date of the recurrence interval.
setRecurType ( integer $recurrence ) Sets a recurrence type for this event.
toJson ( ) : object Returns a simple object suitable for json transport representing this object.
toKolab ( ) : array Export this object into a Kolab hash.
toRRule10 ( Horde_Icalendar $calendar ) : string Creates a vCalendar 1.0 recurrence rule.
toRRule20 ( Horde_Icalendar $calendar ) : string Creates an iCalendar 2.0 recurrence rule.
toString ( $date_format ) : string Output a human readable description of the recurrence rule.

Protected Methods

Method Description
_formatExceptionDate ( string $date, string $format ) : string Returns a correcty formatted exception date for recurring events.

Method Details

__construct() public method

Constructor.
public __construct ( Horde_Date $start )
$start Horde_Date Start of the recurring event.

_formatExceptionDate() protected method

Returns a correcty formatted exception date for recurring events.
Since: 2.1.0
protected _formatExceptionDate ( string $date, string $format ) : string
$date string Exception in the format Ymd.
$format string The format to display in.
return string The formatted date and delete link.

addCompletion() public method

Adds a completion to a recurring event.
public addCompletion ( integer $year, integer $month, integer $mday )
$year integer The year of the exception.
$month integer The month of the exception.
$mday integer The day of the month of the completion.

addException() public method

Adds an exception to a recurring event.
public addException ( integer $year, integer $month, integer $mday )
$year integer The year of the exception.
$month integer The month of the exception.
$mday integer The day of the month of the exception.

deleteCompletion() public method

Deletes a completion from a recurring event.
public deleteCompletion ( integer $year, integer $month, integer $mday )
$year integer The year of the exception.
$month integer The month of the exception.
$mday integer The day of the month of the completion.

deleteException() public method

Deletes an exception from a recurring event.
public deleteException ( integer $year, integer $month, integer $mday )
$year integer The year of the exception.
$month integer The month of the exception.
$mday integer The day of the month of the exception.

fromKolab() public method

Parses the recurrence data from a Kolab hash.
public fromKolab ( array $hash ) : boolean
$hash array The hash to convert.
return boolean True if the hash seemed valid, false otherwise.

fromRRule10() public method

Parses a vCalendar 1.0 recurrence rule.
public fromRRule10 ( string $rrule )
$rrule string A vCalendar 1.0 conform RRULE value.

fromRRule20() public method

Parses an iCalendar 2.0 recurrence rule.
public fromRRule20 ( string $rrule )
$rrule string An iCalendar 2.0 conform RRULE value.

getCompletions() public method

Retrieves all the completions for this event.
public getCompletions ( ) : array
return array Array containing the dates of all the completions in YYYYMMDD form.

getExceptions() public method

Retrieves all the exceptions for this event.
public getExceptions ( ) : array
return array Array containing the dates of all the exceptions in YYYYMMDD form.

getRecurCount() public method

Retrieves the number of recurrences of this event.
public getRecurCount ( ) : integer
return integer The number recurrences.

getRecurEnd() public method

Retrieves the end date of the recurrence interval.
public getRecurEnd ( ) : Horde_Date
return Horde_Date The recurrence end.

getRecurInterval() public method

Retrieves the length of time between recurrences of this event.
public getRecurInterval ( ) : integer
return integer The number of seconds between recurrences.

getRecurName() public method

Returns a description of this event's recurring type.
public getRecurName ( ) : string
return string Human readable recurring type.

getRecurOnDays() public method

Returns the days this event recurs on.
public getRecurOnDays ( ) : integer
return integer A mask consisting of Horde_Date::MASK_* constants specifying the day(s) this event recurs on.

getRecurStart() public method

Retrieves the start date of the recurrence interval.
public getRecurStart ( ) : Horde_Date
return Horde_Date The recurrence start.

getRecurType() public method

Returns recurrence type of this event.
public getRecurType ( ) : integer
return integer A RECUR_* constant.

hasActiveRecurrence() public method

Returns whether this event has any date that matches the recurrence rules and is not an exception.
public hasActiveRecurrence ( ) : boolean
return boolean True if an active recurrence exists.

hasCompletion() public method

Checks if a completion exists for a given reccurence of an event.
public hasCompletion ( integer $year, integer $month, integer $mday ) : boolean
$year integer The year of the recurrance.
$month integer The month of the recurrance.
$mday integer The day of the month of the recurrance.
return boolean True if a completion exists for the given date.

hasException() public method

Checks if an exception exists for a given reccurence of an event.
public hasException ( integer $year, integer $month, integer $mday ) : boolean
$year integer The year of the reucrance.
$month integer The month of the reucrance.
$mday integer The day of the month of the reucrance.
return boolean True if an exception exists for the given date.

hasRecurCount() public method

Returns whether this event has a recurrence with a fixed count.
public hasRecurCount ( ) : boolean
return boolean True if this recurrence has a fixed count.

hasRecurEnd() public method

Returns whether this event has a recurrence end.
public hasRecurEnd ( ) : boolean
return boolean True if this recurrence ends.

hasRecurType() public method

Returns whether this event has a specific recurrence type.
public hasRecurType ( integer $recurrence ) : boolean
$recurrence integer RECUR_* constant of the recurrence type to check for.
return boolean True if the event has the specified recurrence type.

isEqual() public method

The objects are considered equal if the recurrence rules are the same. This does not take any exceptions into account.
Since: 2.2.0
public isEqual ( Horde_Date_Recurrence $recurrence ) : boolean
$recurrence Horde_Date_Recurrence The recurrence object to check equality to.
return boolean True if the recurrence rules are the same.

nextActiveRecurrence() public method

Returns the next active recurrence.
public nextActiveRecurrence ( Horde_Date $afterDate ) : Horde_Date | boolean
$afterDate Horde_Date Return events after this date.
return Horde_Date | boolean The date of the next active recurrence or false if the event has no active recurrence after $afterDate.

nextRecurrence() public method

Finds the next recurrence of this event that's after $afterDate.
public nextRecurrence ( Horde_Date | string $after ) : Horde_Date | boolean
$after Horde_Date | string Return events after this date.
return Horde_Date | boolean The date of the next recurrence or false if the event does not recur after $afterDate.

recurOnDay() public method

Checks if this event recurs on a given day of the week.
public recurOnDay ( integer $dayMask ) : boolean
$dayMask integer A mask consisting of Horde_Date::MASK_* constants specifying the day(s) to check.
return boolean True if this event recurs on the given day(s).

reset() public method

Resets the class properties.
public reset ( )

setRecurCount() public method

Sets the number of recurrences of this event.
public setRecurCount ( integer $count )
$count integer The number of recurrences.

setRecurEnd() public method

Sets the end date of the recurrence interval.
public setRecurEnd ( Horde_Date $end )
$end Horde_Date The recurrence end.

setRecurInterval() public method

Sets the length of time between recurrences of this event.
public setRecurInterval ( integer $interval )
$interval integer The time between recurrences.

setRecurOnDay() public method

Specifies the days this event recurs on.
public setRecurOnDay ( integer $dayMask )
$dayMask integer A mask consisting of Horde_Date::MASK_* constants specifying the day(s) to recur on.

setRecurStart() public method

Sets the start date of the recurrence interval.
public setRecurStart ( Horde_Date $start )
$start Horde_Date The recurrence start.

setRecurType() public method

Sets a recurrence type for this event.
public setRecurType ( integer $recurrence )
$recurrence integer A RECUR_* constant.

toJson() public method

Possible properties are: - t: type - i: interval - e: end date - c: count - d: data - co: completions - ex: exceptions
public toJson ( ) : object
return object A simple object.

toKolab() public method

Export this object into a Kolab hash.
public toKolab ( ) : array
return array The recurrence hash.

toRRule10() public method

Creates a vCalendar 1.0 recurrence rule.
public toRRule10 ( Horde_Icalendar $calendar ) : string
$calendar Horde_Icalendar A Horde_Icalendar object instance.
return string A vCalendar 1.0 conform RRULE value.

toRRule20() public method

Creates an iCalendar 2.0 recurrence rule.
public toRRule20 ( Horde_Icalendar $calendar ) : string
$calendar Horde_Icalendar A Horde_Icalendar object instance.
return string An iCalendar 2.0 conform RRULE value.

toString() public method

Output a human readable description of the recurrence rule.
Since: 2.1.0
public toString ( $date_format ) : string
return string

Property Details

$completions public_oe property

All the dates this recurrence has been marked as completed.
public array $completions
return array

$exceptions public_oe property

All the exceptions from recurrence for this event.
public array $exceptions
return array

$recurCount public_oe property

The number of recurrences.
public int $recurCount
return integer

$recurData public_oe property

Any additional recurrence data.
public int $recurData
return integer

$recurEnd public_oe property

The end date of the recurrence interval.
public Horde_Date $recurEnd
return Horde_Date

$recurInterval public_oe property

The length of time between recurrences. The time unit depends on the recurrence type.
public int $recurInterval
return integer

$recurType public_oe property

The type of recurrence this event follows. RECUR_* constant.
public int $recurType
return integer

$start public_oe property

The start time of the event.
public Horde_Date $start
return Horde_Date