Suppression NAF
This commit is contained in:
parent
2df7ad11d1
commit
4f09096385
@ -12,9 +12,7 @@ class CriteresController extends Zend_Controller_Action
|
|||||||
|
|
||||||
public function indexAction(){}
|
public function indexAction(){}
|
||||||
|
|
||||||
public function entrepriseAction(){
|
public function entrepriseAction(){}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function economiqueAction(){}
|
public function economiqueAction(){}
|
||||||
|
|
||||||
@ -24,40 +22,4 @@ class CriteresController extends Zend_Controller_Action
|
|||||||
|
|
||||||
public function financiereAction(){}
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user