<?=$this->doctype('HTML5')?>
<html lang="<?=$this->layout()->userLang?>">
  <head>
    <?=$this->headThemeResources()?>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
    <meta name="google-site-verification" content="AwTZvdqICTyzm1pFOk7CK722lokP8HkavYrUP4aohms" />
    <?=$this->headMeta()?>
    <?=$this->headTitle()?>
    <link rel="shortcut icon" href="https://www.bibb.de/system/library/favicon.ico"/>
    <?php
      // Set up OpenSearch link:
      $this->headLink(
        [
          'href' => $this->url('search-opensearch') . '?method=describe',
          'type' => 'application/opensearchdescription+xml',
          'title' => $this->transEsc('Library Catalog Search'),
          'rel' => 'search'
        ]
      );
    ?>
    <!-- RTL styling -->
    <?php if ($this->layout()->rtl) {
      $this->headLink()->appendStylesheet('vendor/bootstrap-rtl.min.css');
    } ?>
    <?=$this->headLink()?>
    <?=$this->headStyle()?>
    <?php
      if (!isset($this->renderingError)) {
        // Add translation strings
        $this->jsTranslations()->addStrings(
          [
            'add_tag_success' => 'add_tag_success',
            'bulk_email_success' => 'bulk_email_success',
            'bulk_noitems_advice' => 'bulk_noitems_advice',
            'bulk_save_success' => 'bulk_save_success',
            'close' => 'close',
            'collection_empty' => 'collection_empty',
            'error_occurred' => 'An error has occurred',
            'go_to_list' => 'go_to_list',
            'libphonenumber_invalid' => 'libphonenumber_invalid',
            'libphonenumber_invalidcountry' => 'libphonenumber_invalidcountry',
            'libphonenumber_invalidregion' => 'libphonenumber_invalidregion',
            'libphonenumber_notanumber' => 'libphonenumber_notanumber',
            'libphonenumber_toolong' => 'libphonenumber_toolong',
            'libphonenumber_tooshort' => 'libphonenumber_tooshort',
            'libphonenumber_tooshortidd' => 'libphonenumber_tooshortidd',
            'loading' => 'Loading',
            'more' => 'more',
            'number_thousands_separator' => [
                'number_thousands_separator', null, ','
            ],
            'sms_success' => 'sms_success'
          ]
        );
        // Add libphonenumber.js strings
        $this->jsTranslations()->addStrings(
          [
            "Phone number invalid" => 'libphonenumber_invalid',
            "Invalid country calling code" => 'libphonenumber_invalidcountry',
            "Invalid region code" => 'libphonenumber_invalidregion',
            "The string supplied did not seem to be a phone number" => 'libphonenumber_notanumber',
            "The string supplied is too long to be a phone number" => 'libphonenumber_toolong',
            "The string supplied is too short to be a phone number" => 'libphonenumber_tooshort',
            "Phone number too short after IDD" => 'libphonenumber_tooshortidd'
          ]
        );
        // Deal with cart stuff:
        $cart = $this->cart();
        if ($cart->isActive()) {
          $this->headScript()->appendFile("vendor/cookies.js");
          $this->headScript()->appendFile("cart.js");
          $domain = $cart->getCookieDomain();
          if (!empty($domain)) {
            $this->headScript()->appendScript(
              'VuFind.cart.setDomain("' . $domain . '");'
            );
          }
          $cookiePath = $cart->getCookiePath();
          if (!empty($cookiePath)) {
            $this->headScript()->appendScript(
              'VuFind.cart.setCookiePath("' . $cookiePath . '");'
            );
          }
          $this->jsTranslations()->addStrings(
            [
              'addBookBag' => 'Add to Book Bag',
              'bookbagFull' => 'bookbag_full_msg',
              'bookbagMax' => $cart->getMaxSize(),
              'bookbagStatusFull' => 'bookbag_full',
              'confirmDelete' => 'confirm_delete',
              'confirmEmpty' => 'bookbag_confirm_empty',
              'itemsAddBag' => 'items_added_to_bookbag',
              'itemsInBag' => 'items_already_in_bookbag',
              'removeBookBag' => 'Remove from Book Bag',
              'viewBookBag' => 'View Book Bag'
            ]
          );
        }
        $this->headScript()->appendScript(
          'var userIsLoggedIn = ' . ($this->auth()->isLoggedIn() ? 'true' : 'false') . ';'
        );
      }

      // Session keep-alive
      if ($this->keepAlive()) {
          $this->headScript()->appendScript('var keepAliveInterval = '
            . $this->keepAlive());
          $this->headScript()->appendFile("keep_alive.js");
      }
    ?>
    <?php
      $root = rtrim($this->url('home'), '/');
      $translations = $this->jsTranslations()->getJSON();
      $dsb = DEFAULT_SEARCH_BACKEND;
      $setupJS = <<<JS
