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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 397 - (hide annotations)
Thu Sep 20 09:01:35 2012 UTC (12 years, 4 months ago) by nhaye
File size: 8762 byte(s)
Régénération suite à la maj d'OM 4.3.0
suppression de surcharges

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26