Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Calendar_Common Class Reference

Public Member Functions

 getSingleEventQueryBase ($root_ids, $event_type_code='calendar_event_single', $include_exceptions=TRUE, &$bind_vars=Array())
 
 getRecurringEventQueryBase ($root_ids, $view, $iso, $length=NULL, $event_type='calendar_event_recurring', &$bind_vars=Array())
 
 condenseResultTreeids ($raw)
 
expandEventList (&$events, $first_day, $last_day, $day_start_time='00:00', $day_end_time='23:59')
 
 processExceptions (&$res)
 
 compareStartDates ($a, $b)
 
 compareEventLengths ($a, $b)
 
 getDateComponents ($iso, $prefix='')
 
 _getTableList ()
 
 _ts2Sql ($y, $m, $d, $h='00', $i='00', $s='00')
 
 _getTreeClause ($root_ids)
 
 _expandSingleEvent (&$result_list, &$event, $assetid, $first_day, $last_day, $day_start_time, $day_end_time)
 
 _expandRecurringEvent (&$result_list, &$event, $assetid, $first_day, $last_day, $day_start_time, $day_end_time)
 
 _getDayStamp ($value)
 
 _getMonthStamp ($value)
 
 _getTypeDescendantsQuoted ($type_code)
 
 limitRecurringEventInstances ($events, $instances)
 
 getWholeEventInstances ($events, $first_day, $last_day, $day_start_time='00:00', $day_end_time='23:59')
 
 _getSingleEventWholeInstance (&$result_list, &$event, $assetid, $limit_start_day, $limit_end_day, $limit_start_time, $limit_end_time)
 
 _getRecurringEventWholeInstances (&$result_list, $event, $assetid, $first_day, $last_day, $day_start_time, $day_end_time, $frequency_threshold)
 

Detailed Description

+-----------------------------------------------------------------—+ | This MySource Matrix CMS file is Copyright (c) Squiz Pty Ltd | | ABN 77 084 670 600 | +-----------------------------------------------------------------—+ | IMPORTANT: Your use of this Software is subject to the terms of | | the Licence provided in the file licence.txt. If you cannot find | | this file please contact Squiz (www.squiz.com.au) so we may provide| | you a copy. | +-----------------------------------------------------------------—+

Id:
calendar_common.inc,v 1.79 2012/08/30 00:57:28 ewang Exp

Definition at line 33 of file calendar_common.inc.

Member Function Documentation

_expandRecurringEvent ( $result_list,
$event,
  $assetid,
  $first_day,
  $last_day,
  $day_start_time,
  $day_end_time 
)

Expands a list of recurring events into a series of single-day events

Parameters
array&$result_listThe result array to append the expanded events to
array&$eventThe cached calendar components of the event to expand (format as per structure of cal_date_val table)
int$assetidThe asset ID of the event being expanded
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
Returns
void public

Definition at line 1016 of file calendar_common.inc.

_expandSingleEvent ( $result_list,
$event,
  $assetid,
  $first_day,
  $last_day,
  $day_start_time,
  $day_end_time 
)

Expands a multiple-day single event into a series of single-day events

Parameters
array&$result_listThe result array to append the expanded events to
array&$eventThe cached calendar components of the event to expand (format as per structure of cal_date_val table)
int$assetidThe asset ID of the event being expanded
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
Returns
void public

Definition at line 883 of file calendar_common.inc.

_getDayStamp (   $value)

Get the daystamp value for the supplied date

Parameters
int | string$valueThe date to convert, either a timestamp or ISO-format date
Returns
int public

Definition at line 1235 of file calendar_common.inc.

_getMonthStamp (   $value)

Get the monthstamp value for the supplied date

Parameters
int | string$valueThe date to convert, either a timestamp or ISO-format date
Returns
int public

Definition at line 1257 of file calendar_common.inc.

_getRecurringEventWholeInstances ( $result_list,
  $event,
  $assetid,
  $first_day,
  $last_day,
  $day_start_time,
  $day_end_time,
  $frequency_threshold 
)

Expands a list of recurring events into a series of whole events

Parameters
array&$result_listThe result array to append the expanded events to
array$eventThe cached calendar components of the event to expand (format as per structure of cal_date_val table)
int$assetidThe asset ID of the event being expanded
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
string$frequency_threshold
Returns
void public

Definition at line 1448 of file calendar_common.inc.

_getSingleEventWholeInstance ( $result_list,
$event,
  $assetid,
  $limit_start_day,
  $limit_end_day,
  $limit_start_time,
  $limit_end_time 
)

Returns the whole single event instance

Parameters
array&$result_listThe result array to append the expanded events to
array$eventThe cached calendar components of the event to expand (format as per structure of cal_date_val table)
int$assetidThe asset ID of the event being expanded
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
Returns
void public

Definition at line 1391 of file calendar_common.inc.

_getTableList ( )

Build SQL join statements

Returns
string private

Definition at line 800 of file calendar_common.inc.

_getTreeClause (   $root_ids)

