This commit is contained in:
Michael RICOIS 2012-10-05 14:12:07 +00:00
commit ce75d6509e
4 changed files with 165 additions and 162 deletions

View File

@ -38,8 +38,8 @@ Vos critères seront enregistrées et une référence vous sera fourni.</p>
<tr>
<td>Prix du fichier</td><td><?=number_format($this->prix, 2, ',', ' ')?></td>
</tr>
<tr><td colspan="2"></td></tr>
<?php if ($this->forfaitRemain) {?>
<tr><td colspan="2"></td></tr>
<tr><td>Forfait Restant</td><td><?=number_format($this->forfaitRemain, 2, ',', ' ')?></td></tr>
<?php }?>
</table>
@ -49,7 +49,6 @@ Vos critères seront enregistrées et une référence vous sera fourni.</p>
<?php }?>
<br/>
<form name="commande" method="post" action="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'commande'))?>">
<input type="hidden" name="id" value="<?=$this->id?>" />
<input type="hidden" type="text" value="<?=$this->ref?>" name="ref">
@ -60,19 +59,24 @@ Vos critères seront enregistrées et une référence vous sera fourni.</p>
$('#dialog').dialog({ buttons: [ {
text: "Commander",
click: function() {
$('div#progress').html('<br /><center><img src="/themes/default/images/ajax_loader.gif" /></center>');
$('#dialog').dialog({ buttons: [{}] });
$('#cache').css('display', 'none');
$.post(
$('form[name=commande]').attr('action'),
$('form[name=commande]').serialize(),
var url = '/dashboard/ciblage/id/<?=$this->id?>';
var ok = false;
$.post($('form[name=commande]').attr('action'),$('form[name=commande]').serialize(),
function(data){
$('div#update').html(data);
ok = true; $('div#update').html(data);
});
$('#dialog').dialog({ buttons: [{ text: "Quitter", click: function() {
$(this).dialog("close");
if (ok==true) {
window.href= url;
}
} }] });
}
},
{
text: "Quitter",
click: function() { $(this).dialog("close"); }
text: "Quitter", click: function() { $(this).dialog("close"); }
}
] });
</script>

View File

@ -34,4 +34,4 @@ contact = supportdev@scores-decisions.com
production = supportdev@scores-decisions.com
[path]
data = "/sites/dataciblage"
data = "/home/vhosts/data"

View File

@ -231,7 +231,34 @@ class Ciblage
return $resSphinx['total_found'];
}
}
/**
*
* @param unknown $key
* @param string $min
* @param string $max
* @return multitype:unknown
*/
protected function minmax($key, $min=null, $max=null)
{
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find($key)->current();
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($min===null) ? $valMin : $min;
$max = ($max===null) ? $valMax : $max;
return array(
'min' => $min,
'max' => $max,
);
}
/**
*
* @param unknown_type $value
@ -341,20 +368,9 @@ class Ciblage
protected function nbActio($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('nbActio')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
list($min, $max) = $this->minmax('nbActio', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -364,20 +380,9 @@ class Ciblage
protected function nbPart($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('nbPart')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
if ( array_key_exists('in', $value) ) {
list($min, $max) = $this->minmax('nbPart', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -389,19 +394,8 @@ class Ciblage
protected function nbMPubli($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('nbMPubli')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
list($min, $max) = $this->minmax('nbMPubli', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -413,19 +407,8 @@ class Ciblage
protected function capital($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('capital')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
list($min, $max) = $this->minmax('capital', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -437,20 +420,9 @@ class Ciblage
protected function age_entrep($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('age_entrep')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
list($min, $max) = $this->minmax('age_entrep', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -460,21 +432,10 @@ class Ciblage
protected function age_etab($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('age_etab')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
if ( array_key_exists('in', $value) ) {
list($min, $max) = $this->minmax('age_etab', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -506,19 +467,8 @@ class Ciblage
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('eff_etab')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
list($min, $max) = $this->minmax('eff_etab', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -529,20 +479,10 @@ class Ciblage
protected function eff_entrep($value)
{
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('eff_entrep')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
if ( array_key_exists('in', $value) ) {
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
if ( array_key_exists('in', $value) ) {
list($min, $max) = $this->minmax('eff_entrep', $value['in'][0], $value['in'][1]);
Zend_Registry::get('firebug')->info('Min : '.$min.', Max : '.$max);
@ -555,20 +495,9 @@ class Ciblage
protected function nbEtab($value)
{
if ( array_key_exists('in', $value) ) {
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('nbEtab')->current();
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
if ( array_key_exists('in', $value) ) {
list($min, $max) = $this->minmax('nbEtab', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
@ -719,8 +648,12 @@ class Ciblage
protected function bilEE($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilEE', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilEE', $min, $max);
}
}
@ -728,8 +661,12 @@ class Ciblage
protected function bilFL($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilFL', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilFL', $min, $max);
}
}
@ -737,8 +674,12 @@ class Ciblage
protected function bilFK($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilFK', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilFK', $min, $max);
}
}
@ -746,8 +687,12 @@ class Ciblage
protected function bilFR($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilFR', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilFR', $min, $max);
}
}
@ -755,8 +700,12 @@ class Ciblage
protected function bilGF($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilGF', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilGF', $min, $max);
}
}
@ -764,8 +713,12 @@ class Ciblage
protected function bilGP($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilGP', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilGP', $min, $max);
}
}
@ -773,8 +726,12 @@ class Ciblage
protected function bilGW($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilGW', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilGW', $min, $max);
}
}
@ -782,8 +739,12 @@ class Ciblage
protected function bilHD($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilHD', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilHD', $min, $max);
}
}
@ -791,8 +752,12 @@ class Ciblage
protected function bilHH($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilHH', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilHH', $min, $max);
}
}
@ -800,8 +765,12 @@ class Ciblage
protected function bilHL($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilHL', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilHL', $min, $max);
}
}
@ -809,8 +778,12 @@ class Ciblage
protected function bilHM($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilHM', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilHM', $min, $max);
}
}
@ -818,8 +791,12 @@ class Ciblage
protected function bilHN($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilHN', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilHN', $min, $max);
}
}
@ -827,8 +804,12 @@ class Ciblage
protected function bilYP($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
list($min, $max) = $this->minmax('bilYP', $value['in'][0], $value['in'][1]);
if ($min===null || $max===null)
return;
$this->setFilterRange('bilYP', $min, $max);
}
}

View File

@ -886,9 +886,27 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
unset($this->ciblage[$sessionKey]['in']);
break;
case 'interval':
//@todo : Check Min Max
//@todo : Check Number => A préciser dans Fields
//@todo : Check Date => A préciser dans Fields
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find($sessionKey)->current();
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
if ($value[0]<$valMin) {
$value[0] = $valMin;
}
if ($value[0]>$valMax) {
return false;
}
if ($value[1]>$valMax) {
$value[1]=$valMax;
}
if ($value[1]<$valMin) {
return false;
}
}
break;
case 'checkbox':
if ( $value==0 ) {