diff --git a/application/modules/admin/controllers/PrintController.php b/application/modules/admin/controllers/PrintController.php index 32804a1fef872d6ed1f055992d8c58cd97963caa..f5274ff53789c193fa4eacb679566c6b580464ab 100644 --- a/application/modules/admin/controllers/PrintController.php +++ b/application/modules/admin/controllers/PrintController.php @@ -47,7 +47,8 @@ class Admin_PrintController extends ZendAfi_Controller_Action { } public function indexAction() { - $this->_redirectToIndex(); + $this->view->titre=$this->view->_('Modèles d\'impressions'); + $this->view->models= Class_ModeleFusion::findAll(); } diff --git a/application/modules/admin/views/scripts/print/_print_row.phtml b/application/modules/admin/views/scripts/print/_print_row.phtml new file mode 100644 index 0000000000000000000000000000000000000000..5a50d733b47bf2fe5e70dddb07113d1d8c66f237 --- /dev/null +++ b/application/modules/admin/views/scripts/print/_print_row.phtml @@ -0,0 +1,20 @@ + + +<li > + +<?php +echo $this->tag('div', $this->model->getLibelle()); +$action_buttons=[]; +$actions = [ +['action' => 'edit', 'icon' => 'ico/edit.gif', 'help' => 'Editer'], +['action' => 'add', 'icon' => 'ico/add_news.gif', 'help' => 'Ajouter un nouveau modèle'], +['action' => 'delete', 'icon' => 'ico/del.gif', 'help' => 'Supprimer']]; + foreach ($actions as $action) { + $action_buttons[]= $this->tagAnchor($this->url(array('action' => $action['action'], + 'id' => $this->model->getId())), + '<img src="'.URL_ADMIN_IMG.$action['icon'].'" alt="'.$action['help'].'" title="'.$action['help'].'" />'); + } +echo $this->tag('div', implode('',$action_buttons),['class' => 'actions']); + +?> +</li> diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 8caf1120de1746b89d30cb1141f936ba453cdeea..8e71b0a48c9eb8092b283536c717993cf86fb3dd 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -18,7 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class CmsController extends Zend_Controller_Action { +class CmsController extends ZendAfi_Controller_Action { use Trait_TimeSource; public function init() { @@ -389,4 +389,6 @@ class CmsController extends Zend_Controller_Action { $this->renderScript('cms/articlesview.phtml'); } + + } \ No newline at end of file diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index 6f7c747068401b517358c8dc9a197c89ae979fee..2d6fea6cdfdbe5945ec51cd4effff4b43fed6a8b 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -743,7 +743,6 @@ class RechercheController extends ZendAfi_Controller_Action { } - protected function newCriteresRecherches($params) { $criteres = (new Class_CriteresRecherche())->setParams($params); @@ -777,6 +776,7 @@ class RechercheController extends ZendAfi_Controller_Action { $this->renderScript('recherche/print-fusion.phtml'); } + } diff --git a/application/modules/opac/views/scripts/cms/articlesview.phtml b/application/modules/opac/views/scripts/cms/articlesview.phtml index 40ee72767864ccfa90a09af8e257a49ee93273ca..55067f36804ed6e1c21dee107f06e001d749a680 100644 --- a/application/modules/opac/views/scripts/cms/articlesview.phtml +++ b/application/modules/opac/views/scripts/cms/articlesview.phtml @@ -4,6 +4,15 @@ if (0 == count($this->articles)) { echo $this->_('Aucun article trouvé'); } +$ids = array_map(function($article) { + return $article->getId(); + +}, $this->articles); + + echo $this->tagAnchor($this->url( ['action' => 'print', + 'ids' => implode(';',$ids), + 'strategy' => 'article', + 'modele_fusion' => 8]), 'imprimer'); foreach ($this->articles as $article) { echo $this->partial( diff --git a/application/modules/opac/views/scripts/print.phtml b/application/modules/opac/views/scripts/print.phtml new file mode 100644 index 0000000000000000000000000000000000000000..21af2be282989a2b2760d4ac8e59f8961e2ef8d8 --- /dev/null +++ b/application/modules/opac/views/scripts/print.phtml @@ -0,0 +1,3 @@ +<div class="lettre_fusion"> + <?php echo $this->lettre->getContenuFusionne(); ?> +</div> diff --git a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml index e241c10688bf640dab709ec4957459c5ccbc3d47..881391aa1801d77185b4a1a84f000a29c9a90273 100644 --- a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml +++ b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml @@ -18,13 +18,20 @@ if ($this->is_pertinence) { ?> <div class="print"> <?php + if ($fusion=Class_ModeleFusion::findFirstBy(['nom' => 'recherche'])) { -?> -<a href="<?php echo $this->url(['action' => 'print', - 'modele_fusion' => $fusion->getId()]); ?>">imprimer</a> +$ids = array_map(function($notice) { + return $notice->getId(); + +}, $this->liste); + +echo $this->tagAnchor($this->url(['action' => 'print', + 'strategy' => 'notice', + 'ids' => implode(';',$ids), + 'modele_fusion' => $fusion->getId()]),'imprimer'); -<?php } ?> + } ?> </div> <div class="resultats_page"> <?php diff --git a/library/Class/CollectionFusion.php b/library/Class/CollectionFusion.php new file mode 100644 index 0000000000000000000000000000000000000000..35ed52f913570fb20f0fad780033224291c97b53 --- /dev/null +++ b/library/Class/CollectionFusion.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_CollectionFusion extends Storm_Model_Abstract{ + protected $_elements; + + public function __construct($elements) { + $this->_elements=$elements; + } + + public function getElements() { + return $this->_elements; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action.php b/library/ZendAfi/Controller/Action.php index 49e906b33ee6e5cb1b8067356cb1a641ff96cc69..3a7c4d67cde6cc1249623ee50fcab20186096ca7 100644 --- a/library/ZendAfi/Controller/Action.php +++ b/library/ZendAfi/Controller/Action.php @@ -407,5 +407,25 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action { return $parts[1]; } + public function printAction() { + $models=[]; + if ($this->_getParam('strategy')=="article") + $models = Class_Article::findAllBy(['id_article' => explode(';',$this->_getParam('ids',0))]); + + if ($this->_getParam('strategy')=="notice") + $models = Class_Notice::findAllBy(['id_notice' => explode(';',$this->_getParam('ids',0))]); + + $this->view->lettre = Class_ModeleFusion::getBibliorecord($this->_getParam('modele_fusion')); + + $this->view->lettre + ->setDataSource(['results' => new Class_CollectionFusion($models)]); + + $this->_helper->getHelper('viewRenderer')->setLayoutScript('empty.phtml'); + $this->renderScript('print.phtml'); + + } + + + } ?> \ No newline at end of file