1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 20/09/2012 18:29 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class parametre_gen extends om_dbform { |
8 |
var $table="parametre"; |
9 |
var $clePrimaire="parametre"; |
10 |
var $typeCle="A"; |
11 |
var $required_field=array( |
12 |
"parametre", |
13 |
"libelle" |
14 |
); |
15 |
var $retourformulaire; |
16 |
|
17 |
function setvalF($val) { |
18 |
//affectation valeur formulaire |
19 |
$this->valF['parametre'] = $val['parametre']; |
20 |
$this->valF['libelle'] = $val['libelle']; |
21 |
$this->valF['actif'] = $val['actif']; |
22 |
$this->valF['sitadel'] = $val['sitadel']; |
23 |
if(!is_numeric($val['longueur_champ'])) { |
24 |
$this->valF['longueur_champ']= null; |
25 |
} else { |
26 |
$this->valF['longueur_champ'] = $val['longueur_champ']; |
27 |
} |
28 |
$this->valF['type_champ'] = $val['type_champ']; |
29 |
$this->valF['valeur_autorisee'] = $val['valeur_autorisee']; |
30 |
} |
31 |
|
32 |
//========================== |
33 |
// Formulaire [form] |
34 |
//========================== |
35 |
|
36 |
function setType(&$form,$maj) { |
37 |
//type |
38 |
if ($maj==0){ //ajout |
39 |
$form->setType('parametre','text'); |
40 |
$form->setType('libelle','text'); |
41 |
$form->setType('actif','text'); |
42 |
$form->setType('sitadel','text'); |
43 |
$form->setType('longueur_champ','text'); |
44 |
$form->setType('type_champ','text'); |
45 |
$form->setType('valeur_autorisee','text'); |
46 |
}// fin ajout |
47 |
if ($maj==1){ //modifier |
48 |
$form->setType('parametre','hiddenstatic'); |
49 |
$form->setType('libelle','text'); |
50 |
$form->setType('actif','text'); |
51 |
$form->setType('sitadel','text'); |
52 |
$form->setType('longueur_champ','text'); |
53 |
$form->setType('type_champ','text'); |
54 |
$form->setType('valeur_autorisee','text'); |
55 |
}// fin modifier |
56 |
if ($maj==2){ //supprimer |
57 |
$form->setType('parametre','hiddenstatic'); |
58 |
$form->setType('libelle','hiddenstatic'); |
59 |
$form->setType('actif','hiddenstatic'); |
60 |
$form->setType('sitadel','hiddenstatic'); |
61 |
$form->setType('longueur_champ','hiddenstatic'); |
62 |
$form->setType('type_champ','hiddenstatic'); |
63 |
$form->setType('valeur_autorisee','hiddenstatic'); |
64 |
}//fin supprimer |
65 |
if ($maj==3){ //consulter |
66 |
$form->setType('parametre','static'); |
67 |
$form->setType('libelle','static'); |
68 |
$form->setType('actif','static'); |
69 |
$form->setType('sitadel','static'); |
70 |
$form->setType('longueur_champ','static'); |
71 |
$form->setType('type_champ','static'); |
72 |
$form->setType('valeur_autorisee','static'); |
73 |
}//fin consulter |
74 |
} |
75 |
|
76 |
function setOnchange(&$form,$maj) { |
77 |
//javascript controle client |
78 |
$form->setOnchange('longueur_champ','VerifNum(this)'); |
79 |
} |
80 |
/** |
81 |
* Methode setTaille |
82 |
*/ |
83 |
function setTaille(&$form, $maj) { |
84 |
$form->setTaille("parametre", 20); |
85 |
$form->setTaille("libelle", 30); |
86 |
$form->setTaille("actif", 10); |
87 |
$form->setTaille("sitadel", 10); |
88 |
$form->setTaille("longueur_champ", 11); |
89 |
$form->setTaille("type_champ", 20); |
90 |
$form->setTaille("valeur_autorisee", 30); |
91 |
} |
92 |
|
93 |
/** |
94 |
* Methode setMax |
95 |
*/ |
96 |
function setMax(&$form, $maj) { |
97 |
$form->setMax("parametre", 20); |
98 |
$form->setMax("libelle", 50); |
99 |
$form->setMax("actif", 3); |
100 |
$form->setMax("sitadel", 3); |
101 |
$form->setMax("longueur_champ", 11); |
102 |
$form->setMax("type_champ", 20); |
103 |
$form->setMax("valeur_autorisee", 50); |
104 |
} |
105 |
|
106 |
|
107 |
function setLib(&$form,$maj) { |
108 |
//libelle des champs |
109 |
$form->setLib('parametre',_('parametre')); |
110 |
$form->setLib('libelle',_('libelle')); |
111 |
$form->setLib('actif',_('actif')); |
112 |
$form->setLib('sitadel',_('sitadel')); |
113 |
$form->setLib('longueur_champ',_('longueur_champ')); |
114 |
$form->setLib('type_champ',_('type_champ')); |
115 |
$form->setLib('valeur_autorisee',_('valeur_autorisee')); |
116 |
} |
117 |
|
118 |
//================================== |
119 |
// sous Formulaire [subform] |
120 |
//================================== |
121 |
|
122 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
123 |
$this->retourformulaire = $retourformulaire; |
124 |
}// fin setValsousformulaire |
125 |
|
126 |
//================================== |
127 |
// cle secondaire [secondary key] |
128 |
//================================== |
129 |
/** |
130 |
* Methode clesecondaire |
131 |
*/ |
132 |
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
133 |
// On appelle la methode de la classe parent |
134 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
135 |
// Verification de la cle secondaire : statistique |
136 |
$this->rechercheTable($db, "statistique", "parametre", $id); |
137 |
} |
138 |
|
139 |
|
140 |
}// fin classe |
141 |
?> |