getValueLabelGeographique
This commit is contained in:
parent
6e6647c4d8
commit
389509d700
@ -941,11 +941,34 @@ class Scores_Fields
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
public function getValueLabelGeographique($values)
|
||||
{
|
||||
sort($values);
|
||||
|
||||
$out = array();
|
||||
|
||||
foreach ( $values as $item ) {
|
||||
switch( substr($item,0,1) ) {
|
||||
case 'C':
|
||||
$communeM = new Application_Model_CodePostaux();
|
||||
$sql = $communeM->select()->from($communeM, array('Commune'))->where('INSEE = ?', substr($item, 1));
|
||||
$result = $communeM->fetchAll($sql)->toArray();
|
||||
$out[] = $result[0]['Commune'];
|
||||
break;
|
||||
case 'D':
|
||||
$departementsM = new Application_Model_Departements();
|
||||
$sql = $departementsM->select()->from($departementsM, array('libdep'))->where('numdep = ?', substr($item, 1));
|
||||
$result = $departementsM->fetchAll($sql)->toArray();
|
||||
$out[] = $result[0]['libdep'];
|
||||
break;
|
||||
case 'R':
|
||||
$regionsM = new Application_Model_Departements();
|
||||
$sql = $regions->select()->from($regionsM, array('NCCENR'))->where('REGION = ?', substr($item,1));
|
||||
$result = $regionsM->fetchAll($sql)->toArray();
|
||||
$out[] = $result[0]['NCCENR'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user