Class Calendar

Description

Calendar object

Retrives, sorts and displays bookings for an instrument over a given period of time

  • todo: //TODO: display bugs for off-slot bookings?
  • todo: //TODO: week-long / multi-day bookings

Located in /inc/bb/calendar.php (line 55)


	
			
Variable Summary
Method Summary
Calendar Calendar (SimpleDate $start, SimpleDate $stop, mixed $instrument)
void display ()
void displayAsTable ()
string displayDayAsTable (SimpleTime $daystart, SimpleTime $daystop, integer $granularity, integer $reportPeriod)
string displayMonthAsTable (SimpleTime $daystart, SimpleTime $daystop, integer $granularity, integer $reportPeriod)
void log (string $string, [integer $priority = 10])
void setOutputStyles (string $dayClass, string $today, mixed $day, [string $dayrotate = 'm'])
void setTimeSlotPicture (string $pic)
void slotlog (string $string, TimeSlot $slot, [boolean $display = false])
void timelog (string $string,  $time, SimpleDate $slot)
void _breakAccordingToList ($list $list, $keepTimesVacant $keepTimesVacant, $keepTimesBook $keepTimesBook)
void _collectMatrix ( $daystart,  $daystop,  $granularity)
void _fill ()
void _getBookingData ( $instrument)
string _getDayClass (SimpleDate $today, SimpleDate $t)
void _reduceList ( $list)
Variables
string $bookhrefCallback = '' (line 73)
  • var: callback function used to make URLs for booking hrefs in the calendar
BookingData $bookinglist (line 69)
  • var: list of bookings
string $dayClass = '' (line 75)
  • var: html/css class to be used for all table cells corresponding to a day
integer $DEBUG = 0 (line 94)
  • var: debug level (0=off, 10=verbose)
boolean $fatal_sql = 1 (line 67)
  • var: sql errors are fatal
boolean $freeBusyOnly = false (line 87)
  • var: only show free/busy information and not the details of the bookings
integer $instrument (line 63)
  • var: instrument id number for which the calendar is being displayed
array $instrumentlist = null (line 65)
  • var: list of instrument ids for which the calendar is being displayed
boolean $isAdminView = 0 (line 85)
  • var: generate the calendar with an admin view (i.e. all times are bookable)
integer $numDays (line 61)
  • var: number of days in the calendar
integer $reloadInterval = 300000 (line 91)
  • var: time after which the calendar should automatically reload itself (in milliseconds)
mixed $rotateDayClass = '' (line 79)
  • var: array or string. list of html/css class to be rotated through month by month for the time periods in the calendar
mixed $rotateDayClassDatePart = '' (line 81)
  • var: array or string. list of html/css class to be rotated through month by month for the day header
boolean $showDetails = true (line 89)
  • var: show a popup layer with extra details on it on the page
SimpleDate $start (line 57)
  • var: start date/time for the calendar
SimpleDate $stop (line 59)
  • var: stop date/time for the calendar
TimeSlotRule $timeslots (line 83)
  • var: time slots that govern this calendar
string $todayClass = '' (line 77)
  • var: html/css class to be used for all table cells corresponding today
string $zoomhref = '' (line 71)
  • var: prepended to all zoom hrefs generated by in the calendar
Methods
Constructor Calendar (line 103)

Create a calendar object, can display bookings in calendar format

Calendar Calendar (SimpleDate $start, SimpleDate $stop, mixed $instrument)
  • SimpleDate $start: start time to display bookings from
  • SimpleDate $stop: stop time to display bookings until
  • mixed $instrument: what instrument number (or list of instrumets) to display bookings for
display (line 455)

Display the booking details in a list

void display ()
displayAsTable (line 462)

Display the booking details in a list

void displayAsTable ()
displayDayAsTable (line 593)

Display the booking details in a table with rowspan based on the duration of the booking

  • return: html representation of the calendar
string displayDayAsTable (SimpleTime $daystart, SimpleTime $daystop, integer $granularity, integer $reportPeriod)
  • SimpleTime $daystart: time from which bookings should be displayed
  • SimpleTime $daystop: time up until which bookings should be displayed
  • integer $granularity: seconds per row in display
  • integer $reportPeriod: seconds between reporting the time in a column down the side
displayMonthAsTable (line 481)

Generate html for the booking details in a table with rowspan based on the duration of the booking

  • return: html representation of the calendar
string displayMonthAsTable (SimpleTime $daystart, SimpleTime $daystop, integer $granularity, integer $reportPeriod)
  • SimpleTime $daystart: time from which bookings should be displayed
  • SimpleTime $daystop: time up until which bookings should be displayed
  • integer $granularity: seconds per row in display
  • integer $reportPeriod: seconds between reporting the time in a column down the side
log (line 671)

