Class TimeSlotRule

Description

Timeslot validation based on rules passed to us (presumably from an SQL entry)

  • todo: //TODO: more documentation

Located in /inc/bookings/timeslotrule.php (line 44)


	
			
Variable Summary
mixed $DEBUG
mixed $picture
mixed $slots
Method Summary
TimeSlotRule TimeSlotRule ( $pic)
void dump ([ $html = 1])
void findNextSlot ( $date, [ $datetime = 0])
void findSlotByStart (mixed $date, [mixed $datetime = 0])
void findSlotByStop ( $date, [ $datetime = 0])
void findSlotFromWithin ( $date, [ $datetime = 0])
void isValidSingleSlot ( $startdate,  $stopdate)
void isValidSlot ( $startdate,  $stopdate)
void isValidStart ( $date)
void isValidStop ( $date)
void log ( $logstring, [ $prio = 10])
void _fillDaySlots ( $dow)
void _findDayLines ()
void _findSlot ( $date,  $match, [ $datetime = 0])
void _interpret ()
void _isValidStartStop ( $date,  $type, [ $daysdate = 0])
Variables
mixed $DEBUG = 0 (line 48)
mixed $picture = '' (line 45)
mixed $slots (line 46)
Methods
Constructor TimeSlotRule (line 50)
TimeSlotRule TimeSlotRule ( $pic)
  • $pic
dump (line 382)
void dump ([ $html = 1])
  • $html
findNextSlot (line 275)

returns the slot that starts >= the date specified.

void findNextSlot ( $date,  $datetime)
  • $date
  • $datetime
findSlotByStart (line 253)

return the corresponding the slot specified by the given start date.

ASSUMES that the specified date is a valid start, else behaviour is undefined.

void findSlotByStart (mixed $date, mixed $datetime)
  • mixed $date: SimpleDate $date the date to match or SimpleTime to match
  • mixed $datetime: optional SimpleDate iff $date was a SimpleTime. Provide the date component
findSlotByStop (line 261)

return the

as per findSlotByStart

void findSlotByStop ( $date,  $datetime)
  • $date
  • $datetime
findSlotFromWithin (line 268)

return the corresponding startdate/time to a time that is possibly within a slot

void findSlotFromWithin ( $date,  $datetime)
  • $date
  • $datetime
isValidSingleSlot (line 241)

return true if the specified dates & times are valid as above, but only occupy one slot

void isValidSingleSlot ( $startdate,  $stopdate)
  • $startdate
  • $stopdate
isValidSlot (line 234)

return true if the specified dates & times are valid start/stop times to this object's slot rules.

void isValidSlot ( $startdate,  $stopdate)
  • $startdate
  • $stopdate
isValidStart (line 202)

return true if the specified date & time correspond to a valid starting time according to this object's slot rules.

void isValidStart ( $date)
  • $date
isValidStop (line 210)

return true if the specified date & time correspond to a valid stopping time according to this object's slot rules.

void isValidStop ( $date)
  • $date
log (line 402)
void log ( $logstring, [ $prio = 10])
  • $logstring
  • $prio
_fillDaySlots (line 116)
void _fillDaySlots ( $dow)
  • $dow
_findDayLines (line 97)
void _findDayLines ()
_findSlot (line 291)

return the corresponding slot number of the starting or stopping date-time $date returns -1 if no matching slot found.

$match is TSSTART, TSSTOP, TSWITHIN, TSNEXT depending on what matching is queried. $return is TSSTART or TSSTOP depending on the required return value

this function will return a slot from the previous day if the slot spans days and that is the appropriate slot.

WARNING: There be dragons....

void _findSlot ( $date,  $match,  $datetime)
  • $date
  • $match
  • $datetime
_interpret (line 86)

timeslot picture syntax (concatinate onto one line, no spaces)

[x] or [x-y] specify the day of week (or range of days). 0=Sunday, 6=Saturday <slot;slot;slot> around the comma-separated slot specifications for that day. All times from 00:00 to 24:00 must be included in the list starttime-stoptime/num_slots-discount%,comment HH:MM time slots with the length of each slot. e.g. 09:00-17:00/1 specifies a slot starting at 9am and finishing 5pm. both 00:00 and 24:00 are valid, also 32:00 for 8am the next day (o'night) num_slots is integer, or wildcard of * for freely adjustable time e.g. 09:00-12:00/3 specifies 3 slots 9-10, 10-11 and 11-12. discount (optional) is the percentage discount applied to bookings in that slot comment (optional) is displayed in vacant or unavailable slots

EXAMPLES:

[0-6]<00:00-08:00/*;08:00-13:00/1;13:00-18:00/1;18:00-24:00/*> Available all days, free booking until 8am and after 6pm, other slots as defined [0]<00:00-24:00/0,Unavailable>[1-5]<09:00-17:00/01:00>[6]<00:00-24:00/0,Unavailable> Not available Sunday and Saturday. Only available weekdays 9am till 5pm with 1hr booking granularity. Calendar views of Sat & Sun will see message "Unavailable" [0]<>[1-5]<00:00-09:00/*;09:00-17:00/8;17:00-24:00/*-50%>[6]<> Not available Sunday and Saturday. Available weekdays 9am till 5pm with 1hr booking granularity, before 9am and after 5pm with no granularity and at a 50% discount. [0]<>[1-5]<09:00-13:00/4;13:00-17:00/2;17:00-33:00/1>[6]<> Not available Sunday and Saturday. Available weekdays 9am till 5pm with 1hr booking granularity, before 9am and after 5pm with no granularity

void _interpret ()
_isValidStartStop (line 226)

perform the above operations with no code duplication

void _isValidStartStop ( $date,  $type,  $daysdate)
  • $date
  • $type
  • $daysdate

Documentation generated on Tue, 06 Mar 2007 10:02:04 +0000 by phpDocumentor 1.3.0