• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/mysql/connection.php
  • Класс: CDavConnection
  • Вызов: CDavConnection::Add
static function Add($arFields)
{
	global $DB, $APPLICATION;

	$res = self::ParseFields($arFields);
	if ($res !== true)
	{
		foreach ($res as $v)
		{
			$APPLICATION->ThrowException($v[0], $v[1]);
		}
		return null;
	}

	$arInsert = $DB->PrepareInsert("b_dav_connections", $arFields);

	$strSql =
		"INSERT INTO b_dav_connections (".$arInsert[0].", CREATED, MODIFIED) ".
		"VALUES(".$arInsert[1].", ".$DB::CurrentTimeFunction().", ".$DB::CurrentTimeFunction().")";
	$DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__); $id = (int)$DB->LastID(); if ($id > 0 && BitrixMainLoader::includeModule('calendar')) { // TODO: remove dependence from different calendar systems /** @var GoogleHelper $googleHelper */ $googleHelper = ServiceLocator::getInstance()->get('calendar.service.google.helper'); /** @var Office365Helper $office365Helper */ $office365Helper = ServiceLocator::getInstance()->get('calendar.service.office365.helper'); $iCloudHelper = ServiceLocator::getInstance()->get('calendar.service.icloud.helper'); $caldavHelper = ServiceLocator::getInstance()->get('calendar.service.caldav.helper'); $connectionType = $googleHelper->isGoogleConnection($arFields['ACCOUNT_TYPE']) ? 'google' : ($office365Helper->isVendorConnection($arFields['ACCOUNT_TYPE']) ? 'office365' : ($iCloudHelper->isVendorConnection($arFields['ACCOUNT_TYPE']) ? 'icloud' : ($caldavHelper->isYandex($arFields['SERVER_HOST']) ? 'yandex' : 'caldav' ) ) ) ; $connectionName = $connectionType . $id; BitrixCalendarUtil::addPullEvent( 'add_sync_connection', $arFields['ENTITY_ID'], [ 'syncInfo' => [ $connectionName => [ 'type' => $connectionType, ], ] ] ); AddEventToStatFile('calendar', 'sync_connection_connected', $connectionType, '', 'server_connection'); } return $id; }