• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/lib/integration/zoom/recording.php
  • Класс: BitrixSocialServicesIntegrationZoomRecording
  • Вызов: Recording::formatLength
static function formatLength(int $lengthSeconds, $format = self::LENGTH_FORMAT_SHORT): string
{
	$hours = intdiv($lengthSeconds,  3600);
	$lengthSeconds -= $hours * 3600;
	$minutes = intdiv($lengthSeconds, 60);
	$seconds = $lengthSeconds - $minutes * 60;

	if ($format === self::LENGTH_FORMAT_FULL)
	{
		if($hours)
		{
			$result = Loc::getMessage("CRM_ZOOM_CONFERENCE_HOUR_F" . static::getNumericSuffix($hours), ["#VALUE#" => $hours]) . " ";
		}
		else
		{
			$result = "";
		}
		$result .= Loc::getMessage("CRM_ZOOM_CONFERENCE_MINUTE_F" . static::getNumericSuffix($minutes), ["#VALUE#" => $minutes]) . " ";
		$result .= Loc::getMessage("CRM_ZOOM_CONFERENCE_SECOND_F" . static::getNumericSuffix($seconds), ["#VALUE#" => $seconds]);
	}
	else
	{
		$result = $hours ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ":" : "";
		$minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT);
		$seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT);
		$result .= "$minutes:$seconds";
	}

	return $result;
}