From b0121fd4847e47bfd3c9fd2791146bec1b24937b Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Mon, 13 Jan 2020 11:13:51 +0100
Subject: [PATCH] refs #16630 [fid_adlr] refactor getIt box

* adapt templates to new GetIt logics
---
 .../templates/RecordTab/holdingsils.phtml     | 36 +++++++++----------
 .../fid_adlr/templates/get-it-box/links.phtml |  6 ++--
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/themes/fid_adlr/templates/RecordTab/holdingsils.phtml b/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
index 3367e3ee2fa..174e89120f9 100644
--- a/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
+++ b/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
@@ -13,7 +13,7 @@
   // finc-specific: externalCatalogueLink
   $extUrls = $this->externalCatalogueLink($this->driver)->getLinks();
   // #15930 Get It Box
-  $getit = $this->getit($this->driver);
+  $getitConfig = $this->getit($this->driver)->getConfig();
   $id = $this->driver->getUniqueId();
   // $controllerClass = 'controller:' . $this->record($this->driver)->getController();
   $controllerClass = 'controller:SolrMarcFincPDA';
@@ -35,7 +35,7 @@
   $this->headTitle($this->driver->getBreadcrumb());
 ?>
 
-<?php if ($user && $getit->showBOSSData()): ?>
+<?php if ($user && $getitConfig['bossData']): ?>
       <? $script = <<<JS
   $(document).ready(function() {
       var recordId = $('.hiddenId').val();
@@ -61,7 +61,7 @@ JS;
       <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET');?>
 <?php endif; ?>
 
-<?php if ($getit->hideNotice()): ?>
+<?php if ($getitConfig['hideNotice']): ?>
     <? $script = <<<JS
   $(document).ready(function() {
       $('.getitbox-notices').addClass('hidden');
@@ -72,24 +72,24 @@ JS;
 <?php endif; ?>
 
 <div class="getitbox-getit">
-  <h4><?=$getit->getBoxHeadline()?></h4>
+  <h4><?=$getitConfig['boxHeadline']?></h4>
 
     <?=($offlineMode == "ils-offline") ? $this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message']) : ''?>
 
-    <?php if ($user && $getit->showBOSSData()): ?>
+    <?php if ($user && $getitConfig['bossData']): ?>
       <div class="boss-data-true"></div>
     <?php endif; ?>
 
     <?php if ($openUrlActive): ?>
       <div class="openUrlButton"></div>
     <?php endif; ?>
-    <?php if ($getit->showOrderButton() && $user): ?>
+    <?php if ($getitConfig['showOrderButton'] && $user): ?>
       <a class="btn btn-primary pda-button full-order" data-lightbox href="<?=$this->url('record-fidpda', array('id' => $id))?>" rel="nofollow">
           <?=$this->transEsc('getit_order')?>
       </a>
     <?php endif; ?>
 
-    <?php if ($getit->showPartCopyButton() && $user): ?>
+    <?php if ($getitConfig['showPartCopyButton'] && $user): ?>
       <a class="btn btn-primary pda-button part-order" data-lightbox href="<?=$this->url('record-fidsubitopartialcopy', array('id' => $id))?>" rel="nofollow">
           <?=$this->transEsc('getit_partcopy')?>
       </a><br />
@@ -99,9 +99,9 @@ JS;
     <?php endif; ?>
 
     <?php /* finc: add 'Online Access' in holdings-tab #13770 - VE */ ?>
-    <?php if ($getit->showLinks() && (!empty($urls) || $openUrlActive || $doiActive)): ?>
+    <?php if ($getitConfig['showLinks'] && (!empty($urls) || $openUrlActive || $doiActive)): ?>
       <?= $this->context($this)->renderInContext('get-it-box/links.phtml',
-            compact('getit', 'openUrl','openUrlActive','urls','doiActive','doi')
+            compact('getitConfig', 'openUrl','openUrlActive','urls','doiActive','doi')
       ); ?>
     <?php endif; ?>
 </div>
@@ -112,26 +112,26 @@ JS;
   </div>
 <?php endif; ?>
 
-<?php if (!empty($getit->getNotices())): ?>
+<?php if (!empty($getitConfig['notice'])): ?>
 <div class="getitbox-notices">
 
-    <?php if ($user && $getit->showBOSSData()): ?>
+    <?php if ($user && $getitConfig['bossData']): ?>
       <div class="boss-data-false"></div>
-<?php if ($getit->hideNotice()): ?><br/><?php endif; ?>
+<?php if ($getitConfig['hideNotice']): ?><br/><?php endif; ?>
     <?php endif; ?>
 
     <?php
     $url = '<a href="'.$this->url('myresearch-account').'?auth_method='.$account->getAuthMethod().'" target="_blank" data-lightbox>'.$this->transEsc('getit_text_3_2').'</a>';
     ?>
-    <?php if ($getit->hideNotice()): ?><div class="boss-notice"><?php endif; ?>
-        <?=sprintf($getit->getNotices(), $url)?>
-        <?php if ($getit->hideNotice()): ?></div><?php endif; ?>
+    <?php if ($getitConfig['hideNotice']): ?><div class="boss-notice"><?php endif; ?>
+        <?=sprintf($getitConfig['notice'], $url)?>
+        <?php if ($getitConfig['hideNotice']): ?></div><?php endif; ?>
 </div>
-<?php elseif (!$getit->isAISIDRecord()): ?>
+<?php elseif (!$getitConfig['isAiSidRecord']): ?>
 <div class="getitbox-notices resolver">
-    <?php if ($user && $getit->showBOSSData()): ?>
+    <?php if ($user && $getitConfig['bossData']): ?>
     <div class="boss-data-false"></div>
-        <?php if ($getit->hideNotice()): ?><br/><?php endif; ?>
+        <?php if ($getitConfig['hideNotice']): ?><br/><?php endif; ?>
     <?php endif; ?>
 </div>
 <?php endif; ?>
diff --git a/themes/fid_adlr/templates/get-it-box/links.phtml b/themes/fid_adlr/templates/get-it-box/links.phtml
index 6dac92c17db..68f2d11784e 100644
--- a/themes/fid_adlr/templates/get-it-box/links.phtml
+++ b/themes/fid_adlr/templates/get-it-box/links.phtml
@@ -1,12 +1,12 @@
 <!-- fid_adlr: get-it-box - links -->
-<div class="facet-group" id="get-it-links-<?= $getit->getAccordeonColor() ?>">
+<div class="facet-group" id="get-it-links-<?= $getitConfig['accordeonColor'] ?>">
   <button class="title collapsed" id="get-it-button" data-toggle="collapse" href="#side-collapse-links-data">
-    <?= $getit->getAccordeonHeadline() ?>
+    <?= $getitConfig['accordeonHeadline'] ?>
   </button>
   <div id="side-collapse-links-data" class="collapse">
     <?php $maxDisplayLength = 50; ?>
     <?php if (!empty($urls)): ?>
-      <?php $isEBCEbooks = $getit->isEBCEBooks(); ?>
+      <?php $isEBCEbooks = $getitConfig['isEBCEBooks']; ?>
       <?php foreach ($urls as $current): ?>
           <?php if ($isEBCEbooks): ?>
               <?php if (preg_match_all('/fid\-medien/', $current['url'])): ?>
-- 
GitLab