Création et validation des interval avec jquery ! laborieux !!

Ajout du filtre nbMPubli dans l'indexation et le moteur
Correction css.
This commit is contained in:
Damien LASSERRE 2011-12-23 15:12:22 +00:00
parent 7184d2ce35
commit fefcff02b3
6 changed files with 53 additions and 31 deletions

View File

@ -157,13 +157,7 @@ class CriteresController extends Zend_Controller_Action
array('name' => 'bilHN', 'libelle' => 'Résultat', 'type' => 'interval'),
array('name' => 'bilYP', 'libelle' => 'Effectif de l\'entreprise au dernier bilan (poste YP)', 'type' => 'interval')
);
/*array('name' => 'tca', 'libelle' => 'Tranche de Chiffre d\'affaire de l\'entreprise (Insee)', 'type' => 'interval'),
array('name' => 'tcaexp', 'libelle' => 'Tranche de Chiffre d\'affaire à l\'export', 'type' => 'interval'),
array('name' => 'actifEco', 'libelle' => 'Etablissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tvaIntraValide', 'libelle' => 'Numéro de TVA Valide', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
*/
$this->view->champs = $champs;
}
}

View File

@ -10,18 +10,34 @@ Class Zend_View_Helper_Interval extends Zend_View_Helper_Abstract
return ($session->ciblage[$name]);
}
protected function getMinMax($name){
$session = new Zend_Session_Namespace('ciblage');
switch ($name) {
case 'nbMPubli':
$min = ((!empty($session->ciblage['nbMPubli'][0]))?$session->ciblage['nbMPubli'][0]:'0');
$max = ((!empty($session->ciblage['nbMPubli'][0]))?$session->ciblage['nbMPubli'][1]:'1000');
return (array($min, $max));
case 'nbAction':
return array('0', '100');
case 'nbPart':
return array('0', '100');
}
}
public function Interval($name, $libelle, $date = false)
{
$session = new Zend_Session_Namespace('ciblage');
$minMax = $this->getMinMax($name);
$champ = '<div class="ui-state-default" id="'.$name.'" style="margin-top:5px;padding:5px;'/*.((empty($session->ciblage[$name]))?'display:none':null)*/.';">';
$champ = '<div class="ui-state-default" style="margin-top:5px;padding:5px;'/*.((empty($session->ciblage[$name]))?'display:none':null)*/.';">';
$champ .= '<li>';
$champ .= '<div style="margin-top:3px;float:left;text-align:left;">
<label for="amount">'.$libelle .': </label>
</div>';
$champ .= '<div style="text-align:right;height:17px;">
<input class="range" type="text" id="Value'.$name.'" style="margin-left:10px;margin-top:3px;float:left;border:0; color:black; font-weight:bold;" />
<div min="0" max="1000" input="'.$name.'" class="slider-range"></div>
<input name="'.$name.'" class="range slider_Text" type="text" id="'.$name.'" min="'.$minMax[0].'" max="'.$minMax[1].'" style="margin-left:10px;margin-top:3px;float:left;border:0; color:black; font-weight:bold;" />
<div input="'.$name.'" class="slider-range"></div>
</div>';
$champ .= '</li>';
$champ .= '</div>';

View File

@ -8,14 +8,14 @@
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle'], (isset($valeur[1])?$valeur[1]:false));
break;
case 'text':
/*case 'text':
echo $this->Text($champ['name'], $champ['libelle']);
break;
case 'textarea':
echo $this->Textarea($champ['name'], $champ['libelle']);
break;
default:
echo $champ['name'].'<br />';
echo $champ['name'].'<br />';*/
}
} ?>
</div>

View File

@ -36,8 +36,7 @@ Class Ciblage
$resSphinx = $this->sphinx->Query($this->alpha, ConfigurationCiblage::$index);
return ($resSphinx['total_found']);
}
/*30036,30039,30047,30060,30075,30082,30102,30125, 30128, 30061, 30138, 30145, 30155, 30156, 30169, 30189, 30189, 30927, 30935, 30206, 30211, 30356, 30241, 30245, 30249, 30257, 30258, 30190, 30210
*/
public function execute($need = false)
{
if($need) {
@ -241,6 +240,10 @@ Class Ciblage
$this->setFilterRange('nbActio', $valeur);
}
protected function nbMPubli($valeur) {
$this->setFilterRange('nbMPubli', $valeur);
}
protected function nbPart($valeur) {
$this->setFilterRange('nbPart', $valeur);
}

View File

@ -25,6 +25,30 @@ $(document).ready(function(){
});
});
$(function() {
$( ".slider-range" ).slider({
range: true,
create: function(event, ui) {
var max = $("#"+$(this).attr('input')).attr('max');
var min = $("#"+$(this).attr('input')).attr('min');
$(this).slider( "option", "min", min );
$(this).slider( "option", "max", max );
},
values : [0, 100000000000000],
slide: function( event, ui ) {
var name = $(this).attr('input');
$( "#"+name ).val( ui.values[ 0 ] + " , " + ui.values[ 1 ] );
},
step: 10,
stop: function( event, ui ) {
var name = $(this).attr('input');
set(name, ui.values[ 0 ] + "," + ui.values[ 1 ]);
},
});
});
$(function() {
$( ".datepicker" ).datepicker({
showOn: "button",
@ -61,22 +85,7 @@ $(document).ready(function(){
$( "#sortable" ).disableSelection();
});
$(function() {
$( ".slider-range" ).slider({
slide: function( event, ui ) {
var name = $(this).attr('input');
$( "#Value"+name ).val( ui.values[ 0 ] + " , " + ui.values[ 1 ] );
},
range: true,
min: $(this).attr('min'),
max: $(this).attr('max'),
values: [ 0, 1000 ]
});
$( "#"+name ).val( "$" + $( ".slider-range" ).slider( "values", 0 ) +
" - $" + $( ".slider-range" ).slider( "values", 10 ) );
});
$(function() {
$( ".column" ).sortable({

View File

@ -25,7 +25,7 @@ ul, ul li {
#global {
position: relative;
width:1000px;
width:1050px;
margin-right: auto;
margin-left: auto;
}
@ -202,14 +202,14 @@ h3 {
#tabs {
float:left;
margin: 2px;
width:706px;
width:710px;
}
#result {
/*background: #ffffff;*/
color: #000000;
float:left;
width:250px;
width:300px;
margin:2px;
}