2012-02-02 17:29:14 +00:00
|
|
|
<?php
|
2012-05-02 18:19:07 +00:00
|
|
|
class JuridiqueController extends Zend_Controller_Action
|
2012-02-02 17:29:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
/* Initialize action controller here */
|
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2012-05-11 12:26:16 +00:00
|
|
|
$field = new Scores_Fields();
|
2012-02-02 17:29:14 +00:00
|
|
|
$this->view->fields = $field;
|
|
|
|
}
|
|
|
|
|
2012-02-15 09:25:21 +00:00
|
|
|
public function resetAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender();
|
2012-05-14 08:02:57 +00:00
|
|
|
$fields = new Scores_Fields();
|
|
|
|
$fields->resetFamille('juridique');
|
2012-02-15 09:25:21 +00:00
|
|
|
}
|
2012-02-24 14:59:27 +00:00
|
|
|
|
|
|
|
public function completedAction()
|
|
|
|
{
|
2012-05-10 12:32:57 +00:00
|
|
|
$table = new Application_Model_FormeJuridique();
|
2012-02-24 14:59:27 +00:00
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
$request = $this->getRequest();
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-05-14 13:16:14 +00:00
|
|
|
$q = strtolower($request->getParam('q'));
|
|
|
|
|
|
|
|
$separator = ' , ';
|
|
|
|
|
2012-02-24 14:59:27 +00:00
|
|
|
$sql = $table->select()
|
2012-05-14 13:16:14 +00:00
|
|
|
->where('LOWER(fjLibelle) LIKE "%'.$q.'%"')
|
|
|
|
->where('LENGTH(fjCode) = 4');
|
2012-02-24 14:59:27 +00:00
|
|
|
$result = $table->fetchAll($sql);
|
|
|
|
foreach ($result as $item) {
|
|
|
|
$output[] = array(
|
|
|
|
'label' => $item->fjLibelle . $separator . $item->fjCode,
|
|
|
|
'value' => $item->fjCode
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo json_encode($output);
|
|
|
|
}
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|