/[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 1270 - (show annotations)
Wed Feb 20 16:22:45 2013 UTC (11 years, 11 months ago) by nhaye
File size: 15229 byte(s)
Ajout des données techniques aux lots via overlay jquery,
correction du widget de tableau de formulaire,
création d'un script (displayLotCerfa).php appelé en javascript,
correction de l'ordre des champs du tableau de surface (donnees_techniques.form.inc.php)
ajout d'un lien dans le menu contextuel permettant d'afficher le form 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 lié à 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 // Renumérotation
108 $this->champs = array_values($this->champs);
109 }
110
111 /**
112 * Méthode permettant de définir le type des différents tableaux en fonction
113 * des valeurs du cerfa
114 **/
115 function setTabType($tab) {
116 // Définition du type "tableau"
117 if ( $this->cerfa->getVal($tab) != "" ){
118
119 $this->form->setType($tab,'tableau');
120 }
121 //Le chache si non défini
122 else {
123
124 $this->form->setType($tab,'hidden');
125 }
126 }
127
128 function setType(&$form,$maj) {
129 parent::setType($form,$maj);
130
131 if(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php"))
132 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc.php");
133 elseif(file_exists ("../sql/".$this->db->phptype."/".$this->table.".form.inc"))
134 include ("../sql/".$this->db->phptype."/".$this->table.".form.inc");
135
136 if(empty($this->cerfa)) {
137 $this->getCerfa();
138 }
139
140 $this->setTabType("tab_surface");
141 $this->setTabType("tab_tax_su_princ");
142 $this->setTabType("tab_tax_su_heber");
143 $this->setTabType("tab_tax_su_secon");
144 $this->setTabType("tab_tax_su_tot");
145 $this->setTabType("tab_tax_su_non_habit_surf");
146 $this->setTabType("tab_tax_am");
147
148
149 //Cache les champs des clés étrangères, elles sont renseignées automatiquement
150 $form->setType('dossier_instruction', 'hidden');
151 $form->setType('lot', 'hidden');
152
153 // Boucler sur les champs du cerfa pour cacher les données qui ne doivent
154 // pas être saisies
155
156 foreach ($this->champs as $champ) {
157 if(array_search($champ, $this->cerfa->champs) !== false) {
158 if($this->cerfa->getVal($champ) == 'f') {
159 $form->setType($champ,'hidden');
160 }
161 } else {
162 if(!in_array($champ, $tab_surface[$this->cerfa->getVal("tab_surface")]['values'])) {
163 $form->setType($champ,'hidden');
164 }
165 }
166 }
167 }
168
169 // Ajout des clés étrangères
170 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
171 $this->retourformulaire = $retourformulaire;
172 if($validation == 0) {
173
174 //Si on est dans le dossier
175 if($retourformulaire =='dossier' || $retourformulaire =='dossier_instruction' ) {
176
177 $form->setVal('dossier_instruction', $idxformulaire);
178 $form->setVal('lot', "");
179 }
180
181 //Si on est dans le lot
182 if($retourformulaire =='lot') {
183
184 $form->setVal('dossier_instruction', "");
185 $form->setVal('lot', $idxformulaire);
186 }
187 }// fin validation
188 }// fin setValsousformulaire
189
190 function setLayout(&$form, $maj) {
191 /*Fieldset Parametrage du cerfa */
192 $form->setBloc('cerfa','D',"","col_12");
193 $form->setFieldset('cerfa','D'
194 ,_("Parametrage du cerfa"));
195
196
197 $form->setFieldset('om_validite_fin','F','');
198 $form->setBloc('om_validite_fin','F');
199
200 $form->setBloc('avap_co_elt_pro','D',"","col_12");
201 $form->setFieldset('avap_co_elt_pro','D'
202 ,_("Projet"));
203
204
205 $form->setFieldset('avap_aut_auv_elec','F','');
206 $form->setBloc('avap_aut_auv_elec','F');
207
208
209 $form->setBloc('tr_total','D',"","col_12");
210 $form->setFieldset('tr_total','D'
211 ,_("Projet"));
212
213
214 $form->setFieldset('tr_desc','F','');
215 $form->setBloc('tr_desc','F');
216
217
218
219 /*Fieldset n°4 Projet d'aménagement */
220 $form->setBloc('am_lotiss','D',"","col_12");
221 $form->setFieldset('am_lotiss','D'
222 ,_("Projet d'amenagement"));
223 // bloc 4.1
224 $form->setBloc('am_lotiss','D',_("Nature des travaux, instalations
225 ou aménagements envisagés"),"col_12");
226
227 $form->setBloc('am_tranche_desc','F');
228
229 // bloc 4.2
230 $form->setBloc('am_lot_max_nb','D',_("Demande concernant un lotissement"),"col_12");
231
232 $form->setBloc('am_lot_vente_ant','F');
233
234 // bloc 4.3
235 $form->setBloc('am_empl_nb','D',_("Amenagement d'un camping ou
236 d'un terrain aménagé en vue de l'hébergement
237 touristique"),"col_12");
238
239 $form->setBloc('am_exist_agrand','F');
240
241 $form->setFieldset('am_coupe_autr','F','');
242
243 $form->setBloc('am_coupe_autr','F');
244
245 /*Fieldset n°5 Projet de construction */
246 $form->setBloc('co_archi_recours','D',"","col_12");
247 $form->setFieldset('co_archi_recours','D'
248 ,_("Projet de construction"));
249 // bloc 5.1
250 $form->setBloc('co_archi_recours','D',_("Architecte"),"col_12");
251
252 $form->setBloc('co_archi_recours','F');
253
254 // bloc 5.2
255 $form->setBloc('co_cstr_nouv','D',_("Nature du projet"),"col_12");
256
257 $form->setBloc('co_elec_tension','F');
258
259 // bloc 5.3
260 $form->setBloc('co_tot_log_nb','D',_("Informations complementaires"),"col_12");
261
262 $form->setBloc('co_trx_nivsup','F');
263
264 // bloc 5.4
265 $form->setBloc('co_demont_period','D',_("Construction periodiquement
266 démontee et re-installee"),"col_12");
267
268 $form->setBloc('co_demont_period','F');
269
270 // bloc 5.5
271 $form->setBloc('tab_surface','D',_("Destination des constructions
272 et tableau des surfaces"),"col_12");
273
274 $form->setBloc('tab_surface','F');
275
276 // bloc 5.6
277 $form->setBloc('co_sp_transport','D',_("Destination des constructions
278 futures en cas de realisation au benefice d'un
279 service public ou d'interet collectif"),"col_12");
280
281 $form->setBloc('co_sp_culture','F');
282
283 // bloc 5.7
284 $form->setBloc('co_statio_avt_nb','D',_("Stationnement"),"col_12");
285
286 $form->setBloc('co_statio_comm_cin_surf','F');
287
288 $form->setFieldset('co_statio_apr_surf','F','');
289
290 $form->setBloc('co_statio_apr_surf','F');
291
292
293 /*Fieldset n°6 Projet necessitant demolitions */
294 $form->setBloc('dm_constr_dates','D',"","col_12");
295 $form->setFieldset('dm_constr_dates','D'
296 ,_("Projet necessitant demolitions"));
297
298 $form->setBloc('dm_constr_dates','D',"","col_12");
299
300 $form->setBloc('dm_tot_log_nb','F');
301
302 $form->setFieldset('dm_tot_log_nb','F','');
303
304 $form->setBloc('dm_tot_log_nb','F');
305
306 $form->setBloc('tax_surf_tot','D',_("Declaration des elements necessaires au calcul des impositions"),"col_12");
307 $form->setBloc('tax_surf_tot','D',"","col_12");
308 $form->setFieldset('tax_surf_tot','D'
309 ,_("Renseignement"));
310
311 $form->setBloc('tax_surf_tot','D',"","col_12");
312
313 $form->setBloc('tax_dest_loc_tr','F');
314
315 $form->setBloc('tab_tax_su_princ','D',_("Locaux a usage d'habitation principale"),"col_12");
316 $form->setBloc('tab_tax_su_princ','F');
317
318 $form->setBloc('tab_tax_su_heber','D',_("Locaux a usage d'hebergement"),"col_12");
319 $form->setBloc('tab_tax_su_heber','F');
320
321 $form->setBloc('tab_tax_su_secon','D',_("Locaux a usage d'habitation secondaire"),"col_12");
322 $form->setBloc('tab_tax_su_secon','F');
323
324 $form->setBloc('tab_tax_su_tot','D',_("Total de logement"),"col_12");
325 $form->setBloc('tab_tax_su_tot','F');
326
327 $form->setBloc('tax_ext_pret','D',"","col_12");
328 $form->setBloc('tax_log_exist_nb','F');
329
330 $form->setBloc('tax_comm_nb','D',_("Creation ou extension de locaux non destines a l'habitation"),"col_12");
331 $form->setBloc('tab_tax_su_non_habit_surf','F');
332
333 $form->setBloc('tab_tax_am','D',_("Autres elements soumis a la taxe d'amenagement"),"col_12");
334 $form->setBloc('tab_tax_am','F');
335
336 $form->setBloc('tax_trx_presc_ppr','D',_("Cas particuliers"),"col_12");
337 $form->setBloc('tax_monu_hist','F');
338
339 $form->setFieldset('tax_monu_hist','F','');
340
341 $form->setBloc('tax_monu_hist','F');
342
343 $form->setBloc('vsd_surf_planch_smd','D',"","col_12");
344 $form->setFieldset('vsd_surf_planch_smd','D'
345 ,_("Autres renseignements"));
346
347 $form->setBloc('vsd_surf_planch_smd','D',_("Versement pour sous-densite (VSD)"),"col_12");
348 $form->setBloc('vsd_rescr_fisc','F');
349
350 $form->setBloc('pld_val_terr','D',_("Plafond legal de densite (PLD)"),"col_12");
351 $form->setBloc('pld_const_exist_dem_surf','F');
352
353 $form->setFieldset('pld_const_exist_dem_surf','F','');
354
355 $form->setBloc('pld_const_exist_dem_surf','F');
356
357 $form->setBloc('pld_const_exist_dem_surf','F');
358 }
359
360
361
362 /**
363 * Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas
364 */
365 function retoursousformulaire($idxformulaire, $retourformulaire, $val,
366 $objsf, $premiersf, $tricolsf, $validation,
367 $idx, $maj, $retour) {
368
369 // Ajout et consultation, retour dossier
370 if ( ( $maj == 0 && $validation == 0 ) ||
371 ( $maj == 3 && $validation == 0 ) ||
372 ( $maj == 0 && $validation == 1 ) && $retourformulaire == "dossier_instruction" ){
373
374 echo "\n<a class=\"retour\" ";
375 echo "href=\"#\" ";
376 echo "onclick=\"redirectPortletAction(1,'main');\" ";
377 echo ">";
378 echo _("Retour");
379 echo "</a>\n";
380 }
381 //Sinon affiche un retour normal
382 else {
383
384 parent::retoursousformulaire($idxformulaire, $retourformulaire, $val,
385 $objsf, $premiersf, $tricolsf, $validation,
386 $idx, $maj, $retour);
387 }
388 }
389 }// fin classe
390 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26