You are here

function bat_fullcalendar_event_management in Booking and Availability Management Tools for Drupal 7

The EventManager page shows when clicking on an event in the calendar - will allow a user to manipulate that event.

Parameters

$entity_id:

string $event_type:

$event_id:

$start_date:

$end_date:

1 string reference to 'bat_fullcalendar_event_management'
bat_fullcalendar_menu in modules/bat_fullcalendar/bat_fullcalendar.module
Implements hook_menu().

File

modules/bat_fullcalendar/bat_fullcalendar.module, line 86
Manages the display of FullCalendar and provides ways for other modules to easily modify it.

Code

function bat_fullcalendar_event_management($entity_id, $event_type, $event_id, $start_date, $end_date) {

  // Include modal library.
  ctools_include('modal');

  // If any info missing we cannot load the event.
  if ($event_id == NULL || $start_date === 0 || $end_date === 0) {
    $output[] = ctools_modal_command_dismiss();
    drupal_set_message(t('Unable to load event.'), 'error');
  }
  $args = array(
    $entity_id,
    $event_type,
    $event_id,
    $start_date,
    $end_date,
  );
  foreach (array_reverse(module_implements('bat_fullcalendar_modal_content')) as $module) {
    $function = $module . '_bat_fullcalendar_modal_content';
    if (function_exists($function)) {
      $result = call_user_func_array($function, $args);
      if (isset($result) && is_array($result)) {
        $modal_content = reset($result);
        break;
      }
    }
  }
  if (isset($modal_content['title']) && isset($modal_content['content'])) {
    ctools_modal_render($modal_content['title'], $modal_content['content']);
  }
  elseif (isset($modal_content['commands'])) {
    print ajax_render($modal_content['commands']);
    exit;
  }
}