layout.phtml: Setup the Icinga js object with the user's locale and timezone

This commit is contained in:
Johannes Meyer 2021-04-15 16:08:47 +02:00
parent c202eccf65
commit 04b906bff5

View File

@ -11,6 +11,7 @@ if (array_key_exists('_dev', $_GET)) {
$cssfile = 'css/icinga.min.css'; $cssfile = 'css/icinga.min.css';
} }
$timezone = date_default_timezone_get();
$lang = Translator::splitLocaleCode()->language; $lang = Translator::splitLocaleCode()->language;
$isIframe = $this->layout()->isIframe; $isIframe = $this->layout()->isIframe;
$showFullscreen = $this->layout()->showFullscreen; $showFullscreen = $this->layout()->showFullscreen;
@ -93,7 +94,9 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
<script type="text/javascript"> <script type="text/javascript">
window.name = '<?= $this->protectId('Icinga') ?>'; window.name = '<?= $this->protectId('Icinga') ?>';
var icinga = new Icinga({ var icinga = new Icinga({
baseUrl: '<?= $this->baseUrl(); ?>' baseUrl: '<?= $this->baseUrl(); ?>',
locale: '<?= $lang; ?>',
timezone: '<?= $timezone ?>'
}); });
</script> </script>
</body> </body>