PHP Класс Recurr\Rule

http://www.ietf.org/rfc/rfc2445.txt Information, not contained in the built/parsed RRULE, necessary to determine the various recurrence instance start time and dates are derived from the DTSTART property (default: \DateTime()). For example, "FREQ=YEARLY;BYMONTH=1" doesn't specify a specific day within the month or a time. This information would be the same as what is specified for DTSTART. BYxxx rule parts modify the recurrence in some manner. BYxxx rule parts for a period of time which is the same or greater than the frequency generally reduce or limit the number of occurrences of the recurrence generated. For example, "FREQ=DAILY;BYMONTH=1" reduces the number of recurrence instances from all days (if BYMONTH tag is not present) to all days in January. BYxxx rule parts for a period of time less than the frequency generally increase or expand the number of occurrences of the recurrence. For example, "FREQ=YEARLY;BYMONTH=1,2" increases the number of days within the yearly recurrence set from 1 (if BYMONTH tag is not present) to 2. If multiple BYxxx rule parts are specified, then after evaluating the specified FREQ and INTERVAL rule parts, the BYxxx rule parts are applied to the current set of evaluated occurrences in the following order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated. Here is an example of evaluating multiple BYxxx rule parts. FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30 First, the "INTERVAL=2" would be applied to "FREQ=YEARLY" to arrive at "every other year". Then, "BYMONTH=1" would be applied to arrive at "every January, every other year". Then, "BYDAY=SU" would be applied to arrive at "every Sunday in January, every other year". Then, "BYHOUR=8,9" would be applied to arrive at "every Sunday in January at 8 AM and 9 AM, every other year". Then, "BYMINUTE=30" would be applied to arrive at "every Sunday in January at 8:30 AM and 9:30 AM, every other year". Then, lacking information from RRULE, the second is derived from DTSTART, to end up in "every Sunday in January at 8:30:00 AM and 9:30:00 AM, every other year". Similarly, if the BYMINUTE, BYHOUR, BYDAY, BYMONTHDAY or BYMONTH rule part were missing, the appropriate minute, hour, day or month would have been retrieved from the "DTSTART" property. Example: The following is a rule which specifies 10 meetings which occur every other day: FREQ=DAILY;COUNT=10;INTERVAL=2
Автор: Shaun Simmons ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$freqs

Защищенные свойства (Protected)

Свойство Тип Описание
$byDay array
$byHour array
$byMinute array
$byMonth array
$byMonthDay array
$bySecond array
$bySetPosition integer
$byWeekNumber array
$byYearDay array
$count integer | null
$days array
$endDate DateTime | null
$exDates array
$freq string
$interval integer
$isExplicitInterval boolean
$isStartDateFromDtstart boolean
$rDates array
$startDate DateTime | null
$timezone string
$until DateTime | null
$weekStart string
$weekStartDefined

Открытые методы

