function rooms_availability_update_status_form in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Form to manage the availability for specific month.
See also
rooms_availability_bulk_unit_management()
1 string reference to 'rooms_availability_update_status_form'
- rooms_availability_bulk_unit_management in modules/
rooms_availability/ rooms_availability.module - Form for the Bulk Availability Management.
File
- modules/
rooms_availability/ rooms_availability.module, line 229 - Manages availability for Bookable Units and displaying dates on the jquery FullCalendar plugin.
Code
function rooms_availability_update_status_form($form, &$form_state, $month, $year, $type, $rooms_units) {
$form['#attributes']['class'][] = 'rooms-management-form rooms-bulk-availability-form';
$form['rooms_availability_update'] = array(
'#type' => 'fieldset',
'#title' => t('Update Availability'),
'#description' => t('Change the availability status of the units selected below for the specified date range.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['rooms_update_availability']['curr_month'] = array(
'#type' => 'hidden',
'#value' => $month,
);
$form['rooms_update_availability']['curr_year'] = array(
'#type' => 'hidden',
'#value' => $year,
);
$form['rooms_update_availability']['curr_type'] = array(
'#type' => 'hidden',
'#value' => $type,
);
$form['rooms_availability_update']['rooms_date_range'] = rooms_date_range_fields($year, $month);
$state_options = rooms_unit_state_options();
$form['rooms_availability_update']['change_event_status'] = array(
'#title' => t('Bookable Unit State'),
'#type' => 'select',
'#options' => $state_options,
'#empty_option' => t('- Select -'),
);
$form['rooms_availability_update']['actions'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'form-actions',
),
),
'#weight' => 400,
);
$form['rooms_availability_update']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update Unit Availability'),
);
$form['#validate'][] = 'rooms_form_start_end_dates_validate';
$form['#validate'][] = 'rooms_availability_update_status_form_validate';
$form['rooms_data'] = array(
'#prefix' => '<table class="rooms-month-manager">',
'#type' => 'container',
'#suffix' => '</tbody></table>',
);
if (count($rooms_units) > 0) {
$date = new DateTime();
$date
->setDate($year, $month, '01');
$form['rooms_data']['select-all'] = array(
'#type' => 'select',
'#prefix' => '<thead><tr><th class="unit-bulk-select">',
'#options' => array(
ROOMS_THIS_PAGE => t('All (this page)'),
ROOMS_ALL_PAGES => t('All (all pages)'),
ROOMS_NONE => t('None'),
),
'#empty_option' => t('- Select -'),
'#suffix' => '</th><th class="month-name"><div class="fc-header-title"><h2>' . format_date($date
->getTimestamp(), 'custom', 'F Y') . '</h2></div></th></tr></thead><tbody>',
);
}
foreach ($rooms_units as $key => $value) {
$form['rooms_data']['rooms-' . $value->unit_id] = array(
'#type' => 'checkbox',
'#title' => $value->name,
'#prefix' => '<tr><th class="unit-name">',
'#suffix' => '</th><td class="unit-days"><div id="calendar' . $key . '"></div></td></tr>',
);
}
return $form;
}