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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 547 - (hide annotations)
Mon Oct 29 16:44:54 2012 UTC (12 years, 3 months ago) by nhaye
File size: 10104 byte(s)
Régénération suite à la suppression de champs de la table om_utilisateur

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26