You are here

function availability_calendar_add_calendar_view_js in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 availability_calendar.inc \availability_calendar_add_calendar_view_js()

Adds the necessary javascript files, settings and initialization for the given calendar view.

Parameters

int $cvid:

int|string $cid: Existing cid (int) or temporary cid for new calendars (string).

string $name:

array $settings:

2 calls to availability_calendar_add_calendar_view_js()
availability_calendar_add_full_calendar_js in ./availability_calendar.theme.inc
Adds the necessary javascript for a full calendar if it is interactive (full in the sense of not placed in a viewport).
availability_calendar_add_viewport_js in ./availability_calendar.theme.inc
Adds the necessary javascript to be able to show an (interactive) calendar in a viewport.

File

./availability_calendar.inc, line 73

Code

function availability_calendar_add_calendar_view_js($cvid, $cid, $name, $settings) {
  static $added = FALSE;
  availability_calendar_add_calendar_js($cid, $settings['allocation_type']);
  if (!$added) {
    $added = TRUE;
    drupal_add_js(drupal_get_path('module', 'availability_calendar') . '/availability_calendar.view.js', array(
      'weight' => -1,
    ));
  }
  drupal_add_js(array(
    'availabilityCalendar' => array(
      'views' => array(
        $cvid => array(
          'cvid' => $cvid,
          'cid' => $cid,
          'name' => $name,
          'splitDay' => (bool) $settings['show_split_day'],
          'selectMode' => isset($settings['selectable']) ? $settings['selectable'] ? 'available' : 'none' : 'all',
          'firstDayOfWeek' => (int) $settings['first_day_of_week'],
        ),
      ),
    ),
  ), array(
    'type' => 'setting',
  ));
}