[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/calendar/classes/ -> rrule_manager.php (summary)

Defines calendar class to manage recurrence rule (rrule) during ical imports.

Copyright: 2014 onwards Ankit Agarwal
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 666 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

rrule_manager:: (12 methods):
  __construct()
  parse_rrule()
  parse_rrule_property()
  set_frequency()
  get_day()
  create_events()
  create_repeated_events()
  create_repeated_events_by_offsets()
  create_repeated_events_by_offsets_from_fixedstart()
  create_weekly_events()
  create_monthly_events()
  create_yearly_events()


Class: rrule_manager  - X-Ref

Defines calendar class to manage recurrence rule (rrule) during ical imports.

Please refer to RFC 2445 {@link http://www.ietf.org/rfc/rfc2445.txt} for detail explanation of the logic.
Here is a basic extract from it to explain various params:-
recur = "FREQ"=freq *(
; either UNTIL or COUNT may appear in a 'recur',
; but UNTIL and COUNT MUST NOT occur in the same 'recur'
( ";" "UNTIL" "=" enddate ) /
( ";" "COUNT" "=" 1*DIGIT ) /
; the rest of these keywords are optional,
; but MUST NOT occur more than once
( ";" "INTERVAL" "=" 1*DIGIT )          /
( ";" "BYSECOND" "=" byseclist )        /
( ";" "BYMINUTE" "=" byminlist )        /
( ";" "BYHOUR" "=" byhrlist )           /
( ";" "BYDAY" "=" bywdaylist )          /
( ";" "BYMONTHDAY" "=" bymodaylist )    /
( ";" "BYYEARDAY" "=" byyrdaylist )     /
( ";" "BYWEEKNO" "=" bywknolist )       /
( ";" "BYMONTH" "=" bymolist )          /
( ";" "BYSETPOS" "=" bysplist )         /
( ";" "WKST" "=" weekday )              /
( ";" x-name "=" text )
)

freq       = "SECONDLY" / "MINUTELY" / "HOURLY" / "DAILY"
/ "WEEKLY" / "MONTHLY" / "YEARLY"
enddate    = date
enddate    =/ date-time            ;An UTC value
byseclist  = seconds / ( seconds *("," seconds) )
seconds    = 1DIGIT / 2DIGIT       ;0 to 59
byminlist  = minutes / ( minutes *("," minutes) )
minutes    = 1DIGIT / 2DIGIT       ;0 to 59
byhrlist   = hour / ( hour *("," hour) )
hour       = 1DIGIT / 2DIGIT       ;0 to 23
bywdaylist = weekdaynum / ( weekdaynum *("," weekdaynum) )
weekdaynum = [([plus] ordwk / minus ordwk)] weekday
plus       = "+"
minus      = "-"
ordwk      = 1DIGIT / 2DIGIT       ;1 to 53
weekday    = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA"
;Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
;FRIDAY, SATURDAY and SUNDAY days of the week.
bymodaylist = monthdaynum / ( monthdaynum *("," monthdaynum) )
monthdaynum = ([plus] ordmoday) / (minus ordmoday)
ordmoday   = 1DIGIT / 2DIGIT       ;1 to 31
byyrdaylist = yeardaynum / ( yeardaynum *("," yeardaynum) )
yeardaynum = ([plus] ordyrday) / (minus ordyrday)
ordyrday   = 1DIGIT / 2DIGIT / 3DIGIT      ;1 to 366
bywknolist = weeknum / ( weeknum *("," weeknum) )
weeknum    = ([plus] ordwk) / (minus ordwk)
bymolist   = monthnum / ( monthnum *("," monthnum) )
monthnum   = 1DIGIT / 2DIGIT       ;1 to 12
bysplist   = setposday / ( setposday *("," setposday) )
setposday  = yeardaynum

__construct($rrule)   X-Ref
Constructor for the class

param: string $rrule Recurrence rule

parse_rrule()   X-Ref
Parse the recurrence rule and setup all properties.


parse_rrule_property($prop)   X-Ref
Parse a property of the recurrence rule.

param: string $prop property string with type-value pair

set_frequency($freq)   X-Ref
Sets Frequency property.

param: string $freq Frequency of event

get_day($daystring)   X-Ref
Gets the day from day string.

param: string $daystring Day string (MO, TU, etc)
return: string Day represented by the parameter.

create_events($passedevent)   X-Ref
Create events for specified rrule.

param: \calendar_event $passedevent Properties of event to create.

create_repeated_events($event, $timediff, $currenttime = false)   X-Ref
Create repeated events.

param: \stdClass $event Event properties to create event
param: int $timediff Time difference between events in seconds
param: bool $currenttime If set, the event timestart is used as the timestart for the first event,

create_repeated_events_by_offsets($event, $secsoffset, $dayoffset, $monthoffset, $yearoffset, $start,$currenttime = false)   X-Ref
Create repeated events based on offsets.

param: \stdClass $event
param: int $secsoffset Seconds since the start of the day that this event occurs
param: int $dayoffset Day offset.
param: int $monthoffset Months offset.
param: int $yearoffset Years offset.
param: int $start timestamp to apply offsets onto.
param: bool $currenttime If set, the event timestart is used as the timestart for the first event,

create_repeated_events_by_offsets_from_fixedstart($event, $secsoffset, $prefix, $monthoffset,$yearoffset, $start, $currenttime = false)   X-Ref
Create repeated events based on offsets from a fixed start date.

param: \stdClass $event
param: int $secsoffset Seconds since the start of the day that this event occurs
param: string $prefix Prefix string to add to strtotime while calculating next date for the event.
param: int $monthoffset Months offset.
param: int $yearoffset Years offset.
param: int $start timestamp to apply offsets onto.
param: bool $currenttime If set, the event timestart is used as the timestart + offset for the first event,

create_weekly_events($event)   X-Ref
Create events for weekly frequency.

param: \stdClass $event Event properties to create event

create_monthly_events($event)   X-Ref
Create events for monthly frequency.

param: \stdClass $event Event properties to create event

create_yearly_events($event)   X-Ref
Create events for yearly frequency.

param: \stdClass $event Event properties to create event



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1