Merge
This commit is contained in:
commit
6f4ed6d185
@ -57,6 +57,8 @@ class IndexController extends Zend_Controller_Action
|
||||
$fields = new Scores_Fields();
|
||||
$values = $fields->getCritere($critere);
|
||||
|
||||
$this->view->assign('critereName', $critere);
|
||||
|
||||
//Inclusion
|
||||
if (count($values['in'])>0) {
|
||||
$inLabels = $fields->getValueLabel($critere, $values['in']);
|
||||
@ -79,20 +81,38 @@ class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$nameCritereToDelete = $this->getRequest()->getParam('critere');
|
||||
$request = $this->getRequest();
|
||||
|
||||
$nameCritereToDelete = $request->getParam('critere');
|
||||
$posInList = $request->getParam('in', false);
|
||||
$posExList = $request->getParam('ex', false);
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$fields->unsetCritere($nameCritereToDelete);
|
||||
|
||||
if ($posInList) {
|
||||
$fields->unsetCritereValue($nameCritereToDelete, $posInList);
|
||||
} elseif ($posExList) {
|
||||
$fields->unsetCritereValue($nameCritereToDelete, $posExList, true);
|
||||
} else {
|
||||
$fields->unsetCritere($nameCritereToDelete);
|
||||
}
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
|
||||
$fields->setNb('total', $total);
|
||||
$fields->setNb('insee', $insee);
|
||||
$fields->setNb('total', $total);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
Zend_Registry::get('firebug')->info($user);
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
$insee = null;
|
||||
} else {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
}
|
||||
$fields->setNb('insee', $insee);
|
||||
|
||||
$this->_redirect('/');
|
||||
}
|
||||
|
@ -351,7 +351,6 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$valeur = $session->getCritere($name);
|
||||
$valeur = explode(',', $valeur);
|
||||
|
||||
$return = '<div class="interval" >';
|
||||
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> à ';
|
||||
|
@ -1,7 +1,15 @@
|
||||
<?php if (count($this->inValues)>0) {?>
|
||||
<ul>
|
||||
<?php foreach ($this->inValues as $i => $item) {?>
|
||||
<li><?=$this->inLabels[$i]?></li>
|
||||
<li><?=$this->inLabels[$i]?>
|
||||
<a class="remove" href="<?=$this->url(array(
|
||||
'controller'=>'index',
|
||||
'action'=>'remove',
|
||||
'critere'=>$this->critereName,
|
||||
'in'=>$i
|
||||
), null, true)?>">
|
||||
<img src="/themes/default/images/cross.png"></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
||||
@ -9,7 +17,14 @@
|
||||
<?php if (count($this->exValues)>0) {?>
|
||||
<ul>
|
||||
<?php foreach ($this->exValues as $i => $item) {?>
|
||||
<li><?=$this->exLabels[$i]?></li>
|
||||
<li><?=$this->exLabels[$i]?><a class="remove" href="<?=$this->url(array(
|
||||
'controller'=>'index',
|
||||
'action'=>'remove',
|
||||
'critere'=>$this->critereName,
|
||||
'ex'=>$i
|
||||
), null, true)?>">
|
||||
<img src="/themes/default/images/cross.png"></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
@ -25,7 +25,7 @@ $application = new Zend_Application(
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
array(
|
||||
'help|?' => "Aide.",
|
||||
'cron' => "Mode automatique",
|
||||
'manuel' => "Mode manuel",
|
||||
@ -58,10 +58,32 @@ try {
|
||||
}
|
||||
|
||||
$keys = array(
|
||||
'nbActio','nbPart', 'teff_entrep', 'teff_etab', 'nbEtab',
|
||||
'eff_entrep', 'eff_etab', 'capital', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF',
|
||||
'bilGP', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'dateCrea_etab', 'dateCrea_ent',
|
||||
'dateImmat'
|
||||
'dateCrea_ent',
|
||||
'dateCrea_etab',
|
||||
'nbActio',
|
||||
'nbPart',
|
||||
'age_etab',
|
||||
'age_entrep',
|
||||
'nbEtab',
|
||||
'eff_entrep',
|
||||
'eff_etab',
|
||||
'capital',
|
||||
'dateImmat',
|
||||
'bilAnnee',
|
||||
'bilCloture',
|
||||
'bilEE',
|
||||
'bilFL',
|
||||
'bilFK',
|
||||
'bilFR',
|
||||
'bilGF',
|
||||
'bilGP',
|
||||
'bilGW',
|
||||
'bilHD',
|
||||
'bilHH',
|
||||
'bilHL',
|
||||
'bilHM',
|
||||
'bilHN',
|
||||
'bilYP',
|
||||
);
|
||||
|
||||
$sql = 'TRUNCATE TABLE minmax';
|
||||
@ -70,7 +92,7 @@ if ( !$db->query($sql) ) {
|
||||
}
|
||||
|
||||
foreach($keys as $key) {
|
||||
|
||||
|
||||
//Lecture
|
||||
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act';
|
||||
$stmt = $dbMetier->query($sql);
|
||||
@ -82,7 +104,7 @@ foreach($keys as $key) {
|
||||
'min' => $result->min,
|
||||
'max' => $result->max,
|
||||
);
|
||||
$db->insert('minmax', $data);
|
||||
$db->insert('minmax', $data);
|
||||
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
|
||||
}
|
||||
if ($opts->manuel) print('Terminé');
|
||||
|
@ -111,18 +111,6 @@ class Scores_Fields
|
||||
'activated' => true,
|
||||
'title' => 'Inclure ou exclure les entreprises ayant un principal dirigeant renseigné',
|
||||
),
|
||||
|
||||
/* What is this ? */
|
||||
'lieuAct' => array(
|
||||
'label' => "Lieu d\'activté",
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000')),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
),
|
||||
|
||||
'nbMPubli' => array(
|
||||
'label' => 'Marchés publiques remportés',
|
||||
'fields' => array(
|
||||
@ -211,7 +199,7 @@ class Scores_Fields
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'title' => 'Limiter la sélection aux établissements ayant des NACE spécifiques (Nomenclature d\'ACtivités Européenne)',
|
||||
'title' => 'Limiter la sélection aux établissements ayant des NACE spécifiques (Nomenclature d\'Activités Européenne)',
|
||||
),
|
||||
'NaceEntrep' => array(
|
||||
'label' => 'Code NACE de l\'entreprise',
|
||||
@ -221,7 +209,7 @@ class Scores_Fields
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'title' => 'Limiter la sélection aux entreprises ayant des NACE spécifiques (Nomenclature d\'ACtivités Européenne)',
|
||||
'title' => 'Limiter la sélection aux entreprises ayant des NACE spécifiques (Nomenclature d\'Activités Européenne)',
|
||||
),
|
||||
'age_etab' => array(
|
||||
'label' => 'Age de l\'établissement',
|
||||
@ -231,6 +219,7 @@ class Scores_Fields
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'title' => 'Limiter la sélection aux établissements ayant un age spécifique',
|
||||
'unit' => 'an',
|
||||
),
|
||||
'age_entrep' => array(
|
||||
'label' => 'Age de l\'entreprise',
|
||||
@ -240,6 +229,7 @@ class Scores_Fields
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'title' => 'Limiter la sélection aux entreprises ayant un age spécifique',
|
||||
'unit' => 'an',
|
||||
),
|
||||
'teff_entrep' => array(
|
||||
'label' => "Tranche d'effectif de l'Entreprise",
|
||||
@ -852,25 +842,16 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
/**
|
||||
* Permet de supprimer une valeur dans une clef de session
|
||||
* @param string $key
|
||||
* @param mixed $valeur
|
||||
* @param int $pos
|
||||
* @param boolean $ex
|
||||
*/
|
||||
public function unsetCritereValue($key, $valeur) {
|
||||
|
||||
//@todo provisoir trouver une autre technique plus adapté.
|
||||
public function unsetCritereValue($key, $pos, $ex = false)
|
||||
{
|
||||
if(key_exists($key, $this->ciblage)) {
|
||||
$don = explode(',', $this->ciblage[$key]);
|
||||
foreach ($don as $val) {
|
||||
if($val == $valeur)
|
||||
$don[key($don)] = '';
|
||||
else
|
||||
$new[] = $val;
|
||||
}
|
||||
if(count($new) > 0) {
|
||||
$don = implode(',', $new);
|
||||
if(!empty($don))
|
||||
$this->ciblage[$key] = $don;
|
||||
if ($ex) {
|
||||
unset($this->ciblage[$key]['ex'][$pos]);
|
||||
} else {
|
||||
unset($this->ciblage[$key]);
|
||||
unset($this->ciblage[$key]['in'][$pos]);
|
||||
}
|
||||
$this->setSession();
|
||||
}
|
||||
@ -1074,24 +1055,38 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
}
|
||||
break;
|
||||
case 'interval':
|
||||
// de X à X [unités]
|
||||
return 'De '.number_format($values[0], null, ',', ' ')
|
||||
.' à '.number_format($values[1], null, ',', ' ');
|
||||
//@todo Gestion des unités
|
||||
$unit = '';
|
||||
if (array_key_exists('unit', $this->fields[$name])) {
|
||||
$unit = $this->fields[$name]['unit'];
|
||||
}
|
||||
//Max is not set
|
||||
if ($values[1]=='') {
|
||||
$label = "de ".$values[0]." ".$unit;
|
||||
if ($values[0]>1) $label.= "s";
|
||||
$label.=" et plus";
|
||||
//Min is not set
|
||||
} elseif ($values[0]=='') {
|
||||
$label = "jusqu'à ".$values[1]." ".$unit;
|
||||
if ($values[1]>1) $label.= "s";
|
||||
//Min Max are set
|
||||
} else {
|
||||
$label = 'de '.number_format($values[0], null, ',', ' ')." ".$unit;
|
||||
if ($values[0]>1) $label.= "s";
|
||||
$label.= ' à '.number_format($values[1], null, ',', ' ')." ".$unit;
|
||||
if ($values[1]>1) $label.= "s";
|
||||
}
|
||||
return $label;
|
||||
break;
|
||||
case 'intervalDate':
|
||||
// du XX/XX/XXXX au XX/XX/XXXX
|
||||
$date1 = substr($values[0],6,2).'/'.substr($values[0],4,2).'/'.substr($values[0],0,4);
|
||||
$date2 = substr($values[1],6,2).'/'.substr($values[1],4,2).'/'.substr($values[1],0,4);
|
||||
return 'Du '.$date1.' au '.$date2;
|
||||
return 'du '.$date1.' au '.$date2;
|
||||
break;
|
||||
case 'tree':
|
||||
$action = ucfirst($this->fields[$name]['fields'][$firstType]['action']);
|
||||
|
||||
return $this->{'getValueLabel'.$action}($values);
|
||||
|
||||
//Recherche des valeurs
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user