diff --git a/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml b/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml index a0164cae423b46758ebdc9a4920bcc78810de403..fe08a2ea6a307a201c5633838da15176eb6caf41 100644 --- a/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml +++ b/application/modules/admin/views/scripts/accueil/premier-chapitre.phtml @@ -1,3 +1,22 @@ +<script> + function pc_conf_view(type) { + if (type == 0) { + $("#pc_conf_panier").hide(); + $("#pc_conf_nb_aleat").show(); + $("#pc_conf_format").show(); + } + if (type == 1) { + $("#pc_conf_nb_aleat").hide(); + $("#pc_conf_panier").show(); + $("#pc_conf_format").show(); + } + if (type == 2) { + $("#pc_conf_nb_aleat").hide(); + $("#pc_conf_panier").hide(); + $("#pc_conf_format").hide(); + } + } +</script> <center> <h1>Propriétés du module Premier-Chapitre</h1><br> <div class="formTable"> @@ -37,21 +56,25 @@ <fieldset> <legend>Mode d'affichage</legend> <table cellspacing="2"> - <tr> + <tr id="pc_conf_type"> <td class="droite">Type de selection </td> <td class="gauche"> - <select name="type" id="type"> + <select name="type" id="type" onchange="pc_conf_view(this.value);"> <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> + <tr id="pc_conf_nb_aleat"> <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> + <tr id="pc_conf_panier"> + <td class="droite">Panier </td> + <td class="gauche"><?php echo $this->formSelect("id_panier", $this->preferences["id_panier"],null,$this->paniers) ?></td> + </tr> + <tr id="pc_conf_format"> <td class="droite" valign="top">Format d'affichage</td> <td class="gauche"> <select name="format" id="format"> @@ -61,14 +84,12 @@ </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> - +<script> + pc_conf_view(<?php print $this->preferences["type"]; ?>); +</script> diff --git a/application/modules/opac/controllers/PremierChapitreController.php b/application/modules/opac/controllers/PremierChapitreController.php index 29b9eedfa82e714752db6335528a3068ff9c54ad..85b63ee059774d74d92156d97d742ff7bddf638f 100644 --- a/application/modules/opac/controllers/PremierChapitreController.php +++ b/application/modules/opac/controllers/PremierChapitreController.php @@ -30,7 +30,7 @@ class PremierChapitreController extends Zend_Controller_Action { } public function preDispatch() { - $no_front_actions = array("aleatoire", "ajout-frame"); + $no_front_actions = array("aleatoire", "ajout-frame", "panier"); $request = $this->_request; $action = $request->getActionName(); if (!$this->active && $action != 'inactive') { @@ -114,6 +114,24 @@ class PremierChapitreController extends Zend_Controller_Action { $this->getResponse()->setBody($html . Class_ScriptLoader::getInstance()->html()); } + function panierAction() { + $params = $this->_request->getParams(); + $id_panier = (!empty($params['id_panier']))?$params['id_panier']:((!empty($params['id']))?$params['id']:""); + $pcs = []; $html = ''; + if (!empty($id_panier)) { + $pan = Class_PanierNotice::find($id_panier); + if ($pan) { + foreach ($pan->getNoticesAsArray() as $notice) + if ($pc = Class_PremierChapitre::getByNotice($notice)) + $pcs[] = $pc; + } + $html = $this->view->premierChapitre_Vignettes($pcs); + } + $this->getResponse()->setHeader('Content-Type', 'text/html;charset=utf-8'); + $this->getResponse()->setHeader('Pragma', 'no-cache', true); + $this->getResponse()->setBody($html . Class_ScriptLoader::getInstance()->html()); + } + public function __call($method, $args) { if ('Action' == substr($method, -6)) { // Si une méthode d'action n'est pas trouvée,