2011-12-14 13:55:57 +01:00
|
|
|
<?php
|
|
|
|
class SessionCiblage
|
|
|
|
{
|
2011-12-29 22:06:17 +01:00
|
|
|
protected $criteres = array(
|
|
|
|
'nbMPubli' , 'dirNom', 'lieuAct', 'adrDom', 'siege', 'adr_cp', 'adr_dep', 'adr_com', 'tel', 'fax', 'cj', 'capital', 'ape_etab', 'ape_entrep', 'age_entrep',
|
|
|
|
'age_etab', 'tcaexp', 'teff_entrep', 'teff_etab', 'rang', 'actifEco', 'presentRcs', 'procolHisto', 'tvaIntraValide',
|
|
|
|
'NaceEtab', 'NaceEntrep', 'dateCrea_etab', 'dateCrea_ent', 'dateImmat', 'eff_entrep', 'eff_etab', 'rivoli', 'nbEtab',
|
|
|
|
'sirenGrp', 'nbActio', 'nbPart', 'bilType', 'bilAnnee', 'avisCs', 'bilTca', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF', 'bilGP',
|
|
|
|
'bilGU', 'bilGW', 'bilHD', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'bilFS', 'bilGG', 'bilGV', 'bilHI'
|
2011-12-14 15:40:55 +01:00
|
|
|
);
|
|
|
|
protected $valeur;
|
2011-12-29 22:06:17 +01:00
|
|
|
protected $total = null;
|
|
|
|
protected $insee = null;
|
2011-12-14 13:55:57 +01:00
|
|
|
|
2011-12-14 15:40:55 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$session = new Zend_Session_Namespace('ciblage');
|
|
|
|
$this->valeur = $session->ciblage;
|
2011-12-29 22:06:17 +01:00
|
|
|
if (isset($this->valeur['NB']['total'])){ $this->total = $this->valeur['NB']['total']; }
|
|
|
|
if (isset($this->valeur['NB']['insee'])){ $this->insee = $this->valeur['NB']['insee']; }
|
|
|
|
if (isset($this->valeur['NB'])){ unset($this->valeur['NB']); }
|
2011-12-14 15:40:55 +01:00
|
|
|
}
|
2011-12-14 13:55:57 +01:00
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Enregistre les informations dans la session
|
|
|
|
*/
|
2011-12-14 15:40:55 +01:00
|
|
|
protected function setSession()
|
|
|
|
{
|
2011-12-29 22:06:17 +01:00
|
|
|
$session = new Zend_Session_Namespace('ciblage');
|
|
|
|
$this->valeur['NB']['total'] = $this->total;
|
|
|
|
$this->valeur['NB']['insee'] = $this->insee;
|
|
|
|
$session->ciblage = $this->valeur;
|
2011-12-14 15:40:55 +01:00
|
|
|
}
|
2011-12-29 22:10:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enregistre un critère et sa valeur
|
|
|
|
* @param unknown_type $key
|
|
|
|
* @param unknown_type $value
|
|
|
|
*/
|
2011-12-14 15:40:55 +01:00
|
|
|
public function setCritere($key, $value)
|
|
|
|
{
|
|
|
|
if(in_array($key, $this->criteres)) {
|
2011-12-15 10:48:45 +01:00
|
|
|
$this->valeur[$key] = $value;
|
2011-12-14 15:40:55 +01:00
|
|
|
$this->setSession();
|
|
|
|
}
|
|
|
|
}
|
2011-12-14 13:55:57 +01:00
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Définir les critères en une fois
|
|
|
|
* @param array $criteres
|
|
|
|
*/
|
2011-12-14 15:40:55 +01:00
|
|
|
public function setCriteres($criteres){}
|
2011-12-14 13:55:57 +01:00
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Désactivation d'un critère
|
|
|
|
* @param unknown_type $key
|
|
|
|
*/
|
2011-12-14 15:40:55 +01:00
|
|
|
public function unsetCritere($key)
|
|
|
|
{
|
|
|
|
if(key_exists($key, $this->valeur)) {
|
|
|
|
unset($this->valeur[$key]);
|
|
|
|
$this->setSession();
|
|
|
|
}
|
|
|
|
}
|
2011-12-29 22:10:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Récupération de la valeur d'un critère
|
|
|
|
* @param unknown_type $key
|
|
|
|
*/
|
2011-12-29 21:33:23 +01:00
|
|
|
public function getCritere($key)
|
2011-12-14 15:40:55 +01:00
|
|
|
{
|
2011-12-29 21:35:08 +01:00
|
|
|
if(in_array($key, $this->criteres) && in_array($key, $this->valeur)) {
|
2011-12-29 21:33:23 +01:00
|
|
|
return $this->valeur[$key];
|
|
|
|
}
|
|
|
|
return null;
|
2011-12-14 15:40:55 +01:00
|
|
|
}
|
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Récupération des critères et de leurs valeurs
|
|
|
|
*/
|
2011-12-14 15:40:55 +01:00
|
|
|
public function getCriteres()
|
|
|
|
{
|
2011-12-29 21:33:23 +01:00
|
|
|
return $this->valeur;
|
2011-12-14 15:40:55 +01:00
|
|
|
}
|
2011-12-29 22:06:17 +01:00
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Définit un élément de comptage
|
|
|
|
* @param unknown_type $element
|
|
|
|
* @param unknown_type $nb
|
|
|
|
*/
|
2011-12-29 22:06:17 +01:00
|
|
|
public function setNb($element, $nb)
|
|
|
|
{
|
|
|
|
$this->{$element} = $nb;
|
|
|
|
$this->setSession();
|
|
|
|
}
|
|
|
|
|
2011-12-29 22:10:23 +01:00
|
|
|
/**
|
|
|
|
* Récupére la valeur d'un élément de comptage
|
|
|
|
* @param unknown_type $element
|
|
|
|
*/
|
2011-12-29 22:06:17 +01:00
|
|
|
public function getNb($element)
|
|
|
|
{
|
|
|
|
return $this->{$element};
|
|
|
|
}
|
|
|
|
|
2011-12-14 13:55:57 +01:00
|
|
|
}
|