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