logging function -- logs debug info to stdout

The higher $priority, the more verbose (in the debugging sense) the output.

void log (string $string, [integer $priority = 10])
  • string $string: text to be logged
  • integer $priority: (optional, default value 10) debug level of the message
setOutputStyles (line 126)

set the CSS style names by which

void setOutputStyles (string $dayClass, string $today, mixed $day, [string $dayrotate = 'm'])
  • string $dayClass: class to use in every day header
  • string $today: class to use on today's date
  • mixed $day: string for class on each day, or array to rotate through
  • string $dayrotate: time-part ('m', 'd', 'y' etc) on which day CDD should be rotated
setTimeSlotPicture (line 138)

set the time slot picture (passed straight to a TimeSlotRule object) to apply

void setTimeSlotPicture (string $pic)
  • string $pic: timeslot picture for this instrument and this calendar
slotlog (line 686)

time logging function -- logs the start and stop time of a booking or slot

void slotlog (string $string, TimeSlot $slot, [boolean $display = false])
  • string $string: prefix to text to be logged
  • TimeSlot $slot: the slot whose start/stop is to be logged
  • boolean $display:

    (optional ) use the displayStart rather than the start data in $slot

    The higher $prio, the more verbose (in the debugging sense) the output.

timelog (line 711)

time logging function

void timelog (string $string,  $time, SimpleDate $slot)
  • string $string: prefix to text to be logged
  • SimpleDate $slot:

    the time to be logged

    The higher $prio, the more verbose (in the debugging sense) the output.

  • $time
_breakAccordingToList (line 312)

Break up bookings that span elements of a defined list (e.g. allowable times or days). A TimeSlotRule ($list) is used to define how the times should be broken up

$keepTimes(Vacant|Book) are set to CAL_TIME_BOOKING, CAL_TIME_SLOTRULE

CAL_TIME_BOOKING: start|stop are set according to the timeslotrule and will be used to display the timeslot in a graphica display (i.e. calculating height of boxes) display(Start|Stop) are set to the values of the original vacancy or booking being examined.

CAL_TIME_SLOTRULE: display(Start|Stop) variables are set to the values of the timeslot rule that breaks up the slots with the exception of slots that overlap a booking, where min() or max() is used start|stop are set to the same as the start/stop vars Note: vacancies that are at the start or end of the booking list are a corner case that is handled respectively as: start = slotrule->stop and stop = slotrule->stop

void _breakAccordingToList ($list $list, $keepTimesVacant $keepTimesVacant, $keepTimesBook $keepTimesBook)
  • $list $list: TimeSlotRule Object set of rules used to break up booking stream
  • $keepTimesVacant $keepTimesVacant: enum how should the display(Start|Stop) and (start|stop)
  • $keepTimesBook $keepTimesBook: enum .. variables be set for Vacancy and Booking slots
_breakAcrossDays (line 283)

Break up bookings that span days (for display purposes only)

For example, if we had a vacancy pseudo-bookings from 2004-01-01-11:00 to 2004-01-02-24:00, then we would break it up into two bookings as follows:

  • 2004-01-01-11:00 to 2004-01-01-24:00 and
  • 2004-01-02-00:00 to 2004-01-02-24:00.

void _breakAcrossDays ()
_collectMatrix (line 421)

Generate a booking matrix for all the days we are interested in

void _collectMatrix ( $daystart,  $daystop,  $granularity)
  • $daystart
  • $daystop
  • $granularity
_fill (line 151)

Obtain the booking data for this time period

  • access: private
void _fill ()
_getBookingData (line 162)
void _getBookingData ( $instrument)
  • $instrument
_getDayClass (line 442)

work out what html/css class this date should be rendered as

  • return: space-separated css class list for use in class=""
string _getDayClass (SimpleDate $today, SimpleDate $t)
_insertVacancies (line 232)

Create pseudo-bookings for all vacancies between the start of this calendar and the end.

For example, if we were constructing a calendar from 00:00 on 2004-01-01 to 23:59 on 2004-01-02, but there was only a booking from 10:00 to 11:00 on 2004-01-01, then we should create vacancy pseudo-bookings from:

  • 2004-01-01-00:00 to 2004-01-01-10:00 and from
  • 2004-01-01-11:00 to 2004-01-01-24:00 and from
  • 2004-01-02-00:00 to 2004-01-02-24:00.
Bookings are NOT restricted to remaining on one day (i.e. a booking from 20:00:00 until 10:00:00 the next day is OK.

void _insertVacancies ()
_makeRefreshScript (line 650)
void _makeRefreshScript ()
_reduceList (line 173)
void _reduceList ( $list)
  • $list

Documentation generated on Tue, 06 Mar 2007 10:00:58 +0000 by phpDocumentor 1.3.0