Skip to content
Snippets Groups Projects
layout.phtml 8.71 KiB
Newer Older
<?=$this->doctype('HTML5')?>
<html lang="<?=$this->layout()->userLang?>"<?php if ($this->layout()->rtl): ?> dir="rtl"<?php endif; ?>>
<head>
  <?php $this->headThemeResources(); ?>
  <?php /* remove meta because of W3C Validator error - CK */
  /*  <meta charset="utf-8">  */

  if (empty($this->headTitle()) || $this->headTitle()->toString() == "<title></title>") {
    $this->headTitle($this->translate('adlr_head_title'));
  }

  ?>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  <? /* TODO: use TranslatorAwareTrait:translateString instead of using postfix [_locale]*/ ?>
  <meta name="description" lang="de" content="<?=$this->translate('adlr_head_description_de')?>">
  <meta name="description" lang="en" content="<?=$this->translate('adlr_head_description_en')?>">
  <meta name="keywords" lang="de" content="<?=$this->translate('adlr_head_keywords_de')?>">
  <meta name="keywords" lang="en" content="<?=$this->translate('adlr_head_keywords_en')?>">
  <? /* END TODO */ ?>

  <?=$this->headMeta()?>
  <?=$this->headTitle()?>
  <?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
    // PDA (BELOW) is a custom finc string - CK
    $this->jsTranslations()->addStrings(
      [
        'pda_send_success' => 'PDA::pda_send_success',
        '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',
        'filter-All' => 'All',
        'filter-AVMedia' => 'SearchTabs::AV Media',
        'filter-Releases' => 'SearchTabs::Releases',
        'filter-Texts' => 'Texts',
        'go_to_list' => 'go_to_list',
        'hold_available' => 'hold_available',
        '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()->prependScript(
      '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");
  }

  // If account ajax is active, load script and add language strings
  $account = $this->auth()->getManager();
  if ($account->ajaxEnabled()) {
    $this->headScript()->appendFile("account_ajax.js");
    $this->jsTranslations()->addStrings(
      [
        'account_has_alerts' => 'account_has_alerts',
        'Checked Out Items' => 'Checked Out Items',
        'ill_request_available' => 'ill_request_available',
        'renew_item_due_tooltip' => 'renew_item_due_tooltip',
        'renew_item_overdue_tooltip' => 'renew_item_overdue_tooltip',
        'request_in_transit' => 'request_in_transit',
        'storage_retrieval_request_available' => 'storage_retrieval_request_available'
      ]
    );
  }

  $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()?>
</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');
}
?>
<?php if (isset($this->layout()->srmessage)): // message for benefit of screen-reader users ?>
  <span class="sr-only" role="heading" aria-level="1"><?=$this->layout()->srmessage?></span>
<?php endif; ?>
<a class="sr-only" href="#searchslots"><?=$this->transEsc('Skip to search')?></a>
<a class="sr-only" href="#content"><?=$this->transEsc('Skip to content')?></a>

<?php /* Start header here, not above, custom finc, CK */ ?>
<header class="hidden-print collapse in">
  <?=$this->render('header.phtml')?>
</header>
<div role="main" class="main collapse in" id="main">
  <div id="content" class="container">
    <?=$this->layout()->content?>
  </div>
</div>

<?=$this->render('footer.phtml')?>


<!-- MODAL IN CASE WE NEED ONE -->
<?php /* move X button to logical pos. in structure + make accessible via tab - CK */ ?>
<div id="modal" class="modal fade hidden-print" tabindex="-1" role="dialog" aria-modal="true" data-aria-labelledby="modalTitle" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body"><?=$this->transEsc('Loading')?>&nbsp;...</div>
      <button type="button" class="close" data-dismiss="modal" tabindex="0">
        <span class="sr-only"><?=$this->transEsc('Close')?></span>
        <i class="fa fa-times" aria-hidden="true"></i>
      </button>
    </div>
  </div>
</div>
<div class="offcanvas-overlay" data-toggle="offcanvas"></div>
<?=$this->googleanalytics()?>
<?=$this->piwik()?>
<?php if ($this->recaptcha()->active()): ?>
  <?=$this->inlineScript(\Zend\View\Helper\HeadScript::FILE, "https://www.google.com/recaptcha/api.js?onload=recaptchaOnLoad&render=explicit&hl=" . $this->layout()->userLang, 'SET')?>
<?php endif; ?>
<?php /* Enable Tooltips, finc-specific, CK */ ?>
<script>
  $(document).ready(function () {
    $("body").tooltip({selector: '[data-toggle=tooltip]'});
  });
</script>
</body>
</html>