function calendar_systems_get_calendar_instance in Calendar Systems 6
Same name and namespace in other branches
- 8 calendar_systems.helpers.inc \calendar_systems_get_calendar_instance()
- 5 calendar_systems.module \calendar_systems_get_calendar_instance()
- 6.3 calendar_systems.module \calendar_systems_get_calendar_instance()
- 7.3 calendar_systems.module \calendar_systems_get_calendar_instance()
- 7 calendar_systems.helpers.inc \calendar_systems_get_calendar_instance()
- 7.2 calendar_systems.helpers.inc \calendar_systems_get_calendar_instance()
Gets an instance of the calendar object for the selected calendar system acording to the settings
3 calls to calendar_systems_get_calendar_instance()
- calendar_systems_date_validate in ./
calendar_systems.module - Validates date fields considerign the acitve calendar system
- calendar_systems_format_date in ./
calendar_systems.module - Implementation of hook format_date
- SimpletestUnitTestExampleTestCase::testCalendarSystemsConversion in ./
simpletest_calendar_systems.test
File
- ./
calendar_systems.module, line 206
Code
function calendar_systems_get_calendar_instance() {
calendar_systems_load_dependenies();
$profiles = calendar_systems_profile_load_all();
$lang = calendar_systems_get_active_lang();
if (isset($profiles[$lang])) {
$calendar_system = $profiles[$lang]->calendar_system;
}
else {
if ($profiles['default']) {
$calendar_system = $profiles['default']->calendar_system;
}
}
if (empty($calendar_system)) {
$calendar_system = 'default';
}
if ($calendar_system == 'iranian') {
$calendar = cmfcCalendar::factory('v1', array(
'name' => 'iranian',
));
}
elseif ($calendar_system == 'arabic') {
$calendar = cmfcCalendar::factory('v1', array(
'name' => 'arabic',
));
}
elseif ($calendar_system == 'default') {
$calendar = cmfcCalendar::factory('v1', array(
'name' => 'gregorian',
));
}
elseif ($calendar_system == 'default') {
$calendar = cmfcCalendar::factory('v1', array(
'name' => 'thai',
));
}
return $calendar;
}