diff --git a/VERSIONS_HOTLINE/36324 b/VERSIONS_HOTLINE/36324 new file mode 100644 index 0000000000000000000000000000000000000000..8583e193aa723237fd922e78dac5a30291a07d60 --- /dev/null +++ b/VERSIONS_HOTLINE/36324 @@ -0,0 +1 @@ + - ticket #36324 : Valence : Pb toutapprendre/arte VOD/ 1DTOUCH sur profil smartphone \ No newline at end of file diff --git a/application/modules/telephone/controllers/RechercheController.php b/application/modules/telephone/controllers/RechercheController.php index 1a17a97d368e0d350cc11931c6e056e1afe6c1a0..f0ba039d2ef5fb278ec3c5288c1daf9e4068fcf2 100644 --- a/application/modules/telephone/controllers/RechercheController.php +++ b/application/modules/telephone/controllers/RechercheController.php @@ -18,6 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + require_once ROOT_PATH.'application/modules/opac/controllers/RechercheController.php'; class Telephone_RechercheController extends RechercheController { @@ -27,78 +28,69 @@ class Telephone_RechercheController extends RechercheController { return; } - $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']]; - - $actions = $this->getActionForTypeDoc($actions, $notice); - $this->view->notice = $notice; - $this->view->actions = $actions; + $this->view->actions = $this->addCommonActions($this->getActionForTypeDoc($notice)); } - protected function getActionForTypeDoc($actions, $notice) { + protected function getActionForTypeDoc($notice) { if(!$notice->isRessourceNumerique()) - return $actions; + return []; $action_array = ['action' => 'ressourcesnumeriques', 'attribs' => ['data-ajax' => 'false']]; - if ($notice->isLivreNumerique()|| $notice->isEpub()) { - $actions[$this->_('Feuilleter le livre')] = $action_array; - return $actions; - } + if ($notice->isLivreNumerique()|| $notice->isEpub()) + return [$this->_('Feuilleter le livre') => $action_array]; - if ($notice->isArteVOD()) { - $actions[$this->_('Bande-annonce')] = $action_array; - return $actions; - } + if ($notice->isArteVOD()) + return [$this->_('Bande-annonce') => $action_array]; - if ($notice->isAudioRecord()) { - $actions[$this->_('Ecouter l\'album')] = $action_array; - return $actions; - } + if ($notice->isAudioRecord()) + return [$this->_('Ecouter l\'album') => $action_array]; - if($notice->isToutApprendre()) { - $actions[$this->_('Cours ToutApprendre')] = $action_array; - return $actions; - } + if ($notice->isToutApprendre()) + return [$this->_('Cours ToutApprendre') => $action_array]; + return [$this->_('Accéder à la ressource') => $action_array]; + } - $actions[$this->_('Accéder à la ressource')] = $action_array; - return $actions; + protected function addCommonActions($actions) { + return $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']]; } public function grandeimageAction() { - if (!$this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id'))) + if (!$this->view->notice = Class_Notice::find($this->_getParam('id'))) $this->_redirect('/'); } public function exemplairesAction() { $this->view->preferences_exemplaires = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray()['exemplaires']; - if (!$this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id'))) + if (!$this->view->notice = Class_Notice::find($this->_getParam('id'))) $this->_redirect('/'); } public function avisAction() { - if (!$this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id'))) + if (!$this->view->notice = Class_Notice::find($this->_getParam('id'))) $this->_redirect('/'); } public function detailAction() { - if (!$this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id'))) + if (!$this->view->notice = Class_Notice::find($this->_getParam('id'))) $this->_redirect('/'); } @@ -110,7 +102,7 @@ class Telephone_RechercheController extends RechercheController { public function reservationAction() { - if (!Class_Users::getLoader()->getIdentity()) { + if (!Class_Users::getIdentity()) { $this->_setLastReservationParamsAndGotoLogin(); return; } @@ -118,18 +110,18 @@ class Telephone_RechercheController extends RechercheController { $this->_loadReservationParamsFromSession(); if (Class_CosmoVar::isSiteRetraitResaChoiceEnabled() - && !$this->_getParam('pickup')) { + && !$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')))); + urlencode($this->_getParam('b')), + urlencode($this->_getParam('e')), + urlencode($this->_getParam('a')))); return; } $ret = Class_CommSigb::getInstance() ->reserverExemplaire($this->_getParam('b'), - $this->_getParam('e'), - ($this->_getParam('pickup')) ? $this->_getParam('pickup') : $this->_getParam('a')); + $this->_getParam('e'), + ($this->_getParam('pickup')) ? $this->_getParam('pickup') : $this->_getParam('a')); if (isset($ret["erreur"]) && '' != $ret['erreur']) { $this->_loadUrlRetourForExemplaire($this->_getParam('e')); @@ -154,21 +146,20 @@ class Telephone_RechercheController extends RechercheController { public function resumeAction() { - if (!$this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id'))) + if (!$this->view->notice = Class_Notice::find($this->_getParam('id'))) $this->_redirect('/'); } public function videosAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); - $video = Class_WebService_AllServices::runServiceAfiVideo(array('titre' => $notice->getTitrePrincipal(), - 'auteur' => $notice->getAuteurPrincipal())); + $notice = Class_Notice::find($this->_getParam('id')); + $video = Class_WebService_AllServices::runServiceAfiVideo(['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); - } + if (($html = $video['video']) + && 1 == preg_match('/value=\"([^\"\&]+)/', $html, $matches)) { + $parts = explode('/', $matches[1]); + $video_id = end($parts); } $this->view->notice = $notice; @@ -177,7 +168,7 @@ class Telephone_RechercheController extends RechercheController { public function tagsAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $notice = Class_Notice::find($this->_getParam('id')); $notice_html = new Class_NoticeHtml(); $this->view->tags = $notice_html->getTags($notice->getTags(), $notice->getId(), $this->view); $this->view->notice = $notice; @@ -185,46 +176,43 @@ class Telephone_RechercheController extends RechercheController { public function biographieAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $this->view->notice = Class_Notice::find($this->_getParam('id')); } public function similairesAction() { - $notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $notice = Class_Notice::find($this->_getParam('id')); $this->view->notices = $notice->getNoticesSimilaires(); - $this->view->preferences = array('liste_codes' => 'TA'); + $this->view->preferences = ['liste_codes' => 'TA']; $this->view->notice = $notice; } public function frbrAction() { - $this->view->notice = Class_Notice::getLoader()->find($this->_getParam('id')); + $this->view->notice = Class_Notice::find($this->_getParam('id')); } - public function bibliothequeAction() { - $this->view->bib = Class_Bib::getLoader()->find($this->_getParam('id')); + $this->view->bib = Class_Bib::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); + $exemplaire = Class_Exemplaire::find($id_exemplaire); + $this->view->url_retour = $this->view->url(['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')); + $exemplaire = Class_Exemplaire::find($this->_getParam('e')); + Zend_Registry::get('session') + ->lastReservationParams = ['b' => $this->_getParam('b'), + 'e' => $this->_getParam('e'), + 'a' => $this->_getParam('a')]; $this->_redirect('/auth/login-reservation/id/' . urlencode($exemplaire->getIdNotice())); } @@ -237,4 +225,5 @@ class Telephone_RechercheController extends RechercheController { ->setParam('b', $params['b']) ->setParam('e', $params['e']) ->setParam('a', $params['a']); - }} + } +} \ No newline at end of file diff --git a/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php b/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php index 017aaf64bd4806d2e4170bb7928ce587116b0176..e500248ad4eaee7f8a9ded7d3a4243589dd26bd6 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerRessourceNumeriqueTest.php @@ -65,9 +65,10 @@ class Telephone_RechercheControllerPropagandaRessourceNumeriqueViewNoticeTest ex /** @test */ - public function pageShouldContainsLinkToRessouresNumeriquesEpub() { - $this->assertXPathContentContains('//a[contains(@href, "ressourcesnumeriques/id/1")][@data-ajax="false"]', - 'Feuilleter le livre',$this->_response->getBody()); + public function firstActionLinkShouldBeRessouresNumeriquesEpub() { + $this->assertXPathContentContains('//ul[@data-role="listview"]/li[2]//a[contains(@href, "ressourcesnumeriques/id/1")][@data-ajax="false"]', + 'Feuilleter le livre', + $this->_response->getBody()); } }