• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_user_settings.php
  • Класс: CCalendarUserSettings
  • Вызов: CCalendarUserSettings::Get
static function Get($userId = false)
{
	if (!$userId)
	{
		$userId = CCalendar::GetUserId();
	}

	$resSettings = self::$settings;

	if ($userId)
	{
		$settings = CUserOptions::GetOption("calendar", "user_settings", false, $userId);
		if (is_array($settings))
		{
			foreach($settings as $key => $value)
			{
				$resSettings[$key] = $value;
			}
		}

		$resSettings['timezoneName'] = CCalendar::GetUserTimezoneName($userId);
		$resSettings['timezoneOffsetUTC'] = CCalendar::GetCurrentOffsetUTC($userId);
		$resSettings['timezoneDefaultName'] = '';

		// We don't have default timezone for this offset for this user
		// We will ask him but we should suggest some suitable for his offset
		// We will ask him but we should suggest some suitable for his offset
		if (!$resSettings['timezoneName'])
		{
			$resSettings['timezoneDefaultName'] = CCalendar::GetGoodTimezoneForOffset($resSettings['timezoneOffsetUTC']);
		}

		$workTime = CUserOptions::GetOption("calendar", "workTime", false, $userId);
		if ($workTime)
		{
			$resSettings['work_time_start'] = $workTime['start'].'.00';
			$resSettings['work_time_end'] = $workTime['end'].'.00';
		}
	}

	$resSettings['showDeclined'] = intval($resSettings['showDeclined']);
	$resSettings['denyBusyInvitation'] = intval($resSettings['denyBusyInvitation']);

	return $resSettings;
}