VuFind.path = '{$root}';
VuFind.defaultSearchBackend = '{$dsb}';
VuFind.addTranslations({$translations});
JS;
      $this->headScript()->appendScript($setupJS);
    ?>
    <?=$this->headScript()?>

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
  _paq.push(["setCookieDomain", "*.thesaurus.bibb.de"]);
  _paq.push(["setDomains", ["*.thesaurus.bibb.de"]]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//thesaurus.bibb.de/matomo/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
//    alert ("TEST : " +u +g.type +g.src); 
  } )();
</script>
<noscript><p><img src="//thesaurus.bibb.de/matomo/matomo.php?idsite=1&amp;rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->

  </head>
  <body class="template-dir-<?=$this->templateDir?> template-name-<?=$this->templateName?> <?=$this->layoutClass('offcanvas-row')?><?php if ($this->layout()->rtl): ?> rtl<?php endif; ?>">
    <?php // Set up the search box -- there are three possible cases:
      // 1. No search box was set; we should default to the normal box
      // 2. It was set to false; we should display nothing
      // 3. It is set to a custom string; we should display the provided version
      // Set up default search box if no data was provided from the template;
      // this covers case 1.  Cases 2 and 3 are then covered by logic below.
      if (!isset($this->layout()->searchbox)) {
        $this->layout()->searchbox = $this->render('search/searchbox.phtml');
      }
    ?>
    <header class="hidden-print">
      <?php if (isset($this->layout()->srmessage)): // message for benefit of screen-reader users ?>
        <span class="sr-only"><?=$this->layout()->srmessage ?></span>
      <?php endif; ?>
      <a class="sr-only" href="#content"><?=$this->transEsc('Skip to content') ?></a>
      <?=$this->render('header.phtml')?>
    </header>
    <nav class="breadcrumbs">
      <div class="container">
        <?php if((!isset($this->layout()->showBreadcrumbs) || $this->layout()->showBreadcrumbs == true)
          && !empty($this->layout()->breadcrumbs)
          && $this->layout()->breadcrumbs !== false
        ): ?>
          <ul class="breadcrumb hidden-print">
            <?php if(is_array($this->layout()->breadcrumbs)): ?>
              <?php if(count($this->layout()->breadcrumbs) > 1): ?>
                <?=$this->render('breadcrumbs/multi.phtml', [
                    'parents' => $this->layout()->breadcrumbs,
                    'title'   => $this->layout()->title,
                    'from'    => $this->layout()->from
                  ]) ?>
              <?php else: ?>
                <?=$this->render('breadcrumbs/default.phtml', [
                    'parents' => $this->layout()->breadcrumbs,
                    'title'   => $this->layout()->title
                  ]) ?>
              <?php endif; ?>
            <?php else: ?>
              <?=$this->layout()->breadcrumbs ?>
            <?php endif; ?>
          </ul>
        <?php endif; ?>
      </div>
    </nav>
    <div role="main" class="main">
      <div id="content" class="container">
        <?=$this->layout()->content ?>
      </div>
    </div>
    <?=$this->render('footer.phtml')?>
    <!-- MODAL IN CASE WE NEED ONE -->
    <div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <div class="modal-body"><?=$this->transEsc('Loading') ?>...</div>
        </div>
      </div>
    </div>
    <div class="offcanvas-toggle" data-toggle="offcanvas"><i class="fa" title="<?=$this->transEsc('sidebar_expand') ?>"></i></div>
    <div class="offcanvas-overlay" data-toggle="offcanvas"></div>
    <?=$this->googleanalytics()?>
    <?=$this->piwik()?>
  </body>
</html>
