function rooms_availability_page in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Callback for admin/rooms/units/unit/%unit/availability - builds availability page by adding calendar and pulling events from availability table.
1 string reference to 'rooms_availability_page'
- rooms_availability_menu in modules/
rooms_availability/ rooms_availability.module - Implements hook_menu().
File
- modules/
rooms_availability/ rooms_availability.module, line 383 - Manages availability for Bookable Units and displaying dates on the jquery FullCalendar plugin.
Code
function rooms_availability_page(RoomsUnit $rooms_unit, $year = '', $month = '') {
// Set the page title.
drupal_set_title(t('Edit @unit_name Availability', array(
'@unit_name' => $rooms_unit->name,
)));
// Add styles.
rooms_availability_modal_style();
// Get the current page's URL, stripped of the year and month args.
// This allows us to place this page anywhere, including at
// unit/%/availability or admin/rooms/units/unit/%/availability
list($url) = explode('/' . $year . '/' . $month, current_path());
$js_file = drupal_get_path('module', 'rooms_availability') . '/js/rooms_availability.js';
$css_file = drupal_get_path('module', 'rooms_availability') . '/css/rooms_availability.css';
// Show full day events on calendar.
if (variable_get('rooms_calendar_events_view', '0') == '1') {
$js_file = drupal_get_path('module', 'rooms_availability') . '/js/rooms_availability_full_day.js';
}
return array(
'#theme' => 'rooms_three_month_calendar',
'#url' => $url,
'#form' => drupal_get_form('update_availability_calendar_form', $rooms_unit->unit_id, $year, $month),
'#year' => $year,
'#month' => $month,
'#attached' => array(
'css' => array(
$css_file,
),
'js' => array(
$js_file,
array(
'data' => array(
'roomsAvailability' => array(
'roomID' => $rooms_unit->unit_id,
),
),
'type' => 'setting',
),
),
),
);
}