Suppression NAF

This commit is contained in:
Michael RICOIS 2012-01-16 20:26:45 +00:00
parent 2df7ad11d1
commit 4f09096385

View File

@ -12,9 +12,7 @@ class CriteresController extends Zend_Controller_Action
public function indexAction(){}
public function entrepriseAction(){
}
public function entrepriseAction(){}
public function economiqueAction(){}
@ -24,40 +22,4 @@ class CriteresController extends Zend_Controller_Action
public function financiereAction(){}
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$niveau = $request->getParam('niveau', 1);
$parent = $request->getParam('parent', '');
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
$niveau++;
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
$sql->where("code LIKE '".$parent."%'");
}
$sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$naf = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if ($niveau<5){
$naf['state'] = 'closed';
$naf['children'] = array();
}
$tabNaf[] = $naf;
}
echo json_encode($tabNaf);
}
}