1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 30/11/2012 12:37 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class affectation_automatique_gen extends om_dbform { |
8 |
var $table="affectation_automatique"; |
9 |
var $clePrimaire="affectation_automatique"; |
10 |
var $typeCle="N"; |
11 |
var $required_field=array( |
12 |
"affectation_automatique", |
13 |
"instructeur" |
14 |
); |
15 |
var $retourformulaire; |
16 |
|
17 |
function setvalF($val) { |
18 |
//affectation valeur formulaire |
19 |
if (!is_numeric($val['affectation_automatique'])) { |
20 |
$this->valF['affectation_automatique'] = ""; // -> requis |
21 |
} else { |
22 |
$this->valF['affectation_automatique'] = $val['affectation_automatique']; |
23 |
} |
24 |
if (!is_numeric($val['arrondissement'])) { |
25 |
$this->valF['arrondissement'] = NULL; |
26 |
} else { |
27 |
$this->valF['arrondissement'] = $val['arrondissement']; |
28 |
} |
29 |
if (!is_numeric($val['quartier'])) { |
30 |
$this->valF['quartier'] = NULL; |
31 |
} else { |
32 |
$this->valF['quartier'] = $val['quartier']; |
33 |
} |
34 |
if ($val['section'] == "") { |
35 |
$this->valF['section'] = NULL; |
36 |
} else { |
37 |
$this->valF['section'] = $val['section']; |
38 |
} |
39 |
if (!is_numeric($val['instructeur'])) { |
40 |
$this->valF['instructeur'] = ""; // -> requis |
41 |
} else { |
42 |
$this->valF['instructeur'] = $val['instructeur']; |
43 |
} |
44 |
if (!is_numeric($val['dossier_autorisation_type_detaille'])) { |
45 |
$this->valF['dossier_autorisation_type_detaille'] = NULL; |
46 |
} else { |
47 |
$this->valF['dossier_autorisation_type_detaille'] = $val['dossier_autorisation_type_detaille']; |
48 |
} |
49 |
} |
50 |
|
51 |
//================================================= |
52 |
//cle primaire automatique [automatic primary key] |
53 |
//================================================== |
54 |
|
55 |
function setId(&$db) { |
56 |
//numero automatique |
57 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
58 |
} |
59 |
|
60 |
function setValFAjout($val) { |
61 |
//numero automatique -> pas de controle ajout cle primaire |
62 |
} |
63 |
|
64 |
function verifierAjout() { |
65 |
//numero automatique -> pas de verfication de cle primaire |
66 |
} |
67 |
|
68 |
//========================== |
69 |
// Formulaire [form] |
70 |
//========================== |
71 |
|
72 |
function setType(&$form,$maj) { |
73 |
//type |
74 |
if ($maj==0){ //ajout |
75 |
$form->setType('affectation_automatique','hidden');// cle automatique |
76 |
|
77 |
if($this->retourformulaire=='arrondissement' |
78 |
and $form->val['arrondissement'] == $this->getParameter('idxformulaire')) { |
79 |
$form->setType('arrondissement','selecthiddenstatic'); |
80 |
} else { |
81 |
$form->setType('arrondissement','select'); |
82 |
} |
83 |
|
84 |
if($this->retourformulaire=='quartier' |
85 |
and $form->val['quartier'] == $this->getParameter('idxformulaire')) { |
86 |
$form->setType('quartier','selecthiddenstatic'); |
87 |
} else { |
88 |
$form->setType('quartier','select'); |
89 |
} |
90 |
$form->setType('section','text'); |
91 |
|
92 |
if($this->retourformulaire=='instructeur' |
93 |
and $form->val['instructeur'] == $this->getParameter('idxformulaire')) { |
94 |
$form->setType('instructeur','selecthiddenstatic'); |
95 |
} else { |
96 |
$form->setType('instructeur','select'); |
97 |
} |
98 |
|
99 |
if($this->retourformulaire=='dossier_autorisation_type_detaille' |
100 |
and $form->val['dossier_autorisation_type_detaille'] == $this->getParameter('idxformulaire')) { |
101 |
$form->setType('dossier_autorisation_type_detaille','selecthiddenstatic'); |
102 |
} else { |
103 |
$form->setType('dossier_autorisation_type_detaille','select'); |
104 |
} |
105 |
}// fin ajout |
106 |
if ($maj==1){ //modifier |
107 |
$form->setType('affectation_automatique','hiddenstatic'); |
108 |
|
109 |
if($this->retourformulaire=='arrondissement' |
110 |
and $form->val['arrondissement'] == $this->getParameter('idxformulaire')) { |
111 |
$form->setType('arrondissement','selecthiddenstatic'); |
112 |
} else { |
113 |
$form->setType('arrondissement','select'); |
114 |
} |
115 |
|
116 |
if($this->retourformulaire=='quartier' |
117 |
and $form->val['quartier'] == $this->getParameter('idxformulaire')) { |
118 |
$form->setType('quartier','selecthiddenstatic'); |
119 |
} else { |
120 |
$form->setType('quartier','select'); |
121 |
} |
122 |
$form->setType('section','text'); |
123 |
|
124 |
if($this->retourformulaire=='instructeur' |
125 |
and $form->val['instructeur'] == $this->getParameter('idxformulaire')) { |
126 |
$form->setType('instructeur','selecthiddenstatic'); |
127 |
} else { |
128 |
$form->setType('instructeur','select'); |
129 |
} |
130 |
|
131 |
if($this->retourformulaire=='dossier_autorisation_type_detaille' |
132 |
and $form->val['dossier_autorisation_type_detaille'] == $this->getParameter('idxformulaire')) { |
133 |
$form->setType('dossier_autorisation_type_detaille','selecthiddenstatic'); |
134 |
} else { |
135 |
$form->setType('dossier_autorisation_type_detaille','select'); |
136 |
} |
137 |
}// fin modifier |
138 |
if ($maj==2){ //supprimer |
139 |
$form->setType('affectation_automatique','hiddenstatic'); |
140 |
$form->setType('arrondissement','selectstatic'); |
141 |
$form->setType('quartier','selectstatic'); |
142 |
$form->setType('section','hiddenstatic'); |
143 |
$form->setType('instructeur','selectstatic'); |
144 |
$form->setType('dossier_autorisation_type_detaille','selectstatic'); |
145 |
}//fin supprimer |
146 |
if ($maj==3){ //consulter |
147 |
$form->setType('affectation_automatique','static'); |
148 |
$form->setType('arrondissement','selectstatic'); |
149 |
$form->setType('quartier','selectstatic'); |
150 |
$form->setType('section','static'); |
151 |
$form->setType('instructeur','selectstatic'); |
152 |
$form->setType('dossier_autorisation_type_detaille','selectstatic'); |
153 |
}//fin consulter |
154 |
} |
155 |
|
156 |
function setOnchange(&$form,$maj) { |
157 |
//javascript controle client |
158 |
$form->setOnchange('affectation_automatique','VerifNum(this)'); |
159 |
$form->setOnchange('arrondissement','VerifNum(this)'); |
160 |
$form->setOnchange('quartier','VerifNum(this)'); |
161 |
$form->setOnchange('instructeur','VerifNum(this)'); |
162 |
$form->setOnchange('dossier_autorisation_type_detaille','VerifNum(this)'); |
163 |
} |
164 |
/** |
165 |
* Methode setTaille |
166 |
*/ |
167 |
function setTaille(&$form, $maj) { |
168 |
$form->setTaille("affectation_automatique", 11); |
169 |
$form->setTaille("arrondissement", 11); |
170 |
$form->setTaille("quartier", 11); |
171 |
$form->setTaille("section", 10); |
172 |
$form->setTaille("instructeur", 11); |
173 |
$form->setTaille("dossier_autorisation_type_detaille", 11); |
174 |
} |
175 |
|
176 |
/** |
177 |
* Methode setMax |
178 |
*/ |
179 |
function setMax(&$form, $maj) { |
180 |
$form->setMax("affectation_automatique", 11); |
181 |
$form->setMax("arrondissement", 11); |
182 |
$form->setMax("quartier", 11); |
183 |
$form->setMax("section", 2); |
184 |
$form->setMax("instructeur", 11); |
185 |
$form->setMax("dossier_autorisation_type_detaille", 11); |
186 |
} |
187 |
|
188 |
|
189 |
function setLib(&$form,$maj) { |
190 |
//libelle des champs |
191 |
$form->setLib('affectation_automatique',_('affectation_automatique')); |
192 |
$form->setLib('arrondissement',_('arrondissement')); |
193 |
$form->setLib('quartier',_('quartier')); |
194 |
$form->setLib('section',_('section')); |
195 |
$form->setLib('instructeur',_('instructeur')); |
196 |
$form->setLib('dossier_autorisation_type_detaille',_('dossier_autorisation_type_detaille')); |
197 |
} |
198 |
|
199 |
function setSelect(&$form, $maj,&$db,$debug) { |
200 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
201 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
202 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
203 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
204 |
|
205 |
// arrondissement |
206 |
$this->init_select($form, $db, $maj, $debug, "arrondissement", |
207 |
$sql_arrondissement, $sql_arrondissement_by_id, false); |
208 |
|
209 |
// dossier_autorisation_type_detaille |
210 |
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation_type_detaille", |
211 |
$sql_dossier_autorisation_type_detaille, $sql_dossier_autorisation_type_detaille_by_id, false); |
212 |
|
213 |
// instructeur |
214 |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
215 |
$sql_instructeur, $sql_instructeur_by_id, true); |
216 |
|
217 |
// quartier |
218 |
$this->init_select($form, $db, $maj, $debug, "quartier", |
219 |
$sql_quartier, $sql_quartier_by_id, false); |
220 |
}// fin select |
221 |
|
222 |
//================================== |
223 |
// sous Formulaire [subform] |
224 |
//================================== |
225 |
|
226 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
227 |
$this->retourformulaire = $retourformulaire; |
228 |
if($validation == 0) { |
229 |
if($retourformulaire =='arrondissement') |
230 |
$form->setVal('arrondissement', $idxformulaire); |
231 |
if($retourformulaire =='dossier_autorisation_type_detaille') |
232 |
$form->setVal('dossier_autorisation_type_detaille', $idxformulaire); |
233 |
if($retourformulaire =='instructeur') |
234 |
$form->setVal('instructeur', $idxformulaire); |
235 |
if($retourformulaire =='quartier') |
236 |
$form->setVal('quartier', $idxformulaire); |
237 |
}// fin validation |
238 |
}// fin setValsousformulaire |
239 |
|
240 |
//================================== |
241 |
// cle secondaire [secondary key] |
242 |
//================================== |
243 |
|
244 |
}// fin classe |
245 |
?> |