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