|
|
|
Schedules
Introduction | Settings | Creating | Updating | Events
Options | Functions | Container
Appendix: MySQL Date-Format Specifiers
Introduction
O3's Scheduler module is primarily designed for use as a bookings management system, but it can be used as a general scheduler, and is extensible through the use of Types. Schedules can be created associated with items, products or the website as a whole. Events can be added to or removed from schedules.
You can show a schedule in the catalog by passing in the parameter sitm=ScheduleName.
Schedules can be contained within content items. There are macros for displaying all O3 things within content items - so you can format them however you like. This means you can put text and formatting around a schedule, like we've done on the demo website with the 'Audio-Room Bookings' example.
You can define a set of Opening Hours for your business in the Settings. If these are defined, and the schedule is set the 'Use Opening Hours', then an additional parameter is available to your container: 'isopen' - which takes the values 'Y' or 'N'. You can use this to display different things if the store is open or closed using the O3IF macro.
O3 does not restrict placing events outside opening hours - it just gives you the mechanism to not give the option (i.e. you don't show the 'Book' button).
Settings
The settings are listed under 'Scheduler'. The sections are:
- Displaying Schedules - Text / Headings and Containers.
- Updating Schedules - Create, Update and Delete forms for Schedules & Events. Event Approve form. Schedule Add permissions. Default Schedule Status.
- Default View - This defines the default start & end times, & the interval duration for displaying schedules.
- Opening Hours - This info can be used to restrict when events may be placed - i.e. only when the business is open.
Creating Schedules
You can create schedules in the Schedules manager, or from the front end using a Create Schedule form.
In addition, schedules can be created automatically when a product is purchased - if the appropriate Create Options are set in the product definition. This is how you create booking schedules for premium list items. In this case the schedule can be copied from a template - so you can set the correct defaults, permissions etc on the schedule prior to your customer getting their hands on it.
Updating Schedules
Schedules can be updated from the front end using an Update Schedule form. You can opt to give your users access to as many of the fields as you want - you just include them in the update form. If fields aren't included in the form, they don't get updated. Note, it's not possible to blank any fields from the front-end!
Commonly, access to the Schedule Start & End times, and the Interval are required by users, although you can define a type for the schedule, and hence add any type-data fields that you want to a schedule.
Schedules can be deleted and approved, just like items and event, from the front-end - using the forms defined in the settings.
Events
Events must belong to schedules. They can be added and deleted from schedules, and they can be updated, and approved. You can define the default Status for events in the settings & if set to 'Pending' you can then have an 'Approval' step to confirm the event. This approval can be done by whoever has the permission to do it - as defined in the Schedule.
Events can be added from the front end using a Create Event form. This is defined in the settings, and can be overridden in the CREATE-EVENT# macro you use to show the form. This macro appears in the Interval section of the Schedule container and is replaced by the Create Event form...
If the schedule is set to allow 'Multiple Bookings in the same interval - the Create Event form is always displayed by the CREATE-EVENT# macro, else nothing is displayed if the interval already contains an event.
When events are added to a schedule, or changed, you can opt to send out notification emails to the schedule and event creators. This is set up in the Schedules Manager.
Important Note: When admins change events and schedules - no emails are sent out!
When updating, you can opt to give your users access to as many of the fields as you want - you just include them in the update form. If fields aren't included in the form, they don't get updated. Note, it's not possible to blank any fields from the front-end! See Appendix C for more info on actions.
Schedule Options
There are quite a few options for schedules:
| General Settings |
| Name & Descr. | Name & description |
| Category | The schedule's category - optional. |
| Status | The schedule's status |
| Start | The schedule's start date/time |
| End | The schedule's end date/tim |
| Interval | The schedule's display interval (i.e. 1 HOUR, 1 DAY, 7 DAY) |
| Multi Bookings | Are multiple events allowed in the save interval? |
| Default Event Status | Default status when events are created |
| Event Product | To place an event the customer buys this product |
| Type | The Schedule's type & type data. |
| Display / Update |
| Schedule Update Form | The form used to update a schedule |
| Schedule Delete Form | The form used to delete a schedule |
| Schedule Approve Form | The form used to approve a schedule |
| Event Create Form | The form used to create an event |
| Event Update Form | The form used to update an event |
| Event Delete Form | The form used to delete an event |
| Event Approve Form | The form used to approve an event |
| Add Confirm Text | If placing the event requires confirmation, a form is placed in the $o3msg variable - so it's always displayed at the top of the page (IF you've put it there or are using the catalog page). This is the text displayed |
| Confirm Button Text | The confirm button text. |
| Permissions |
| Schedule Update | The Access Rule used to determine if the user has access to this function. See the page on Permissions and Access for details of valid values. |
| Schedule Delete | The Access Rule |
| Schedule Approve | Access Rule |
| Event Create | Access Rule |
| Event Update | Access Rule |
| Event Delete | Access Rule |
| Event Approve | Access Rule |
| Notification Emails |
| Event Add Notify (S)? | Inform the schedule owner when an event is added to the schedule? |
| Event Add Notify (E)? | Inform the event owner when the event is added to the schedule? |
| Event Change Notify (S)? | Inform the schedule owner when an event is changed (updated or deleted)? |
| Event Change Notify (E)? | Inform the event owner when the event is changed (updated or deleted)? |
| Add Notify Subject | Email subject text |
| Add Notify Body | Email body text. Can contain the following macros:
- EV-NAME - The event name
- SC-NAME - The schedule name
- SC-OWNER - The schedule name
- USER-EMAIL - The current user...
- USER-NAME
- SC-URL - The URL of the schedule.
|
|---|
| Change Notify Subject | Email subject text |
| Change Notify Body | Email body text. Can contain the same macros as above |
Functions
- show_schedule(schedule, container). Container is optional.
- show_schedules(namelike, categorylike, type, starttime, endtime, ownerlike, container, statuslike, incols).
- All parameters are optional
- namelike - A case-insensitive regular expression matching the item name (i.e. 'exactname' or 'part' or 'item1|item2|item3' etc)
- categorylike - A case-insensitive regular expression matching the item category.
- ownerlike - A regular expression matching the item creator.
- type - A single type, or a list of pipe-delimited types (i.e. 'type1|type2...').
- starttime - A Select schedules which start after this date/time.
- endtime - A Select schedules which end before this date/time.
- order - a list of columns to order the results by. Can include columns for the item's Type! (i.e. 'it_type ASC, it_type DESC, size')
- typedata - an SQL expression to be included in the WHERE clause specifying Type data. (i.e. 'AND size>100 AND color=`blue`')
- container - the container the results should be displayed in.
- incols - the number of columns to show the list in (overrides the default set for the container)
Container
The schedule container is the most complex of O3's containers because it has to handle lines of intervals - with lines of events within them.
To do this it uses 3 special delimiters...
- #LINE# - delimits the INTERVAL part of the container - i.e. the bit which must be repeated for each interval
- #EVENT# - delimits the EVENTs - i.e. the bit which must be repeated for each event
- #EVTITLE# - delimits the event titles. This is then displayed once in each interval as the titles for the events list. It's only shown in intervals with events.
Macros which are relevant to the EVENT are only processed within the #EVENT# delimiters. If you put macros outside their area of context - they will not be parsed. This applies to INTERVALS as well.
This is an example schedule container:
DATE-FORMAT%M-%d %Y %H:%i:%s#
<!-- Bookings Schedule -->
<table width='100%'>
<tr><th colspan=3>
<h2>Schedule For O3VARit_title#<br>
<span style='font-size:xx-small'>
<a href='catalog.php?iitm=O3VARit_name#'>(O3VARit_name#)</a><br>
Displaying: INT-VISIBLEs (PG-START-PG-END)<br>
UPDATE-SCHEDULE
</span>
</h2>
</th></tr>
<tr class=heading>
<th style='background:#EEF; text-align:center'>Start Date</th>
<th style='background:#EEF; text-align:center'>End Date</th>
<th style='background:#EEF; text-align:center'>Bookings</th>
</tr>
#LINE#
<tr style='background:ROWCOLOR'>
<th style='font-size:xx-small'>INT-START</th><th style='font-size:xx-small'>INT-END</th>
<td>CREATE-EVENTCreateBooking#
<table width='100%'>
#EVENT#
<tr>
<th style='font-size:xx-small' colspan=2>
UPDATE-EVENT#
</th>
</tr>
<tr>
<td class='eventO3VARev_status#'>Status: EV-STATUS</td>
<td class='eventO3VARev_status#'>Booked By: EV-CREATOR</td>
</tr>
<tr>
<td colspan=2 class='eventO3VARev_status#' style='text-align:right'>
DELETE-EVENT# APPROVE-EVENT#
</td>
</tr>
<tr>
#EVENT#
</table>
</td>
</tr>
#LINE#
</table>
Schedule Macros
| Macro | Is Replaced By |
| General Macros Replaced Within The Whole Container |
| ROWCOLOR | When displaying lists, this alternates between the colors defined in the Search Settings. |
| TITLES | A list of all the Type data descriptions, for all events in the schedule. It's intended to be used to dynamically generate the titles for an event list |
| DATE-FORMAT | This macro specifies the date format to be used througout the container. All the dated below will be shown in this format. It uses the standard MySQL DATE_FORMAT specification which can be found here: http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html and is repeated below |
|---|
| SC-NAME | The schedule name. |
| SC-TYPE | The schedule type. |
| SC-CREATOR | The schedule creator. |
| SC-CREATED | The schedule created date. |
| SC-UPDATOR | The schedule updator. |
| SC-UPDATED | The schedule updated date. |
| SC-START | The schedule start date/time. |
| SC-END | The schedule end date/time. |
| INT-VISIBLE | The visible period on the page - i.e. from the beginning of the first interval to the end of the last. (as the schedule may be paginated - the whole lot may not be visible at once. |
| PG-START | The first start date/time on the page. |
| PG-END | The last end date/time on the page. |
| CALENDAR | Display a calendar for the current schedule... |
| CREATE-SCHEDULE# | The schedule create form specified in the settings. |
| UPDATE-SCHEDULE# | The schedule update form specified in the settings. |
| 'Local' Macros Replaced Within The Body & #LINE# Separately |
| O3VAR# | Any internal value from the item's data or type data (i.e. O3VARsize#) |
| O3USR# | Any value from the current user's data or type data (i.e. O3USRus_email#)
|
| SHOW-FORMform# | Display the (mandatory) form. Used for remove/change qty etc. |
| O3IFa|b|c|dO3ENDIF | A simple comparison operator. If a=b then c is output, else d. The contents can contain other macros as all others are parsed first. Note this macro has a different terminator to the others to allow you to embed them within an O3IF. |
| INTERVAL Macros Only Available Within The #LINE# delimiters |
| INT-START | The interval start date/time. |
| INT-END | The interval start date/time. |
| ROWCOLOR | An alternating color - as specified in the settings. |
| CREATE-EVENT | A create event form. |
| isopen | This is a variable (Not a macro!) that's available within an O3IF which defines if the store is open of closed during that interval (Y|N). |
| EVENT Macros Only Available Within The #EVENT# delimiters |
| EV-NAME | The interval start date/time. |
| EV-DESC | The interval start date/time. |
| EV-TYPE | The event type. |
| EV-START | The event start date/time. |
| EV-END | The event end date/time. |
| EV-CREATOR | The event creator. |
| EV-CREATED | The event created date. |
| EV-UPDATOR | The event updator. |
| EV-UPDATED | The event updated date. |
| EV-STATUS | The event status. |
| CREATE-EVENT | A create event form. |
| UPDATE-EVENT | An update event form. |
| DELETE-EVENT | A delete event form. |
| APPROVE-EVENT | An approve event form. |
| EV-START | A create event form. |
| EV-START | A create event form. |
| TYPEDATA | A list of all the Type data values, for all items - in the same order as the TITLES |
MySQL Date Format Specifiers
You can use any of these symbols in the DATE-FORMAT macro to customise your schedules' display...
| Specifier |
Description |
%a |
Abbreviated weekday name (Sun..Sat)
|
%b |
Abbreviated month name (Jan..Dec)
|
%c |
Month, numeric (0..12)
|
%D |
Day of the month with English suffix (0th, 1st, 2nd, 3rd, ...)
|
%d |
Day of the month, numeric (00..31)
|
%e |
Day of the month, numeric (0..31)
|
%f |
Microseconds (000000..999999)
|
%H |
Hour (00..23)
|
%h |
Hour (01..12)
|
%I |
Hour (01..12)
|
%i |
Minutes, numeric (00..59)
|
%j |
Day of year (001..366)
|
%k |
Hour (0..23)
|
%l |
Hour (1..12)
|
%M |
Month name (January..December)
|
%m |
Month, numeric (00..12)
|
%p |
AM or PM
|
%r |
Time, 12-hour (hh:mm:ss followed by AM or PM)
|
%S |
Seconds (00..59)
|
%s |
Seconds (00..59)
|
%T |
Time, 24-hour (hh:mm:ss)
|
%U |
Week (00..53), where Sunday is the first day of the week
|
%u |
Week (00..53), where Monday is the first day of the week
|
%V |
Week (01..53), where Sunday is the first day of the week; used with %X
|
%v |
Week (01..53), where Monday is the first day of the week; used with %x
|
%W |
Weekday name (Sunday..Saturday)
|
%w |
Day of the week (0=Sunday..6=Saturday)
|
%X |
Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V
|
%x |
Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v
|
%Y |
Year, numeric, four digits
|
%y |
Year, numeric, two digits
|
%% |
A literal '%'.
|
|