odea/application/controllers/CriteresController.php
Michael RICOIS bf4ad53075 Ajout
2011-11-29 15:53:05 +00:00

73 lines
1.7 KiB
PHP

<?php
class CriteresController extends Zend_Controller_Action
{
public function indexAction(){}
public function entrepriseAction()
{
//$this->_helper->layout()->disableLayout();
}
public function economiqueAction()
{
$this->_helper->layout()->disableLayout();
}
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$niveau = $request->getParam('niveau', 1);
$niveau++;
$parent = $request->getParam('parent', '');
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
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);
}
public function geographiqueAction()
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$regionsM = new Application_Model_Regions();
//$sql = $regionsM->select();
$this->view->assign('regions', $regionsM->fetchAll()->toArray());
}
public function juridiqueAction()
{
$this->_helper->layout()->disableLayout();
}
public function financiereAction()
{
$this->_helper->layout()->disableLayout();
}
}