/[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 1570 - (show annotations)
Thu Mar 28 09:54:56 2013 UTC (11 years, 10 months ago) by nhaye
File size: 21888 byte(s)
Suppression du libellé des tableaux des données techniques

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 $id_tab_surface = $this->cerfa->getVal("tab_surface");
104 $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
105 $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
106 $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
107 $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
108 $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
109 $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
110
111 //Suppression des champs de tableaux
112 if(!empty($id_tab_surface)) {
113 foreach($tab_surface[$this->cerfa->getVal("tab_surface")]['values'] as $champ) {
114 unset($this->champs[array_search($champ,$this->champs)]);
115 }
116 }
117 if(!empty($id_tab_tax_su_princ)) {
118 foreach($tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'] as $champ) {
119 unset($this->champs[array_search($champ,$this->champs)]);
120 }
121 }
122 if(!empty($id_tab_tax_su_heber)) {
123 foreach($tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'] as $champ) {
124 unset($this->champs[array_search($champ,$this->champs)]);
125 }
126 }
127 if(!empty($id_tab_tax_su_secon)) {
128 foreach($tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'] as $champ) {
129 unset($this->champs[array_search($champ,$this->champs)]);
130 }
131 }
132 if(!empty($id_tab_tax_su_tot)) {
133 foreach($tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'] as $champ) {
134 unset($this->champs[array_search($champ,$this->champs)]);
135 }
136 }
137 if(!empty($id_tab_tax_su_non_habit_surf)) {
138 foreach($tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'] as $champ) {
139 unset($this->champs[array_search($champ,$this->champs)]);
140 }
141 }
142 if(!empty($id_tab_tax_am)) {
143 foreach($tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'] as $champ) {
144 unset($this->champs[array_search($champ,$this->champs)]);
145 }
146 }
147 // Renumérotation
148 $this->champs = array_values($this->champs);
149 }
150
151 /**
152 * Méthode permettant de définir le type des différents tableaux en fonction
153 * des valeurs du cerfa
154 **/
155 function setTabType($tab) {
156 // Définition du type "tableau"
157 if ( $this->cerfa->getVal($tab) != "" ){
158
159 $this->form->setType($tab,'tableau');
160 }
161 //Le chache si non défini
162 else {
163
164 $this->form->setType($tab,'hidden');
165 }
166 }
167
168 /**
169 * Méthode permettant de définir le type des champs des tableaux en fonction
170 * des valeurs du cerfa
171 **/
172 function setTabChampType($tab) {
173 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
174 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
175 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
176 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
177 // Pour chaque champ dans la liste des champs du cerfa
178 $tableau = $$tab;
179
180 foreach ($this->champs as $champ) {
181 if(array_search($champ, $this->cerfa->champs) !== false) {
182 // On les cache si décoché dans le formulaire de cerfa
183 if($this->cerfa->getVal($champ) == 'f') {
184 $this->form->setType($champ,'hidden');
185 }
186 } else {
187
188 if(!in_array($champ, $tableau[$this->cerfa->getVal($tab)]['values'])) {
189
190 $this->form->setType($champ,'hidden');
191 }
192 }
193 }
194 }
195
196
197
198 function setType(&$form,$maj) {
199 parent::setType($form,$maj);
200
201 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
202 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
203 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
204 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
205
206 if(empty($this->cerfa)) {
207 $this->getCerfa();
208 }
209
210 $this->setTabType("tab_surface");
211 $this->setTabType("tab_tax_su_princ");
212 $this->setTabType("tab_tax_su_heber");
213 $this->setTabType("tab_tax_su_secon");
214 $this->setTabType("tab_tax_su_tot");
215 $this->setTabType("tab_tax_su_non_habit_surf");
216 $this->setTabType("tab_tax_am");
217
218
219 //Cache les champs des clés étrangères, elles sont renseignées automatiquement
220 $form->setType('dossier_instruction', 'hidden');
221 $form->setType('lot', 'hidden');
222
223 // Boucler sur les champs du cerfa pour cacher les données qui ne doivent
224 // pas être saisies
225
226 foreach ($this->champs as $champ) {
227 if(array_search($champ, $this->cerfa->champs) !== false) {
228 if($this->cerfa->getVal($champ) == 'f') {
229 $form->setType($champ,'hidden');
230 }
231 } else {
232 $id_tab_surface = $this->cerfa->getVal("tab_surface");
233 $id_tab_tax_su_princ = $this->cerfa->getVal("tab_tax_su_princ");
234 $id_tab_tax_su_heber = $this->cerfa->getVal("tab_tax_su_heber");
235 $id_tab_tax_su_secon = $this->cerfa->getVal("tab_tax_su_secon");
236 $id_tab_tax_su_tot = $this->cerfa->getVal("tab_tax_su_tot");
237 $id_tab_tax_su_non_habit_surf = $this->cerfa->getVal("tab_tax_su_non_habit_surf");
238 $id_tab_tax_am = $this->cerfa->getVal("tab_tax_am");
239 $hidden = true;
240
241 // On cache tous les champs
242 $form->setType($champ,'hidden');
243
244 // On défini l'affichage des champs des tableaux de configuration
245 // Si les tableau sont définis dans le cerfa on test si les champs des données
246 // techniques sont définis dans les tableaux de configuration des tableaux
247 // pour chaque cerfa alors on les affiche en type "text"
248 if(!empty($id_tab_surface)) {
249 if(in_array($champ, $tab_surface[$this->cerfa->getVal("tab_surface")]['values'])) {
250 $hidden = false;
251 }
252 }
253 if(!empty($id_tab_tax_su_princ)) {
254 if(in_array($champ, $tab_tax_su_princ[$this->cerfa->getVal("tab_tax_su_princ")]['values'])) {
255 $hidden = false;
256 }
257 }
258 if(!empty($id_tab_tax_su_heber)) {
259 if(in_array($champ, $tab_tax_su_heber[$this->cerfa->getVal("tab_tax_su_heber")]['values'])) {
260 $hidden = false;
261 }
262 }
263 if(!empty($id_tab_tax_su_secon)) {
264 if(in_array($champ, $tab_tax_su_secon[$this->cerfa->getVal("tab_tax_su_secon")]['values'])) {
265 $hidden = false;
266 }
267 }
268 if(!empty($id_tab_tax_su_tot)) {
269 if(in_array($champ, $tab_tax_su_tot[$this->cerfa->getVal("tab_tax_su_tot")]['values'])) {
270 $hidden = false;
271 }
272 }
273 if(!empty($id_tab_tax_su_non_habit_surf)) {
274 if(in_array($champ, $tab_tax_su_non_habit_surf[$this->cerfa->getVal("tab_tax_su_non_habit_surf")]['values'])) {
275 $hidden = false;
276 }
277 }
278 if(!empty($id_tab_tax_am)) {
279 if(in_array($champ, $tab_tax_am[$this->cerfa->getVal("tab_tax_am")]['values'])) {
280 $hidden = false;
281 }
282 }
283
284 if(!$hidden){
285 if($maj < 2) {
286 $form->setType($champ,'text');
287 } else {
288 $form->setType($champ,'static');
289 }
290
291 }
292 }
293 }
294 }
295
296 // Ajout des clés étrangères
297 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
298 $this->retourformulaire = $retourformulaire;
299 if($validation == 0) {
300
301 //Si on est dans le dossier
302 if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) {
303
304 $form->setVal('dossier_instruction', $idxformulaire);
305 $form->setVal('lot', "");
306 }
307
308 //Si on est dans le lot
309 if($retourformulaire =='lot') {
310
311 $form->setVal('dossier_instruction', "");
312 $form->setVal('lot', $idxformulaire);
313 }
314 }// fin validation
315 }// fin setValsousformulaire
316
317 function setLib(&$form,$maj) {
318 parent::setLib($form,$maj);
319 //libelle des champs
320 $form->setLib('tab_surface', "");
321 $form->setLib('tab_tax_su_princ', "");
322 $form->setLib('tab_tax_su_heber', "");
323 $form->setLib('tab_tax_su_secon', "");
324 $form->setLib('tab_tax_su_tot', "");
325 $form->setLib('tab_tax_su_non_habit_surf', "");
326 $form->setLib('tab_tax_am', "");
327 }
328
329 function setLayout(&$form, $maj) {
330 /*Fieldset Parametrage du cerfa */
331 $form->setBloc('cerfa','D',"","col_12");
332 $form->setFieldset('cerfa','D'
333 ,_("Parametrage du cerfa"));
334
335
336 $form->setFieldset('om_validite_fin','F','');
337 $form->setBloc('om_validite_fin','F');
338
339 $form->setBloc('avap_co_elt_pro','D',"","col_12");
340 $form->setFieldset('avap_co_elt_pro','D'
341 ,_("Projet"));
342
343
344 $form->setFieldset('avap_aut_auv_elec','F','');
345 $form->setBloc('avap_aut_auv_elec','F');
346
347
348 $form->setBloc('tr_total','D',"","col_12");
349 $form->setFieldset('tr_total','D'
350 ,_("Projet"));
351
352
353 $form->setFieldset('tr_desc','F','');
354 $form->setBloc('tr_desc','F');
355
356
357
358 /*Fieldset n°4 Projet d'aménagement */
359 $form->setBloc('am_lotiss','D',"","col_12");
360 $form->setFieldset('am_lotiss','D'
361 ,_("Projet d'amenagement"));
362 // bloc 4.1
363 $form->setBloc('am_lotiss','D',_("Nature des travaux, instalations
364 ou amenagements envisages"),"col_12");
365
366 $form->setBloc('am_tranche_desc','F');
367
368 // bloc 4.2
369 $form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12");
370
371 $form->setBloc('am_lot_vente_ant','F');
372
373 // bloc 4.3
374 $form->setBloc('am_empl_nb','D',_("Amenagement d'un camping ou
375 d'un terrain amenage en vue de l'hebergement
376 touristique"),"col_12");
377
378 $form->setBloc('am_exist_agrand','F');
379
380 $form->setFieldset('am_coupe_autr','F','');
381
382 $form->setBloc('am_coupe_autr','F');
383
384 /*Fieldset n°5 Projet de construction */
385 $form->setBloc('co_archi_recours','D',"","col_12");
386 $form->setFieldset('co_archi_recours','D'
387 ,_("Projet de construction"));
388 // bloc 5.1
389 $form->setBloc('co_archi_recours','D',_("Architecte"),"col_12");
390
391 $form->setBloc('co_archi_recours','F');
392
393 // bloc 5.2
394 $form->setBloc('co_cstr_nouv','D',_("Nature du projet"),"col_12");
395
396 $form->setBloc('co_elec_tension','F');
397
398 // bloc 5.3
399 $form->setBloc('co_tot_log_nb','D',_("Informations complementaires"),"col_12");
400
401 $form->setBloc('co_trx_nivsup','F');
402
403 // bloc 5.4
404 $form->setBloc('co_demont_period','D',_("Construction periodiquement
405 demontee et re-installee"),"col_12");
406
407 $form->setBloc('co_demont_period','F');
408
409 // bloc 5.5
410 $form->setBloc('tab_surface','D',_("Destination des constructions
411 et tableau des surfaces"),"col_12");
412
413 $form->setBloc('tab_surface','F');
414
415 // bloc 5.6
416 $form->setBloc('co_sp_transport','D',_("Destination des constructions
417 futures en cas de realisation au benefice d'un
418 service public ou d'interet collectif"),"col_12");
419
420 $form->setBloc('co_sp_culture','F');
421
422 // bloc 5.7
423 $form->setBloc('co_statio_avt_nb','D',_("Stationnement"),"col_12");
424
425 $form->setBloc('co_statio_comm_cin_surf','F');
426
427 $form->setFieldset('co_statio_apr_surf','F','');
428
429 $form->setBloc('co_statio_apr_surf','F');
430
431
432 /*Fieldset n°6 Projet necessitant demolitions */
433 $form->setBloc('dm_constr_dates','D',"","col_12");
434 $form->setFieldset('dm_constr_dates','D'
435 ,_("Projet necessitant demolitions"));
436
437 $form->setBloc('dm_constr_dates','D',"","col_12");
438
439 $form->setBloc('dm_tot_log_nb','F');
440
441 $form->setFieldset('dm_tot_log_nb','F','');
442
443 $form->setBloc('dm_tot_log_nb','F');
444
445 $form->setBloc('tax_surf_tot','D',_("Declaration des elements necessaires au calcul des impositions"),"col_12");
446 $form->setBloc('tax_surf_tot','D',"","col_12");
447 $form->setFieldset('tax_surf_tot','D'
448 ,_("Renseignement"));
449
450 $form->setBloc('tax_surf_tot','D',"","col_12");
451
452 $form->setBloc('tax_dest_loc_tr','F');
453
454 $form->setBloc('tab_tax_su_princ','D',_("Locaux a usage d'habitation principale"),"col_12");
455 $form->setBloc('tab_tax_su_princ','F');
456
457 $form->setBloc('tab_tax_su_heber','D',_("Locaux a usage d'hebergement"),"col_12");
458 $form->setBloc('tab_tax_su_heber','F');
459
460 $form->setBloc('tab_tax_su_secon','D',_("Locaux a usage d'habitation secondaire"),"col_12");
461 $form->setBloc('tab_tax_su_secon','F');
462
463 $form->setBloc('tab_tax_su_tot','D',_("Total de logement"),"col_12");
464 $form->setBloc('tab_tax_su_tot','F');
465
466 $form->setBloc('tax_ext_pret','D',"","col_12");
467 $form->setBloc('tax_log_exist_nb','F');
468
469 $form->setBloc('tax_comm_nb','D',_("Creation ou extension de locaux non destines a l'habitation"),"col_12");
470 $form->setBloc('tab_tax_su_non_habit_surf','F');
471
472 $form->setBloc('tab_tax_am','D',_("Autres elements soumis a la taxe d'amenagement"),"col_12");
473 $form->setBloc('tab_tax_am','F');
474
475 $form->setBloc('tax_trx_presc_ppr','D',_("Cas particuliers"),"col_12");
476 $form->setBloc('tax_monu_hist','F');
477
478 $form->setFieldset('tax_monu_hist','F','');
479
480 $form->setBloc('tax_monu_hist','F');
481
482 $form->setBloc('vsd_surf_planch_smd','D',"","col_12");
483 $form->setFieldset('vsd_surf_planch_smd','D'
484 ,_("Autres renseignements"));
485
486 $form->setBloc('vsd_surf_planch_smd','D',_("Versement pour sous-densite (VSD)"),"col_12");
487 $form->setBloc('vsd_rescr_fisc','F');
488
489 $form->setBloc('pld_val_terr','D',_("Plafond legal de densite (PLD)"),"col_12");
490 $form->setBloc('pld_const_exist_dem_surf','F');
491
492 $form->setFieldset('pld_const_exist_dem_surf','F','');
493
494 $form->setBloc('pld_const_exist_dem_surf','F');
495
496 $form->setBloc('pld_const_exist_dem_surf','F');
497 }
498
499
500
501 /**
502 * Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas
503 */
504 function retoursousformulaire($idxformulaire, $retourformulaire, $val,
505 $objsf, $premiersf, $tricolsf, $validation,
506 $idx, $maj, $retour) {
507
508 $visualisation = $this->getParameter('visualisation');
509
510 if ( $visualisation == "" ){
511
512 // Ajout et consultation, retour dossier
513 if ( ( $maj == 0 && $validation == 0 ) ||
514 ( $maj == 3 && $validation == 0 ) ||
515 ( $maj == 0 && $validation == 1 ) && $retourformulaire == "dossier_instruction" ){
516
517 echo "\n<a class=\"retour\" ";
518 echo "href=\"#\" ";
519 echo "onclick=\"redirectPortletAction(1,'main');\" ";
520 echo ">";
521 echo _("Retour");
522 echo "</a>\n";
523 }
524 //Sinon affiche un retour normal
525 else{
526
527 parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
528 $objsf, $premiersf, $tricolsf, $validation,
529 $idx, $maj, $retour);
530 }
531 }
532 }
533 }// fin classe
534 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26