odea/application/controllers/CriteresController.php

73 lines
1.7 KiB
PHP
Raw Normal View History

2011-09-28 08:44:27 +00:00
<?php
class CriteresController extends Zend_Controller_Action
{
public function indexAction(){}
public function entrepriseAction()
{
//$this->_helper->layout()->disableLayout();
}
2011-10-26 18:33:01 +00:00
public function economiqueAction()
2011-09-28 08:44:27 +00:00
{
$this->_helper->layout()->disableLayout();
2011-11-08 19:51:54 +00:00
}
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);
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function geographiqueAction()
2011-09-28 08:44:27 +00:00
{
$this->_helper->layout()->disableLayout();
2011-11-07 13:20:19 +00:00
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$regionsM = new Application_Model_Regions();
2011-11-08 19:51:54 +00:00
//$sql = $regionsM->select();
2011-11-07 13:20:19 +00:00
$this->view->assign('regions', $regionsM->fetchAll()->toArray());
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function juridiqueAction()
2011-09-28 08:44:27 +00:00
{
$this->_helper->layout()->disableLayout();
}
2011-10-26 18:33:01 +00:00
public function financiereAction()
2011-09-28 08:44:27 +00:00
{
$this->_helper->layout()->disableLayout();
}
}