<?php

use Icinga\Web\Url;
use Icinga\Web\Menu;
use Icinga\Web\MenuRenderer;
use Icinga\Web\Widget\SearchDashboard;

// Don't render a menu for unauthenticated users unless menu is auth aware
if (! $this->auth()->isAuthenticated()) {
    return;
}

?>
<div
    id="menu" data-last-update="<?= (time() - 14) ?>000" data-base-target="_main" class="container" data-icinga-url="<?=$this->href('layout/menu');?>"
    data-icinga-refresh="15"
>
  <? if (SearchDashboard::search('dummy')->getPane('search')->hasComponents()): ?>
      <form action="<?= $this->href('search') ?>" method="get" role="search">
        <input type="text" name="q" class="search autofocus" placeholder="<?= $this->translate('Search...') ?>"
               autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
      </form>
  <? endif; ?>
  <?= new MenuRenderer(Menu::load(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()); ?>
</div>
