probleme svn
This commit is contained in:
parent
55e05fbe63
commit
2ab8d3e583
@ -6,16 +6,8 @@ class Object_Codepostaux extends Libs_Row
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$valeurs = explode(',', $session->getCritere($type));
|
||||
foreach ($valeurs as $valeur) {
|
||||
if(!empty($valeur)) {
|
||||
$return[] = $valeur;
|
||||
}
|
||||
}
|
||||
if(is_array($return)) {
|
||||
return ($return);
|
||||
}
|
||||
return (array($valeurs));
|
||||
$valeurs = $session->getCritere($type);
|
||||
return (substr($valeurs, 0, strlen($valeurs)-1));
|
||||
}
|
||||
|
||||
public function _jstree_undetermined($niveau, $type)
|
||||
@ -24,6 +16,7 @@ class Object_Codepostaux extends Libs_Row
|
||||
$session = new SessionCiblage();
|
||||
$table = new Table_Departements();
|
||||
$valeurs = explode(',', $session->getCritere($type));
|
||||
//print_r($valeurs);
|
||||
/*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/
|
||||
$in = array();
|
||||
|
||||
@ -52,11 +45,39 @@ class Object_Codepostaux extends Libs_Row
|
||||
|
||||
public function _getClass($valeur, $niveau)
|
||||
{
|
||||
$type = explode(':', $valeur);
|
||||
if(in_array($type[1], $this->_jstree_checked($type[0])))
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$valeurs = explode(',', $valeur);
|
||||
$key = ((strlen($valeur) < 5)?'adr_dept':'adr_com');
|
||||
$session = explode(',', $session->getCritere('adr_dept'));
|
||||
$row = 0;
|
||||
foreach ($session as $dept) {
|
||||
if(in_array($dept, $valeurs))
|
||||
$row++;
|
||||
}
|
||||
if($row == count($valeurs))
|
||||
return ('jstree-checked');
|
||||
else if($row > 0)
|
||||
return ('jstree-undetermined');
|
||||
|
||||
/*$type = explode(':', $valeur);
|
||||
if($type[1] == $this->_jstree_checked($type[0]))
|
||||
return ('jstree-checked');
|
||||
else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0])))
|
||||
return ('jstree-undetermined');
|
||||
return ('jstree-undetermined');*/
|
||||
}
|
||||
|
||||
protected function getDepartement($region)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('codeRegionInsee = '.$region);
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
$depts = array();
|
||||
foreach($result as $departement) {
|
||||
$depts[] = $departement['numdep'];
|
||||
}
|
||||
return (implode(',', $depts));
|
||||
}
|
||||
|
||||
/* Fonctions de construction de jstree */
|
||||
@ -69,9 +90,9 @@ class Object_Codepostaux extends Libs_Row
|
||||
foreach($regions as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom['REGION'].' '.$nom['NCCENR'],
|
||||
'attr' => array('id' => 'adr_reg:'.$nom['REGION'],
|
||||
'attr' => array('id' => $this->getDepartement($nom['REGION']),
|
||||
'niveau' => 0,
|
||||
'class' => $this->_getClass('adr_reg:'.$nom['REGION'], 0)
|
||||
'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
@ -82,18 +103,20 @@ class Object_Codepostaux extends Libs_Row
|
||||
|
||||
public function _getDepartements($codeRegionInsee)
|
||||
{
|
||||
$code = explode(':', $codeRegionInsee);
|
||||
//$code = explode(':', $codeRegionInsee);
|
||||
$departement = new Table_Departements();
|
||||
$departements = $departement->fetchAll($departement->select()
|
||||
->where('codeRegionInsee ='.$code[1]))->toArray();
|
||||
foreach(explode(',', $codeRegionInsee) as $dept) {
|
||||
$departements[] = $departement->fetchAll($departement->select()
|
||||
->where('numdep ='.$dept))->toArray();
|
||||
}
|
||||
$structure = array();
|
||||
|
||||
foreach($departements as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom['numdep'].' '.$nom['libdep'],
|
||||
'attr' => array('id' => 'adr_dept:'.$nom['numdep'],
|
||||
'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'],
|
||||
'attr' => array('id' => $nom[0]['numdep'],
|
||||
'niveau' => 1,
|
||||
'class' => $this->_getClass('adr_dept:'.$nom['numdep'], 1)
|
||||
'class' => $this->_getClass($nom[0]['numdep'], 1)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
@ -105,17 +128,18 @@ class Object_Codepostaux extends Libs_Row
|
||||
|
||||
public function _getCommunes($numdep)
|
||||
{
|
||||
$numdep = explode(':', $numdep);
|
||||
|
||||
//$numdep = explode(':', $numdep);
|
||||
$codepostau = new Table_Codepostauxs();
|
||||
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep[1].'%"'))->toArray();
|
||||
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
|
||||
$structure = array();
|
||||
|
||||
foreach($codepostaux as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom['Codepos'].' '.$nom['Commune'],
|
||||
'attr' => array('id'=> 'adr_com:'.$nom['INSEE'],
|
||||
'attr' => array('id'=> $nom['INSEE'],
|
||||
'niveau' => 2,
|
||||
'class' => $this->_getClass('adr_com:'.$nom['INSEE'], 2)
|
||||
'class' => $this->_getClass($nom['INSEE'], 2)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
|
@ -8,6 +8,7 @@ class Object_Naf extends Libs_Row
|
||||
$val = $sessionCiblage->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = explode(',',$val);
|
||||
foreach($valuesChecked as $value){
|
||||
|
Loading…
Reference in New Issue
Block a user