1 |
vpihour |
632 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 08/11/2012 14:00 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/demande.class.php"); |
6 |
|
|
|
7 |
|
|
class demande extends demande_gen { |
8 |
|
|
|
9 |
nhaye |
807 |
var $valIdDemandeur; |
10 |
|
|
|
11 |
vpihour |
632 |
function demande($id,&$db,$debug) { |
12 |
|
|
$this->constructeur($id,$db,$debug); |
13 |
|
|
}// fin constructeur |
14 |
vpihour |
651 |
|
15 |
vpihour |
799 |
/* |
16 |
|
|
* La date du jour par défaut dans le champs date_demande |
17 |
|
|
* Put the date of the day by default into the field date_demande |
18 |
|
|
*/ |
19 |
vpihour |
635 |
function setVal(&$form, $maj, $validation, &$db) { |
20 |
|
|
if($maj == 0) { |
21 |
|
|
$form->setVal("date_demande",date('d/m/Y')); |
22 |
|
|
} |
23 |
|
|
} |
24 |
|
|
|
25 |
vpihour |
799 |
/* |
26 |
|
|
* Ajout du fielset |
27 |
|
|
* Add fieldset |
28 |
|
|
*/ |
29 |
vpihour |
635 |
function setLayout(&$form, $maj){ |
30 |
|
|
if ( $maj < 2 OR $maj == 3 ) { |
31 |
|
|
|
32 |
|
|
//Champs sur lequel s'ouvre le fieldset |
33 |
nhaye |
807 |
$form->setBloc('dossier_autorisation_type_detaille','D',"","dossier_type col_8"); |
34 |
|
|
|
35 |
|
|
$form->setFieldset('dossier_autorisation_type_detaille','D' |
36 |
|
|
,_('Type de dossier/demande')); |
37 |
|
|
$form->setFieldset('demande_type','F',''); |
38 |
|
|
|
39 |
|
|
$form->setBloc('demande_type','F'); |
40 |
|
|
|
41 |
|
|
$form->setBloc('date_demande','D',"","col_4 demande_hidden_bloc"); |
42 |
|
|
$form->setFieldset('date_demande','D',_('Date de la demande')); |
43 |
|
|
$form->setFieldset('date_demande','F',''); |
44 |
vpihour |
635 |
$form->setBloc('date_demande','F'); |
45 |
|
|
|
46 |
nhaye |
807 |
$form->setBloc('terrain_references_cadastrales','D',"", |
47 |
|
|
"localisation col_12 demande_hidden_bloc"); |
48 |
vpihour |
693 |
$form->setFieldset('terrain_references_cadastrales','D',_('Localisation du terrain')); |
49 |
|
|
$form->setFieldset('terrain_superficie','F',''); |
50 |
vpihour |
635 |
$form->setBloc('terrain_superficie','F'); |
51 |
vpihour |
676 |
|
52 |
nhaye |
807 |
$form->setBloc('nombre_lots','D',"","lots col_12 demande_hidden_bloc"); |
53 |
vpihour |
693 |
$form->setFieldset('nombre_lots','D',_('Nombre de lots')); |
54 |
|
|
$form->setFieldset('nombre_lots','F',''); |
55 |
vpihour |
676 |
$form->setBloc('nombre_lots','F'); |
56 |
vpihour |
635 |
} |
57 |
|
|
} |
58 |
vpihour |
641 |
|
59 |
vpihour |
799 |
/* |
60 |
|
|
* Ajoute des actions sur les deux premiers select |
61 |
|
|
* Add actions on the two first select |
62 |
|
|
*/ |
63 |
vpihour |
641 |
function setOnchange(&$form,$maj){ |
64 |
|
|
parent::setOnchange($form,$maj); |
65 |
|
|
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
66 |
|
|
$form->setOnchange("demande_type","showFormsDemande();"); |
67 |
|
|
} |
68 |
vpihour |
635 |
|
69 |
vpihour |
799 |
/* |
70 |
|
|
* Cache le champ terrain_references_cadastrales |
71 |
|
|
* Hide the fiels terrain_references_cadastrales |
72 |
|
|
*/ |
73 |
vpihour |
651 |
function setType(&$form,$maj) { |
74 |
|
|
parent::setType($form,$maj); |
75 |
|
|
|
76 |
vpihour |
689 |
$form->setType('dossier_instruction', 'hidden'); |
77 |
|
|
$form->setType('dossier_autorisation', 'hidden'); |
78 |
vpihour |
651 |
} |
79 |
vpihour |
676 |
|
80 |
nhaye |
807 |
/** |
81 |
|
|
* Méthode permettant de récupérer les id des demandeur lié à la demande |
82 |
|
|
**/ |
83 |
|
|
function getValIdDemandeur() { |
84 |
|
|
if( $validation > 0 ) { |
85 |
|
|
foreach($_POST as $champ => $val) { |
86 |
|
|
if(!in_array($champ, $this->champs)) { |
87 |
|
|
$this->valIdDemandeur[$champ]=$val; |
88 |
|
|
} |
89 |
|
|
} |
90 |
|
|
} elseif( $maj > 0 ) { |
91 |
|
|
$sql = "SELECT demandeur, petitionnaire_principal |
92 |
|
|
FROM lien_demande_demandeur |
93 |
|
|
WHERE demande = ".$this->val[array_search('demande', $this->champs)]; |
94 |
|
|
$res = $f->db->query($sql); |
95 |
|
|
$f->isDatabaseError($res); |
96 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
97 |
|
|
$this->valIdDemandeur[$row['demande']]=$row['petitionnaire_principal']; |
98 |
|
|
} |
99 |
|
|
} |
100 |
vpihour |
676 |
} |
101 |
nhaye |
807 |
|
102 |
|
|
/** |
103 |
|
|
* Ajout de la liste des demandeurs |
104 |
|
|
*/ |
105 |
|
|
function formSpecificContent($maj) { |
106 |
|
|
// Conteneur de la listes des demandeurs |
107 |
nhaye |
808 |
echo "<div class=\"demande_hidden_bloc col_12\">"; |
108 |
nhaye |
807 |
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">"; |
109 |
|
|
echo " <legend class=\"ui-corner-all ui-widget-content ui-state-active\">" |
110 |
|
|
._("Petitionnaire")."</legend>"; |
111 |
|
|
// Si des demandeurs sont liés à la demande |
112 |
|
|
if( count($this->valIdDemandeur) > 0 ) { |
113 |
|
|
|
114 |
|
|
} else { |
115 |
|
|
// Bouton d'ajout du pétitionnaire principal |
116 |
|
|
echo "<input id=\"add_petitionnaire_principal\" |
117 |
|
|
class=\"ui-button ui-widget ui-state-default ui-corner-all\" |
118 |
|
|
type=\"button\" value=\""._("Saisir le petitionnaire principal")."\"/>"; |
119 |
|
|
} |
120 |
|
|
echo "</fieldset>"; |
121 |
|
|
echo "</div>"; |
122 |
|
|
} |
123 |
|
|
|
124 |
vpihour |
632 |
}// fin classe |
125 |
|
|
?> |