• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/zoom.php
  • Класс: CSocServZoom
  • Вызов: CSocServZoom::prepareDataToUpdate
private function prepareDataToUpdate(array $updateParams): ?array
{
	$preparedDataToUpdate = [];

	//get activity start and end timestamps
	$activityStartTimeStamp = DateTime::createFromUserTime($updateParams['start_time'])->getTimestamp();
	$activityEndTimeStamp = DateTime::createFromUserTime($updateParams['end_time'])->getTimestamp();

	$meetingData = ZoomMeetingTable::getRowById($updateParams['meeting_id']);
	if (!$meetingData)
	{
		return null;
	}

	//Prepare start_time only if the activity start_time does not match the conference start_time.
	$meetingStartTimeStamp = $meetingData['CONFERENCE_STARTED']->getTimestamp();
	if ($meetingStartTimeStamp !== $activityStartTimeStamp)
	{
		$preparedDataToUpdate['start_time'] = DateTime::createFromUserTime($updateParams['start_time'])
			->setTimeZone(new DateTimeZone('UTC'))
			->format(DATE_ATOM);
	}

	//Prepare duration only if the activity duration does not match the conference duration.
	$currentActivityDuration = ($activityEndTimeStamp - $activityStartTimeStamp) / 60;
	if ($currentActivityDuration !== (int)$meetingData['DURATION'])
	{
		$preparedDataToUpdate['duration'] = $currentActivityDuration;
	}

	//Continue only if duration or start_time has been changed ($preparedDataToUpdate is not empty).
	if (!empty($preparedDataToUpdate))
	{
		$preparedDataToUpdate['id'] = $meetingData['CONFERENCE_EXTERNAL_ID'];
	}

	return $preparedDataToUpdate;
}