ajout du datepicker de jquery sur les champs ou l'option est attribués

This commit is contained in:
Damien LASSERRE 2011-12-16 16:42:58 +00:00
parent a433b02c7e
commit 024950d275
4 changed files with 19 additions and 9 deletions

View File

@ -25,11 +25,11 @@ class CriteresController extends Zend_Controller_Action
array('name' => 'adrDom', 'libelle' => 'Adresse de domiciliation', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'dirNom', 'libelle' => 'Nom du principal dirigeant', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'lieuAct', 'libelle' => 'Lieu d\'activté', 'type' => 'select', 'parametres' => array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '91' => '91', '92' => '92', '93' => '93', '99' => '99')),
array('name' => 'nbMPubli', 'libelle' => 'Nombre de marchés publiques remportés', 'type' => 'interval'),
array('name' => 'dateCrea_ent', 'libelle' => 'Date de création de l\'entreprose', 'type' => 'interval'),
array('name' => 'dateCrea_etab', 'libelle' => 'Date de création de l\'etablissement', 'type' => 'interval'),
array('name' => 'nbAction', 'libelle' => 'Nombre d\'actionnaires connus', 'type' => 'interval'),
array('name' => 'nbPart', 'libelle' => 'Nombre de participations connues', 'type' => 'interval')
array('name' => 'nbMPubli', 'libelle' => 'Nombre de marchés publiques remportés', 'type' => 'interval:regle'),
array('name' => 'dateCrea_ent', 'libelle' => 'Date de création de l\'entreprose', 'type' => 'interval:date'),
array('name' => 'dateCrea_etab', 'libelle' => 'Date de création de l\'etablissement', 'type' => 'interval:date'),
array('name' => 'nbAction', 'libelle' => 'Nombre d\'actionnaires connus', 'type' => 'interval:regle'),
array('name' => 'nbPart', 'libelle' => 'Nombre de participations connues', 'type' => 'interval:regle')
);
$this->view->champs = $champs;
}

View File

@ -13,13 +13,17 @@ Class Zend_View_Helper_Interval extends Zend_View_Helper_Abstract
public function Interval($name, $libelle, $date = false)
{
$session = $this->getValueSession($name);
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<input style="border:1px inset silver;" type="text" name="'.$name.'1" value="'.$session[0].'" /> <b>à</b> <input style="border:1px inset silver;" value="'.$session[1].'" type="text" name="'.$name.'2" /> <a class="interval" id="'.$name.'" href=""><img width="10%" src="/themes/default/images/valider.png" /></a>
<input style="border:1px inset silver;" type="text" name="'.$name.'1" '.
(($date == 'date')?'class="datepicker"':null)
.' value="'.$session[0].'" /> <b>à</b>
<input style="border:1px inset silver;" value="'.$session[1].'" type="text" name="'.$name.'2" '.
(($date == 'date')?'class="datepicker"':null)
.' /> <a class="interval" id="'.$name.'" href=""><img width="10%" src="/themes/default/images/valider.png" /></a>
</div>';
$champ .= '<div style="padding-top:5px;padding-bottom:5px">
<hr />

View File

@ -1,11 +1,12 @@
<div>
<?php foreach($this->champs as $champ){
switch ($champ['type']) {
$valeur = explode(':', $champ['type']);
switch ($valeur[0]) {
case 'select':
echo $this->Select($champ['name'], $champ['libelle'], $champ['parametres']);
break;
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle']);
echo $this->Interval($champ['name'], $champ['libelle'], (isset($valeur[1])?$valeur[1]:false));
break;
case 'text':
echo $this->Text($champ['name'], $champ['libelle']);

View File

@ -25,6 +25,11 @@ $(document).ready(function(){
});
});
$(function() {
$( ".datepicker" ).datepicker();
$( ".datepicker" ).datepicker( "option", "dateFormat", "yymmdd" );
});
$('.accordion .head').click(function() {
$(this).next().toggle('slow');
return false;