diff --git a/.gitattributes b/.gitattributes index be7df1e6e118f8e1d39983ddda51afe6b3bbddb8..8014a0cb69a24f7c3c6fb2367236c8203db9ef10 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 23968e16566f93ba68c39af8a254c8e72c2a2878..eb4ea820a6cee1d1b3496c667737a5fb3a301673 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 1f0a8dc97e6a6d48b3651bbf61c7324b872896f8..1b589d30456893838f8c5883f14a9062f2e1d008 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 0000000000000000000000000000000000000000..5a69765056f079611fed4ff09995d3c993ce3d85 --- /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 8a93e92bd2022745d30319e1ef7f751dd5df7469..201c7affadedb8ab0bcc72e536d8d793f2664707 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 82e68b1eaf099d1386f1ba54c6ee4d3677909d9f..822f35e4d15b558a6d811d40c8577e237436a7c3 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 f500d6af436881d80d6d0ed1aae3d5f125969089..6d9b3a43c994863b5583e2389e3d5b879e0118f2 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 fc952d3c13cdcf68e9541a332521f2cbcd3c5671..722a59a3a8f0541a396f7c02a6fc737082899bfd 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 9416d1e9a109e0a63110568b029042ca73d6d829..d82037376c611667b37073e83856ac7490bbcb01 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');