Overview

Namespaces

  • intouch
    • ical

Classes

  • Duration
  • Factory
  • Freq
  • iCal
  • Line
  • Parser
  • Query
  • Recurrence
  • VCalendar
  • VEvent
  • VTimeZone
  • Overview
  • Namespace
  • Class
  • Tree

Class Freq

A class to store Frequency-rules in. Will allow a easy way to find the last and next occurrence of the rule.

No - this is so not pretty. But.. ehh.. You do it better, and I will gladly accept patches.

Created by trail-and-error on the examples given in the RFC.

TODO: Update to a better way of doing calculating the different options. Instead of only keeping track of the best of the current dates found it should instead keep a array of all the calculated dates within the period. This should fix the issues with multi-rule + multi-rule interference, and make it possible to implement the SETPOS rule. By pushing the next period onto the stack as the last option will (hopefully) remove the need for the awful simpleMode

Namespace: intouch\ical
License: CC-BY-SA-DK
Author: Morten Fangel (C) 2008
Author: Michael Kahn (C) 2013
Located at ical/Freq.php
Methods summary
public
# __construct( mixed $rule, mixed $start, mixed $excluded = array(), mixed $added = array() )

Constructs a new Freqency-rule

Constructs a new Freqency-rule

Parameters

$rule
mixed
$rule string
$start
mixed
$start int Unix-timestamp (important : Need to be the start of Event)
$excluded
mixed
$excluded array of int (timestamps), see EXDATE documentation
$added
mixed
$added array of int (timestamps), see RDATE documentation
public array
# getAllOccurrences( )

Returns all timestamps array(), build the cache if not made before

Returns all timestamps array(), build the cache if not made before

Returns

array
public integer
# previousOccurrence( integer $offset )

Returns the previous (most recent) occurrence of the rule from the given offset

Returns the previous (most recent) occurrence of the rule from the given offset

Parameters

$offset
integer
$offset

Returns

integer
public integer
# nextOccurrence( integer $offset )

Returns the next occurrence of this rule after the given offset

Returns the next occurrence of this rule after the given offset

Parameters

$offset
integer
$offset

Returns

integer
public integer
# firstOccurrence( )

Finds the first occurrence of the rule.

Finds the first occurrence of the rule.

Returns

integer
timestamp
public integer
# lastOccurrence( )

Finds the absolute last occurrence of the rule from the given offset. Builds also the cache, if not set before...

Finds the absolute last occurrence of the rule from the given offset. Builds also the cache, if not set before...

Returns

integer
timestamp
public integer
# findNext( integer $offset )

Calculates the next time after the given offset that the rule will apply.

Calculates the next time after the given offset that the rule will apply.

The approach to finding the next is as follows: First we establish a timeframe to find timestamps in. This is between $offset and the end of the period that $offset is in.

We then loop though all the rules (that is a Prerule in the current freq.), and finds the smallest timestamp inside the timeframe.

If we find something, we check if the date is a valid recurrence (with validDate). If it is, we return it. Otherwise we try to find a new date inside the same timeframe (but using the new- found date as offset)

If no new timestamps were found in the period, we try in the next period

Parameters

$offset
integer
$offset

Returns

integer
public integer
# findEndOfPeriod( integer $offset )

Finds the earliest timestamp posible outside this perioid

Finds the earliest timestamp posible outside this perioid

Parameters

$offset
integer
$offset

Returns

integer
Properties summary
protected array $weekdays array('MO'=>'monday', 'TU'=>'tuesday', 'WE'=>'wednesday', 'TH'=>'thursday', 'FR'=>'friday', 'SA'=>'saturday', 'SU'=>'sunday')
#
protected array $knownRules array('month', 'weekno', 'day', 'monthday', 'yearday', 'hour', 'minute')
#
protected array $ruleModifiers array('wkst')
#
protected boolean $simpleMode true
#
protected array $rules array('freq'=>'yearly', 'interval'=>1)
#
protected integer $start 0
#
protected string $freq ''
#
protected mixed $excluded
#
protected mixed $added
#
protected mixed $cache
#
intouch-iCalendar API documentation generated by ApiGen 2.8.0