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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (hide annotations)
Fri Sep 2 09:15:04 2011 UTC (13 years, 5 months ago) by fraynaud
File size: 5212 byte(s)
regen verion om410 + correction bugs images


1 fraynaud 3 <?php
2     //$Id$
3 fraynaud 118 //gen openMairie le 02/09/2011 11:08
4 fraynaud 3 require_once (PATH_OPENMAIRIE."dbformdyn.class.php");
5    
6     class om_parametre_gen extends dbForm {
7     var $table="om_parametre";
8     var $clePrimaire="om_parametre";
9     var $typeCle="N";
10     var $retourformulaire;
11    
12     function setvalF($val) {
13     //affectation valeur formulaire
14     $this->valF['om_parametre'] = $val['om_parametre'];
15     $this->valF['libelle'] = $val['libelle'];
16     $this->valF['valeur'] = $val['valeur'];
17     $this->valF['om_collectivite'] = $val['om_collectivite'];
18     }
19    
20     //=================================================
21     //cle primaire automatique [automatic primary key]
22     //==================================================
23    
24     function setId(&$db) {
25     //numero automatique
26     $this->valF[$this->table] = $db->nextId(DB_PREFIXE.$this->table);
27     }
28    
29     function setValFAjout($val) {
30     //numero automatique -> pas de controle ajout cle primaire
31     }
32    
33     function verifierAjout() {
34     //numero automatique -> pas de verfication de cle primaire
35     }
36    
37     //====================================
38     // verifier avant validation [verify]
39     //=====================================
40 fraynaud 118 /**
41     * Methode verifier
42     */
43     function verifier($val = array(), &$db = NULL, $DEBUG = false) {
44     // On appelle la methode de la classe parent
45     parent::verifier($val, $db, $DEBUG);
46     // On verifie si le champ n'est pas vide
47     if ($this->valF['libelle'] == "") {
48     $this->correct = false;
49     $this->addToMessage(_("Le champ")." "._("libelle")." "._("est obligatoire"));
50     }
51     }
52 fraynaud 3
53    
54     //==========================
55     // Formulaire [form]
56     //==========================
57    
58     function setType(&$form,$maj) {
59     //type
60     if ($maj==0){ //ajout
61     $form->setType('om_parametre','hidden');// cle automatique
62     $form->setType('libelle','text');
63     $form->setType('valeur','text');
64     if($this->retourformulaire=='om_collectivite')
65     $form->setType('om_collectivite','hiddenstatic');
66     else
67     if($_SESSION['niveau']==2)
68     $form->setType('om_collectivite','select');
69     else
70     $form->setType('om_collectivite','hiddenstatic');
71     }// fin ajout
72     if ($maj==1){ //modifier
73     $form->setType('om_parametre','hiddenstatic');
74     $form->setType('libelle','text');
75     $form->setType('valeur','text');
76     if($this->retourformulaire=='om_collectivite')
77     $form->setType('om_collectivite','hiddenstatic');
78     else
79     if($_SESSION['niveau']==2)
80     $form->setType('om_collectivite','select');
81     else
82     $form->setType('om_collectivite','hiddenstatic');
83     }// fin modifier
84     if ($maj==2){ //supprimer
85     $form->setType('om_parametre','hiddenstatic');
86     $form->setType('libelle','hiddenstatic');
87     $form->setType('valeur','hiddenstatic');
88     $form->setType('om_collectivite','hiddenstatic');
89     }//fin supprimer
90     }
91    
92     function setOnchange(&$form,$maj) {
93     //javascript controle client
94     $form->setOnchange('om_parametre','VerifNum(this)');
95     $form->setOnchange('om_collectivite','VerifNum(this)');
96     }
97    
98     function setTaille(&$form,$maj) {
99     //taille des champs affiches (text)
100 fraynaud 118 $form->setTaille('om_parametre',8);
101 fraynaud 3 $form->setTaille('libelle',20);
102 fraynaud 118 $form->setTaille('valeur',11);
103     $form->setTaille('om_collectivite',8);
104 fraynaud 3 }
105    
106     function setMax(&$form,$maj) {
107     //longueur max en saisie (text)
108 fraynaud 118 $form->setMax('om_parametre',8);
109 fraynaud 3 $form->setMax('libelle',20);
110 fraynaud 118 $form->setMax('valeur',11);
111     $form->setMax('om_collectivite',8);
112 fraynaud 3 }
113    
114     function setLib(&$form,$maj) {
115     //libelle des champs
116     $form->setLib('om_parametre',_('om_parametre'));
117     $form->setLib('libelle',_('libelle'));
118     $form->setLib('valeur',_('valeur'));
119     $form->setLib('om_collectivite',_('om_collectivite'));
120     }
121    
122     function setSelect(&$form, $maj,&$db,$debug) {
123     if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
124     include ("../sql/".$db->phptype."/".$this->table.".form.inc");
125     if($maj<2){
126     // om_collectivite
127     $contenu=array();
128     $res = $db->query($sql_om_collectivite);
129     if (database::isError($res))
130     die($res->getMessage().$sql_om_collectivite);
131     else{
132     if ($debug == 1)
133     echo " la requete ".$sql_om_collectivite." est executee<br>";
134     $contenu[0][0]='';
135     $contenu[1][0]=_('choisir')."&nbsp;"._('om_collectivite');
136     $k=1;
137     while ($row=& $res->fetchRow()){
138     $contenu[0][$k]=$row[0];
139     $contenu[1][$k]=$row[1];
140     $k++;
141     }
142     $form->setSelect('om_collectivite',$contenu);
143     }// fin error db
144     }// fin maj
145     }// fin select
146    
147     function setVal(&$form,$maj,$validation,&$db,$DEBUG=null){
148     if($validation==0 and $maj==0 and $_SESSION['niveau']==1) {
149     $form->setVal('om_collectivite', $_SESSION['collectivite']);
150     }// fin validation
151     }// fin setVal
152    
153     //==================================
154     // sous Formulaire [subform]
155     //==================================
156    
157     function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
158     $this->retourformulaire = $retourformulaire;
159     if($validation==0) {
160     if($retourformulaire =='om_collectivite')
161     $form->setVal('om_collectivite', $idxformulaire);
162     }// fin validation
163     }// fin setValsousformulaire
164    
165     //==================================
166     // cle secondaire [secondary key]
167     //==================================
168    
169     }// fin classe
170     ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26