You are here

function rooms_pricing_page in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Callback for admin/rooms/units/unit/%pricing_unit/pricing.

Builds pricing page by adding calendar and pulling events from pricing table.

1 string reference to 'rooms_pricing_page'
rooms_pricing_menu in modules/rooms_pricing/rooms_pricing.module
Implements hook_menu().

File

modules/rooms_pricing/rooms_pricing.module, line 119
Manages pricing for Bookable Units and displaying dates on the jquery FullCalendar plugin.

Code

function rooms_pricing_page(RoomsUnit $rooms_unit, $year = '', $month = '') {

  // Set the page title.
  drupal_set_title(t('Edit @unit_name Pricing', array(
    '@unit_name' => $rooms_unit->name,
  )));

  // Get the current page's URL, striped of the year and month args.
  // This allows us to place this page anywhere, including at
  // unit/%/pricing  or  admin/rooms/units/unit/%/pricing
  list($url) = explode('/' . $year . '/' . $month, current_path());
  return array(
    '#theme' => 'rooms_three_month_calendar',
    '#url' => $url,
    '#form' => drupal_get_form('update_unit_pricing_form', $rooms_unit->unit_id),
    '#year' => $year,
    '#month' => $month,
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'rooms_pricing') . '/js/rooms_pricing.js',
        array(
          'data' => array(
            'roomsPricing' => array(
              'roomID' => $rooms_unit->unit_id,
            ),
          ),
          'type' => 'setting',
        ),
      ),
      'css' => array(
        drupal_get_path('module', 'rooms_pricing') . '/css/rooms_pricing.css',
      ),
    ),
  );
}