From 554e536d06d9d33fa269fa51b44179be7aee10fa Mon Sep 17 00:00:00 2001 From: Patrick Barroca <pbarroca@sandbox.pergame.net> Date: Tue, 23 Sep 2014 17:35:13 +0200 Subject: [PATCH] rel #14885 : subModal fixes and renew action is officially a popup action --- .../opac/controllers/AbonneController.php | 18 +++-- .../opac/views/scripts/abonne/prets.phtml | 77 ++++++++++--------- public/opac/js/subModal.js | 20 ++--- 3 files changed, 63 insertions(+), 52 deletions(-) diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 8666ab51d62..d39bc1a696c 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -388,17 +388,25 @@ class AbonneController extends ZendAfi_Controller_Action { public function prolongerpretAction() { - $id_pret = $this->_request->getParam('id_pret'); + $id_pret = $this->_getParam('id_pret'); $cls_comm = new Class_CommSigb(); $result = $cls_comm->prolongerPret($this->_user, $id_pret); $this->view->fiche = $this->_user->getFicheSigb(); - $this->_helper->notify($result['statut'] == 1 - ? $this->_('Prêt prolongé') - : $result['erreur']); - $this->_redirect('/opac/abonne/prets'); + $this->view->titre = $result['statut'] == 1 + ? $this->_('Prêt prolongé') + : $this->_('Erreur'); + + $this->view->message = $result['statut'] == 1 + ? $this->_('Votre prêt a bien été prolongé.') + : $result['erreur']; + + $this->renderPopupResult($this->view->titre, + $this->view->render('abonne/prolonger-pret.phtml'), + ['show_modal' => 'true', + 'position' => json_decode('{ "my": "center center", "at": "center center"}')]); } diff --git a/application/modules/opac/views/scripts/abonne/prets.phtml b/application/modules/opac/views/scripts/abonne/prets.phtml index a26c2e97a39..e5de35550f0 100644 --- a/application/modules/opac/views/scripts/abonne/prets.phtml +++ b/application/modules/opac/views/scripts/abonne/prets.phtml @@ -3,58 +3,59 @@ <?php // messages foreach (['message', 'error'] as $type) - if (isset($this->fiche[$type]) && $this->fiche[$type]) + if (isset($this->fiche[$type]) && $this->fiche[$type]) echo '<p class="error">' . $this->fiche[$type] . '</p>'; ?> <?php if (isset($this->fiche['fiche']) - && ($emprunts = $this->fiche['fiche']->getEmprunts()) + && ($emprunts = $this->fiche['fiche']->getEmprunts()) && !empty($emprunts)) { - echo $this->abonne_LoanExport(); -} + echo $this->abonne_LoanExport(); + } ?> <table width="100%" class="tablesorter"> <thead> - <tr> - <th style="text-align:left; white-space:nowrap"><?php echo $this->_('n°'); ?></th> - <th style="text-align:left"><?php echo $this->_('Titre'); ?></th> - <th style="text-align:left"><?php echo $this->_('Auteur'); ?></th> - <th style="text-align:left"><?php echo $this->_('Bibliothèque'); ?></th> - <th style="text-align:center"><?php echo $this->_('Retour prévu'); ?></th> - <th style="text-align:center"><?php echo $this->_('Informations'); ?></th> - </tr> + <tr> + <th style="text-align:left; white-space:nowrap"><?php echo $this->_('n°'); ?></th> + <th style="text-align:left"><?php echo $this->_('Titre'); ?></th> + <th style="text-align:left"><?php echo $this->_('Auteur'); ?></th> + <th style="text-align:left"><?php echo $this->_('Bibliothèque'); ?></th> + <th style="text-align:center"><?php echo $this->_('Retour prévu'); ?></th> + <th style="text-align:center"><?php echo $this->_('Informations'); ?></th> + </tr> </thead> <tbody> <?php $num = 1; if (isset($this->fiche['fiche'])) { - foreach ($this->fiche["fiche"]->getEmprunts() as $emprunt) { - $class_retard = $emprunt->enRetard() ? 'class="pret_en_retard"' : '';?> - <tr <?php echo $class_retard;?>> - <td width="15px" align="center"><b><?php echo $num++;?></b></td> - <td> - <?php - echo $this->tagAnchor( - $this->url(['controller' => 'recherche', - 'action' => 'viewnotice', - 'id' => $emprunt->getNoticeOPACId(), - 'retour_abonne' => 'prets'], - null, true), - $emprunt->getTitre()); - ?></td> - <td><?php echo $emprunt->getAuteur();?></td> - <td><?php echo $emprunt->getBibliotheque();?></td> - <td class="date_retour"> - <?php echo $emprunt->getDateRetour() . ' ';?> - <?php - if ($emprunt->isRenewable()) - echo $this->tagAnchor($this->url(['action' => 'prolongerPret', - 'id_pret' => $emprunt->getId()]), - $this->_('Prolonger'));?> - </td> - <td><?php echo $emprunt->getType();?></td> - </tr> + foreach ($this->fiche["fiche"]->getEmprunts() as $emprunt) { + $class_retard = $emprunt->enRetard() ? 'class="pret_en_retard"' : '';?> + <tr <?php echo $class_retard;?>> + <td width="15px" align="center"><b><?php echo $num++;?></b></td> + <td> + <?php + echo $this->tagAnchor( + $this->url(['controller' => 'recherche', + 'action' => 'viewnotice', + 'id' => $emprunt->getNoticeOPACId(), + 'retour_abonne' => 'prets'], + null, true), + $emprunt->getTitre()); + ?></td> + <td><?php echo $emprunt->getAuteur();?></td> + <td><?php echo $emprunt->getBibliotheque();?></td> + <td class="date_retour"> + <?php echo $emprunt->getDateRetour() . ' ';?> + <?php + if ($emprunt->isRenewable()) + echo $this->tagAnchor($this->url(['action' => 'prolongerPret', + 'id_pret' => $emprunt->getId()]), + $this->_('Prolonger'), + ['data-popup' => 'true']);?> + </td> + <td><?php echo $emprunt->getType();?></td> + </tr> <?php } } ?> </tbody> diff --git a/public/opac/js/subModal.js b/public/opac/js/subModal.js index 211ae3b98d0..ee669febda0 100644 --- a/public/opac/js/subModal.js +++ b/public/opac/js/subModal.js @@ -139,24 +139,26 @@ if (data['show_modal'] && data['show_modal']=='true') show_modal=true; - var position = { my: "center top", at: "center top", of: window }; + var position = (data['position'] != undefined) ? + data['position'] : + { my: "center top", at: "center top", of: window }; - //pour que le dialogue soit en dessous de la notification - if ($("#info_message").size()) - position = {my: "center top", - at: "center bottom", - of: "#info_message", - collision: "flip"}; + //pour que le dialogue soit en dessous de la notification + if ($("#info_message").size()) + position = {my: "center top", + at: "center bottom", + of: "#info_message", + collision: "flip"}; var modal = container.dialog({ width:modal_size['width'], height:modal_size['height'], - modal:false, + modal:show_modal, title: titre, dialogClass: dialogClass, close:onClose, open:onOpen, - position: position + position: position }); return modal; } -- GitLab