diff --git a/module/fid/config/fid-acquisition-form.php b/module/fid/config/fid-acquisition-form.php new file mode 100644 index 0000000000000000000000000000000000000000..81ae0d8c2e9da694b732884d6bc8b93a595f3db9 --- /dev/null +++ b/module/fid/config/fid-acquisition-form.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use fid\Hydrator\OrderHydrator; +use Zend\Form\Element\Submit; + +return [ + 'name' => 'fid-acquisition-pda-form', + 'hydrator' => OrderHydrator::class, + 'elements' => [ + 'submit' => [ + 'spec' => [ + 'name' => 'submit', + 'type' => Submit::class, + 'attributes' => [ + 'value' => 'label_acquisition_submit', + ], + ], + ], + ], + 'input_filter' => [ + 'submit' => [ + 'name' => 'submit', + 'required' => true, + ], + ], +]; \ No newline at end of file diff --git a/module/fid/config/fid-acquisition-subito-partial-copy-form.php b/module/fid/config/fid-acquisition-subito-partial-copy-form.php new file mode 100644 index 0000000000000000000000000000000000000000..bedf96dd9958b1b1e8a47331b2d50fe0d72be69a --- /dev/null +++ b/module/fid/config/fid-acquisition-subito-partial-copy-form.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use fid\Hydrator\OrderHydrator; +use Zend\Filter\StringTrim; +use Zend\Form\Element\Submit; +use Zend\Form\Element\Text; +use Zend\Validator\Regex; +use Zend\Validator\StringLength; + +return [ + 'name' => 'fid-acquisition-form', + 'hydrator' => OrderHydrator::class, + 'elements' => [ + 'pages' => [ + 'spec' => [ + 'name' => 'pages', + 'type' => Text::class, + 'options' => [ + 'label' => 'label_acquisition_pages', + ], + 'attributes' => [ + 'required' => true, + ], + ], + ], + 'submit' => [ + 'spec' => [ + 'name' => 'submit', + 'type' => Submit::class, + 'attributes' => [ + 'value' => 'label_acquisition_submit', + ], + ], + ], + ], + 'input_filter' => [ + 'pages' => [ + 'name' => 'pages', + 'filters' => [ + StringTrim::class => [ + 'name' => StringTrim::class, + ], + ], + 'validators' => [ + StringLength::class => [ + 'name' => StringLength::class, + 'options' => [ + 'min' => 3, + 'max' => 13, + 'messages' => [ + StringLength::TOO_SHORT => 'error_pages_length', + StringLength::TOO_LONG => 'error_pages_length', + ], + ], + ], + Regex::class => [ + 'name' => Regex::class, + 'options' => [ + 'pattern' => '/^(0|[1-9]\d*)-([1-9]\d*)$/', + 'messages' => [ + Regex::NOT_MATCH => 'error_pages_pattern', + ], + ], + ], + ], + ], + 'submit' => [ + 'name' => 'submit', + 'required' => true, + ], + ], +]; \ No newline at end of file diff --git a/module/fid/config/module.config.php b/module/fid/config/module.config.php index f80bb7d8be1cee5d85d05782ab9a2090fd90debf..8493efc516c56ae1ae8dce50422c503e364bf4ce 100644 --- a/module/fid/config/module.config.php +++ b/module/fid/config/module.config.php @@ -19,6 +19,8 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 */ +use fid\Controller\RecordController; +use fid\Controller\RecordControllerDelegatorFactory; use fid\Controller\UserController; use fid\Controller\UserControllerFactory; use fid\Filter\PermissionsFilter; @@ -28,6 +30,7 @@ use fid\FormModel\PasswordResetModel; use fid\FormModel\UsernameChangeModel; use fid\Helper\FormLabel; use fid\Helper\TranslatorDelegator; +use fid\Hydrator\OrderHydrator; use fid\Hydrator\UserHydrator; use fid\Hydrator\UserHydratorDelegatorFactory; use fid\Listener\ErrorListener; @@ -48,6 +51,7 @@ use fid\VuFind\Resolver\Driver\Ezb; use fid\VuFind\Resolver\Driver\EzbDelegatorFactory; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use VuFind\Auth\ILSAuthenticator as BaseILSAuthenticator; +use VuFind\Controller\AbstractBaseWithConfigFactory; use VuFind\Db\Row\User as BaseUser; use VuFind\Db\Row\UserFactory; use VuFind\Resolver\Driver\DriverWithHttpClientFactory; @@ -55,12 +59,14 @@ use Zend\Mvc\I18n\Translator; use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger; use Zend\ServiceManager\Factory\InvokableFactory; -return [ +$config = [ 'forms' => [ 'user-init-form' => require 'user-init-form.php', 'user-create-form' => require 'user-create-form.php', 'user-update-form' => require 'user-update-form.php', 'admin-edit-form' => require 'admin-edit-form.php', + 'fid-acquisition-form' => require 'fid-acquisition-form.php', + 'fid-acquisition-subito-partial-copy-form' => require 'fid-acquisition-subito-partial-copy-form.php', PasswordResetModel::class => require 'password-reset-form.php', PasswordChangeModel::class => require 'password-change-form.php', UsernameChangeModel::class => require 'username-change-form.php', @@ -73,6 +79,7 @@ return [ 'hydrators' => [ 'factories' => [ UserHydrator::class => InvokableFactory::class, + OrderHydrator::class => InvokableFactory::class, ], 'delegators' => [ UserHydrator::class => [ @@ -82,8 +89,17 @@ return [ ], 'controllers' => [ 'factories' => [ + RecordController::class => AbstractBaseWithConfigFactory::class, UserController::class => UserControllerFactory::class, - ] + ], + 'aliases' => [ + \VuFind\Controller\RecordController::class => RecordController::class, + ], + 'delegators' => [ + RecordController::class => [ + RecordControllerDelegatorFactory::class, + ], + ], ], 'listeners' => [ ErrorListener::class, @@ -364,3 +380,18 @@ return [ ], ], ]; + +$nonTabRecordActions = [ + 'fidPDA', 'fidSubitoArticle', 'fidSubitoPartialCopy' +]; + +// Define record view routes -- route name => controller +// Define record view routes once again to add new nonTabRecordActions +$recordRoutes = [ + 'record' => 'Record' +]; + +$routeGenerator = new \VuFind\Route\RouteGenerator($nonTabRecordActions); +$routeGenerator->addRecordRoutes($config, $recordRoutes); + +return $config; \ No newline at end of file diff --git a/module/fid/src/Controller/CustomTraits/FidAcquisitionTrait.php b/module/fid/src/Controller/CustomTraits/FidAcquisitionTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..2f23a442095c1deba3f5689f4e99620819dcc55c --- /dev/null +++ b/module/fid/src/Controller/CustomTraits/FidAcquisitionTrait.php @@ -0,0 +1,187 @@ +<?php +/** + * FID Acquisition Trait + * + * PHP version 5 + * + * Copyright (C) Villanova University 2010. + * Copyright (C) Leipzig University Library 2015. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind FID + * @package Controller + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + */ +namespace fid\Controller\CustomTraits; + +use fid\Service\Client; +use fid\Service\DataTransferObject\Order; +use Zend\Form\Form; +use Zend\Http\PhpEnvironment\Request; + +/** + * FID Acquisition Trait + * + * @category VuFind + * @package Controller + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://finc.info Main Site + */ +trait FidAcquisitionTrait +{ + /** + * @var Client + */ + protected $client; + + /** + * @param Client $client + */ + public function setClient(Client $client): void + { + $this->client = $client; + } + + public function fidPdaAction () + { + if (!($user = $this->getUser())) { + return $this->forceLogin(); + } + + $type = "pda"; + $driver = $this->loadRecord(); + $recordId = $driver->tryMethod('getUniqueID'); + $messenger = $this->flashMessenger(); + + /** @var Form $form */ + /** @var Request $request */ + $request = $this->getRequest(); + $form = $this->serviceLocator->get('fid-acquisition-form'); + + if ($submitted = $this->formWasSubmitted()) { + $form->setData($request->getPost()); + if ($form->isValid()) { + $user = $this->client->requestUserDetails(); + $form->getHydrator()->hydrate(compact('driver','user', 'type'), $order = new Order()); + $response = $this->client->requestOrderCreation($order); + $message = $this->translate('fid::aquisition_success'); + $messenger->addSuccessMessage($message); + return $this->redirect()->toRoute('record',['id' => $recordId]); + } + } + + $patron = $this->catalogLogin(); + $catalog = $this->getILS(); + $profile = $catalog->getMyProfile($patron); + + $action = $this->url()->fromRoute('record-fidpda',['id' => $recordId]); + $form->setAttribute('action', $action); + $form->prepare(); + + $view = $this->createViewModel(); + $view->setVariables(compact('form','driver','profile')); + $view->setTemplate('fid/record/acquisition-pda'); + + return $view; + } + + public function fidSubitoArticleAction () { + + if (!($user = $this->getUser())) { + return $this->forceLogin(); + } + + $type = "subito-article"; + $driver = $this->loadRecord(); + $recordId = $driver->tryMethod('getUniqueID'); + $messenger = $this->flashMessenger(); + + /** @var Form $form */ + /** @var Request $request */ + $request = $this->getRequest(); + $form = $this->serviceLocator->get('fid-acquisition-form'); + + if ($submitted = $this->formWasSubmitted()) { + $form->setData($request->getPost()); + if ($form->isValid()) { + $user = $this->client->requestUserDetails(); + $form->getHydrator()->hydrate(compact('driver','user', 'type'), $order = new Order()); + $response = $this->client->requestOrderCreation($order); + $message = $this->translate('fid::aquisition_success'); + $messenger->addSuccessMessage($message); + return $this->redirect()->toRoute('record',['id' => $recordId]); + } + } + + $patron = $this->catalogLogin(); + $catalog = $this->getILS(); + $profile = $catalog->getMyProfile($patron); + + $action = $this->url()->fromRoute('record-fidsubitoarticle',['id' => $recordId]); + $form->setAttribute('action', $action); + $form->prepare(); + + $view = $this->createViewModel(); + $view->setVariables(compact('form','driver','profile')); + $view->setTemplate('fid/record/acquisition-subito-article'); + + return $view; + } + + public function fidSubitoPartialCopyAction () { + if (!($user = $this->getUser())) { + return $this->forceLogin(); + } + + $type = "subito-partial-copy"; + $driver = $this->loadRecord(); + $recordId = $driver->tryMethod('getUniqueID'); + $messenger = $this->flashMessenger(); + + /** @var Form $form */ + /** @var Request $request */ + $request = $this->getRequest(); + $form = $this->serviceLocator->get('fid-acquisition-subito-partial-copy-form'); + + if ($submitted = $this->formWasSubmitted()) { + $form->setData($request->getPost()); + if ($form->isValid()) { + $user = $this->client->requestUserDetails(); + $pages = $form->getData()['pages']; + $form->getHydrator()->hydrate(compact('driver','user', 'type','pages'), $order = new Order()); + $this->client->requestOrderCreation($order); + $message = $this->translate('fid::aquisition_success'); + $messenger->addSuccessMessage($message); + return $this->redirect()->toRoute('record',['id' => $recordId]); + } + } + + $patron = $this->catalogLogin(); + $catalog = $this->getILS(); + $profile = $catalog->getMyProfile($patron); + + $action = $this->url()->fromRoute('record-fidsubitopartialcopy',['id' => $recordId]); + $form->setAttribute('action', $action); + $form->prepare(); + + $view = $this->createViewModel(); + $view->setVariables(compact('form','driver','profile')); + $view->setTemplate('fid/record/acquisition-subito-partial-copy'); + + return $view; + } + +} diff --git a/module/fid/src/Controller/RecordController.php b/module/fid/src/Controller/RecordController.php new file mode 100644 index 0000000000000000000000000000000000000000..8b9bf816544636298bf28cf90acc60321d5e0ca1 --- /dev/null +++ b/module/fid/src/Controller/RecordController.php @@ -0,0 +1,32 @@ +<?php +/** + * Record Controller + * + * 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 VuFind FID + * @package Controller + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + */ +namespace fid\Controller; + +class RecordController extends \finc\Controller\RecordController +{ + use CustomTraits\FidAcquisitionTrait; +} diff --git a/module/fid/src/Controller/RecordControllerDelegatorFactory.php b/module/fid/src/Controller/RecordControllerDelegatorFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..5a53868764ce15b5144d905afe6abff0f3ad332a --- /dev/null +++ b/module/fid/src/Controller/RecordControllerDelegatorFactory.php @@ -0,0 +1,18 @@ +<?php +namespace fid\Controller; + +use fid\Service\Client; +use Interop\Container\ContainerInterface; +use Zend\ServiceManager\Factory\DelegatorFactoryInterface; + +class RecordControllerDelegatorFactory implements DelegatorFactoryInterface +{ + public function __invoke(ContainerInterface $container, $name, callable $callback, array $options = null) + { + /** @var RecordController $instance */ + $instance = call_user_func($callback); + $instance->setClient($container->get(Client::class)); + + return $instance; + } +} \ No newline at end of file diff --git a/module/fid/src/Hydrator/OrderHydrator.php b/module/fid/src/Hydrator/OrderHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..d8ac9401f945c4c3031e9e60ea86fb7e910f8521 --- /dev/null +++ b/module/fid/src/Hydrator/OrderHydrator.php @@ -0,0 +1,49 @@ +<?php + +namespace fid\Hydrator; + +use fid\Service\DataTransferObject\Order; +use VuFind\RecordDriver\DefaultRecord; +use Zend\Hydrator\AbstractHydrator; + +class OrderHydrator extends AbstractHydrator { + + public function extract($object) + { + return; + // TODO: Implement extract() method. + } + + /** + * @param array $data + * @param Order|object $object + * @return Order|object|void + */ + public function hydrate(array $data, $object) + { + /** @var DefaultRecord $driver */ + $driver = $data['driver']; + + $object->setType($data['type']); + $object->setUser($data['user']); + $object->setCreatedAt(new \DateTime('now')); + + $recordId = $driver->tryMethod('getUniqueID'); + $title = $driver->tryMethod('getTitle'); + $publicationDetails = (array) $driver->tryMethod('getPublicationDetails')[0]; + $authors = $driver->tryMethod('getDeduplicatedAuthors'); + $isbn = $driver->tryMethod('getCleanISBN'); + $issn = $driver->tryMethod('getCleanISSN'); + + $object->setData(compact( + 'recordId', + 'title', + 'publicationDetails', + 'authors', + 'issn', + 'isbn' + )); + return; + } + +} \ No newline at end of file diff --git a/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php b/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..6b1261732bfb22233391423bb5371071b94b5393 --- /dev/null +++ b/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php @@ -0,0 +1,85 @@ +<?php +/** + * Factory for record driver data formatting view helper + * + * PHP version 7 + * + * Copyright (C) Villanova University 2016. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind FID + * @package View_Helpers + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + */ +namespace fid\View\Helper\Root; + +use VuFind\View\Helper\Root\RecordDataFormatter; + +class RecordDataFormatterFactory +{ + /** + * Create the helper. + * + * @return RecordDataFormatter + */ + public function __invoke() + { + $helper = new RecordDataFormatter(); + + $helper->setDefaults('fid-acquisition-general', [$this, 'getFidAcquisitionSpecs']); + //$helper->setDefaults('fid-pda', [$this, 'getFidPdaSpecs']); + //$helper->setDefaults('fid-subito-articel', [$this, 'getFidSubitoArticelSpecs']); + //$helper->setDefaults('fid-subito-partial-copy', [$this, 'getFidSubitoPartialCopySpecs']); + + return $helper; + } + + /** + * Get specifications for displaying data in fid pda form. + * + * @return array + */ + public function getFidAcquisitionSpecs() + { + $spec = new RecordDataFormatter\SpecBuilder(); + $spec->setLine('Title','getTitle'); + $spec->setTemplateLine( + 'Authors/Corporations', + 'getDeduplicatedAuthors', + 'data-authors.phtml', + [ + 'useCache' => true, + 'context' => [ + 'requiredDataFields' => [ + ['name' => 'role', 'prefix' => 'CreatorRoles::'] + ] + ] + ] + ); + $spec->setTemplateLine( + 'Published', + 'getPublicationDetails', + 'data-publicationDetails.phtml' + ); + $spec->setTemplateLine( + 'Price', + 'getPrice', + 'data-price.phtml' + ); + $spec->setLine('Language','getLanguages'); + return $spec->getArray(); + } +} diff --git a/themes/fid/languages/fid/de.ini b/themes/fid/languages/fid/de.ini index e2e6d6f8fe36f233054722e99ccefa496f1222af..6da829fa19b65e2818f2a18a8b2006cbd307ae6c 100644 --- a/themes/fid/languages/fid/de.ini +++ b/themes/fid/languages/fid/de.ini @@ -120,3 +120,21 @@ permission_limited_access = "Einfacher Zugriff" permission_basic_access = "aktiviert" admin_section = "Nutzerverwaltung" + +;Acquisition +acquisition_pda = "Printbestellung" +acquisition_pda_info = "Das Exemplar wird Ihnen leihweise und kostenlos zur Verfügung gestellt. Die Anschaffungskosten übernimmt adlr.link für Sie, die Preisangabe dient nur zur Information. Das Medium wird Ihnen direkt vom Buchhändler an Ihre hier angezeigte Lieferadresse zugeschickt. Zum Ablauf der Leihfrist sind Sie verpflichtet, das Medium auf Ihre Kosten an die Universitätsbibliothek Leipzig zurückzusenden. Sie erhalten mit der Lieferung hierzu genaue Informationen." +acquisition_subito_article = "Artikelbestellung" +acquisition_subito_article_info = "Auf Kosten von %%fidname%% können Sie sich Teile eines erschienenen Werkes sowie Beiträge aus Fachzeitschriften oder wissenschaftlichen Zeitschriften als Kopie bestellen. Wir können Ihnen aus urheberrechtlichen Gründen maximal 10 Prozent des Umfangs eines Buches bzw. einzelne Zeitschriftenbeiträge vervielfältigen. Bitte überprüfen Sie daher bei Büchern ggf. die Anzahl der bestellten Seiten. Mit der Absendung der Bestellung bestätigen Sie, die Vervielfältigung ausschließlich zu nicht kommerziellen Zwecken zu verwenden." +acquisition_subito_partial_copy = "Teilkopiebestellung" +acquisition_subito_partial_copy_info = "Auf Kosten von %%fidname%% können Sie sich Teile eines erschienenen Werkes sowie Beiträge aus Fachzeitschriften oder wissenschaftlichen Zeitschriften als Kopie bestellen. Wir können Ihnen aus urheberrechtlichen Gründen maximal 10 Prozent des Umfangs eines Buches bzw. einzelne Zeitschriftenbeiträge vervielfältigen. Bitte überprüfen Sie daher bei Büchern ggf. die Anzahl der bestellten Seiten. Mit der Absendung der Bestellung bestätigen Sie, die Vervielfältigung ausschließlich zu nicht kommerziellen Zwecken zu verwenden." + +acquisition_order_delivery_name = "Name" +acquisition_delivery_to = "Lieferung an" +acquisition_info_requested_item = "Bestellung" +label_acquisition_pages = "Seitenzahlen (von-bis)" +label_acquisition_submit = "Ja" +acquisition_subito_article_confirmation = "Möchten Sie den Artikel bestellen?" +acquisition_subito_partial_copy_confirmation = "Möchten Sie die Teilkopie bestellen?" +acquisition_pda_confirmation = "Möchten Sie das Buch bestellen?" +aquisition_success = "Ihre Bestellung wurde entgegengenommen und wird nun von uns bearbeitet." \ No newline at end of file diff --git a/themes/fid/languages/fid/en.ini b/themes/fid/languages/fid/en.ini index a8a6a1d2e89510bfc65ce0f0620fa91f364fe578..bd092a316b3d8d379afeb89c2b085a68647c3e5a 100644 --- a/themes/fid/languages/fid/en.ini +++ b/themes/fid/languages/fid/en.ini @@ -119,3 +119,21 @@ permission_limited_access = "basic access" permission_basic_access = "enabled" admin_section = "User Administration" + +;Acquisition +acquisition_pda = "Print order" +acquisition_pda_info = "The copy will be loaned to you free of charge. The purchase costs will be paid by adlr.link, the price is for information only. The medium will be sent directly from the bookseller to the delivery address shown here. At the end of the loan period, you are obliged to return the medium to the Leipzig University Library at your own expense. You will receive detailed information with the delivery." +acquisition_subito_article = "Article Order" +acquisition_subito_article_info +acquisition_subito_partial_copy = "Partial copy order" +acquisition_subito_partial_copy_info + +acquisition_order_delivery_name = "Name" +acquisition_delivery_to = "Delivery to" +acquisition_info_requested_item = "Order item" +label_acquisition_pages = "Pages (from-untill)" +label_acquisition_submit = "Yes" +acquisition_subito_article_confirmation = "Do you like to order the article?" +acquisition_subito_partial_copy_confirmation = "Do you like to order the partial copy?" +acquisition_pda_confirmation = "Do you like to order the book?" +aquisition_success = "Your order is received and will be processed now." diff --git a/themes/fid/templates/fid/record/acquisition-address-details.phtml b/themes/fid/templates/fid/record/acquisition-address-details.phtml new file mode 100644 index 0000000000000000000000000000000000000000..f04f9a2d351c7b85871313aa79d270126bfdba74 --- /dev/null +++ b/themes/fid/templates/fid/record/acquisition-address-details.phtml @@ -0,0 +1,17 @@ +<h4><?=$this->translate("fid::acquisition_delivery_to")?></h4> +<table class="table table-striped"> + <tbody> + <tr> + <th><?= $this->translate("fid::acquisition_order_delivery_name") ?></th> + <td><?= $this->profile['firstname'] ?> <?= $this->profile['lastname'] ?></td> + </tr> + <tr> + <th><?= $this->translate("fid::order_delivery_address") ?></th> + <td><?= $this->profile['address1'] ?></td> + </tr> + <tr> + <th><?= $this->translate("Email Address") ?></th> + <td><?= $this->profile['email'] ?></td> + </tr> + </tbody> +</table> diff --git a/themes/fid/templates/fid/record/acquisition-pda.phtml b/themes/fid/templates/fid/record/acquisition-pda.phtml new file mode 100644 index 0000000000000000000000000000000000000000..97129ac760afafe2b4f2675f420dcd7988d55850 --- /dev/null +++ b/themes/fid/templates/fid/record/acquisition-pda.phtml @@ -0,0 +1,85 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use Zend\Form\Element; +use Zend\Form\Form; +use Zend\Form\View\Helper\FormElementErrors; +use Zend\Form\View\Helper\FormLabel; +use Zend\Form\View\Helper\FormSubmit; + +$driver = $this->driver; +/** @var Form $form */ +/** @var FormLabel $formLabel */ +/** @var FormSubmit $formSubmit */ +/** @var FormElementErrors $formElementErrors */ +$form = $this->form; +$formLabel = $this->formLabel(); +$formLabel->setTranslatorTextDomain('fid'); +$formSubmit = $this->formSubmit(); +$formSubmit->setTranslatorTextDomain('fid'); +$formElementErrors = $this->formElementErrors(); +$formElementErrors->setTranslatorTextDomain('fid'); +$this->headTitle($title = $this->translate("fid::acquisition_pda")); +$form->setAttribute('class','acquisition'); +?> + +<h2><?= $title ?></h2> +<?= $this->flashmessages() ?> + +<?= $this->form()->openTag($form) ?> + +<div class="row details"> + <div class="col col-md-6"> + <?=$this->render('fid/record/acquisition-address-details'); ?> + </div> + <div class="col col-md-6"> + <?php + $formatter = $this->recordDataFormatter(); + $this->coreFields = $formatter->getData($driver, $formatter->getDefaults('fid-acquisition-general')); + ?> + <?=$this->render('fid/record/acquisition-record-details'); ?> + </div> +</div> + +<div class="row information"> + <div class="col col-xs-12"> + <?= $this->translate("fid::acquisition_pda_info") ?> + </div> +</div> + +<div class="row confirmation"> + <div class="col col-xs-9"> + <?= $this->translate("fid::acquisition_pda_confirmation") ?> + </div> + <div class="col col-xs-3"> + <? /* submit button */ ?> + <?php + /** @var Element\Submit $elemSubmit */ + $elemSubmit = $form->get('submit'); + $elemSubmit->setAttributes(['class' => 'btn btn-primary']); + ?> + <div class="form-group right"> + <?= $this->formElement($elemSubmit) ?> + </div> + </div> +</div> + +<?= $this->form()->closeTag($form) ?> \ No newline at end of file diff --git a/themes/fid/templates/fid/record/acquisition-record-details.phtml b/themes/fid/templates/fid/record/acquisition-record-details.phtml new file mode 100644 index 0000000000000000000000000000000000000000..1d346179315d1f44e16cde9a986bbbbdf64493a4 --- /dev/null +++ b/themes/fid/templates/fid/record/acquisition-record-details.phtml @@ -0,0 +1,17 @@ +<?php /* Display FID Acquisition Record Details */ ?> +<?php if (!empty($this->coreFields)): ?> + <h4><?= $this->translate("fid::acquisition_info_requested_item") ?></h4> + <table class="table table-striped"> + <?php foreach ($this->coreFields as $current): ?> + <?php if ($current['label'] == null): ?> + <?= $current['value'] ?> + <?php else: ?> + <tr> + <th><?= $this->transEsc($current['label']) ?>:</th> + <td><?= $current['value'] ?></td> + </tr> + <?php endif; ?> + <?php endforeach; ?> + </table> +<?php endif; ?> +<?php /* End FID Acquisition Record Details */ ?> \ No newline at end of file diff --git a/themes/fid/templates/fid/record/acquisition-subito-article.phtml b/themes/fid/templates/fid/record/acquisition-subito-article.phtml new file mode 100644 index 0000000000000000000000000000000000000000..07dab89e4b3dfe26a65f3c694efea6bb3ea07d67 --- /dev/null +++ b/themes/fid/templates/fid/record/acquisition-subito-article.phtml @@ -0,0 +1,85 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use Zend\Form\Element; +use Zend\Form\Form; +use Zend\Form\View\Helper\FormElementErrors; +use Zend\Form\View\Helper\FormLabel; +use Zend\Form\View\Helper\FormSubmit; + +$driver = $this->driver; +/** @var Form $form */ +/** @var FormLabel $formLabel */ +/** @var FormSubmit $formSubmit */ +/** @var FormElementErrors $formElementErrors */ +$form = $this->form; +$formLabel = $this->formLabel(); +$formLabel->setTranslatorTextDomain('fid'); +$formSubmit = $this->formSubmit(); +$formSubmit->setTranslatorTextDomain('fid'); +$formElementErrors = $this->formElementErrors(); +$formElementErrors->setTranslatorTextDomain('fid'); +$this->headTitle($title = $this->translate("fid::acquisition_subito_article")); +$form->setAttribute('class','acquisition'); +?> + +<h2><?= $title ?></h2> +<?= $this->flashmessages() ?> + +<?= $this->form()->openTag($form) ?> + +<div class="row details"> + <div class="col col-md-6"> + <?=$this->render('fid/record/acquisition-address-details'); ?> + </div> + <div class="col col-md-6"> + <?php + $formatter = $this->recordDataFormatter(); + $this->coreFields = $formatter->getData($driver, $formatter->getDefaults('fid-acquisition-general')); + ?> + <?=$this->render('fid/record/acquisition-record-details'); ?> + </div> +</div> + +<div class="row information"> + <div class="col col-xs-12"> + <?= $this->translate("fid::acquisition_subito_article_info") ?> + </div> +</div> + +<div class="row confirmation"> + <div class="col col-xs-9"> + <?= $this->translate("fid::acquisition_subito_article_confirmation") ?> + </div> + <div class="col col-xs-3"> + <? /* submit button */ ?> + <?php + /** @var Element\Submit $elemSubmit */ + $elemSubmit = $form->get('submit'); + $elemSubmit->setAttributes(['class' => 'btn btn-primary']); + ?> + <div class="form-group right"> + <?= $this->formElement($elemSubmit) ?> + </div> + </div> +</div> + +<?= $this->form()->closeTag($form) ?> \ No newline at end of file diff --git a/themes/fid/templates/fid/record/acquisition-subito-partial-copy.phtml b/themes/fid/templates/fid/record/acquisition-subito-partial-copy.phtml new file mode 100644 index 0000000000000000000000000000000000000000..db11f5dd7c5f1d6e1776905bf25abd69b2eac91b --- /dev/null +++ b/themes/fid/templates/fid/record/acquisition-subito-partial-copy.phtml @@ -0,0 +1,102 @@ +<?php +/** + * Copyright (C) 2019 Leipzig University Library + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use Zend\Form\Element; +use Zend\Form\Form; +use Zend\Form\View\Helper\FormElementErrors; +use Zend\Form\View\Helper\FormLabel; +use Zend\Form\View\Helper\FormSubmit; + +$driver = $this->driver; +/** @var Form $form */ +/** @var FormLabel $formLabel */ +/** @var FormSubmit $formSubmit */ +/** @var FormElementErrors $formElementErrors */ +$form = $this->form; +$formLabel = $this->formLabel(); +$formLabel->setTranslatorTextDomain('fid'); +$formSubmit = $this->formSubmit(); +$formSubmit->setTranslatorTextDomain('fid'); +$formElementErrors = $this->formElementErrors(); +$formElementErrors->setTranslatorTextDomain('fid'); +$this->headTitle($title = $this->translate("fid::acquisition_subito_partial_copy")); +$form->setAttribute('class','acquisition'); +?> + +<h2><?= $title ?></h2> +<?= $this->flashmessages() ?> + +<?= $this->form()->openTag($form) ?> + +<div class="row details"> + <div class="col col-md-6"> + <?= $this->render('fid/record/acquisition-address-details'); ?> + </div> + <div class="col col-md-6"> + <?php + $formatter = $this->recordDataFormatter(); + $this->coreFields = $formatter->getData($driver, $formatter->getDefaults('fid-acquisition-general')); + ?> + <?= $this->render('fid/record/acquisition-record-details'); ?> + </div> +</div> + +<div class="row pages"> + <div class="col-xs-12"> + <? /* pages */ ?> + <?php + /** @var Element\Text $elemPages */ + $elemPages = $form->get('pages'); + $elemPages->setLabelAttributes(['class' => 'control-label']); + $elemPages->setAttributes(['class' => 'form-control']); + ?> + <div class="form-group"> + <?= $this->formLabel($elemPages) ?> + <?= $this->formElement($elemPages) ?> + <?= $this->formElementErrors($elemPages) ?> + </div> + </div> +</div> + +<div class="row information"> + <div class="col col-xs-12"> + <?= $this->translate("fid::acquisition_subito_partial_copy_info") ?> + </div> +</div> + +<div class="row confirmation"> + <div class="col col-xs-9"> + <?= $this->translate("fid::acquisition_subito_partial_copy_confirmation") ?> + </div> + <div class="col col-xs-3"> + <? /* submit button */ ?> + <?php + /** @var Element\Submit $elemSubmit */ + $elemSubmit = $form->get('submit'); + $elemSubmit->setAttributes(['class' => 'btn btn-primary']); + ?> + <div class="form-group right"> + <?= $this->formElement($elemSubmit) ?> + </div> + </div> +</div> + +<?= $this->form()->closeTag($form) ?> \ No newline at end of file diff --git a/themes/fid/theme.config.php b/themes/fid/theme.config.php index c796f8532d90bd9c52cf90744dc362fa94063dba..a372ae4df9d95c085acc32dbf9559be60ed25b83 100644 --- a/themes/fid/theme.config.php +++ b/themes/fid/theme.config.php @@ -30,6 +30,8 @@ return [ 'fid\View\Helper\Root\GetIt' => 'fid\View\Helper\Root\Factory::getGetIt', 'fid\Helper\SearchTabs' => 'VuFind\View\Helper\Root\SearchTabsFactory', + 'VuFind\View\Helper\Root\RecordDataFormatter' => + 'fid\View\Helper\Root\RecordDataFormatterFactory', ), 'aliases' => array( 'usergroups' => 'UserGroups',