trackdirect2023/htdocs/public/views/overview.php

510 lines
30 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php require dirname(__DIR__) . "../../includes/bootstrap.php"; ?>
<?php $station = StationRepository::getInstance()->getObjectById($_GET['id'] ?? null); ?>
<?php if ($station->isExistingObject()) : ?>
<title><?php echo $station->name; ?>, подробнее</title>
<div class="modal-inner-content">
<div class="modal-inner-content-menu">
<span>Подробнее</span>
<a class="tdlink" title="Statistics" href="/views/statistics.php?id=<?php echo $station->id ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">Статистика</a>
<a class="tdlink" title="Trail Chart" href="/views/trail.php?id=<?php echo $station->id ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">Графики</a>
<a class="tdlink" title="Weather" href="/views/weather.php?id=<?php echo $station->id ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">Погода</a>
<a class="tdlink" title="Telemetry" href="/views/telemetry.php?id=<?php echo $station->id ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">Телеметрия</a>
<a class="tdlink" title="Raw packets" href="/views/raw.php?id=<?php echo $station->id ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">Сырые данные</a>
</div>
<div class="horizontal-line">&nbsp;</div>
<div class="overview-content-summary">
<div>
<div class="overview-content-summary-hr">
<?php if ($station->sourceId == 5) : ?>
ID:
<?php else: ?>
Позывной:
<?php endif; ?>
</div>
<div class="overview-content-station" title="Name of the station/object">
<?php echo htmlentities($station->name); ?>
</div>
</div>
<div>
<div class="overview-content-summary-hr">
Идентификатор:
</div>
<div class="overview-content-station" title="Website station id">
<?php echo $station->id; ?>
</div>
</div>
<?php if ($station->sourceId != null) : ?>
<div>
<div class="overview-content-summary-hr">Источник:</div>
<div class="overview-content-station" title="Source of this station">
<?php echo $station->getSourceDescription(); ?>
</div>
</div>
<?php endif; ?>
<?php if ($station->getOgnDevice() !== null) : ?>
<br/>
<?php if ($station->getOgnDevice()->registration != null) : ?>
<div>
<div class="overview-content-summary-hr">Регистрация самолёта:</div>
<div class="overview-content-station" title="Aircraft Registration">
<b><?php echo htmlspecialchars($station->getOgnDevice()->registration); ?></b>
</div>
</div>
<?php endif; ?>
<?php if ($station->getOgnDevice()->cn != null) : ?>
<div>
<div class="overview-content-summary-hr">Aircraft CN:</div>
<div class="overview-content-station" title="Aircraft CN">
<b><?php echo htmlspecialchars($station->getOgnDevice()->cn); ?></b>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($station->getOgnDdbAircraftTypeName() !== null) : ?>
<div>
<div class="overview-content-summary-hr">Тип самолёта:</div>
<div class="overview-content-station" title="Type of aircraft">
<?php echo htmlspecialchars($station->getOgnDdbAircraftTypeName()); ?>
</div>
</div>
<?php if ($station->getOgnDevice()->aircraftModel != null) : ?>
<div>
<div class="overview-content-summary-hr">Модель самолёта:</div>
<div class="overview-content-station" title="Aircraft Model">
<?php echo htmlspecialchars($station->getOgnDevice()->aircraftModel); ?>
</div>
</div>
<?php endif; ?>
<?php elseif ($station->getOgnAircraftTypeName() != null) : ?>
<div>
<div class="overview-content-summary-hr">Тип самолёта:</div>
<div class="overview-content-station" title="Type of aircraft">
<?php echo htmlspecialchars($station->getOgnAircraftTypeName()); ?>
</div>
</div>
<?php else : ?>
<div>
<div class="overview-content-summary-hr">Символ:</div>
<div class="overview-content-station" title="Symbol type">
<img src="<?php echo $station->getIconFilePath(24, 24); ?>" alt="Latest symbol" />
<span>&nbsp;<?php echo htmlentities($station->getLatestSymbolDescription()); ?></span>
</div>
</div>
<?php endif; ?>
<!-- Latest Packet -->
<?php if ($station->latestPacketId !== null) : ?>
<?php $latestPacket = PacketRepository::getInstance()->getObjectById($station->latestPacketId, $station->latestPacketTimestamp); ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последний пакет:</div>
<div class="overview-content-summary-cell-type overview-content-summary-indent"><?php echo $latestPacket->getPacketTypeName(); ?> </div>
</div>
<?php $latestPacketSender = SenderRepository::getInstance()->getObjectById($latestPacket->senderId); ?>
<?php if ($latestPacketSender->name != $station->name) : ?>
<div>
<div class="overview-content-summary-hr-indent">Отправитель:</div>
<div class="overview-content-summary-indent" title="Sender of current packet">
<?php $latestPacketSenderStation = StationRepository::getInstance()->getObjectByNameAndSenderId($latestPacketSender->name, $latestPacketSender->id); ?>
<?php if ($latestPacketSenderStation->isExistingObject()) : ?>
<a class="tdlink" title="Sender of the object" href="/views/overview.php?id=<?php echo $latestPacketSenderStation->id; ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>">
<?php echo htmlentities($latestPacketSenderStation->name); ?>
</a>
<?php else : ?>
<?php echo $latestPacketSender->name; ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div>
<div class="overview-content-summary-hr-indent">Время получения:</div>
<div title="Timestamp of the latest packet" id="latest-timestamp" class="overview-content-summary-cell-time overview-content-summary-indent">
<?php echo $station->latestPacketTimestamp; ?>
</div>
</div>
<div>
<div class="overview-content-summary-hr-indent"></div>
<div title="Age of the latest packet" id="latest-timestamp-age" class="overview-content-summary-cell-time overview-content-summary-indent">
<?php echo $station->latestPacketTimestamp; ?>
</div>
</div>
<div>
<div class="overview-content-summary-hr-indent">Путь:</div>
<div class="overview-content-summary-cell-path overview-content-summary-indent" title="Latest path"><?php echo $latestPacket->rawPath; ?></div>
</div>
<?php if ($latestPacket->comment != '') : ?>
<div>
<div class="overview-content-summary-hr-indent">Комментарий:</div>
<div title="Comment found in thelatest packet" id="latest-packet-comment" class="overview-content-summary-indent">
<?php echo htmlentities($latestPacket->comment); ?>
</div>
</div>
<?php endif;?>
<?php if ($latestPacket->getPacketOgn()->isExistingObject()) : ?>
<div style="line-height: 8px">&nbsp;</div>
<?php if ($latestPacket->getPacketOgn()->ognSignalToNoiseRatio !== null) : ?>
<div>
<div class="overview-content-summary-hr-indent">Сигнал/шум:</div>
<div class="overview-content-summary-indent" title="Signal to Noise Ratio measured upon reception"><?php echo $latestPacket->getPacketOgn()->ognSignalToNoiseRatio; ?> дБ</div>
</div>
<?php endif;?>
<?php if ($latestPacket->getPacketOgn()->ognBitErrorsCorrected !== null) : ?>
<div>
<div class="overview-content-summary-hr-indent">Исправленные биты:</div>
<div class="overview-content-summary-indent" title="The number of bit errors corrected in the packet upon reception"><?php echo $latestPacket->getPacketOgn()->ognBitErrorsCorrected; ?></div>
</div>
<?php endif;?>
<?php if ($latestPacket->getPacketOgn()->ognFrequencyOffset !== null) : ?>
<div>
<div class="overview-content-summary-hr-indent">Разнос по частоте:</div>
<div class="overview-content-summary-indent" title="The frequency offset measured upon reception"><?php echo $latestPacket->getPacketOgn()->ognFrequencyOffset; ?> кГц</div>
</div>
<?php endif;?>
<?php endif;?>
<?php endif;?>
<!-- Latest Weather -->
<?php if ($station->latestWeatherPacketTimestamp !== null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последняя погода:</div>
<div id="weather-timestamp" class="overview-content-summary-cell-weather-time" title="Latest received weather">
<?php echo $station->latestWeatherPacketTimestamp; ?>
</div>
</div>
<?php if ($station->latestWeatherPacketComment != '') : ?>
<div>
<div class="overview-content-summary-hr-indent">Комментарий/ПО:</div>
<div class="overview-content-summary-cell-time overview-content-summary-indent" title="Weather packet comment/software">
<?php echo htmlentities($station->latestWeatherPacketComment); ?><br/>
</div>
</div>
<?php endif;?>
<?php endif;?>
<!-- Latest Telemetry -->
<?php if ($station->latestTelemetryPacketTimestamp !== null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последняя телеметрия:</div>
<div id="telemetry-timestamp" class="overview-content-summary-cell-telemetry-time" title="Latest received telemetry">
<?php echo $station->latestTelemetryPacketTimestamp; ?>
</div>
</div>
<?php endif;?>
<!-- Latest Position -->
<?php if ($station->latestConfirmedPacketId !== null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последняя позиция:</div>
<div id="overview-content-latest-position" class="overview-content-summary-cell-position" title="Latest position (that is approved by our filters)">
<?php echo round($station->latestConfirmedLatitude, 5); ?>, <?php echo round($station->latestConfirmedLongitude, 5); ?>
</div>
</div>
<div>
<div class="overview-content-summary-hr-indent">Время получения:</div>
<div id="position-timestamp" class="overview-content-summary-cell-time overview-content-summary-indent" title="Latest position receive time">
<?php if ($station->latestPacketId == $station->latestConfirmedPacketId && $station->latestPacketTimestamp == $station->latestConfirmedPacketTimestamp) : ?>
(получено в последнем пакете)
<?php else : ?>
<?php echo $station->latestConfirmedPacketTimestamp; ?>
<?php endif; ?>
</div>
</div>
<div>
<div class="overview-content-summary-hr">&nbsp;</div>
<div class="overview-content-summary-cell-position">
<a href="?sid=<?php echo $station->id; ?>" onclick="
if (window.parent && window.parent.trackdirect) {
$('.modal', parent.document).hide();
window.parent.trackdirect.filterOnStationId([]);
window.parent.trackdirect.filterOnStationId([<?php echo $station->id; ?>]);
return false;
}">Показать на карте</a>
</div>
</div>
<?php $latestConfirmedPacket = PacketRepository::getInstance()->getObjectById($station->latestConfirmedPacketId, $station->latestConfirmedPacketTimestamp); ?>
<?php if ($latestConfirmedPacket->isExistingObject() && $latestConfirmedPacket->posambiguity > 0) : ?>
<div>
<div class="overview-content-summary-hr-indent">Неоднозначное положение:</div>
<div class="overview-content-summary-cell-posambiguity overview-content-summary-indent" title="If posambiguity is active the gps position is inaccurate">Да</div>
</div>
<?php endif;?>
<?php if ($latestConfirmedPacket->isExistingObject()) : ?>
<?php if ($latestConfirmedPacket->speed != '' || $latestConfirmedPacket->course != '' || $latestConfirmedPacket->altitude != '') : ?>
<?php if (round($latestConfirmedPacket->speed) != 0 || round($latestConfirmedPacket->course) != 0 || round($latestConfirmedPacket->altitude) != 0) : ?>
<?php if ($latestConfirmedPacket->speed != '') : ?>
<div>
<div class="overview-content-summary-hr-indent">Скорость:</div>
<div title="Latest speed" class="overview-content-summary-indent">
<?php if (isImperialUnitUser()) : ?>
<?php echo round(convertKilometerToMile($latestConfirmedPacket->speed), 2); ?> миль/ч
<?php else : ?>
<?php echo round($latestConfirmedPacket->speed, 2); ?> км/ч
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php if ($latestConfirmedPacket->course != '') : ?>
<div>
<div class="overview-content-summary-hr-indent">Курс:</div>
<div title="Latest course" class="overview-content-summary-indent"><?php echo $latestConfirmedPacket->course; ?>&deg;</div>
</div>
<?php endif;?>
<?php if ($latestConfirmedPacket->altitude != '') : ?>
<div>
<div class="overview-content-summary-hr-indent">Высота:</div>
<div title="Latest altitude" class="overview-content-summary-indent">
<?php if (isImperialUnitUser()) : ?>
<?php echo round(convertMeterToFeet($latestConfirmedPacket->altitude), 2); ?> ф
<?php else : ?>
<?php echo round($latestConfirmedPacket->altitude, 2); ?> м
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php endif;?>
<?php endif;?>
<?php if ($latestConfirmedPacket->getPacketOgn()->isExistingObject()) : ?>
<?php if ($latestConfirmedPacket->getPacketOgn()->ognClimbRate !== null) : ?>
<div>
<div class="overview-content-summary-hr-indent">Набор высоты:</div>
<div class="overview-content-summary-indent" title="The climb rate in feet-per-minute"><?php echo $latestConfirmedPacket->getPacketOgn()->ognClimbRate; ?> ф/мин</div>
</div>
<?php endif;?>
<?php if ($latestConfirmedPacket->getPacketOgn()->ognTurnRate !== null) : ?>
<div>
<?php $turnRateNote = true; ?>
<div class="overview-content-summary-hr-indent">Скорость поворота:</div>
<div class="overview-content-summary-indent" title="Current turn rate."><?php echo $latestConfirmedPacket->getPacketOgn()->ognTurnRate; ?> rot</div>
</div>
<?php endif;?>
<?php endif;?>
<?php endif;?>
<?php endif;?>
<!-- Latest PHG and RNG -->
<?php if ($latestConfirmedPacket && $latestConfirmedPacket->isExistingObject()) : ?>
<?php if ($latestConfirmedPacket->phg != null || $latestConfirmedPacket->latestPhgTimestamp != null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последний PHG:</div>
<div class="overview-content-summary-cell-phg" title="Power-Height-Gain (and directivity)">
<?php echo $latestConfirmedPacket->getPHGDescription(true); ?><br/>
(расчётный диапазон:
<?php if (isImperialUnitUser()) : ?>
<?php echo round(convertKilometerToMile($latestConfirmedPacket->getPHGRange(true)/1000),2); ?> миль)
<?php else : ?>
<?php echo round($latestConfirmedPacket->getPHGRange(true)/1000,2); ?> км)
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php if ($latestConfirmedPacket->rng != null || $latestConfirmedPacket->latestRngTimestamp != null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последний RNG:</div>
<div class="overview-content-summary-cell-phg" title="The pre-calculated radio range">
<?php if (isImperialUnitUser()) : ?>
<?php echo round(convertKilometerToMile($latestConfirmedPacket->getRng(true)), 2); ?> миль
<?php else : ?>
<?php echo round($latestConfirmedPacket->getRng(true), 2); ?> км
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php endif;?>
<!-- Latest Symbols -->
<?php $stationLatestSymbols = $station->getLatestIconFilePaths(22, 22); ?>
<?php if ($stationLatestSymbols !== null && count($stationLatestSymbols) > 1) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Последние символы:</div>
<div title="Latest symbols that this station has used">
<?php foreach ($stationLatestSymbols as $symbolPath) : ?>
<img src="<?php echo $symbolPath; ?>" alt="Symbol"/>&nbsp;
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<!-- Packet Frequency -->
<?php $packetFrequencyNumberOfPackets = null; ?>
<?php $stationPacketFrequency = $station->getPacketFrequency(null, $packetFrequencyNumberOfPackets); ?>
<?php if ($stationPacketFrequency != null) : ?>
<div class="overview-content-divider"></div>
<div>
<div class="overview-content-summary-hr">Частота следования пакетов:</div>
<div class="overview-content-packet-frequency" title="Calculated packet frequency"><span><?php echo $stationPacketFrequency; ?> сек</span> <span>(последние <?php echo $packetFrequencyNumberOfPackets; ?> пакета(ов))</span></div>
</div>
<?php endif; ?>
<div class="overview-content-divider"></div>
</div>
<div class="overview-content-symbol" id ="overview-content-symbol-<?php echo $station->id; ?>">
<img src="<?php echo $station->getIconFilePath(150, 150); ?>" alt="Latest symbol" title="<?php echo $station->getLatestSymbolDescription(); ?>"/>
<?php if ($station->latestPacketId !== null) : ?>
<br/>
<div style="text-align: center; padding-top: 30px;">
<?php if ($station->getOgnDevice() !== null && $station->getOgnDevice()->registration != null) : ?>
<div>
Искать <a href="https://www.jetphotos.com/registration/<?php echo $station->getOgnDevice()->registration; ?>" target="_blank"><?php echo htmlspecialchars($station->getOgnDevice()->registration); ?></a> фото!
</div>
<?php endif; ?>
<?php if ($station->sourceId == 1) : ?>
<?php if ($station->getLiklyHamRadioCallsign() !== null) : ?>
<div>Искать <a href="https://www.qrz.com/db/<?php echo $station->getLiklyHamRadioCallsign(); ?>" target="_blank"><?php echo htmlspecialchars($station->getLiklyHamRadioCallsign()); ?></a> на QRZ</div>
<?php endif; ?>
<?php endif; ?>
<div>Экспорт <a href="/data/kml.php?id=<?php echo $station->id; ?>"><?php echo htmlspecialchars($station->name); ?></a> данных в KML</div>
</div>
<div style="clear: both;"></div>
<?php endif; ?>
</div>
<div class="horizontal-line">&nbsp;</div>
<div class="overview-content-summary">
<!-- Related stations -->
<?php $relatedStations = StationRepository::getInstance()->getRelatedObjectListByStationId($station->id, 15); ?>
<?php if (count($relatedStations) > 1) : ?>
<div>
<?php $relatedStattionNote = true; ?>
<div class="overview-content-summary-hr">Связанные станции/объекты:</div>
<div class="overview-content-station-list" title="Stations with same call except SSID or objects with related sender">
<?php foreach ($relatedStations as $relatedStation) : ?>
<?php if ($relatedStation->id != $station->id) : ?>
<img src="<?php echo $relatedStation->getIconFilePath(22, 22); ?>" alt="Symbol"/>&nbsp;
<span><a class="tdlink" href="/views/overview.php?id=<?php echo $relatedStation->id; ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>"><?php echo htmlentities($relatedStation->name) ?></a></span>
<br/>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="overview-content-divider"></div>
<?php endif; ?>
<!-- Close by stations -->
<?php $closeByStations = StationRepository::getInstance()->getCloseByObjectListByStationId($station->id, 15); ?>
<?php if (count($closeByStations) > 1) : ?>
<div>
<div class="overview-content-summary-hr">Ближайшие станции/объекты:</div>
<div class="overview-content-station-list" title="The closest stations/objects at the current position">
<?php foreach ($closeByStations as $closeByStation) : ?>
<?php if ($closeByStation->id != $station->id) : ?>
<img src="<?php echo $closeByStation->getIconFilePath(22, 22); ?>" alt="Symbol"/>&nbsp;
<span>
<a class="tdlink" href="/views/overview.php?id=<?php echo $closeByStation->id; ?>&imperialUnits=<?php echo $_GET['imperialUnits'] ?? 0; ?>"><?php echo htmlentities($closeByStation->name) ?></a>
<span>
<?php if (isImperialUnitUser()) : ?>
<?php if (convertMeterToYard($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude)) < 1000) : ?>
<?php echo round(convertMeterToYard($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude)), 0); ?> ярд
<?php else : ?>
<?php echo round(convertKilometerToMile($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude) / 1000), 2); ?> миль
<?php endif; ?>
<?php else : ?>
<?php if ($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude) < 1000) : ?>
<?php echo round($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude), 0); ?> м
<?php else : ?>
<?php echo round($closeByStation->getDistance($station->latestConfirmedLatitude, $station->latestConfirmedLongitude) / 1000, 2); ?> км
<?php endif; ?>
<?php endif; ?>
</span>
</span>
<br/>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="overview-content-divider"></div>
<?php endif; ?>
</div>
<?php if (count($relatedStations) > 1 || count($closeByStations) > 1) : ?>
<div class="horizontal-line">&nbsp;</div>
<?php endif; ?>
</div>
</div>
<script>
$(document).ready(function() {
var locale = window.navigator.userLanguage || window.navigator.language;
moment.locale(locale);
$('#overview-content-comment, #overview-content-beacon, #overview-content-status').each(function() {
if ($(this).html().trim() != '') {
$(this).html(Autolinker.link($(this).html()));
}
});
$('#latest-timestamp, #comment-timestamp, #status-timestamp, #beacon-timestamp, #position-timestamp, #weather-timestamp, #telemetry-timestamp').each(function() {
if ($(this).html().trim() != '' && !isNaN($(this).html().trim())) {
$(this).html(moment(new Date(1000 * $(this).html())).format('L LTSZ'));
}
});
if ($('#latest-timestamp-age').length && $('#latest-timestamp-age').html().trim() != '' && !isNaN($('#latest-timestamp-age').html().trim())) {
$('#latest-timestamp-age').html(moment(new Date(1000 * $('#latest-timestamp-age').html())).locale('ru').fromNow());
}
if (window.parent && window.parent.trackdirect) {
<?php if ($station->latestConfirmedLatitude != null && $station->latestConfirmedLongitude != null) : ?>
window.parent.trackdirect.addListener("map-created", function() {
window.parent.trackdirect.focusOnStation(<?php echo $station->id ?>, true);
});
<?php endif; ?>
}
});
</script>
<?php endif; ?>