/[openfoncier]/trunk/gen/obj/om_utilisateur.class.php
ViewVC logotype

Contents of /trunk/gen/obj/om_utilisateur.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 555 - (show annotations)
Tue Oct 30 14:05:14 2012 UTC (12 years, 3 months ago) by vpihour
File size: 11137 byte(s)
Ajout de nouvelles tables
Correction de bug 

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26