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