• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/managers/incomingmanager.php
  • Класс: BitrixCalendarSyncManagersIncomingManager
  • Вызов: IncomingManager::import
public function import(): Result
{
	$resultData = [];
	$result = new Result();
	/** @var Section[] $sections */
	$sections = $this->getFactory()->getSectionManager()->getSections($this->connection);

	/** @var $vendorSectionPack []<
		section => Section
	 	id => string Vendor ID
	    version => string Vendor version >
	 */
	foreach ($sections as $vendorSectionPack)
	{
		try {
			$sectionLink = $this->importSection(
				$vendorSectionPack['section'],
				$vendorSectionPack['id'],
				$vendorSectionPack['version'] ?? null,
				$vendorSectionPack['is_primary'] ?? null,

			);
			$resultData['importedSectionIds'][] = $sectionLink->getSection()->getId();
			if ($sectionLink->isActive())
			{
				$eventsResult = $this->importSectionEvents($sectionLink);
				$resultData['events'][$vendorSectionPack['id']] = $eventsResult->getData();
				$resultData['sections'][$vendorSectionPack['id']] = Dictionary::SYNC_STATUS['success'];
			}
			else
			{
				$resultData['sections'][$vendorSectionPack['id']] = Dictionary::SYNC_STATUS['inactive'];
				$resultData['events'][$vendorSectionPack['id']] = null;
			}
		} catch (SystemException $e) {
			$resultData['sections'][$vendorSectionPack['id']] = Dictionary::SYNC_STATUS['failed'];
		}
	}

	return $result->setData($resultData);
}