From e868451d75eaa0308c9b08e84da33eceed96e6fe Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Wed, 13 Feb 2013 13:40:37 +0000 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20lien=20retour=20notice=20su?= =?UTF-8?q?r=20les=20paniers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 1 + .../opac/controllers/PanierController.php | 13 ++++++++++--- .../opac/controllers/RechercheController.php | 4 +++- .../views/scripts/panier/_panier_row.phtml | 18 ++++++++++++++++++ .../opac/views/scripts/panier/index.phtml | 5 ++++- library/Class/PanierNotice.php | 4 +++- .../ZendAfi/View/Helper/Abonne/RetourFiche.php | 2 +- public/opac/css/global.css | 11 ++++++++++- .../opac/controllers/PanierControllerTest.php | 7 +++++++ 9 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 application/modules/opac/views/scripts/panier/_panier_row.phtml diff --git a/.gitattributes b/.gitattributes index be7df1e6e11..8014a0cb69a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -774,6 +774,7 @@ application/modules/opac/views/scripts/oai/list-identifiers.xml.phtml -text application/modules/opac/views/scripts/oai/list-metadata-formats.xml.phtml -text svneol=unset#application/xml application/modules/opac/views/scripts/oai/list-records.xml.phtml -text svneol=unset#application/xml application/modules/opac/views/scripts/oai/list-sets.xml.phtml -text svneol=unset#application/xml +application/modules/opac/views/scripts/panier/_panier_row.phtml -text application/modules/opac/views/scripts/panier/error.phtml -text application/modules/opac/views/scripts/panier/export.phtml -text application/modules/opac/views/scripts/panier/index.phtml -text diff --git a/application/modules/opac/controllers/PanierController.php b/application/modules/opac/controllers/PanierController.php index 23968e16566..eb4ea820a6c 100644 --- a/application/modules/opac/controllers/PanierController.php +++ b/application/modules/opac/controllers/PanierController.php @@ -80,6 +80,11 @@ function indexAction() { } $this->view->id_notice = $id_notice; + + if (isset($_SESSION["panier"]["url_retour"])) + $this->view->url_retour=$_SESSION["panier"]["url_retour"]; + else if (isset($id_notice)) + $this->view->url_retour = $this->view->urlNotice(Class_Notice::find($id_notice)); if ($panier_courant) { // comme ça quand on clique est sur une notice on peut revenir au panier @@ -106,10 +111,12 @@ function indexAction() { // Ajout d'un document dans un panier //------------------------------------------------------------------------------------------------------ function panierajouternoticeAction() { - if (!$panier = Class_PanierNotice::find($this->_getParam('id_panier'))) + if (!$panier = Class_PanierNotice::find($this->_getParam('id_panier'))) { + $id_panier = Class_PanierNotice::maxIdPanierForUser(Class_Users::getIdentity()) + 1; $panier = (new Class_PanierNotice()) - ->setLibelle($this->_('Panier no %d', - Class_PanierNotice::maxIdPanierForUser($this->_user) + 1)); + ->setLibelle($this->_('Panier no %d', $id_panier)) + ->setIdPanier($id_panier); + } if ($notice = Class_Notice::find($this->_getParam('id_notice'))) { $panier diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index 1f0a8dc97e6..1b589d30456 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -363,7 +363,9 @@ class RechercheController extends Zend_Controller_Action } // Url panier - $this->view->url_panier=BASE_URL."/opac/panier?id_notice=".$id_notice; + $this->view->url_panier = $this->view->url(['controller' => 'panier', + 'action' => 'index', + 'id_notice' => $id_notice]); // Stats visualisation $stat=new Class_StatsNotices(); diff --git a/application/modules/opac/views/scripts/panier/_panier_row.phtml b/application/modules/opac/views/scripts/panier/_panier_row.phtml new file mode 100644 index 00000000000..5a69765056f --- /dev/null +++ b/application/modules/opac/views/scripts/panier/_panier_row.phtml @@ -0,0 +1,18 @@ +<tr class="<?php echo $this->_item_class; ?>"> + <td style="text-align:right"><?php echo $this->panier->getId(); ?></td> + <td style="text-align:center"><?php echo $this->panier->getDateMaj(); ?></td> + <td style="text-align:left"> + <a href="<?php echo $this->url(['action' => 'index', + 'id_panier' => $this->panier->getId()]); ?>"> + <?php echo $this->panier->getLibelle(); ?> + </a> + </td> + + <td style="text-align:right"><?php echo $this->panier->numberOfNotices(); ?></td> + <td style="text-align:center"> + <a href="<?php echo $this->url(['action' => 'supprimerpanier', 'id_panier' => $this->panier->getId()]) ?>" onclick="return confirm('<?php echo $this->traduire("Etes-vous sûr de vouloir supprimer ce panier ?"); ?>')"> + <img border="0" title="<?php echo $this->_('Supprimer') ?>" src="<?php echo URL_IMG; ?>suppression.gif" /> + </a> + </td> +</tr> + diff --git a/application/modules/opac/views/scripts/panier/index.phtml b/application/modules/opac/views/scripts/panier/index.phtml index 8a93e92bd20..201c7affade 100644 --- a/application/modules/opac/views/scripts/panier/index.phtml +++ b/application/modules/opac/views/scripts/panier/index.phtml @@ -13,7 +13,10 @@ if($this->url_creer_panier) { print('</form>'); } ?> -<a href="<?php print($this->url_retour); ?>"> » <?php echo $this->_('Retour') ?></a> + +<?php if (isset($this->url_retour)) { ?> + <a href="<?php print($this->url_retour); ?>"> » <?php echo $this->_('Retour') ?></a> +<?php } ?> <?php $this->closeBoite();?> diff --git a/library/Class/PanierNotice.php b/library/Class/PanierNotice.php index 82e68b1eaf0..822f35e4d15 100644 --- a/library/Class/PanierNotice.php +++ b/library/Class/PanierNotice.php @@ -37,7 +37,9 @@ class PanierNoticeLoader extends Storm_Model_Loader { } public function maxIdPanierForUser($user) { - return $sql->fetchOne("select max(ID_PANIER) from notices_paniers where ID_USER=".$user->getId()); + $select = $this->getTable()->select(); + $select->from($this->getTable(),['max(ID_PANIER) as max_id']); + return $this->getTable()->fetchRow($select)->max_id; } } diff --git a/library/ZendAfi/View/Helper/Abonne/RetourFiche.php b/library/ZendAfi/View/Helper/Abonne/RetourFiche.php index f500d6af436..6d9b3a43c99 100644 --- a/library/ZendAfi/View/Helper/Abonne/RetourFiche.php +++ b/library/ZendAfi/View/Helper/Abonne/RetourFiche.php @@ -22,7 +22,7 @@ class ZendAfi_View_Helper_Abonne_RetourFiche extends ZendAfi_View_Helper_Abonne_ public function abonne_retourFiche() { return '<div style="margin-top:5px"> <a href="'.$this->view->url(['controller' => 'abonne', 'action' => 'fiche'], null, true).'">' - .$this->view->_('Retour').'</a> + .$this->view->_('Retour à la fiche utilisateur').'</a> </div>'; } } diff --git a/public/opac/css/global.css b/public/opac/css/global.css index fc952d3c13c..722a59a3a8f 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -586,12 +586,18 @@ ul.view-raw-rss li { /** modif article depuis le front */ -.edit_article { +.edit_article, +.edit_menu { position: absolute; margin-right: 3px; } +.edit_menu { + left: 0px; +} + + div.rss { float: right; } @@ -1101,6 +1107,9 @@ body.abonne_multimedia-hold-view .actions a { padding-right: 10px; } +#menu_horizontal { + position: relative; +} #menu_horizontal div.boite { background-color: white; diff --git a/tests/application/modules/opac/controllers/PanierControllerTest.php b/tests/application/modules/opac/controllers/PanierControllerTest.php index 9416d1e9a10..d82037376c6 100644 --- a/tests/application/modules/opac/controllers/PanierControllerTest.php +++ b/tests/application/modules/opac/controllers/PanierControllerTest.php @@ -265,6 +265,13 @@ class PanierControllerAjoutNoticeBlackSadToUndefinedPanierTest extends PanierCon } + /** @test */ + public function idPanierShouldBe4() { + $this->assertEquals(4, $this->_new_panier->getIdPanier()); + } + + + /** @test */ public function responseShouldRedirectToIndex() { $this->assertRedirectTo('/opac/panier/index/id_panier/18'); -- GitLab