function bat_event_get_states in Booking and Availability Management Tools for Drupal 7
Same name and namespace in other branches
- 8 modules/bat_event/bat_event.module \bat_event_get_states()
Parameters
string $event_type:
Return value
array
9 calls to bat_event_get_states()
- BatEventTypeController::export in modules/
bat_event/ bat_event.module - bat_booking_confirmation_form_submit in modules/
bat_booking/ bat_booking_example/ bat_booking_example.module - Submit function for the bat_booking_confirmation_form form.
- bat_event_handler_event_state_filter::get_value_options in modules/
bat_event/ views/ bat_event_handler_event_state_filter.inc - Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
- bat_event_load_state in modules/
bat_event/ bat_event.module - Returns information about the configuration of a given fixed event state.
- bat_event_states_form in modules/
bat_event/ bat_event.module - Implements form that handles the definition of states for fixed state events.
2 string references to 'bat_event_get_states'
- bat_event_delete_states_by_type in modules/
bat_event/ bat_event.module - Delete the states associated with $type.
- bat_event_save_state in modules/
bat_event/ bat_event.module
File
- modules/
bat_event/ bat_event.module, line 286 - Manage Events - Events store the EventValue of a Unit over a period of time.
Code
function bat_event_get_states($event_type = NULL) {
$event_states =& drupal_static(__FUNCTION__, array());
if (empty($event_states)) {
$query = db_select('bat_event_state', 'n')
->fields('n', array());
$states = $query
->execute()
->fetchAll();
foreach ($states as $event_state) {
$event_states[$event_state->id] = array(
'id' => $event_state->id,
'machine_name' => $event_state->machine_name,
'event_type' => $event_state->event_type,
'label' => $event_state->label,
'color' => $event_state->color,
'calendar_label' => $event_state->calendar_label,
'locked' => $event_state->locked,
'blocking' => $event_state->blocking,
'default_state' => $event_state->default_state,
);
}
}
if ($event_type !== NULL) {
$states = array();
foreach ($event_states as $id => $state) {
if ($state['event_type'] == $event_type) {
$states[$id] = $state;
}
}
return $states;
}
else {
return $event_states;
}
}