Returns an SQL fragment to restrict results to have treeids in the given range

Parameters
array$root_idsRoot nodes for the listing
Returns
string public

Definition at line 853 of file calendar_common.inc.

_getTypeDescendantsQuoted (   $type_code)

Returns a QUOTED array of a type's descendants

Parameters
string$type_codeType code
Returns
array public
See Also
Asset_Manager::getTypeDescendants()

Definition at line 1278 of file calendar_common.inc.

_ts2Sql (   $y,
  $m,
  $d,
  $h = '00',
  $i = '00',
  $s = '00' 
)

Build SQL to express the unix timestamp represented by the supplied date component expressions

Parameters
string$yExpression for the year component of the date
string$mExpression for the month component of the date
string$dExpression for the day component of the date
string$hExpression for the hour component of the time
string$iExpression for the minute component of the time
string$sExpression for the second component of the time
Returns
string public

Definition at line 821 of file calendar_common.inc.

compareEventLengths (   $a,
  $b 
)

compare lengths of two events

Parameters
array$aDetails of first comparee event
array$bDetails of second comparee event
Returns
int public

Definition at line 671 of file calendar_common.inc.

compareStartDates (   $a,
  $b 
)

Return true if event $a starts before $b

Parameters
array$aDetails of first comparee event
array$bDetails of second comparee event
Returns
boolean public

Definition at line 655 of file calendar_common.inc.

condenseResultTreeids (   $raw)

Condense a result with a new row for each treeid to a result with a new row for each assetid

Makes the 'treeid' entry into an array of treeids

Parameters
array$rawThe raw result with a row for each treeid
Returns
array public

Definition at line 521 of file calendar_common.inc.

& expandEventList ( $events,
  $first_day,
  $last_day,
  $day_start_time = '00:00',
  $day_end_time = '23:59' 
)

Expands list of multiple day and/or recurring events into a series of single-day events

Returned list of events is indexed by a shadow-asset-like identifier of 'assetid:instance' where instance is a 0-based index of how many times an instance the event has occurred previously.

Parameters
array&$eventsArray of Events
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
Returns
array public

Definition at line 553 of file calendar_common.inc.

getDateComponents (   $iso,
  $prefix = '' 
)

Split a datetime attribute into revelant components

Parameters
string$isothe date to split up in ISO format
string$prefixthe prefix to add to array keys generated by this fn
Returns
array public

Definition at line 687 of file calendar_common.inc.

getRecurringEventQueryBase (   $root_ids,
  $view,
  $iso,
  $length = NULL,
  $event_type = 'calendar_event_recurring',
$bind_vars = Array() 
)

Builds the common part of the recurring events query

The ISO 8601 date is taken as passed to the calling function - this means the:

  • YYYY-MM-DD of the day being shown in day view
  • YYYY-MM-DD of the first day in week view
  • the YYYY-MM (only, no day) of the month involved in month view
  • the YYYY (only) of the year involved in the year view
Parameters
array$root_idsArray of root nodes
string$viewthe type of view we are requesting (day|week|month|year|period)
string$isoISO 8601 date as passed to the calling function
int$lengthLength of period to look in (period view only)
string$event_typeDesired event type
array$bind_varsVars to bind when preparing the query later
Returns
string public

Definition at line 105 of file calendar_common.inc.

getSingleEventQueryBase (   $root_ids,
  $event_type_code = 'calendar_event_single',
  $include_exceptions = TRUE,
$bind_vars = Array() 
)

Builds the common part of the single events query

Parameters
array$root_idsRoot node IDs
string$event_type_codeType of the event
boolean$include_exceptionsInclude exceptions
array$bind_varsVars to bind when preparing the query later
Returns
string public

Definition at line 48 of file calendar_common.inc.

getWholeEventInstances (   $events,
  $first_day,
  $last_day,
  $day_start_time = '00:00',
  $day_end_time = '23:59' 
)

Expands list of single day and/or recurring events into a series of whole event instances

Parameters
array&$eventsArray of Events
string$first_dayThe first day we want to display (YYYY-MM-DD)
string$last_dayThe last day we want to display (YYYY-MM-DD)
string$day_start_timeEarliest time of day we will display (HH:mm)
string$day_end_timeLatest time of day we will display (HH:mm)
Returns
array public

Definition at line 1351 of file calendar_common.inc.

limitRecurringEventInstances (   $events,
  $instances 
)

Removes the recurring events instances all but first one if event's frequency is less than the predefined event frequency threshold

Parameters
array$eventsArray of Events
string$first_dayEvents instances
Returns
array public

Definition at line 1305 of file calendar_common.inc.

processExceptions ( $res)

Process exception events (cancellations and modifications) from the set of events passed

When a cancellation or modification event is found in the set, its parent recurring event is removed from the set, and for cancellation events they themselves are removed too

Parameters
array&$resa ($id => array(...)) array of events
Returns
void public

Definition at line 581 of file calendar_common.inc.


The documentation for this class was generated from the following file: