Xataface Calendar Module 0.1
Full Calendar for Xataface
Public Member Functions | Static Public Member Functions | Static Public Attributes
modules_calendar_RepeatEvent Class Reference

A class that encapsulates the "repeating" aspects of an event. It wraps the source record and the repeat info record and provides utility methods to load, save, and delete repeat instances of the event. More...

Public Member Functions

 getStartAtt ()
 Gets the name of the field that stores the start time in the events table.
 getEndAtt ()
 Gets the name of the field that stores the end time in the events table.
 getRepeatAtt ()
 Gets the name of the field that stores the repeat id for the events table.
 getRepeatSeedAtt ()
 getSourceStart ()
 Gets the start time of the source event record.
 getSourceEnd ()
 Gets the end time of the source event record.
 getRepeatID ()
 Gets the repeat ID of the source event record (and all events of this repeat sequence.
 __construct (Dataface_Record $source)
 Creates a new RepeatEvent object to wrap the given source record.
 loadRepeatInfo ()
 Loads the repeat info from the database into this record.
 getDefaultExpiryDifferential ()
 saveRepeatInfo ()
 Saves the repeat info from this object into the database. Note that this does not save all repeat event records. It only stores the repeat meta-info (e.g. the frequency and expire data).
 getRepeatRecords ($limit=250, $query=array())
 Gets all of the repeat event records thare are part of this repeat sequence and are after the source record.
 updateRepeats (array $changes, $startDiffSeconds, $endDiffSeconds, $secure=false)
 Updates all of the repeat records in this sequence with the values specified.
 clearRepeats ($secure=false, $query=array())
 Deletes all repeats in the current sequence that come after the source record.
 fillRepeats ($secure=false)
 Creates all of the repeats for the sequence based on the source record and repeat settings.
 isSaved ()
 Checks to see if the repeat info has already been saved.
 setSourceRecord (Dataface_Record $record)
 Sets the source event record for this sequence. This resets all of the repeat information (i.e. will need to recalculate) because a different record will result in likely a different repeat sequence.
 getSourceRecord ()
 Gets the source record of this sequence. The source record is treated as the "first" event of a sequence of repeating events. All other events in this sequence will be derived from the source record.
 setFrequency ($freq)
 Sets the frequency of this repeat sequence.
 getFrequency ()
 Gets the frequency of this repeat sequence.
 setStartDate ($date)
 Sets the start date of this sequence.
 getStartDate ()
 setExpiryDate ($d)
 Sets the expiry date of this sequence.
 getExpiryDate ()
 Gets the expiry date of this sequence.
 commit (array $changes, $startDiffSeconds, $endDiffSeconds, $secure=false)

Static Public Member Functions

static createRepeatTable ()
 Creates the table used to store repeat details.
static dropRepeatTable ()
static getModule ()
 Returns a reference to the calendar module class.

Static Public Attributes

static $EX_INVALID_FREQUENCY = 501
 Exception code when an invalid frequency is set.
static $EX_INVALID_REPEAT_ID = 502
 Exception code when an invalid repeat id is set.

Detailed Description

A class that encapsulates the "repeating" aspects of an event. It wraps the source record and the repeat info record and provides utility methods to load, save, and delete repeat instances of the event.

Definition at line 7 of file RepeatEvent.class.php.


Constructor & Destructor Documentation

__construct ( Dataface_Record $  source)

Creates a new RepeatEvent object to wrap the given source record.

Parameters:
Dataface_Record$sourceThe source or original event record that serves as a seed for this repeat sequence.

Definition at line 272 of file RepeatEvent.class.php.


Member Function Documentation

clearRepeats ( secure = false,
query = array() 
)

Deletes all repeats in the current sequence that come after the source record.

Parameters:
boolean$secureIf true it will cause this to respect the permissions on each repeat record. (i.e. If a repeat record does not grant the 'delete' permission, then the delete of that repeat will fail.
Returns:
array(Exception) A list of errors that occurred while attempting to delete the repeats.

Definition at line 513 of file RepeatEvent.class.php.

commit ( array $  changes,
startDiffSeconds,
endDiffSeconds,
secure = false 
)

Definition at line 784 of file RepeatEvent.class.php.

static createRepeatTable ( ) [static]

Creates the table used to store repeat details.

Definition at line 100 of file RepeatEvent.class.php.

static dropRepeatTable ( ) [static]

Definition at line 120 of file RepeatEvent.class.php.

fillRepeats ( secure = false)

Creates all of the repeats for the sequence based on the source record and repeat settings.

Parameters:
boolean$secureIf true this method will respect event permissions. I.e. if the 'new' permission is not granted on the events table, then the inserts will fail.
Returns:
array(Exception) List of errors that occurred in filling the repeat records.

Definition at line 556 of file RepeatEvent.class.php.

getDefaultExpiryDifferential ( )

Definition at line 308 of file RepeatEvent.class.php.

getEndAtt ( )

Gets the name of the field that stores the end time in the events table.

Returns:
string The name of the field that stores the end time in the events table.
Exceptions:
ExceptionIf no end field can be found in the events table.

The events table is the table where the $sourceRecord record comes from.

Definition at line 220 of file RepeatEvent.class.php.

getExpiryDate ( )

Gets the expiry date of this sequence.

Returns:
string The expiry date of this repeat sequence as a datetime string. Y-m-d H:i:s

Definition at line 781 of file RepeatEvent.class.php.

getFrequency ( )

Gets the frequency of this repeat sequence.

Returns:
string The frequency of this repeat sequence. Possible values include:
  • Daily
  • Weekly
  • Biweekly
  • Weekdays
  • Monthly
  • Yearly

Definition at line 760 of file RepeatEvent.class.php.

static getModule ( ) [static]

Returns a reference to the calendar module class.

Returns:
modules_calendar The calendar module.

Definition at line 167 of file RepeatEvent.class.php.

getRepeatAtt ( )

Gets the name of the field that stores the repeat id for the events table.

Returns:
string The name of the field that stores the repeat id in the events table.
Exceptions:
ExceptionIf no repeat field can be found in the events table.

The events table is the table where the $sourceRecord record comes from.

Definition at line 231 of file RepeatEvent.class.php.

getRepeatID ( )

Gets the repeat ID of the source event record (and all events of this repeat sequence.

Returns:
int The repeat ID of this repeat sequence.
Exceptions:
ExceptionIf no repeat field can be found in the events table.

Definition at line 263 of file RepeatEvent.class.php.

getRepeatRecords ( limit = 250,
query = array() 
)

Gets all of the repeat event records thare are part of this repeat sequence and are after the source record.

Parameters:
int$limitThe maximum number of records to return.

Definition at line 415 of file RepeatEvent.class.php.

getRepeatSeedAtt ( )

Definition at line 235 of file RepeatEvent.class.php.

getSourceEnd ( )

Gets the end time of the source event record.

Returns:
string The end time of the source event record as a date string 'Y-m-d H:i:s'
Exceptions:
ExceptionIf no end field can be found in the events table.

Definition at line 253 of file RepeatEvent.class.php.

getSourceRecord ( )

Gets the source record of this sequence. The source record is treated as the "first" event of a sequence of repeating events. All other events in this sequence will be derived from the source record.

Returns:
Dataface_Record The new source record up which this repeat sequence will be based.

Definition at line 728 of file RepeatEvent.class.php.

getSourceStart ( )

Gets the start time of the source event record.

Returns:
string The start time of the source event record as a date string 'Y-m-d H:i:s'
Exceptions:
ExceptionIf no start field can be found in the events table.

Definition at line 244 of file RepeatEvent.class.php.

getStartAtt ( )

Gets the name of the field that stores the start time in the events table.

Returns:
string The name of the field that stores the start time in the events table.
Exceptions:
ExceptionIf no start field can be found in the events table.

The events table is the table where the $sourceRecord record comes from.

Definition at line 208 of file RepeatEvent.class.php.

getStartDate ( )

Definition at line 769 of file RepeatEvent.class.php.

isSaved ( )

Checks to see if the repeat info has already been saved.

Returns:
boolean True if the repeat info has already been saved to the repeat table. If false, then this is likely a new repeat.

Definition at line 695 of file RepeatEvent.class.php.

loadRepeatInfo ( )

Loads the repeat info from the database into this record.

Note that this does not save all of the repeat event records. It only stores the repeat meta-info (e.g. the frequency and expire date).

Definition at line 285 of file RepeatEvent.class.php.

saveRepeatInfo ( )

Saves the repeat info from this object into the database. Note that this does not save all repeat event records. It only stores the repeat meta-info (e.g. the frequency and expire data).

Exceptions:
ExceptionIf the frequency is not set or is invalid. (CODE=self::$EX_INVALID_FREQUENCY)
ExceptionIf there is no valid repeat id and there is no repeat_seed field from which a repeat id can be derived. (CODE=self::$EX_INVALID_REPEAT_ID)

Definition at line 331 of file RepeatEvent.class.php.

setExpiryDate ( d)

Sets the expiry date of this sequence.

Parameters:
string$dateA datetime string to serve as the expiry date of this sequence.

Definition at line 775 of file RepeatEvent.class.php.

setFrequency ( freq)

Sets the frequency of this repeat sequence.

Parameters:
string$freqThe frequency of this repeat sequence. Possible values include:
  • Daily
  • Weekly
  • Biweekly
  • Weekdays
  • Monthly
  • Yearly

Definition at line 742 of file RepeatEvent.class.php.

setSourceRecord ( Dataface_Record $  record)

Sets the source event record for this sequence. This resets all of the repeat information (i.e. will need to recalculate) because a different record will result in likely a different repeat sequence.

Returns:
Dataface_Record $record The new source record up on which to base this repeat sequence.

Definition at line 713 of file RepeatEvent.class.php.

setStartDate ( date)

Sets the start date of this sequence.

Parameters:
string$dateA datetime string to serve as the start date of this sequence (not to be confused with the start time of the event).

Definition at line 767 of file RepeatEvent.class.php.

updateRepeats ( array $  changes,
startDiffSeconds,
endDiffSeconds,
secure = false 
)

Updates all of the repeat records in this sequence with the values specified.

Note that this will only affect repeat records that are later than the source record.

Parameters:
array$changesAssociative array of values that are to be updated in the records.
int$startDiffSecondsHow many seconds the start times should be shifted by each.
int$endDiffSecondsHow many seconds the end times should be shifted by each.
boolean$secureIf true then this will respect permissions when trying to save the repeat records. (i.e. they will each need to grant the 'edit' permission in order to save successfully).
Returns:
array(Exception) A list of errors that occurred while updating repeats. Hopefully this is empty.

Definition at line 444 of file RepeatEvent.class.php.


Field Documentation

$EX_INVALID_FREQUENCY = 501 [static]

Exception code when an invalid frequency is set.

Definition at line 12 of file RepeatEvent.class.php.

$EX_INVALID_REPEAT_ID = 502 [static]

Exception code when an invalid repeat id is set.

Definition at line 17 of file RepeatEvent.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables