Retrait de l'ajax dans les onglets

This commit is contained in:
Michael RICOIS 2012-01-02 19:14:04 +00:00
parent dc2a686e0e
commit a9838cd5a5
5 changed files with 61 additions and 64 deletions

View File

@ -1,7 +1,6 @@
<?php <?php
class CriteresController extends Zend_Controller_Action class CriteresController extends Zend_Controller_Action
{ {
public function indexAction(){}
protected $entreprise = array('siege', 'sirenGrp', 'tel', 'fax', 'web', 'mail', 'presentRcs', 'adrDom', 'dirNom', 'lieuAct', 'nbMPubli', 'dateCrea_ent', 'dateCrea_etab', 'nbActio', 'nbPart'); protected $entreprise = array('siege', 'sirenGrp', 'tel', 'fax', 'web', 'mail', 'presentRcs', 'adrDom', 'dirNom', 'lieuAct', 'nbMPubli', 'dateCrea_ent', 'dateCrea_etab', 'nbActio', 'nbPart');
protected $economique = array('ape_etab', 'ape_entrep', 'NaceEtab', 'NaceEntrep', 'age_etab', 'age_entrep', 'teff_entrep', 'teff_etab', 'nbEtab', 'eff_entrep', 'eff_etab', 'capital'); protected $economique = array('ape_etab', 'ape_entrep', 'NaceEtab', 'NaceEntrep', 'age_etab', 'age_entrep', 'teff_entrep', 'teff_etab', 'nbEtab', 'eff_entrep', 'eff_etab', 'capital');
protected $geographique = array('adr_cp', 'adr_dep', 'adr_com'); protected $geographique = array('adr_cp', 'adr_dep', 'adr_com');
@ -17,6 +16,8 @@ class CriteresController extends Zend_Controller_Action
return ($array); return ($array);
} }
public function indexAction(){}
public function entrepriseAction() public function entrepriseAction()
{ {
$champs = array(array('name' => 'siege', 'libelle' => 'Siège', 'type' => 'select', 'parametres' => array('Etablissement' => '0', 'Siege' => '1')), $champs = array(array('name' => 'siege', 'libelle' => 'Siège', 'type' => 'select', 'parametres' => array('Etablissement' => '0', 'Siege' => '1')),
@ -42,7 +43,6 @@ class CriteresController extends Zend_Controller_Action
public function economiqueAction() public function economiqueAction()
{ {
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'ape_etab', 'libelle' => 'Code NAF Etablissement', 'type' => 'text'), $champs = array(array('name' => 'ape_etab', 'libelle' => 'Code NAF Etablissement', 'type' => 'text'),
array('name' => 'ou'), array('name' => 'ou'),
array('name' => 'ape_etab', 'libelle' => 'Liste Code NAF Etablissement', 'type' => 'textarea'), array('name' => 'ape_etab', 'libelle' => 'Liste Code NAF Etablissement', 'type' => 'textarea'),
@ -67,45 +67,9 @@ class CriteresController extends Zend_Controller_Action
$this->view->champs = $champs; $this->view->champs = $champs;
} }
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);
}
public function geographiqueAction() public function geographiqueAction()
{ {
$this->_helper->layout()->disableLayout(); //$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js'); $this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$champs = array(array('name' => 'adr_cp', 'libelle' => 'Code postal', 'type' => 'text'), $champs = array(array('name' => 'adr_cp', 'libelle' => 'Code postal', 'type' => 'text'),
array('name' => 'ou'), array('name' => 'ou'),
@ -122,7 +86,6 @@ class CriteresController extends Zend_Controller_Action
public function juridiqueAction() public function juridiqueAction()
{ {
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'cj', 'libelle' => 'Forme Juridique', 'type' => 'select', 'parametres' => array('1' => '1', '2' => '2', '3' => '3')), $champs = array(array('name' => 'cj', 'libelle' => 'Forme Juridique', 'type' => 'select', 'parametres' => array('1' => '1', '2' => '2', '3' => '3')),
array('name' => 'actifEco', 'libelle' => 'Établissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')), array('name' => 'actifEco', 'libelle' => 'Établissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'procolHisto', 'libelle' => 'Présence d\'une procédure collective dans l\'histo.', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')), array('name' => 'procolHisto', 'libelle' => 'Présence d\'une procédure collective dans l\'histo.', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
@ -135,7 +98,6 @@ class CriteresController extends Zend_Controller_Action
public function financiereAction() public function financiereAction()
{ {
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'bilType', 'libelle' => 'Type du dernier bilan', 'type' => 'select', 'parametres' => array('Inconnue' => 'I', 'Estimé' => 'E', 'Réel' => 'R')), $champs = array(array('name' => 'bilType', 'libelle' => 'Type du dernier bilan', 'type' => 'select', 'parametres' => array('Inconnue' => 'I', 'Estimé' => 'E', 'Réel' => 'R')),
array('name' => 'avisCs', 'libelle' => 'Informations de paiements', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(50)), array('name' => 'avisCs', 'libelle' => 'Informations de paiements', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(50)),
array('name' => 'bilDuree', 'libelle' => 'Durée du dernier bilan en mois', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(9)), array('name' => 'bilDuree', 'libelle' => 'Durée du dernier bilan en mois', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(9)),
@ -160,4 +122,40 @@ class CriteresController extends Zend_Controller_Action
$this->view->champs = $champs; $this->view->champs = $champs;
} }
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);
}
} }

View File

@ -3,7 +3,7 @@
$valeur = explode(':', $champ['type']); $valeur = explode(':', $champ['type']);
switch ($valeur[0]) { switch ($valeur[0]) {
case 'select': case 'select':
echo $this->SelectBilan($champ['name'], $champ['libelle'], $champ['parametres']); //echo $this->SelectBilan($champ['name'], $champ['libelle'], $champ['parametres']);
break; break;
case 'interval': case 'interval':
echo $this->Interval($champ['name'], $champ['libelle'], (isset($valeur[1])?$valeur[1]:false)); echo $this->Interval($champ['name'], $champ['libelle'], (isset($valeur[1])?$valeur[1]:false));

View File

@ -25,20 +25,4 @@
<div id="attente" style="display:none;"> <div id="attente" style="display:none;">
<img src="/themes/default/images/ajax.gif" /> <img src="/themes/default/images/ajax.gif" />
</div> </div>
</div> </div>
<script>
$(function() {
$( "#tabs" ).tabs({
cache: true,
cookie: {
expires: 1
},
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("Erreur lors du chargement...");
}
}
});
});
</script>

View File

@ -4,14 +4,26 @@
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">Critères Entreprise</a></li> <li><a href="#tabs-1">Critères Entreprise</a></li>
<li><a href="<?=$this->url(array('controller'=>'criteres', 'action'=>'economique'))?>">Situation économique</a></li> <li><a href="#tabs-2">Situation économique</a></li>
<li><a href="<?=$this->url(array('controller'=>'criteres', 'action'=>'geographique'))?>">Secteur géographique</a></li> <li><a href="#tabs-3">Secteur géographique</a></li>
<li><a href="<?=$this->url(array('controller'=>'criteres', 'action'=>'juridique'))?>">Situation juridique</a></li> <li><a href="#tabs-4">Situation juridique</a></li>
<li><a href="<?=$this->url(array('controller'=>'criteres', 'action'=>'financiere'))?>">Situation financière</a></li> <li><a href="#tabs-5">Situation financière</a></li>
</ul> </ul>
<div id="tabs-1"> <div id="tabs-1">
<?=$this->action('entreprise', 'criteres')?> <?=$this->action('entreprise', 'criteres')?>
</div> </div>
<div id="tabs-2">
<?=$this->action('economique', 'criteres')?>
</div>
<div id="tabs-3">
<?=$this->action('geographique', 'criteres')?>
</div>
<div id="tabs-4">
<?=$this->action('juridique', 'criteres')?>
</div>
<div id="tabs-5">
<?=$this->action('financiere', 'criteres')?>
</div>
</div> </div>
<script> <script>

View File

@ -1,5 +1,9 @@
$(document).ready(function(){ $(document).ready(function(){
$( "#tabs" ).tabs({
cookie: { expires: 1 },
});
$(".tooltip").each(function(){ $(".tooltip").each(function(){
var title = $(this).attr('title'); var title = $(this).attr('title');
var width = $(this).attr('wdth'); var width = $(this).attr('wdth');
@ -61,7 +65,6 @@ $(document).ready(function(){
} }
}); });
$( ".datepicker" ).datepicker();
$( ".datepicker" ).datepicker( "option", "dateFormat", "yymmdd" ); $( ".datepicker" ).datepicker( "option", "dateFormat", "yymmdd" );
$('.printCritere').click(function(){ $('.printCritere').click(function(){