diff --git a/.gitattributes b/.gitattributes index 8ace69d46d4484dd48148568b1663d978e5b30cb..1ffdda707a54818611da98bc6a45f1c090802253 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,6 @@ /COPYING -text /INSTALL -text /README -text -/afi -text amber/.htaccess -text amber/afi/js/AFI-Core.deploy.js -text amber/afi/js/AFI-Core.js -text diff --git a/afi b/afi deleted file mode 120000 index 5d16148b3c6aa6a3653a9b5df074bbdb27390acd..0000000000000000000000000000000000000000 --- a/afi +++ /dev/null @@ -1 +0,0 @@ -../afi-opac3-svn/afi/ \ No newline at end of file diff --git a/application/modules/telephone/controllers/RechercheController.php b/application/modules/telephone/controllers/RechercheController.php index b527b969f35e426a1672d057765e9ec734ee4cb9..e6544ff5b0edc771c230db99d2764eeb8965af98 100644 --- a/application/modules/telephone/controllers/RechercheController.php +++ b/application/modules/telephone/controllers/RechercheController.php @@ -21,174 +21,177 @@ require_once ROOT_PATH.'application/modules/opac/controllers/RechercheController.php'; class Telephone_RechercheController extends RechercheController { - public function viewnoticeAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + use Trait_Translator; - $actions = array($this->view->_('Description du document') => array('action' => 'detail'), - $this->view->_('Où le trouver ?') => array('action' => 'exemplaires'), - $this->view->_('Critiques') => array('action' => 'avis'), - $this->view->_('Résumé') => array('action' => 'resume'), - $this->view->_('Vidéos associées') => array('action' => 'videos'), - $this->view->_('Rebondir dans le catalogue') => array('action' => 'tags'), - $this->view->_('Biographie de l\'auteur') => array('action' => 'biographie'), - $this->view->_('Documents similaires') => array('action' => 'similaires') - ); + public function viewnoticeAction() { + $notice = Class_Notice::find($this->_getParam('id')); - if ($notice->isLivreNumerique()) - $actions[$this->view->_('Feuilleter le livre')] = array('action' => 'ressourcesnumeriques', - 'attribs' => array('data-ajax' => 'false')); + $actions = [$this->_('Description du document') => ['action' => 'detail'], + $this->_('Où le trouver ?') => ['action' => 'exemplaires'], + $this->_('Critiques') => ['action' => 'avis'], + $this->_('Résumé') => ['action' => 'resume'], + $this->_('Vidéos associées') => ['action' => 'videos'], + $this->_('Rebondir dans le catalogue') => ['action' => 'tags'], + $this->_('Biographie de l\'auteur') => ['action' => 'biographie'], + $this->_('Documents similaires') => ['action' => 'similaires'], + $this->_('Notices liées') => ['action' => 'frbr'] + ]; - if ($notice->isArteVOD()) - $actions[$this->view->_('Bande-annonce')] = array('action' => 'ressourcesnumeriques', - 'attribs' => array('data-ajax' => 'false')); + if ($notice->isLivreNumerique()) + $actions[$this->_('Feuilleter le livre')] = ['action' => 'ressourcesnumeriques', + 'attribs' => ['data-ajax' => 'false']]; - $this->view->notice = $notice; - $this->view->actions = $actions; - } + if ($notice->isArteVOD()) + $actions[$this->_('Bande-annonce')] = ['action' => 'ressourcesnumeriques', + 'attribs' => ['data-ajax' => 'false']]; + $this->view->notice = $notice; + $this->view->actions = $actions; + } - public function grandeimageAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function grandeimageAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function exemplairesAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function exemplairesAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function avisAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function avisAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function detailAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function detailAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function ressourcesnumeriquesAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function ressourcesnumeriquesAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function reservationAction() { - if (!Class_Users::getLoader()->getIdentity()) { - $this->_setLastReservationParamsAndGotoLogin(); - return; - } - $this->_loadReservationParamsFromSession(); + public function reservationAction() { + if (!Class_Users::getLoader()->getIdentity()) { + $this->_setLastReservationParamsAndGotoLogin(); + return; + } - if (Class_CosmoVar::isSiteRetraitResaEnabled() - && !$this->_getParam('pickup')) { - $this->_redirect(sprintf('/recherche/pickup-location/b/%s/e/%s/a/%s', - urlencode($this->_getParam('b')), - urlencode($this->_getParam('e')), - urlencode($this->_getParam('a')))); - return; - } + $this->_loadReservationParamsFromSession(); - $ret = Class_CommSigb::getInstance() - ->reserverExemplaire($this->_getParam('b'), - $this->_getParam('e'), - ($this->_getParam('pickup')) ? $this->_getParam('pickup') : $this->_getParam('a')); + if (Class_CosmoVar::isSiteRetraitResaEnabled() + && !$this->_getParam('pickup')) { + $this->_redirect(sprintf('/recherche/pickup-location/b/%s/e/%s/a/%s', + urlencode($this->_getParam('b')), + urlencode($this->_getParam('e')), + urlencode($this->_getParam('a')))); + return; + } - if (isset($ret["erreur"]) && '' != $ret['erreur']) { - $this->_loadUrlRetourForExemplaire($this->_getParam('e')); - $this->view->message = $ret['erreur']; - return; - } + $ret = Class_CommSigb::getInstance() + ->reserverExemplaire($this->_getParam('b'), + $this->_getParam('e'), + ($this->_getParam('pickup')) ? $this->_getParam('pickup') : $this->_getParam('a')); - if (isset($ret["popup"]) && '' != $ret['popup']) { - $this->_loadUrlRetourForExemplaire($this->_getParam('e')); - $this->view->message = $this->view->_('Réservation en ligne non supportée pour cette bibliothèque.'); - return; - } + if (isset($ret["erreur"]) && '' != $ret['erreur']) { + $this->_loadUrlRetourForExemplaire($this->_getParam('e')); + $this->view->message = $ret['erreur']; + return; + } - $this->_redirect('/abonne/fiche'); - } + if (isset($ret["popup"]) && '' != $ret['popup']) { + $this->_loadUrlRetourForExemplaire($this->_getParam('e')); + $this->view->message = $this->view->_('Réservation en ligne non supportée pour cette bibliothèque.'); + return; + } + $this->_redirect('/abonne/fiche'); + } - public function pickupLocationAction() { - $this->_loadUrlRetourForExemplaire($this->_getParam('e')); - $this->view->annexes = Class_CodifAnnexe::findAllByPickup(); - } + public function pickupLocationAction() { + $this->_loadUrlRetourForExemplaire($this->_getParam('e')); + $this->view->annexes = Class_CodifAnnexe::findAllByPickup(); + } - public function resumeAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function resumeAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function videosAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); - $video = Class_WebService_AllServices::runServiceAfiVideo(array('titre' => $notice->getTitrePrincipal(), - 'auteur' => $notice->getAuteurPrincipal())); - $video_id = null; - if ($html = $video['video']) { - if (1==preg_match('/value=\"([^\"\&]+)/', $html, $matches)) { - $parts = explode('/', $matches[1]); - $video_id = end($parts); - } - } - $this->view->notice = $notice; - $this->view->video_id = $video_id; - } + public function videosAction() { + $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $video = Class_WebService_AllServices::runServiceAfiVideo(array('titre' => $notice->getTitrePrincipal(), + 'auteur' => $notice->getAuteurPrincipal())); + $video_id = null; + if ($html = $video['video']) { + if (1==preg_match('/value=\"([^\"\&]+)/', $html, $matches)) { + $parts = explode('/', $matches[1]); + $video_id = end($parts); + } + } + $this->view->notice = $notice; + $this->view->video_id = $video_id; + } - public function tagsAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); - $notice_html = new Class_NoticeHtml(); - $this->view->tags = $notice_html->getTags($notice->getTags(), $notice->getId()); - $this->view->notice = $notice; - } + public function tagsAction() { + $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $notice_html = new Class_NoticeHtml(); + $this->view->tags = $notice_html->getTags($notice->getTags(), $notice->getId()); + $this->view->notice = $notice; + } - public function biographieAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); - } + public function biographieAction() { + $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + } - public function similairesAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); - $this->view->notices = $notice->getNoticesSimilaires($notice->getId()); - $this->view->preferences = array('liste_codes' => 'TA'); - $this->view->notice = $notice; - } + public function similairesAction() { + $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $this->view->notices = $notice->getNoticesSimilaires($notice->getId()); + $this->view->preferences = array('liste_codes' => 'TA'); + $this->view->notice = $notice; + } - public function bibliothequeAction() { - $this->view->bib = Class_Bib::getLoader()->find($this->_getParam('id')); - } + public function bibliothequeAction() { + $this->view->bib = Class_Bib::getLoader()->find($this->_getParam('id')); + } - protected function _loadUrlRetourForExemplaire($id_exemplaire) { - $exemplaire = Class_Exemplaire::getLoader()->find($id_exemplaire); - $this->view->url_retour = $this->view->url(array('controller' => 'recherche', - 'action' => 'exemplaires', - 'id' => $exemplaire->getNotice()->getId()), - null, true); - } - - - protected function _setLastReservationParamsAndGotoLogin() { - $exemplaire = Class_Exemplaire::getLoader()->find($this->_getParam('e')); - Zend_Registry::get('session')->lastReservationParams = array('b' => $this->_getParam('b'), - 'e' => $this->_getParam('e'), - 'a' => $this->_getParam('a')); - $this->_redirect('/auth/login-reservation/id/' . urlencode($exemplaire->getNotice()->getId())); - } - - - protected function _loadReservationParamsFromSession() { - if (!$params = Zend_Registry::get('session')->lastReservationParams) - return; - $this->_request - ->setParam('b', $params['b']) - ->setParam('e', $params['e']) - ->setParam('a', $params['a']); - } + protected function _loadUrlRetourForExemplaire($id_exemplaire) { + $exemplaire = Class_Exemplaire::getLoader()->find($id_exemplaire); + $this->view->url_retour = $this->view->url(array('controller' => 'recherche', + 'action' => 'exemplaires', + 'id' => $exemplaire->getNotice()->getId()), + null, true); + } + + + protected function _setLastReservationParamsAndGotoLogin() { + $exemplaire = Class_Exemplaire::getLoader()->find($this->_getParam('e')); + Zend_Registry::get('session')->lastReservationParams = array('b' => $this->_getParam('b'), + 'e' => $this->_getParam('e'), + 'a' => $this->_getParam('a')); + $this->_redirect('/auth/login-reservation/id/' . urlencode($exemplaire->getNotice()->getId())); + } + + + protected function _loadReservationParamsFromSession() { + if (!$params = Zend_Registry::get('session')->lastReservationParams) + return; + + $this->_request + ->setParam('b', $params['b']) + ->setParam('e', $params['e']) + ->setParam('a', $params['a']); + } } diff --git a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php index 86b3271f12fdd3b6eab195274f7e873678e6f772..2e50f263828d24b3d2717e8895e0e0e611096b0d 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php @@ -148,6 +148,13 @@ class Telephone_RechercheControllerHarryPotterViewNoticeTest extends Telephone_R public function pageShouldNotContainsLinkToRessourcesNumeriques() { $this->assertNotXPath('//a[contains(@href, "recherche/ressourcesnumeriques/id/4")]'); } + + + /** @test */ + public function pageShouldContainsLinkToFRBR() { + $this->assertXPathContentContains('//a[contains(@href, "recherche/frbr/id/4")]', 'Notices liées'); + } + }