diff --git a/application/modules/admin/controllers/AccueilController.php b/application/modules/admin/controllers/AccueilController.php index b4b8830e12b0598918ccab9a06b6f54488ee4fac..f460775b000a94cbf5bad7bfaf353bc4b3558d46 100644 --- a/application/modules/admin/controllers/AccueilController.php +++ b/application/modules/admin/controllers/AccueilController.php @@ -283,6 +283,11 @@ class Admin_AccueilController extends Zend_Controller_Action { $this->view->catalogues = Class_Catalogue::getCataloguesForCombo(); $this->view->paniers = Class_PanierNotice::getPaniersForCombo(); } + + public function premierChapitreAction() { + $this->view->paniers = Class_PanierNotice::getPaniersForCombo(); + $this->_simpleAction('PREMIER-CHAPITRE'); + } protected function isAFlashStyleSelected() { diff --git a/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml b/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml new file mode 100644 index 0000000000000000000000000000000000000000..a0164cae423b46758ebdc9a4920bcc78810de403 --- /dev/null +++ b/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml @@ -0,0 +1,74 @@ +<center> + <h1>Propriétés du module Premier-Chapitre</h1><br> + <div class="formTable"> + <form class="news" method="post" action="<?php echo $this->url ?>"> + + <fieldset> + <legend>Affichage</legend> + <table cellspacing="2"> + + <tr> + <td class="droite">Style de boite </td> + <td class="gauche"><?php echo $this->combo_templates ?></td> + </tr> + + </table> + </fieldset> + <br /> + + <fieldset> + <legend>Généralités</legend> + <table cellspacing="2"> + <tr> + <td class="droite">Titre </td> + <td class="gauche"> + <input type="text" name="titre" size="55" value='<?php print htmlspecialchars($this->preferences["titre"], ENT_QUOTES) ?>' > + </td> + </tr> + <tr> + <td class="droite">Texte d'introduction </td> + <td class="gauche"> + <input type="text" name="intro" size="55" value='<?php print htmlspecialchars($this->preferences["intro"], ENT_QUOTES) ?>' > + </td> + </tr> + </table> + </fieldset> + + <fieldset> + <legend>Mode d'affichage</legend> + <table cellspacing="2"> + <tr> + <td class="droite">Type de selection </td> + <td class="gauche"> + <select name="type" id="type"> + <option value="0" <?php if($this->preferences["type"]==0) print(" selected"); ?>>Aléatoire</option> + <option value="1" <?php if($this->preferences["type"]==1) print(" selected"); ?>>Panier</option> + <option value="2" <?php if($this->preferences["type"]==2) print(" selected"); ?>>Toutes les notice</option> + </select> + </td> + </tr> + <tr> + <td class="droite">Nombre à afficher<br/>(en mode aléatoire) </td> + <td class="gauche"><input type="text" name="nb_aff" size="4" value="<?php print($this->preferences["nb_aff"]); ?>"></td> + </tr> + <tr> + <td class="droite" valign="top">Format d'affichage</td> + <td class="gauche"> + <select name="format" id="format"> + <option value="0" <?php if($this->preferences["format"]==0) print(" selected"); ?>>Vignettes seules</option> + <option value="1" <?php if($this->preferences["format"]==1) print(" selected"); ?>>Vignettes + Frame</option> + <option value="2" <?php if($this->preferences["format"]==2) print(" selected"); ?>>Vignettes + Frame + lien Notice</option> + </select> + </td> + </tr> + <tr> + <td class="droite">Panier </td> + <td class="gauche"><?php echo $this->formSelect("id_panier", $this->preferences["id_panier"],null,$this->paniers) ?></td> + </tr> + </table> + </fieldset> + + <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> + </form> + </div> + diff --git a/library/Class/Systeme/ModulesAccueil.php b/library/Class/Systeme/ModulesAccueil.php index 7d7a5ad8ad785ab611a5e3a3fc7b0006c37d4fa2..80bee9724946fbd7f9c717363084d5100bcfb22f 100644 --- a/library/Class/Systeme/ModulesAccueil.php +++ b/library/Class/Systeme/ModulesAccueil.php @@ -127,6 +127,7 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { 'HISTORIQUE_RECHERCHES' => new Class_Systeme_ModulesAccueil_HistoriqueRecherches, 'PANIER' => new Class_Systeme_ModulesAccueil_Panier, 'DOMAIN_BROWSER' => new Class_Systeme_ModulesAccueil_DomainBrowser, + 'PREMIER_CHAPITRE' => new Class_Systeme_ModulesAccueil_PremierChapitre, ]; } diff --git a/library/Class/Systeme/ModulesAccueil/PremierChapitre.php b/library/Class/Systeme/ModulesAccueil/PremierChapitre.php new file mode 100644 index 0000000000000000000000000000000000000000..ab359fc494ccd8d8eb38c40246aa33559615fbdc --- /dev/null +++ b/library/Class/Systeme/ModulesAccueil/PremierChapitre.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright (c) 2015, Gaël VINOT (Ville de Montrouge). 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_Systeme_ModulesAccueil_PremierChapitre extends Class_Systeme_ModulesAccueil_Null{ + + protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; + + protected $_libelle = 'Premier Chapitre'; + + protected $_action = 'premier-chapitre'; + + protected $_popupWidth = 600; + + + protected $_popupHeight = 700; + + protected $_defaultValues = ['titre' => 'Premier Chapitre', + 'intro' => '', + 'type' => 0, + 'nb_aff' => 8, + 'id_panier' => 0, + 'format' => 0]; +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/PremierChapitre.php b/library/ZendAfi/View/Helper/Accueil/PremierChapitre.php new file mode 100644 index 0000000000000000000000000000000000000000..7f187ef1c0fd2d876d6a5192205a1f2ba235f510 --- /dev/null +++ b/library/ZendAfi/View/Helper/Accueil/PremierChapitre.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright (c) 2015, Gaël VINOT (Ville de Montrouge). 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 ZendAfi_View_Helper_Accueil_PremierChapitre extends ZendAfi_View_Helper_Accueil_Base { + /** @return array */ + public function getHTML() { + $this->titre = $this->preferences['titre']; + $this->contenu = ''; + if (!empty($this->preferences['intro'])) + $this->contenu = '<p>'.$this->preferences['intro'].'</p>'; + $this->contenu .= $this->view->renderPremierChapitre($this->id_module, $this->preferences); + + return $this->getHtmlArray(); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/PremierChapitre/Abstract.php b/library/ZendAfi/View/Helper/PremierChapitre/Abstract.php index cf2640317693b44fbd9c19ab13ee1dd59f1b358d..037708ab64d11deacbc11b333b8982e51dd01476 100644 --- a/library/ZendAfi/View/Helper/PremierChapitre/Abstract.php +++ b/library/ZendAfi/View/Helper/PremierChapitre/Abstract.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * Copyright (c) 2015, Gaël VINOT (Ville de Montrouge). 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 diff --git a/library/ZendAfi/View/Helper/RenderPremierChapitre.php b/library/ZendAfi/View/Helper/RenderPremierChapitre.php new file mode 100644 index 0000000000000000000000000000000000000000..c49bf4b185ccc0cef6cd0f73cc6b2dc7381feb24 --- /dev/null +++ b/library/ZendAfi/View/Helper/RenderPremierChapitre.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright (c) 2015, Gaël VINOT (Ville de Montrouge). 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 ZendAfi_View_Helper_RenderPremierChapitre extends ZendAfi_View_Helper_BaseHelper { + + protected $_pref, $_id_module,$renderer; + + public function renderPremierChapitre($id_module, $preferences) { + $this->_id_module=$id_module; + $this->_pref = $preferences; + + $type = $this->_pref["type"]; + $format = $this->_pref["format"]; + + if ($type == 1) + $data = $this->_selection(); + else if ($type == 2) { + $data = $this->_complete(); + $format = 0; + } + else + $data = $this->_aleatoire(); + + if ($format == 1 || $format == 2) $preferences['target'] = 'frame'; + if ($format == 2) $preferences['linkNotice'] = true; + return $this->view->premierChapitre_Vignettes($data,$preferences); + } + protected function _aleatoire() { + $nb_aff = $this->_pref["nb_aff"]; + if (!preg_match('@^\d+$@',$nb_aff)) + $pcs = Class_PremierChapitre::getAleatoire(); + else + $pcs = Class_PremierChapitre::getAleatoire($nb_aff); + return $pcs; + } + + protected function _complete() { + return Class_PremierChapitre::getAll();; + } + + protected function _selection() { + $id_panier = $this->_pref['id_panier']; + $pan = Class_PanierNotice::find($id_panier); + $pcs = []; + if ($pan) { + foreach ($pan->getNoticesAsArray() as $notice) + if ($pc = Class_PremierChapitre::getByNotice($notice)) + $pcs[] = $pc; + } + return $pcs; + } + +} +?> \ No newline at end of file