/[openfoncier]/trunk/obj/donnees_techniques.class.php
ViewVC logotype

Contents of /trunk/obj/donnees_techniques.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1394 - (show annotations)
Wed Mar 13 15:55:10 2013 UTC (11 years, 10 months ago) by nhaye
File size: 18401 byte(s)
Correction de l'affichage des tableaux des formulaire des données techniquees

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 * Méthode permettant de récupérer l'id du cerfa lié au dossier
17 **/
18 function getCerfa(){
19 if($this->getParameter("retourformulaire") == "lot") {
20 $sql = "SELECT cerfa_lot FROM ".DB_PREFIXE."dossier_instruction_type
21 JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type=
22 dossier_instruction_type.dossier_instruction_type
23 JOIN ".DB_PREFIXE."lien_dossier_lot ON dossier.dossier=lien_dossier_lot.dossier
24 WHERE lien_dossier_lot.lot = ".$this->getParameter("idxformulaire");
25
26 } else {
27 $sql = "SELECT cerfa FROM ".DB_PREFIXE."dossier_instruction_type
28 JOIN ".DB_PREFIXE."dossier ON dossier.dossier_instruction_type=
29 dossier_instruction_type.dossier_instruction_type
30 WHERE dossier = '";
31 $sql .= $this->getParameter("idxformulaire")."'";
32 }
33
34 $cerfa = $this->db->getOne($sql);
35 $this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE);
36 $this->f->isDatabaseError($cerfa);
37
38 // Si le cerfa est défini dans dossier on instancie le cerfa correspondant
39 if(!empty($cerfa)) {
40 require_once ("../obj/cerfa.class.php");
41 $this->cerfa = new cerfa($cerfa, $this->db, DEBUG);
42 } else {
43 $this->f->displayMessage("error", _("Aucun cerfa lie a ce type de dossier"));
44 die();
45 }
46 }
47
48 /**
49 * Méthode permettant de vérifier si le tableau passé en parametre est défini
50 * dans la table des cerfa
51 */
52
53 function setTabSelect($tab, $idchamp) {
54 // Test si un tableau de surface a été défini
55 if ( $this->cerfa->getVal($idchamp) != "" ){
56
57 // Configuration du tableau des surfaces
58 $contenu['column_header']=$tab[$this->cerfa->getVal($idchamp)]['column_header'];
59 $contenu['row_header']=$tab[$this->cerfa->getVal($idchamp)]['row_header'];
60
61 foreach($tab[$this->cerfa->getVal($idchamp)]['values'] as $champ) {
62 $contenu['values'][$champ] = $this->getVal($champ);
63 }
64
65 $this->form->setSelect($idchamp,$contenu);
66 }
67 }
68
69
70 function setSelect(&$form, $maj,&$db,$debug) {
71 parent::setSelect($form, $maj,$db,$debug);
72 if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
73 include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
74 elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
75 include ("../sql/".$db->phptype."/".$this->table.".form.inc");
76
77 if(empty($this->cerfa)) {
78 $this->getCerfa();
79 }
80
81 $this->setTabSelect($tab_surface, "tab_surface");
82 $this->setTabSelect($tab_tax_su_princ, "tab_tax_su_princ");
83 $this->setTabSelect($tab_tax_su_heber, "tab_tax_su_heber");
84 $this->setTabSelect($tab_tax_su_secon, "tab_tax_su_secon");
85 $this->setTabSelect($tab_tax_su_tot, "tab_tax_su_tot");
86 $this->setTabSelect($tab_tax_su_tot, "tab_tax_su_non_habit_surf");
87 $this->setTabSelect($tab_tax_am, "tab_tax_am");
88
89
90 }
91
92
93 // XXX Créer une nouvelle méthode au même endroit que l'appel a checkAccessibility()
94 function checkAccessibility() {
95 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
96 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
97 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
98 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
99 if(empty($this->cerfa)) {
100 $this->getCerfa();
101 }
102
103 //Suppression des champs de tableaux
104 foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) {
105 unset($this->champs[array_search($champ,$this->champs)]);
106 }
107 foreach($tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'] as $champ) {
108 unset($this->champs[array_search($champ,$this->champs)]);
109 }
110 foreach($tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'] as $champ) {
111 unset($this->champs[array_search($champ,$this->champs)]);
112 }
113 foreach($tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'] as $champ) {
114 unset($this->champs[array_search($champ,$this->champs)]);
115 }
116 foreach($tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'] as $champ) {
117 unset($this->champs[array_search($champ,$this->champs)]);
118 }
119 foreach($tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'] as $champ) {
120 unset($this->champs[array_search($champ,$this->champs)]);
121 }
122 foreach($tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'] as $champ) {
123 unset($this->champs[array_search($champ,$this->champs)]);
124 }
125 // Renumérotation
126 $this->champs = array_values($this->champs);
127 }
128
129 /**
130 * Méthode permettant de définir le type des différents tableaux en fonction
131 * des valeurs du cerfa
132 **/
133 function setTabType($tab) {
134 // Définition du type "tableau"
135 if ( $this->cerfa->getVal($tab) != "" ){
136
137 $this->form->setType($tab,'tableau');
138 }
139 //Le chache si non défini
140 else {
141
142 $this->form->setType($tab,'hidden');
143 }
144 }
145
146 /**
147 * Méthode permettant de définir le type des champs des tableaux en fonction
148 * des valeurs du cerfa
149 **/
150 function setTabChampType($tab) {
151 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
152 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
153 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
154 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
155 // Pour chaque champ dans la liste des champs du cerfa
156 $tableau = $$tab;
157 print_r($tableau[$this->cerfa->getVal($tab)]['values']);
158 foreach ($this->champs as $champ) {
159 if(array_search($champ, $this->cerfa->champs) !== false) {
160 // On les cache si décoché dans le formulaire de cerfa
161 if($this->cerfa->getVal($champ) == 'f') {
162 $this->form->setType($champ,'hidden');
163 }
164 } else {
165
166 if(!in_array($champ, $tableau[$this->cerfa->getVal($tab)]['values'])) {
167
168 $this->form->setType($champ,'hidden');
169 }
170 }
171 }
172 }
173
174
175
176 function setType(&$form,$maj) {
177 parent::setType($form,$maj);
178
179 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
180 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
181 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
182 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
183
184 if(empty($this->cerfa)) {
185 $this->getCerfa();
186 }
187
188 $this->setTabType("tab_surface");
189 $this->setTabType("tab_tax_su_princ");
190 $this->setTabType("tab_tax_su_heber");
191 $this->setTabType("tab_tax_su_secon");
192 $this->setTabType("tab_tax_su_tot");
193 $this->setTabType("tab_tax_su_non_habit_surf");
194 $this->setTabType("tab_tax_am");
195
196
197 //Cache les champs des clés étrangères, elles sont renseignées automatiquement
198 $form->setType('dossier_instruction', 'hidden');
199 $form->setType('lot', 'hidden');
200
201 // Boucler sur les champs du cerfa pour cacher les données qui ne doivent
202 // pas être saisies
203
204 foreach ($this->champs as $champ) {
205 if(array_search($champ, $this->cerfa->champs) !== false) {
206 if($this->cerfa->getVal($champ) == 'f') {
207 $form->setType($champ,'hidden');
208 }
209 } else {
210
211 if(!in_array($champ, $tab_surface[$this->cerfa->getVal("tab_surface")]['values']) AND
212 !in_array($champ, $tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values']) AND
213 !in_array($champ, $tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values']) AND
214 !in_array($champ, $tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values']) AND
215 !in_array($champ, $tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'])AND
216 !in_array($champ, $tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values']) AND
217 !in_array($champ, $tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'])) {
218 $form->setType($champ,'hidden');
219 }
220 }
221 }
222 }
223
224 // Ajout des clés étrangères
225 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
226 $this->retourformulaire = $retourformulaire;
227 if($validation == 0) {
228
229 //Si on est dans le dossier
230 if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) {
231
232 $form->setVal('dossier_instruction', $idxformulaire);
233 $form->setVal('lot', "");
234 }
235
236 //Si on est dans le lot
237 if($retourformulaire =='lot') {
238
239 $form->setVal('dossier_instruction', "");
240 $form->setVal('lot', $idxformulaire);
241 }
242 }// fin validation
243 }// fin setValsousformulaire
244
245 function setLayout(&$form, $maj) {
246 /*Fieldset Parametrage du cerfa */
247 $form->setBloc('cerfa','D',"","col_12");
248 $form->setFieldset('cerfa','D'
249 ,_("Parametrage du cerfa"));
250
251
252 $form->setFieldset('om_validite_fin','F','');
253 $form->setBloc('om_validite_fin','F');
254
255 $form->setBloc('avap_co_elt_pro','D',"","col_12");
256 $form->setFieldset('avap_co_elt_pro','D'
257 ,_("Projet"));
258
259
260 $form->setFieldset('avap_aut_auv_elec','F','');
261 $form->setBloc('avap_aut_auv_elec','F');
262
263
264 $form->setBloc('tr_total','D',"","col_12");
265 $form->setFieldset('tr_total','D'
266 ,_("Projet"));
267
268
269 $form->setFieldset('tr_desc','F','');
270 $form->setBloc('tr_desc','F');
271
272
273
274 /*Fieldset n°4 Projet d'aménagement */
275 $form->setBloc('am_lotiss','D',"","col_12");
276 $form->setFieldset('am_lotiss','D'
277 ,_("Projet d'amenagement"));
278 // bloc 4.1
279 $form->setBloc('am_lotiss','D',_("Nature des travaux, instalations
280 ou amenagements envisages"),"col_12");
281
282 $form->setBloc('am_tranche_desc','F');
283
284 // bloc 4.2
285 $form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12");
286
287 $form->setBloc('am_lot_vente_ant','F');
288
289 // bloc 4.3
290 $form->setBloc('am_empl_nb','D',_("Amenagement d'un camping ou
291 d'un terrain amenage en vue de l'hebergement
292 touristique"),"col_12");
293
294 $form->setBloc('am_exist_agrand','F');
295
296 $form->setFieldset('am_coupe_autr','F','');
297
298 $form->setBloc('am_coupe_autr','F');
299
300 /*Fieldset n°5 Projet de construction */
301 $form->setBloc('co_archi_recours','D',"","col_12");
302 $form->setFieldset('co_archi_recours','D'
303 ,_("Projet de construction"));
304 // bloc 5.1
305 $form->setBloc('co_archi_recours','D',_("Architecte"),"col_12");
306
307 $form->setBloc('co_archi_recours','F');
308
309 // bloc 5.2
310 $form->setBloc('co_cstr_nouv','D',_("Nature du projet"),"col_12");
311
312 $form->setBloc('co_elec_tension','F');
313
314 // bloc 5.3
315 $form->setBloc('co_tot_log_nb','D',_("Informations complementaires"),"col_12");
316
317 $form->setBloc('co_trx_nivsup','F');
318
319 // bloc 5.4
320 $form->setBloc('co_demont_period','D',_("Construction periodiquement
321 demontee et re-installee"),"col_12");
322
323 $form->setBloc('co_demont_period','F');
324
325 // bloc 5.5
326 $form->setBloc('tab_surface','D',_("Destination des constructions
327 et tableau des surfaces"),"col_12");
328
329 $form->setBloc('tab_surface','F');
330
331 // bloc 5.6
332 $form->setBloc('co_sp_transport','D',_("Destination des constructions
333 futures en cas de realisation au benefice d'un
334 service public ou d'interet collectif"),"col_12");
335
336 $form->setBloc('co_sp_culture','F');
337
338 // bloc 5.7
339 $form->setBloc('co_statio_avt_nb','D',_("Stationnement"),"col_12");
340
341 $form->setBloc('co_statio_comm_cin_surf','F');
342
343 $form->setFieldset('co_statio_apr_surf','F','');
344
345 $form->setBloc('co_statio_apr_surf','F');
346
347
348 /*Fieldset n°6 Projet necessitant demolitions */
349 $form->setBloc('dm_constr_dates','D',"","col_12");
350 $form->setFieldset('dm_constr_dates','D'
351 ,_("Projet necessitant demolitions"));
352
353 $form->setBloc('dm_constr_dates','D',"","col_12");
354
355 $form->setBloc('dm_tot_log_nb','F');
356
357 $form->setFieldset('dm_tot_log_nb','F','');
358
359 $form->setBloc('dm_tot_log_nb','F');
360
361 $form->setBloc('tax_surf_tot','D',_("Declaration des elements necessaires au calcul des impositions"),"col_12");
362 $form->setBloc('tax_surf_tot','D',"","col_12");
363 $form->setFieldset('tax_surf_tot','D'
364 ,_("Renseignement"));
365
366 $form->setBloc('tax_surf_tot','D',"","col_12");
367
368 $form->setBloc('tax_dest_loc_tr','F');
369
370 $form->setBloc('tab_tax_su_princ','D',_("Locaux a usage d'habitation principale"),"col_12");
371 $form->setBloc('tab_tax_su_princ','F');
372
373 $form->setBloc('tab_tax_su_heber','D',_("Locaux a usage d'hebergement"),"col_12");
374 $form->setBloc('tab_tax_su_heber','F');
375
376 $form->setBloc('tab_tax_su_secon','D',_("Locaux a usage d'habitation secondaire"),"col_12");
377 $form->setBloc('tab_tax_su_secon','F');
378
379 $form->setBloc('tab_tax_su_tot','D',_("Total de logement"),"col_12");
380 $form->setBloc('tab_tax_su_tot','F');
381
382 $form->setBloc('tax_ext_pret','D',"","col_12");
383 $form->setBloc('tax_log_exist_nb','F');
384
385 $form->setBloc('tax_comm_nb','D',_("Creation ou extension de locaux non destines a l'habitation"),"col_12");
386 $form->setBloc('tab_tax_su_non_habit_surf','F');
387
388 $form->setBloc('tab_tax_am','D',_("Autres elements soumis a la taxe d'amenagement"),"col_12");
389 $form->setBloc('tab_tax_am','F');
390
391 $form->setBloc('tax_trx_presc_ppr','D',_("Cas particuliers"),"col_12");
392 $form->setBloc('tax_monu_hist','F');
393
394 $form->setFieldset('tax_monu_hist','F','');
395
396 $form->setBloc('tax_monu_hist','F');
397
398 $form->setBloc('vsd_surf_planch_smd','D',"","col_12");
399 $form->setFieldset('vsd_surf_planch_smd','D'
400 ,_("Autres renseignements"));
401
402 $form->setBloc('vsd_surf_planch_smd','D',_("Versement pour sous-densite (VSD)"),"col_12");
403 $form->setBloc('vsd_rescr_fisc','F');
404
405 $form->setBloc('pld_val_terr','D',_("Plafond legal de densite (PLD)"),"col_12");
406 $form->setBloc('pld_const_exist_dem_surf','F');
407
408 $form->setFieldset('pld_const_exist_dem_surf','F','');
409
410 $form->setBloc('pld_const_exist_dem_surf','F');
411
412 $form->setBloc('pld_const_exist_dem_surf','F');
413 }
414
415
416
417 /**
418 * Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas
419 */
420 function retoursousformulaire($idxformulaire, $retourformulaire, $val,
421 $objsf, $premiersf, $tricolsf, $validation,
422 $idx, $maj, $retour) {
423
424 $visualisation = $this->getParameter('visualisation');
425
426 if ( $visualisation == "" ){
427
428 // Ajout et consultation, retour dossier
429 if ( ( $maj == 0 && $validation == 0 ) ||
430 ( $maj == 3 && $validation == 0 ) ||
431 ( $maj == 0 && $validation == 1 ) && $retourformulaire == "dossier_instruction" ){
432
433 echo "\n<a class=\"retour\" ";
434 echo "href=\"#\" ";
435 echo "onclick=\"redirectPortletAction(1,'main');\" ";
436 echo ">";
437 echo _("Retour");
438 echo "</a>\n";
439 }
440 //Sinon affiche un retour normal
441 else{
442
443 parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
444 $objsf, $premiersf, $tricolsf, $validation,
445 $idx, $maj, $retour);
446 }
447 }
448 }
449 }// fin classe
450 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26