Add Calendar to the list in the use statement for Gantry in your
applications base module. For example:
In your modules _form method, add the following to the form hash:
where your_form_name must match the name entry in the hash.
Add the following to the hash for your date fields:
User Label will be the link text, so make it something like Select or Choose Date.
When you use the Calendar template, methods are exported into the site object. The important ones are calendar_month_js and do_calendar_month. The global handler will call do_calendar_month for you.
datepopup(form_name) makes the calendar window popup. SetDate(field_name, date) sets the date when the user clicks on a date in the popup window.
The other functions are not directly useful to normal callers but here is a complete list.
calendar_month_js See above.
do_calendar_month( $site, ... ) This is the only do_* method we currently use. do_calendar_week( $site ... ) Might not work, not tested. Meant to display weeks with time slots. do_calendar_year( $site ... ) Might not work, not tested. Meant to display a whole year at a time.
@month = _calendar_month( $r, $root, $month, $year, $select, \&function, @param ) This function creates a month in html for display. $r is the apache request object. $root is the uri root of the calendar, this is used for paging. $month and $year are the month and year to show. $select should be a boolean value, true if the month select is to be shown, false otherwise. \&function is a function referenc for the day. @params are any params that need to be passed to \&function @week = _calendar_week( $r, $root, $day, $month, $year, \&function, @param ) This function creates a week in html for display. $r is the apache request object. $root is the uri root of the week, this is used for paging. $day, $month, and $year are the day, month, and year of the Wednesday of the week. \&function should be a function reference for the day function. @param is for the parameters for the day function that will be passed through. @year = _calendar_year( $r, $root, $year, \&function, @param ) This function creates a year in html for display. $r is the apache request object. $root is the uri root of the year, this is used for paging. $year is the year to show. \&function is the day function to be used. @param are any other params to pass into the day function. This function uses the cal_month function to create its month. @day = \&function( $year, $month, $day, @params) This is the day function it is not defined in this module at all. It needs to be defined by the user. The function should take the year, month, and day to show. It should also accept the @params that would be passed into the cal_* params.
Only do_calendary_month has been tested, the other do_* methods are unlikely to work.
Tim Keefer <firstname.lastname@example.org> Phil Crow <email@example.com> Nicholas Studt <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
|perl v5.20.3||GANTRY::PLUGINS::CALENDAR (3)||2016-04-03|