Define min max for interval value

This commit is contained in:
Michael RICOIS 2012-05-24 07:34:12 +00:00
parent 42cf983eb5
commit 5f412b2315

View File

@ -290,22 +290,22 @@ class Ciblage
protected function nbActio($value)
{
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('nbActio')->current();
$valMin = '';
$valMax = '';
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
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];
if ($min=='' || $max=='')
if ($min===null || $max===null)
return;
$this->setFilterRange('nbActio', $min, $max);
@ -315,15 +315,47 @@ class Ciblage
protected function nbPart($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
//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 ($min===null || $max===null)
return;
$this->setFilterRange('nbPart', $min, $max);
}
}
protected function nbMPubli($value)
{
if ( array_key_exists('in', $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];
if ($min===null || $max===null)
return;
$this->setFilter('nbMPubli', $value);
}
}
@ -331,17 +363,47 @@ class Ciblage
protected function capital($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
//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];
if ($min===null || $max===null)
return;
$this->setFilterRange('capital', $min, $max);
}
}
protected function age_entrep($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
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];
if ($min===null || $max===null)
return;
$this->setFilterRange('age_entrep', $min, $max);
}
}
@ -349,8 +411,23 @@ class Ciblage
protected function age_etab($value)
{
if ( array_key_exists('in', $value) ) {
$min = $value['in'][0];
$max = $value['in'][1];
//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 ($min===null || $max===null)
return;
$this->setFilterRange('age_etab', $min, $max);
}
}
@ -377,27 +454,24 @@ class Ciblage
protected function eff_etab($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;
}
if ( array_key_exists('in', $value) ) {
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
//Read min max
$minmaxM = new Application_Model_MinMax();
$minmax = $minmaxM->find('eff_etab')->current();
Zend_Registry::get('firebug')->info('eff_etab Min : '.$min.', Max : '.$max);
$valMin = 0;
$valMax = null;
if ($minmax!==false) {
$valMin = $minmax->min;
$valMax = $minmax->max;
}
if ($min===null || $max===null)
return;
$min = ($value['in'][0]=='') ? $valMin : $value['in'][0];
$max = ($value['in'][1]=='') ? $valMax : $value['in'][1];
Zend_Registry::get('firebug')->info('Min : '.$min.', Max : '.$max);
if ($min===null || $max===null)
return;
$this->setFilterRange('eff_etab', $min, $max);
}
@ -431,26 +505,24 @@ class Ciblage
protected function nbEtab($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;
}
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 ($min===null || $max===null)
return;
Zend_Registry::get('firebug')->info('Min : '.$min.', Max : '.$max);
$this->setFilterRange('nbEtab', $min, $max);
}
}