You are here

function calendar_systems_calendars in Calendar Systems 6.2

API function to provide a list of available calendars.

Parameters

$op: The format of return list. Allowed values are:

  • calendar: Returns information about calendar identified by $identifier.
  • calendars: Returns a list of all available calendar informations.
  • name: Return the name of a calendar identified by $identifier.
  • names: Returns a list of all available calendar names.
  • identifiers: Returns a list of available calendar identifiers.

$identifier: A calendar identifier to filter the results.

Return value

An array of calendars or a single calendar.

See also

_calendar_systems_build()

9 calls to calendar_systems_calendars()
calendar_systems_calendars_form in ./calendar_systems.admin.inc
Form callback to list all available calendars and their config links.
calendar_systems_calendar_form in ./calendar_systems.admin.inc
Form callback for a calendar administration settings.
calendar_systems_calendar_title in ./calendar_systems.module
Calendar menu title callback.
calendar_systems_call in ./calendar_systems.module
API function to call a calendar's internal routine.
calendar_systems_default in ./calendar_systems.module
API function to get current default calendar.

... See full list

File

./calendar_systems.module, line 252
Contains Calendar Systems module hooks, helpers and API functions.

Code

function calendar_systems_calendars($op = 'calendars', $identifier = NULL) {
  list($calendars, $names) = _calendar_systems_build();
  switch ($op) {

    // Return a array of identifier keyed calendars information.
    case 'calendars':
      return $calendars;

    // Return the information about the calendar specified by $identifier.
    case 'calendar':
      return is_array($calendars[$identifier]) ? array_merge($calendars[$identifier], array(
        'identifier' => $identifier,
      )) : NULL;

    // Return an array of all available calendar names.
    case 'names':
      return $names;

    // Return the name of the calendar specified by $identifier.
    case 'name':
      return $names[$identifier];

    // Return an array of all available calendar identifiers.
    case 'identifiers':
      return array_keys($calendars);
  }
}