Rappel des critères dans l'arborescence

This commit is contained in:
Michael RICOIS 2012-05-16 14:16:58 +00:00
parent 95f1d2054d
commit fc600f3be2

View File

@ -201,8 +201,8 @@ class ArborescenceController extends Zend_Controller_Action
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
//$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getGeoParent($value));
}
}
}
@ -269,17 +269,15 @@ class ArborescenceController extends Zend_Controller_Action
protected function getGeoParent($code)
{
if (susbtr($code,0,1)=='D') {
if (substr($code,0,1)=='D') {
$departementsM = new Application_Model_Departements();
$sql = $departementsM->select()
->from($departementsM, array('codeRegionInsee'))
->where('numdep = ?', substr($code,1));
$departements = $departementsM->fetchRow($sql);
$departement = $departementsM->fetchRow($sql);
Zend_Registry::get('firebug')->info($departements);
return array('R'.$departements->codeRegionInsee);
return array('R'.$departement->codeRegionInsee);
} elseif ( substr($code,0,1)=='C' ) {
@ -289,8 +287,13 @@ class ArborescenceController extends Zend_Controller_Action
->where('INSEE = ?', substr($code,1));
$commune = $codePostauxM->fetchRow($sql);
return array('D'.substr($commune->Codepos,0,2));
$departement = 'D'.substr($commune->Codepos,0,2);
$region = $this->getGeoParent($departement);
return array_merge(array($departement), $region);
}
return array();
}