1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 07/11/2012 12:55 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class evenement_gen extends om_dbform { |
8 |
var $table="evenement"; |
9 |
var $clePrimaire="evenement"; |
10 |
var $typeCle="N"; |
11 |
var $required_field=array( |
12 |
"evenement", |
13 |
"libelle" |
14 |
); |
15 |
var $retourformulaire; |
16 |
|
17 |
function setvalF($val) { |
18 |
//affectation valeur formulaire |
19 |
if (!is_numeric($val['evenement'])) { |
20 |
$this->valF['evenement'] = ""; // -> requis |
21 |
} else { |
22 |
$this->valF['evenement'] = $val['evenement']; |
23 |
} |
24 |
$this->valF['libelle'] = $val['libelle']; |
25 |
if ($val['nature'] == "") { |
26 |
$this->valF['nature'] = NULL; |
27 |
} else { |
28 |
$this->valF['nature'] = $val['nature']; |
29 |
} |
30 |
if ($val['action'] == "") { |
31 |
$this->valF['action'] = NULL; |
32 |
} else { |
33 |
$this->valF['action'] = $val['action']; |
34 |
} |
35 |
if ($val['etat'] == "") { |
36 |
$this->valF['etat'] = NULL; |
37 |
} else { |
38 |
$this->valF['etat'] = $val['etat']; |
39 |
} |
40 |
if (!is_numeric($val['delai'])) { |
41 |
$this->valF['delai'] = NULL; |
42 |
} else { |
43 |
$this->valF['delai'] = $val['delai']; |
44 |
} |
45 |
if ($val['accord_tacite'] == "") { |
46 |
$this->valF['accord_tacite'] = ""; // -> default |
47 |
} else { |
48 |
$this->valF['accord_tacite'] = $val['accord_tacite']; |
49 |
} |
50 |
if (!is_numeric($val['delai_notification'])) { |
51 |
$this->valF['delai_notification'] = NULL; |
52 |
} else { |
53 |
$this->valF['delai_notification'] = $val['delai_notification']; |
54 |
} |
55 |
if ($val['lettretype'] == "") { |
56 |
$this->valF['lettretype'] = ""; // -> default |
57 |
} else { |
58 |
$this->valF['lettretype'] = $val['lettretype']; |
59 |
} |
60 |
if ($val['consultation'] == "") { |
61 |
$this->valF['consultation'] = ""; // -> default |
62 |
} else { |
63 |
$this->valF['consultation'] = $val['consultation']; |
64 |
} |
65 |
if (!is_numeric($val['avis_decision'])) { |
66 |
$this->valF['avis_decision'] = NULL; |
67 |
} else { |
68 |
$this->valF['avis_decision'] = $val['avis_decision']; |
69 |
} |
70 |
} |
71 |
|
72 |
//================================================= |
73 |
//cle primaire automatique [automatic primary key] |
74 |
//================================================== |
75 |
|
76 |
function setId(&$db) { |
77 |
//numero automatique |
78 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
79 |
} |
80 |
|
81 |
function setValFAjout($val) { |
82 |
//numero automatique -> pas de controle ajout cle primaire |
83 |
} |
84 |
|
85 |
function verifierAjout() { |
86 |
//numero automatique -> pas de verfication de cle primaire |
87 |
} |
88 |
|
89 |
//========================== |
90 |
// Formulaire [form] |
91 |
//========================== |
92 |
|
93 |
function setType(&$form,$maj) { |
94 |
//type |
95 |
if ($maj==0){ //ajout |
96 |
$form->setType('evenement','hidden');// cle automatique |
97 |
$form->setType('libelle','text'); |
98 |
|
99 |
if($this->retourformulaire=='nature' |
100 |
and $form->val['nature'] == $this->getParameter('idxformulaire')) { |
101 |
$form->setType('nature','selecthiddenstatic'); |
102 |
} else { |
103 |
$form->setType('nature','select'); |
104 |
} |
105 |
|
106 |
if($this->retourformulaire=='action' |
107 |
and $form->val['action'] == $this->getParameter('idxformulaire')) { |
108 |
$form->setType('action','selecthiddenstatic'); |
109 |
} else { |
110 |
$form->setType('action','select'); |
111 |
} |
112 |
|
113 |
if($this->retourformulaire=='etat' |
114 |
and $form->val['etat'] == $this->getParameter('idxformulaire')) { |
115 |
$form->setType('etat','selecthiddenstatic'); |
116 |
} else { |
117 |
$form->setType('etat','select'); |
118 |
} |
119 |
$form->setType('delai','text'); |
120 |
$form->setType('accord_tacite','text'); |
121 |
$form->setType('delai_notification','text'); |
122 |
$form->setType('lettretype','text'); |
123 |
$form->setType('consultation','text'); |
124 |
|
125 |
if($this->retourformulaire=='avis_decision' |
126 |
and $form->val['avis_decision'] == $this->getParameter('idxformulaire')) { |
127 |
$form->setType('avis_decision','selecthiddenstatic'); |
128 |
} else { |
129 |
$form->setType('avis_decision','select'); |
130 |
} |
131 |
}// fin ajout |
132 |
if ($maj==1){ //modifier |
133 |
$form->setType('evenement','hiddenstatic'); |
134 |
$form->setType('libelle','text'); |
135 |
|
136 |
if($this->retourformulaire=='nature' |
137 |
and $form->val['nature'] == $this->getParameter('idxformulaire')) { |
138 |
$form->setType('nature','selecthiddenstatic'); |
139 |
} else { |
140 |
$form->setType('nature','select'); |
141 |
} |
142 |
|
143 |
if($this->retourformulaire=='action' |
144 |
and $form->val['action'] == $this->getParameter('idxformulaire')) { |
145 |
$form->setType('action','selecthiddenstatic'); |
146 |
} else { |
147 |
$form->setType('action','select'); |
148 |
} |
149 |
|
150 |
if($this->retourformulaire=='etat' |
151 |
and $form->val['etat'] == $this->getParameter('idxformulaire')) { |
152 |
$form->setType('etat','selecthiddenstatic'); |
153 |
} else { |
154 |
$form->setType('etat','select'); |
155 |
} |
156 |
$form->setType('delai','text'); |
157 |
$form->setType('accord_tacite','text'); |
158 |
$form->setType('delai_notification','text'); |
159 |
$form->setType('lettretype','text'); |
160 |
$form->setType('consultation','text'); |
161 |
|
162 |
if($this->retourformulaire=='avis_decision' |
163 |
and $form->val['avis_decision'] == $this->getParameter('idxformulaire')) { |
164 |
$form->setType('avis_decision','selecthiddenstatic'); |
165 |
} else { |
166 |
$form->setType('avis_decision','select'); |
167 |
} |
168 |
}// fin modifier |
169 |
if ($maj==2){ //supprimer |
170 |
$form->setType('evenement','hiddenstatic'); |
171 |
$form->setType('libelle','hiddenstatic'); |
172 |
$form->setType('nature','selectstatic'); |
173 |
$form->setType('action','selectstatic'); |
174 |
$form->setType('etat','selectstatic'); |
175 |
$form->setType('delai','hiddenstatic'); |
176 |
$form->setType('accord_tacite','hiddenstatic'); |
177 |
$form->setType('delai_notification','hiddenstatic'); |
178 |
$form->setType('lettretype','hiddenstatic'); |
179 |
$form->setType('consultation','hiddenstatic'); |
180 |
$form->setType('avis_decision','selectstatic'); |
181 |
}//fin supprimer |
182 |
if ($maj==3){ //consulter |
183 |
$form->setType('evenement','static'); |
184 |
$form->setType('libelle','static'); |
185 |
$form->setType('nature','selectstatic'); |
186 |
$form->setType('action','selectstatic'); |
187 |
$form->setType('etat','selectstatic'); |
188 |
$form->setType('delai','static'); |
189 |
$form->setType('accord_tacite','static'); |
190 |
$form->setType('delai_notification','static'); |
191 |
$form->setType('lettretype','static'); |
192 |
$form->setType('consultation','static'); |
193 |
$form->setType('avis_decision','selectstatic'); |
194 |
}//fin consulter |
195 |
} |
196 |
|
197 |
function setOnchange(&$form,$maj) { |
198 |
//javascript controle client |
199 |
$form->setOnchange('evenement','VerifNum(this)'); |
200 |
$form->setOnchange('delai','VerifNum(this)'); |
201 |
$form->setOnchange('delai_notification','VerifNum(this)'); |
202 |
$form->setOnchange('avis_decision','VerifNum(this)'); |
203 |
} |
204 |
/** |
205 |
* Methode setTaille |
206 |
*/ |
207 |
function setTaille(&$form, $maj) { |
208 |
$form->setTaille("evenement", 11); |
209 |
$form->setTaille("libelle", 30); |
210 |
$form->setTaille("nature", 10); |
211 |
$form->setTaille("action", 20); |
212 |
$form->setTaille("etat", 20); |
213 |
$form->setTaille("delai", 11); |
214 |
$form->setTaille("accord_tacite", 10); |
215 |
$form->setTaille("delai_notification", 11); |
216 |
$form->setTaille("lettretype", 30); |
217 |
$form->setTaille("consultation", 10); |
218 |
$form->setTaille("avis_decision", 11); |
219 |
} |
220 |
|
221 |
/** |
222 |
* Methode setMax |
223 |
*/ |
224 |
function setMax(&$form, $maj) { |
225 |
$form->setMax("evenement", 11); |
226 |
$form->setMax("libelle", 70); |
227 |
$form->setMax("nature", 2); |
228 |
$form->setMax("action", 20); |
229 |
$form->setMax("etat", 20); |
230 |
$form->setMax("delai", 11); |
231 |
$form->setMax("accord_tacite", 3); |
232 |
$form->setMax("delai_notification", 11); |
233 |
$form->setMax("lettretype", 60); |
234 |
$form->setMax("consultation", 3); |
235 |
$form->setMax("avis_decision", 11); |
236 |
} |
237 |
|
238 |
|
239 |
function setLib(&$form,$maj) { |
240 |
//libelle des champs |
241 |
$form->setLib('evenement',_('evenement')); |
242 |
$form->setLib('libelle',_('libelle')); |
243 |
$form->setLib('nature',_('nature')); |
244 |
$form->setLib('action',_('action')); |
245 |
$form->setLib('etat',_('etat')); |
246 |
$form->setLib('delai',_('delai')); |
247 |
$form->setLib('accord_tacite',_('accord_tacite')); |
248 |
$form->setLib('delai_notification',_('delai_notification')); |
249 |
$form->setLib('lettretype',_('lettretype')); |
250 |
$form->setLib('consultation',_('consultation')); |
251 |
$form->setLib('avis_decision',_('avis_decision')); |
252 |
} |
253 |
|
254 |
function setSelect(&$form, $maj,&$db,$debug) { |
255 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
256 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
257 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
258 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
259 |
|
260 |
// action |
261 |
$this->init_select($form, $db, $maj, $debug, "action", |
262 |
$sql_action, $sql_action_by_id, false); |
263 |
|
264 |
// avis_decision |
265 |
$this->init_select($form, $db, $maj, $debug, "avis_decision", |
266 |
$sql_avis_decision, $sql_avis_decision_by_id, false); |
267 |
|
268 |
// etat |
269 |
$this->init_select($form, $db, $maj, $debug, "etat", |
270 |
$sql_etat, $sql_etat_by_id, false); |
271 |
|
272 |
// nature |
273 |
$this->init_select($form, $db, $maj, $debug, "nature", |
274 |
$sql_nature, $sql_nature_by_id, false); |
275 |
}// fin select |
276 |
|
277 |
//================================== |
278 |
// sous Formulaire [subform] |
279 |
//================================== |
280 |
|
281 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
282 |
$this->retourformulaire = $retourformulaire; |
283 |
if($validation == 0) { |
284 |
if($retourformulaire =='action') |
285 |
$form->setVal('action', $idxformulaire); |
286 |
if($retourformulaire =='avis_decision') |
287 |
$form->setVal('avis_decision', $idxformulaire); |
288 |
if($retourformulaire =='etat') |
289 |
$form->setVal('etat', $idxformulaire); |
290 |
if($retourformulaire =='nature') |
291 |
$form->setVal('nature', $idxformulaire); |
292 |
}// fin validation |
293 |
}// fin setValsousformulaire |
294 |
|
295 |
//================================== |
296 |
// cle secondaire [secondary key] |
297 |
//================================== |
298 |
/** |
299 |
* Methode clesecondaire |
300 |
*/ |
301 |
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
302 |
// On appelle la methode de la classe parent |
303 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
304 |
// Verification de la cle secondaire : bible |
305 |
$this->rechercheTable($db, "bible", "evenement", $id); |
306 |
// Verification de la cle secondaire : demande_type |
307 |
$this->rechercheTable($db, "demande_type", "evenement", $id); |
308 |
// Verification de la cle secondaire : instruction |
309 |
$this->rechercheTable($db, "instruction", "evenement", $id); |
310 |
// Verification de la cle secondaire : lien_evenement_dossier_autorisation_type |
311 |
$this->rechercheTable($db, "lien_evenement_dossier_autorisation_type", "evenement", $id); |
312 |
} |
313 |
|
314 |
|
315 |
}// fin classe |
316 |
?> |