Метод Описание
__construct ( string $rrule = null, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) Construct a new Rule.
createFromArray ( array $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule Create a Rule object based on a RRULE array.
createFromString ( string $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule Create a Rule object based on a RRULE string.
getByDay ( ) : array Get an array of days of the week (SU, MO, TU, .
getByDayTransformedToWeekdays ( ) : array Get an array of Weekdays
getByHour ( ) : array Get an array of hours of the day.
getByMinute ( ) : array Get an array of minutes within an hour.
getByMonth ( ) : array Get an array of months of the year.
getByMonthDay ( ) : array Get an array of days of the month.
getBySecond ( ) : array Get an array of seconds within a minute.
getBySetPosition ( ) : array Get the array of values which corresponds to the nth occurrence within the set of events specified by the rule.
getByWeekNumber ( ) : array Get an array of ordinals specifying weeks of the year.
getByYearDay ( ) : array Get an array of days of the year.
getCount ( ) : integer | null Get the number of occurrences at which the recurrence is range-bound.
getEndDate ( ) : DateTime
getExDates ( ) : recurr\DateExclusion[] Get the array of dates that will not be included in a recurrence set.
getFreq ( ) : integer Get the type of recurrence rule (as integer).
getFreqAsText ( ) : string Get the type of recurrence rule (as text).
getInterval ( ) : integer Get the interval that represents how often the recurrence rule repeats.
getRDates ( ) : recurr\DateInclusion[] Get the array of dates that will be included in a recurrence set.
getStartDate ( ) : DateTime
getString ( $timezoneType = self::TZ_FLOAT ) : string Get the RRULE as a string
getTimezone ( ) : null | string Get timezone to use for \DateTime() objects that are UTC.
getUntil ( ) : DateTime | null Get the \DateTime that the recurrence lasts until.
getWeekStart ( ) : string Get the day on which the workweek starts.
getWeekStartAsNum ( ) : integer Get the day on which the workweek starts, as an integer from 0-6, 0 being Monday and 6 being Sunday.
hasByMonth ( )
loadFromArray ( $parts ) : Rule Populate the object based on a RRULE array.
loadFromString ( string $rrule ) : Rule Populate the object based on a RRULE string.
setByDay ( array $byDay ) This rule specifies an array of days of the week;
setByHour ( array $byHour ) This rule specifies an array of hours of the day.
setByMinute ( array $byMinute ) This rule specifies an array of minutes within an hour.
setByMonth ( array $byMonth ) This rule specifies an array of months of the year.
setByMonthDay ( array $byMonthDay ) This rule specifies an array of days of the month.
setBySecond ( array $bySecond ) This rule specifies an array of seconds within a minute.
setBySetPosition ( array $bySetPosition ) This rule specifies an array of values which corresponds to the nth occurrence within the set of events specified by the rule. Valid values are 1 to 366 or -366 to -1. It MUST only be used in conjunction with another BYxxx rule part.
setByWeekNumber ( array $byWeekNumber ) This rule specifies an array of ordinals specifying weeks of the year.
setByYearDay ( array $byYearDay ) This rule specifies an array of days of the year.
setCount ( integer $count ) The count defines the number of occurrences at which to range-bound the recurrence. The DTSTART counts as the first occurrence.
setEndDate ( DateTime | null $endDate ) This date specifies the last possible instance in the recurrence set.
setExDates ( array $exDates ) This rule specifies an array of exception dates that will not be included in a recurrence set.
setFreq ( string $freq ) Identifies the type of recurrence rule.
setInterval ( integer $interval ) The interval represents how often the recurrence rule repeats.
setRDates ( array $rDates ) This rule specifies an array of dates that will be included in a recurrence set.
setStartDate ( DateTime | null $startDate, boolean | null $includeInString = null ) This date specifies the first instance in the recurrence set.
setTimezone ( string $timezone )
setUntil ( DateTime $until ) Define a \DateTime value which bounds the recurrence rule in an inclusive manner. If the value specified is synchronized with the specified recurrence, this DateTime becomes the last instance of the recurrence. If not present, and a COUNT is also not present, the RRULE is considered to repeat forever.
setWeekStart ( string $weekStart ) This rule specifies the day on which the workweek starts.

Приватные методы

Метод Описание
convertZtoUtc ( DateTime $date ) : DateTime DateTime::setTimezone fails if the timezone does not have an ID.

Описание методов

__construct() публичный Метод

Construct a new Rule.
public __construct ( string $rrule = null, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null )
$rrule string RRULE string
$startDate string | DateTime
$endDate DateTime | null
$timezone string

createFromArray() публичный статический Метод

Create a Rule object based on a RRULE array.
public static createFromArray ( array $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule
$rrule array RRULE array
$startDate string | DateTime
$endDate DateTime | null
$timezone string
Результат Rule

createFromString() публичный статический Метод

Create a Rule object based on a RRULE string.
public static createFromString ( string $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule
$rrule string RRULE string
$startDate string | DateTime
$endDate DateTime | null
$timezone string
Результат Rule

getByDay() публичный Метод

.)
public getByDay ( ) : array
Результат array

getByDayTransformedToWeekdays() публичный Метод

Get an array of Weekdays
public getByDayTransformedToWeekdays ( ) : array
Результат array of Weekdays

getByHour() публичный Метод

Get an array of hours of the day.
public getByHour ( ) : array
Результат array

getByMinute() публичный Метод

Get an array of minutes within an hour.
public getByMinute ( ) : array
Результат array

getByMonth() публичный Метод

Get an array of months of the year.
public getByMonth ( ) : array
Результат array

getByMonthDay() публичный Метод

Get an array of days of the month.
public getByMonthDay ( ) : array
Результат array

getBySecond() публичный Метод

Get an array of seconds within a minute.
public getBySecond ( ) : array
Результат array

getBySetPosition() публичный Метод

Get the array of values which corresponds to the nth occurrence within the set of events specified by the rule.
public getBySetPosition ( ) : array
Результат array

getByWeekNumber() публичный Метод

Get an array of ordinals specifying weeks of the year.
public getByWeekNumber ( ) : array
Результат array

getByYearDay() публичный Метод

Get an array of days of the year.
public getByYearDay ( ) : array
Результат array

getCount() публичный Метод

Get the number of occurrences at which the recurrence is range-bound.
public getCount ( ) : integer | null
Результат integer | null

getEndDate() публичный Метод

public getEndDate ( ) : DateTime
Результат DateTime

getExDates() публичный Метод

Get the array of dates that will not be included in a recurrence set.
public getExDates ( ) : recurr\DateExclusion[]
Результат recurr\DateExclusion[]

getFreq() публичный Метод

Get the type of recurrence rule (as integer).
public getFreq ( ) : integer
Результат integer

getFreqAsText() публичный Метод

Get the type of recurrence rule (as text).
public getFreqAsText ( ) : string
Результат string

getInterval() публичный Метод

Get the interval that represents how often the recurrence rule repeats.
public getInterval ( ) : integer
Результат integer

getRDates() публичный Метод

Get the array of dates that will be included in a recurrence set.
public getRDates ( ) : recurr\DateInclusion[]
Результат recurr\DateInclusion[]

getStartDate() публичный Метод

public getStartDate ( ) : DateTime
Результат DateTime

getString() публичный Метод

Get the RRULE as a string
public getString ( $timezoneType = self::TZ_FLOAT ) : string
Результат string

getTimezone() публичный Метод

Get timezone to use for \DateTime() objects that are UTC.
public getTimezone ( ) : null | string
Результат null | string

getUntil() публичный Метод

Get the \DateTime that the recurrence lasts until.
public getUntil ( ) : DateTime | null
Результат DateTime | null

getWeekStart() публичный Метод

Get the day on which the workweek starts.
public getWeekStart ( ) : string
Результат string

getWeekStartAsNum() публичный Метод

Get the day on which the workweek starts, as an integer from 0-6, 0 being Monday and 6 being Sunday.
public getWeekStartAsNum ( ) : integer
Результат integer

hasByMonth() публичный Метод

public hasByMonth ( )

loadFromArray() публичный Метод

Populate the object based on a RRULE array.
public loadFromArray ( $parts ) : Rule
Результат Rule

loadFromString() публичный Метод

Populate the object based on a RRULE string.
public loadFromString ( string $rrule ) : Rule
$rrule string RRULE string
Результат Rule

setByDay() публичный Метод

MO indicates Monday; TU indicates Tuesday; WE indicates Wednesday; TH indicates Thursday; FR indicates Friday; SA indicates Saturday; SU indicates Sunday. Each BYDAY value can also be preceded by a positive (+n) or negative (-n) integer. If present, this indicates the nth occurrence of the specific day within the MONTHLY or YEARLY RRULE. For example, within a MONTHLY rule, +1MO (or simply 1MO) represents the first Monday within the month, whereas -1MO represents the last Monday of the month. If an integer modifier is not present, it means all days of this type within the specified frequency. For example, within a MONTHLY rule, MO represents all Mondays within the month. ------------------------------------------- DO NOT MIX DAYS AND DAYS WITH MODIFIERS. This is not supported. -------------------------------------------
public setByDay ( array $byDay )
$byDay array Array of days of the week

setByHour() публичный Метод

Valid values are 0 to 23.
public setByHour ( array $byHour )
$byHour array Array of hours of the day

setByMinute() публичный Метод

Valid values are 0 to 59.
public setByMinute ( array $byMinute )
$byMinute array Array of minutes within an hour

setByMonth() публичный Метод

Valid values are 1 to 12.
public setByMonth ( array $byMonth )
$byMonth array Array of months of the year from 1 to 12

setByMonthDay() публичный Метод

Valid values are 1 to 31 or -31 to -1. For example, -10 represents the tenth to the last day of the month.
public setByMonthDay ( array $byMonthDay )
$byMonthDay array Array of days of the month from -31 to 31

setBySecond() публичный Метод

Valid values are 0 to 59.
public setBySecond ( array $bySecond )
$bySecond array Array of seconds within a minute

setBySetPosition() публичный Метод

For example "the last work day of the month" could be represented as: RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 Each BYSETPOS value can include a positive or negative integer. If present, this indicates the nth occurrence of the specific occurrence within the set of events specified by the rule.
public setBySetPosition ( array $bySetPosition )
$bySetPosition array Array of values which corresponds to the nth occurrence within the set of events specified by the rule.

setByWeekNumber() публичный Метод

Valid values are 1 to 53 or -53 to -1. This corresponds to weeks according to week numbering as defined in [ISO 8601]. A week is defined as a seven day period, starting on the day of the week defined to be the week start (see setWeekStart). Week number one of the calendar year is the first week which contains at least four days in that calendar year. This rule is only valid for YEARLY rules. For example, 3 represents the third week of the year. Note: Assuming a Monday week start, week 53 can only occur when Thursday is January 1 or if it is a leap year and Wednesday is January 1.
public setByWeekNumber ( array $byWeekNumber )
$byWeekNumber array Array of ordinals specifying weeks of the year.

setByYearDay() публичный Метод

Valid values are 1 to 366 or -366 to -1. For example, -1 represents the last day of the year (December 31st) and -306 represents the 306th to the last day of the year (March 1st).
public setByYearDay ( array $byYearDay )
$byYearDay array Array of days of the year from -1 to 306

setCount() публичный Метод

Either COUNT or UNTIL may be specified, but COUNT and UNTIL MUST NOT both be specified.
public setCount ( integer $count )
$count integer Number of occurrences

setEndDate() публичный Метод

This date specifies the last possible instance in the recurrence set.
public setEndDate ( DateTime | null $endDate )
$endDate DateTime | null Date of the last possible instance in the recurrence

setExDates() публичный Метод

This rule specifies an array of exception dates that will not be included in a recurrence set.
public setExDates ( array $exDates )
$exDates array Array of dates that will not be included in the recurrence set.

setFreq() публичный Метод

May be one of: - Frequency::SECONDLY to specify repeating events based on an interval of a second or more. - Frequency::MINUTELY to specify repeating events based on an interval of a minute or more. - Frequency::HOURLY to specify repeating events based on an interval of an hour or more. - Frequency::DAILY to specify repeating events based on an interval of a day or more. - Frequency::WEEKLY to specify repeating events based on an interval of a week or more. - Frequency::MONTHLY to specify repeating events based on an interval of a month or more. - Frequency::YEAR to specify repeating events based on an interval of a year or more.
public setFreq ( string $freq )
$freq string Frequency of recurrence.

setInterval() публичный Метод

The default value is "1", meaning every second for a SECONDLY rule, or every minute for a MINUTELY rule, every hour for an HOURLY rule, every day for a DAILY rule, every week for a WEEKLY rule, every month for a MONTHLY rule and every year for a YEARLY rule.
public setInterval ( integer $interval )
$interval integer Positive integer that represents how often the recurrence rule repeats.

setRDates() публичный Метод

This rule specifies an array of dates that will be included in a recurrence set.
public setRDates ( array $rDates )
$rDates array Array of dates that will be included in the recurrence set.

setStartDate() публичный Метод

This date specifies the first instance in the recurrence set.
public setStartDate ( DateTime | null $startDate, boolean | null $includeInString = null )
$startDate DateTime | null Date of the first instance in the recurrence
$includeInString boolean | null If true, include as DTSTART when calling getString()

setTimezone() публичный Метод

См. также: http://www.php.net/manual/en/timezones.php
public setTimezone ( string $timezone )
$timezone string

setUntil() публичный Метод

Either UNTIL or COUNT may be specified, but UNTIL and COUNT MUST NOT both be specified.
public setUntil ( DateTime $until )
$until DateTime The upper bound of the recurrence.

setWeekStart() публичный Метод

Valid values are MO, TU, WE, TH, FR, SA and SU. This is significant when a WEEKLY RRULE has an interval greater than 1, and a BYDAY rule part is specified. This is also significant when in a YEARLY RRULE when a BYWEEKNO rule is specified. The default value is MO.
public setWeekStart ( string $weekStart )
$weekStart string The day on which the workweek starts.

Описание свойств

$byDay защищенное свойство

protected array $byDay
Результат array

$byHour защищенное свойство

protected array $byHour
Результат array

$byMinute защищенное свойство

protected array $byMinute
Результат array

$byMonth защищенное свойство

protected array $byMonth
Результат array

$byMonthDay защищенное свойство

protected array $byMonthDay
Результат array

$bySecond защищенное свойство

protected array $bySecond
Результат array

$bySetPosition защищенное свойство

protected int $bySetPosition
Результат integer

$byWeekNumber защищенное свойство

protected array $byWeekNumber
Результат array

$byYearDay защищенное свойство

protected array $byYearDay
Результат array

$count защищенное свойство

protected int|null $count
Результат integer | null

$days защищенное свойство

protected array $days
Результат array

$endDate защищенное свойство

protected DateTime|null $endDate
Результат DateTime | null

$exDates защищенное свойство

protected array $exDates
Результат array

$freq защищенное свойство

protected string $freq
Результат string

$freqs публичное статическое свойство

public static $freqs

$interval защищенное свойство

protected int $interval
Результат integer

$isExplicitInterval защищенное свойство

protected bool $isExplicitInterval
Результат boolean

$isStartDateFromDtstart защищенное свойство

protected bool $isStartDateFromDtstart
Результат boolean

$rDates защищенное свойство

protected array $rDates
Результат array

$startDate защищенное свойство

protected DateTime|null $startDate
Результат DateTime | null

$timezone защищенное свойство

protected string $timezone
Результат string

$until защищенное свойство

protected DateTime|null $until
Результат DateTime | null

$weekStart защищенное свойство

protected string $weekStart
Результат string

$weekStartDefined защищенное свойство

protected $weekStartDefined