69 lines
2.1 KiB
PHTML
69 lines
2.1 KiB
PHTML
<?php
|
|
/**
|
|
* @var App\Entity\Station $station
|
|
* @var App\Acl $acl
|
|
* @var App\View\GlobalSections $sections
|
|
*/
|
|
|
|
$sections->appendStart('bodyjs');
|
|
?>
|
|
<script>
|
|
App.station = <?=$this->escapeJs([
|
|
'id' => $station->getIdRequired(),
|
|
'name' => $station->getName(),
|
|
'shortName' => $station->getShortName(),
|
|
'timezone' => $station->getTimezone(),
|
|
]); ?>;
|
|
|
|
ready(() => {
|
|
// Show the "Restart to Apply Changes" link
|
|
document.addEventListener('station-needs-restart', () => {
|
|
document.querySelectorAll('.btn-restart-station').forEach((el) => {
|
|
el.classList.remove('d-none');
|
|
});
|
|
});
|
|
|
|
// Update the clock in the header
|
|
const updateClock = () => {
|
|
let d = new Date();
|
|
document.querySelector("#station-time").textContent = d.toLocaleString(
|
|
App.locale_with_dashes,
|
|
{
|
|
...App.time_config,
|
|
timeZone: App.station.timezone,
|
|
timeStyle: 'long'
|
|
}
|
|
);
|
|
}
|
|
|
|
setInterval(updateClock, 1000);
|
|
updateClock();
|
|
});
|
|
</script>
|
|
<?php
|
|
$sections->end();
|
|
?>
|
|
|
|
<div class="navdrawer-header offcanvas-header">
|
|
<div class="d-flex align-items-center">
|
|
<a class="navbar-brand px-0 flex-fill" href="<?= $router->fromHere('stations:profile:index') ?>">
|
|
<div><?= $this->e($station->getName()) ?></div>
|
|
<div class="fs-6" id="station-time" title="<?= $this->e(__('Station Time')) ?>">
|
|
<?= date('H:i:s T') ?>
|
|
</div>
|
|
</a>
|
|
<?php
|
|
if ($acl->isAllowed(App\Enums\StationPermissions::Profile, $station)): ?>
|
|
<a class="navbar-brand ms-0 flex-shrink-0" href="<?= $router->fromHere('stations:profile:edit') ?>">
|
|
<i class="material-icons">edit</i>
|
|
<span class="visually-hidden"><?= __('Edit Profile') ?>
|
|
</a>
|
|
<?php
|
|
endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
echo $this->fetch('partials/sidebar_menu', ['menu' => $menu, 'active' => $active]);
|
|
?>
|