You are here

function fullcalendar_results in FullCalendar 7.2

Returns events for FullCalendar.

1 string reference to 'fullcalendar_results'
fullcalendar_menu in ./fullcalendar.module
Implements hook_menu().

File

./fullcalendar.module, line 245
Provides a views style plugin for FullCalendar

Code

function fullcalendar_results($view_name = NULL, $view_display = NULL) {

  // Bail out if no view_name or view_display is passed.
  if (empty($view_name) || empty($view_display) || empty($_POST['dom_id'])) {
    return;
  }

  // Find Views arguments.
  $args = func_get_args();
  unset($args[0], $args[1]);
  $args = array_values($args);
  $dom_id = check_plain($_POST['dom_id']);
  $view_name = check_plain($view_name);
  $view_display = check_plain($view_display);

  // Add all $_POST data, because AJAX is always a post and many things,
  // such as tablesorts, exposed filters and paging assume $_GET.
  $_GET += $_POST;

  // Get the view and check access.
  $view = views_get_view($view_name);
  if (!$view || !$view
    ->access($view_display)) {
    return;
  }
  if (!$view
    ->set_display($view_display)) {
    return;
  }
  $view->dom_id = $dom_id;
  $view->fullcalendar_ajax = TRUE;
  $view
    ->pre_execute($args);
  $view
    ->init_style();
  $view
    ->execute($view_display);
  $output = $view->style_plugin
    ->render();
  $view
    ->post_execute();
  return array(
    '#type' => 'ajax',
    '#commands' => array(
      array(
        'command' => 'fullcalendar_results_response',
        'data' => $output,
      ),
    ),
  );
}