1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 13/02/2013 14:41 |
4 |
|
5 |
require_once ("../gen/obj/donnees_techniques.class.php"); |
6 |
|
7 |
class donnees_techniques extends donnees_techniques_gen { |
8 |
|
9 |
var $cerfa; // Instance de la classe cerfa |
10 |
|
11 |
function donnees_techniques($id,&$db,$debug) { |
12 |
$this->constructeur($id,$db,$debug); |
13 |
}// fin constructeur |
14 |
|
15 |
|
16 |
/** |
17 |
* Méthode permettant de récupérer l'id du cerfa lié au dossier |
18 |
**/ |
19 |
function getCerfa(){ |
20 |
|
21 |
$sql = "SELECT cerfa FROM ".DB_PREFIXE."dossier_instruction_type |
22 |
JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type= |
23 |
dossier_instruction_type.dossier_instruction_type |
24 |
WHERE dossier = '".$this->getParameter("idxformulaire")."'"; |
25 |
$cerfa = $this->db->getOne($sql); |
26 |
$this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
27 |
$this->f->isDatabaseError($cerfa); |
28 |
|
29 |
// Si le cerfa est défini dans dossier on instancie le cerfa correspondant |
30 |
if(!empty($cerfa)) { |
31 |
require_once ("../obj/cerfa.class.php"); |
32 |
$this->cerfa = new cerfa($cerfa, $this->db, DEBUG); |
33 |
} else { |
34 |
$this->f->displayMessage("error", _("Aucun cerfa lié à ce type de dossier")); |
35 |
die(); |
36 |
} |
37 |
} |
38 |
|
39 |
function setSelect(&$form, $maj,&$db,$debug) { |
40 |
parent::setSelect($form, $maj,$db,$debug); |
41 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
42 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
43 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
44 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
45 |
|
46 |
if(empty($this->cerfa)) { |
47 |
$this->getCerfa(); |
48 |
} |
49 |
|
50 |
// Test si un tableau de surface a été défini |
51 |
if ( $this->cerfa->getVal("tab_surface") != "" ){ |
52 |
|
53 |
// Configuration du tableau des surfaces |
54 |
$contenu['column_header']=$tab_surface[$this->cerfa->getVal("tab_surface")]['column_header']; |
55 |
$contenu['row_header']=$tab_surface[$this->cerfa->getVal("tab_surface")]['row_header']; |
56 |
|
57 |
foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) { |
58 |
$contenu['values'][$champ] = $this->getVal($champ); |
59 |
} |
60 |
|
61 |
$form->setSelect("tab_surface",$contenu); |
62 |
} |
63 |
|
64 |
} |
65 |
|
66 |
|
67 |
// XXX Créer une nouvelle méthode au même endroit que l'appel a checkAccessibility() |
68 |
function checkAccessibility() { |
69 |
|
70 |
unset($this->champs[array_search("su_avt_shon1",$this->champs)]); |
71 |
unset($this->champs[array_search("su_avt_shon2",$this->champs)]); |
72 |
unset($this->champs[array_search("su_avt_shon3",$this->champs)]); |
73 |
unset($this->champs[array_search("su_avt_shon4",$this->champs)]); |
74 |
unset($this->champs[array_search("su_avt_shon5",$this->champs)]); |
75 |
unset($this->champs[array_search("su_avt_shon6",$this->champs)]); |
76 |
unset($this->champs[array_search("su_avt_shon7",$this->champs)]); |
77 |
unset($this->champs[array_search("su_avt_shon8",$this->champs)]); |
78 |
unset($this->champs[array_search("su_avt_shon9",$this->champs)]); |
79 |
unset($this->champs[array_search("su_cstr_shon1",$this->champs)]); |
80 |
unset($this->champs[array_search("su_cstr_shon2",$this->champs)]); |
81 |
unset($this->champs[array_search("su_cstr_shon3",$this->champs)]); |
82 |
unset($this->champs[array_search("su_cstr_shon4",$this->champs)]); |
83 |
unset($this->champs[array_search("su_cstr_shon5",$this->champs)]); |
84 |
unset($this->champs[array_search("su_cstr_shon6",$this->champs)]); |
85 |
unset($this->champs[array_search("su_cstr_shon7",$this->champs)]); |
86 |
unset($this->champs[array_search("su_cstr_shon8",$this->champs)]); |
87 |
unset($this->champs[array_search("su_cstr_shon9",$this->champs)]); |
88 |
unset($this->champs[array_search("su_trsf_shon1",$this->champs)]); |
89 |
unset($this->champs[array_search("su_trsf_shon2",$this->champs)]); |
90 |
unset($this->champs[array_search("su_trsf_shon3",$this->champs)]); |
91 |
unset($this->champs[array_search("su_trsf_shon4",$this->champs)]); |
92 |
unset($this->champs[array_search("su_trsf_shon5",$this->champs)]); |
93 |
unset($this->champs[array_search("su_trsf_shon6",$this->champs)]); |
94 |
unset($this->champs[array_search("su_trsf_shon7",$this->champs)]); |
95 |
unset($this->champs[array_search("su_trsf_shon8",$this->champs)]); |
96 |
unset($this->champs[array_search("su_trsf_shon9",$this->champs)]); |
97 |
unset($this->champs[array_search("su_chge_shon1",$this->champs)]); |
98 |
unset($this->champs[array_search("su_chge_shon2",$this->champs)]); |
99 |
unset($this->champs[array_search("su_chge_shon3",$this->champs)]); |
100 |
unset($this->champs[array_search("su_chge_shon4",$this->champs)]); |
101 |
unset($this->champs[array_search("su_chge_shon5",$this->champs)]); |
102 |
unset($this->champs[array_search("su_chge_shon6",$this->champs)]); |
103 |
unset($this->champs[array_search("su_chge_shon7",$this->champs)]); |
104 |
unset($this->champs[array_search("su_chge_shon8",$this->champs)]); |
105 |
unset($this->champs[array_search("su_chge_shon9",$this->champs)]); |
106 |
unset($this->champs[array_search("su_demo_shon1",$this->champs)]); |
107 |
unset($this->champs[array_search("su_demo_shon2",$this->champs)]); |
108 |
unset($this->champs[array_search("su_demo_shon3",$this->champs)]); |
109 |
unset($this->champs[array_search("su_demo_shon4",$this->champs)]); |
110 |
unset($this->champs[array_search("su_demo_shon5",$this->champs)]); |
111 |
unset($this->champs[array_search("su_demo_shon6",$this->champs)]); |
112 |
unset($this->champs[array_search("su_demo_shon7",$this->champs)]); |
113 |
unset($this->champs[array_search("su_demo_shon8",$this->champs)]); |
114 |
unset($this->champs[array_search("su_demo_shon9",$this->champs)]); |
115 |
unset($this->champs[array_search("su_sup_shon1",$this->champs)]); |
116 |
unset($this->champs[array_search("su_sup_shon2",$this->champs)]); |
117 |
unset($this->champs[array_search("su_sup_shon3",$this->champs)]); |
118 |
unset($this->champs[array_search("su_sup_shon4",$this->champs)]); |
119 |
unset($this->champs[array_search("su_sup_shon5",$this->champs)]); |
120 |
unset($this->champs[array_search("su_sup_shon6",$this->champs)]); |
121 |
unset($this->champs[array_search("su_sup_shon7",$this->champs)]); |
122 |
unset($this->champs[array_search("su_sup_shon8",$this->champs)]); |
123 |
unset($this->champs[array_search("su_sup_shon9",$this->champs)]); |
124 |
unset($this->champs[array_search("su_tot_shon1",$this->champs)]); |
125 |
unset($this->champs[array_search("su_tot_shon2",$this->champs)]); |
126 |
unset($this->champs[array_search("su_tot_shon3",$this->champs)]); |
127 |
unset($this->champs[array_search("su_tot_shon4",$this->champs)]); |
128 |
unset($this->champs[array_search("su_tot_shon5",$this->champs)]); |
129 |
unset($this->champs[array_search("su_tot_shon6",$this->champs)]); |
130 |
unset($this->champs[array_search("su_tot_shon7",$this->champs)]); |
131 |
unset($this->champs[array_search("su_tot_shon8",$this->champs)]); |
132 |
unset($this->champs[array_search("su_tot_shon9",$this->champs)]); |
133 |
unset($this->champs[array_search("su_avt_shon_tot",$this->champs)]); |
134 |
unset($this->champs[array_search("su_cstr_shon_tot",$this->champs)]); |
135 |
unset($this->champs[array_search("su_trsf_shon_tot",$this->champs)]); |
136 |
unset($this->champs[array_search("su_chge_shon_tot",$this->champs)]); |
137 |
unset($this->champs[array_search("su_demo_shon_tot",$this->champs)]); |
138 |
unset($this->champs[array_search("su_sup_shon_tot",$this->champs)]); |
139 |
unset($this->champs[array_search("su_tot_shon_tot",$this->champs)]); |
140 |
// Renumérotation |
141 |
$this->champs = array_values($this->champs); |
142 |
} |
143 |
|
144 |
function setType(&$form,$maj) { |
145 |
parent::setType($form,$maj); |
146 |
|
147 |
if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php")) |
148 |
include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"); |
149 |
elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc")) |
150 |
include ("../sql/".$this->db->phptype."/".$this->table.".form.inc"); |
151 |
|
152 |
if(empty($this->cerfa)) { |
153 |
$this->getCerfa(); |
154 |
} |
155 |
// Définition du type "tableau" |
156 |
if ( $this->cerfa->getVal("tab_surface") != "" ){ |
157 |
|
158 |
$form->setType('tab_surface','tableau'); |
159 |
} |
160 |
//Le chache si non défini |
161 |
else { |
162 |
|
163 |
$form->setType('tab_surface','hidden'); |
164 |
} |
165 |
|
166 |
//Cache les champs des clés étrangères, elles sont renseignées automatiquement |
167 |
$form->setType('dossier_instruction', 'hidden'); |
168 |
$form->setType('lot', 'hidden'); |
169 |
|
170 |
// Boucler sur les champs du cerfa pour cacher les données qui ne doivent |
171 |
// pas être saisies |
172 |
|
173 |
foreach ($this->cerfa->champs as $champ) { |
174 |
if(array_search($champ, $this->champs) !== false) { |
175 |
if($this->cerfa->getVal($champ) == 'f') { |
176 |
$form->setType($champ,'hidden'); |
177 |
} |
178 |
} |
179 |
} |
180 |
} |
181 |
|
182 |
// Ajout des clés étrangères |
183 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
184 |
$this->retourformulaire = $retourformulaire; |
185 |
if($validation == 0) { |
186 |
|
187 |
//Si on est dans le dossier |
188 |
if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) { |
189 |
|
190 |
$form->setVal('dossier_instruction', $idxformulaire); |
191 |
$form->setVal('lot', ""); |
192 |
} |
193 |
|
194 |
//Si on est dans le lot |
195 |
if($retourformulaire =='lot') { |
196 |
|
197 |
$form->setVal('dossier_instruction', ""); |
198 |
$form->setVal('lot', $idxformulaire); |
199 |
} |
200 |
}// fin validation |
201 |
}// fin setValsousformulaire |
202 |
|
203 |
function setLayout(&$form, $maj) { |
204 |
|
205 |
/*Fieldset Parametrage du cerfa */ |
206 |
$form->setBloc('libelle','D',"","col_12"); |
207 |
$form->setFieldset('libelle','D' |
208 |
,_("Parametrage du cerfa")); |
209 |
|
210 |
|
211 |
$form->setFieldset('om_validite_fin','F',''); |
212 |
$form->setBloc('om_validite_fin','F'); |
213 |
|
214 |
/*Fieldset n°4 Projet d'aménagement */ |
215 |
$form->setBloc('am_lotiss','D',"","col_12"); |
216 |
$form->setFieldset('am_lotiss','D' |
217 |
,_("Projet d'amenagement")); |
218 |
// bloc 4.1 |
219 |
$form->setBloc('am_lotiss','D',_("Nature des travaux, instalations |
220 |
ou aménagements envisagés"),"col_12"); |
221 |
|
222 |
$form->setBloc('am_tranche_desc','F'); |
223 |
|
224 |
// bloc 4.2 |
225 |
$form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12"); |
226 |
|
227 |
$form->setBloc('am_lot_vente_ant','F'); |
228 |
|
229 |
// bloc 4.3 |
230 |
$form->setBloc('am_empl_nb','D',_("Amenagement d'un camping ou |
231 |
d'un terrain aménagé en vue de l'hébergement |
232 |
touristique"),"col_12"); |
233 |
|
234 |
$form->setBloc('am_exist_agrand','F'); |
235 |
|
236 |
$form->setFieldset('am_coupe_autr','F',''); |
237 |
|
238 |
$form->setBloc('am_coupe_autr','F'); |
239 |
|
240 |
/*Fieldset n°5 Projet de construction */ |
241 |
$form->setBloc('co_archi_recours','D',"","col_12"); |
242 |
$form->setFieldset('co_archi_recours','D' |
243 |
,_("Projet de construction")); |
244 |
// bloc 5.1 |
245 |
$form->setBloc('co_archi_recours','D',_("Architecte"),"col_12"); |
246 |
|
247 |
$form->setBloc('co_archi_recours','F'); |
248 |
|
249 |
// bloc 5.2 |
250 |
$form->setBloc('co_cstr_nouv','D',_("Nature du projet"),"col_12"); |
251 |
|
252 |
$form->setBloc('co_elec_tension','F'); |
253 |
|
254 |
// bloc 5.3 |
255 |
$form->setBloc('co_tot_log_nb','D',_("Informations complementaires"),"col_12"); |
256 |
|
257 |
$form->setBloc('co_trx_nivsup','F'); |
258 |
|
259 |
// bloc 5.4 |
260 |
$form->setBloc('co_demont_period','D',_("Construction periodiquement |
261 |
démontee et re-installee"),"col_12"); |
262 |
|
263 |
$form->setBloc('co_demont_period','F'); |
264 |
|
265 |
// bloc 5.5 |
266 |
$form->setBloc('tab_surface','D',_("Destination des constructions |
267 |
et tableau des surfaces"),"col_12"); |
268 |
|
269 |
$form->setBloc('tab_surface','F'); |
270 |
|
271 |
// bloc 5.6 |
272 |
$form->setBloc('co_sp_transport','D',_("Destination des constructions |
273 |
futures en cas de realisation au benefice d'un |
274 |
service public ou d'interet collectif"),"col_12"); |
275 |
|
276 |
$form->setBloc('co_sp_culture','F'); |
277 |
|
278 |
// bloc 5.7 |
279 |
$form->setBloc('co_statio_avt_nb','D',_("Stationnement"),"col_12"); |
280 |
|
281 |
$form->setBloc('co_statio_comm_cin_surf','F'); |
282 |
|
283 |
$form->setFieldset('co_statio_apr_surf','F',''); |
284 |
|
285 |
$form->setBloc('co_statio_apr_surf','F'); |
286 |
|
287 |
|
288 |
/*Fieldset n°6 Projet necessitant demolitions */ |
289 |
$form->setBloc('dm_constr_dates','D',"","col_12"); |
290 |
$form->setFieldset('dm_constr_dates','D' |
291 |
,_("Projet necessitant demolitions")); |
292 |
|
293 |
$form->setBloc('dm_constr_dates','D',"","col_12"); |
294 |
|
295 |
$form->setBloc('dm_tot_log_nb','F'); |
296 |
|
297 |
$form->setFieldset('dm_tot_log_nb','F',''); |
298 |
|
299 |
$form->setBloc('dm_tot_log_nb','F'); |
300 |
} |
301 |
|
302 |
/** |
303 |
* Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas |
304 |
*/ |
305 |
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
306 |
$objsf, $premiersf, $tricolsf, $validation, |
307 |
$idx, $maj, $retour) { |
308 |
|
309 |
// Ajout et consultation, retour dossier |
310 |
if ( ( $maj == 0 && $validation == 0 ) || |
311 |
( $maj == 3 && $validation == 0 ) || |
312 |
( $maj == 0 && $validation == 1 ) && $retourformulaire == "dossier_instruction" ){ |
313 |
|
314 |
echo "\n<a class=\"retour\" "; |
315 |
echo "href=\"#\" "; |
316 |
echo "onclick=\"redirectPortletAction(1,'main');\" "; |
317 |
echo ">"; |
318 |
echo _("Retour"); |
319 |
echo "</a>\n"; |
320 |
} |
321 |
//Sinon affiche un retour normal |
322 |
else { |
323 |
|
324 |
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
325 |
$objsf, $premiersf, $tricolsf, $validation, |
326 |
$idx, $maj, $retour); |
327 |
} |
328 |
} |
329 |
}// fin classe |
330 |
?> |