You are here

function bat_event_ui_bulk_update_form in Booking and Availability Management Tools for Drupal 7

Bulk update form.

1 string reference to 'bat_event_ui_bulk_update_form'
bat_event_ui_calendar_page in modules/bat_event_ui/bat_event_ui.module
Callback for admin/bat/calendar.

File

modules/bat_event_ui/bat_event_ui.module, line 139
Manages events for Units and displaying dates on the jquery FullCalendar plugin.

Code

function bat_event_ui_bulk_update_form($form, &$form_state, $unit_type, $event_type) {
  $form['bulk_update'] = array(
    '#type' => 'fieldset',
    '#title' => t('Update event state'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['bulk_update']['event_type'] = array(
    '#type' => 'hidden',
    '#value' => $event_type,
  );
  if ($unit_type == 'all') {
    $types = bat_unit_get_types(NULL, TRUE);
    $types_options = array();
    foreach ($types as $type) {
      $type_bundle = bat_type_bundle_load($type->type);
      if (is_array($type_bundle->default_event_value_field_ids)) {
        if (isset($type_bundle->default_event_value_field_ids[$event_type]) && !empty($type_bundle->default_event_value_field_ids[$event_type])) {
          $types_options[$type->type_id] = $type->name;
        }
      }
    }
    $form['bulk_update']['type'] = array(
      '#type' => 'select',
      '#title' => t('Type'),
      '#options' => $types_options,
      '#required' => TRUE,
    );
  }
  else {
    $form['bulk_update']['type'] = array(
      '#type' => 'hidden',
      '#value' => $unit_type,
    );
  }
  $form['bulk_update'] += bat_date_range_fields();
  $form['bulk_update']['state'] = array(
    '#type' => 'select',
    '#title' => t('State'),
    '#options' => bat_unit_state_options($event_type, array(
      'blocking' => 0,
    )),
    '#required' => TRUE,
  );
  $form['bulk_update']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );
  return $form;
}