diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/Ils.php b/module/VuFind/src/VuFind/Theme/Root/Helper/Ils.php new file mode 100644 index 0000000000000000000000000000000000000000..fccfccf728366842abe89ecfa6d9015212aab1f8 --- /dev/null +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/Ils.php @@ -0,0 +1,51 @@ +<?php +/** + * ILS (integrated library system) view helper + * + * PHP version 5 + * + * Copyright (C) Villanova University 2010. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/building_a_recommendations_module Wiki + */ +namespace VuFind\Theme\Root\Helper; +use Zend\View\Helper\AbstractHelper; + +/** + * ILS (integrated library system) view helper + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/building_a_recommendations_module Wiki + */ +class Ils extends AbstractHelper +{ + /** + * Get the ILS connection object. + * + * @return \VuFind\ILS\Connection + */ + public function __invoke() + { + return \VuFind\Connection\Manager::connectToCatalog(); + } +} \ No newline at end of file diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/tab-holdings.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/tab-holdings.phtml index 1e17906d4292c79789dd8efcc708a4a10fc83afd..a6daf89629872e81d2459c0660e276fe084ae64c 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/tab-holdings.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/tab-holdings.phtml @@ -3,7 +3,7 @@ $user = $this->layout()->account->isLoggedIn(); $holdings = $this->driver->getRealTimeHoldings($this->layout()->account); $openUrl = $this->driver->openURLActive('holdings') ? $this->driver->getOpenURL() : false; - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); // Account for replace_other_urls setting $urls = ($openUrl && $this->driver->replaceURLsWithOpenURL()) ? array() : $this->record($this->driver)->getLinkDetails(); diff --git a/themes/blueprint/templates/myresearch/cataloglogin.phtml b/themes/blueprint/templates/myresearch/cataloglogin.phtml index 4f4bc0e94bc3ee1f585daaf281524e56158d68c1..da71a03c08286bbc69ffaa6dfe28540de28b9bae 100644 --- a/themes/blueprint/templates/myresearch/cataloglogin.phtml +++ b/themes/blueprint/templates/myresearch/cataloglogin.phtml @@ -8,7 +8,7 @@ . $this->transEsc('Login') . '</em>'; // Convenience variable: - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); ?> <? if ($offlineMode == "ils-offline"): ?> <div class="sysInfo"> diff --git a/themes/blueprint/templates/myresearch/login.phtml b/themes/blueprint/templates/myresearch/login.phtml index 14e09542a3380220f0afd7a833d9be92be9ca976..90bf7b92d1b0b99479df221af760c8e73ccb7268 100644 --- a/themes/blueprint/templates/myresearch/login.phtml +++ b/themes/blueprint/templates/myresearch/login.phtml @@ -15,7 +15,7 @@ // Convenience variables: $account = $this->layout()->account; $hideLogin = !(is_object($account) && $account->loginEnabled()); - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); ?> <? if ($offlineMode == "ils-offline"): ?> diff --git a/themes/jquerymobile/templates/RecordDriver/SolrDefault/tab-holdings.phtml b/themes/jquerymobile/templates/RecordDriver/SolrDefault/tab-holdings.phtml index 2730774391ab418f528461de7e18d43e8be9b052..a2283e1bdf57bf929df3bccf0f4929a06b7517c7 100644 --- a/themes/jquerymobile/templates/RecordDriver/SolrDefault/tab-holdings.phtml +++ b/themes/jquerymobile/templates/RecordDriver/SolrDefault/tab-holdings.phtml @@ -2,7 +2,7 @@ // Set up convenience variables: $user = $this->layout()->account->isLoggedIn(); $holdings = $this->driver->getRealTimeHoldings($this->layout()->account); - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); // Set page title. $this->headTitle($this->translate('Holdings') . ': ' . $this->driver->getBreadcrumb()); diff --git a/themes/jquerymobile/templates/myresearch/cataloglogin.phtml b/themes/jquerymobile/templates/myresearch/cataloglogin.phtml index 0218a0996da38995dc81bb3c7a572083365d27a6..2cfcff0f55acbc0418949dd6a200343f822af926 100644 --- a/themes/jquerymobile/templates/myresearch/cataloglogin.phtml +++ b/themes/jquerymobile/templates/myresearch/cataloglogin.phtml @@ -3,7 +3,7 @@ $this->headTitle($this->translate('Login')); // Convenience variable: - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); ?> <div data-role="page" id="MyResearch-login"> <?=$this->mobileMenu()->header()?> diff --git a/themes/jquerymobile/templates/myresearch/login.phtml b/themes/jquerymobile/templates/myresearch/login.phtml index 8a7cd8444274a5f88a9b8dc201d6de4e95bf4312..09e14869dd34cc740bbdd5be156c6fe57526fdbb 100644 --- a/themes/jquerymobile/templates/myresearch/login.phtml +++ b/themes/jquerymobile/templates/myresearch/login.phtml @@ -5,7 +5,7 @@ // Convenience variables: $account = $this->layout()->account; $hideLogin = !(is_object($account) && $account->loginEnabled()); - $offlineMode = \VuFind\Connection\Manager::connectToCatalog()->getOfflineMode(); + $offlineMode = $this->ils()->getOfflineMode(); ?> <div data-role="page" id="MyResearch-login"> <?=$this->mobileMenu()->header()?> diff --git a/themes/root/theme.ini b/themes/root/theme.ini index 97d6acb6184933b2fa820d9a730ae805102fb9c4..0a40eaebf66788ea46b9506361a0fcc6a11c8038 100644 --- a/themes/root/theme.ini +++ b/themes/root/theme.ini @@ -19,6 +19,7 @@ helpers_to_register[] = "HeadLink" helpers_to_register[] = "HeadScript" helpers_to_register[] = "HeadThemeResources" helpers_to_register[] = "Highlight" +helpers_to_register[] = "Ils" helpers_to_register[] = "ImageLink" helpers_to_register[] = "InlineScript" helpers_to_register[] = "JqueryValidation"