function calendar_systems_pick in Calendar Systems 6.2
API function which selects the best-fit calendar for the environment.
At the first level it checks current user calendar settings, and then the locale specific calendar settings. If there were no user/locale specific settings, the default calendar will be chosen.
Return value
Calendar identifier.
2 calls to calendar_systems_pick()
- calendar_systems_call in ./
calendar_systems.module - API function to call a calendar's internal routine.
- calendar_systems_format_date in ./
calendar_systems.module - Implements hook_format_date().
File
- ./
calendar_systems.module, line 296 - Contains Calendar Systems module hooks, helpers and API functions.
Code
function calendar_systems_pick() {
global $user;
global $language;
// Calendar per user.
if (isset($user->calendar) && $user->calendar != 'default' && user_access('select different calendar')) {
return calendar_systems_calendars('calendar', $user->calendar);
}
// Calendar per language.
if ($calendar = variable_get('calendar_systems_' . $language->language . '_calendar', FALSE)) {
return $calendar == 'default' ? calendar_systems_default() : calendar_systems_calendars('calendar', $calendar);
}
// Default calendar.
return calendar_systems_default();
}