1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 05/10/2012 13:55 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class om_tdb_gen extends om_dbform { |
8 |
var $table="om_tdb"; |
9 |
var $clePrimaire="om_tdb"; |
10 |
var $typeCle="N"; |
11 |
var $required_field=array( |
12 |
"bloc", |
13 |
"login", |
14 |
"om_tdb", |
15 |
"om_widget" |
16 |
); |
17 |
var $retourformulaire; |
18 |
|
19 |
function setvalF($val) { |
20 |
//affectation valeur formulaire |
21 |
if (!is_numeric($val['om_tdb'])) { |
22 |
$this->valF['om_tdb'] = ""; // -> requis |
23 |
} else { |
24 |
$this->valF['om_tdb'] = $val['om_tdb']; |
25 |
} |
26 |
$this->valF['login'] = $val['login']; |
27 |
$this->valF['bloc'] = $val['bloc']; |
28 |
if (!is_numeric($val['position'])) { |
29 |
$this->valF['position'] = NULL; |
30 |
} else { |
31 |
$this->valF['position'] = $val['position']; |
32 |
} |
33 |
if (!is_numeric($val['om_widget'])) { |
34 |
$this->valF['om_widget'] = ""; // -> requis |
35 |
} else { |
36 |
$this->valF['om_widget'] = $val['om_widget']; |
37 |
} |
38 |
} |
39 |
|
40 |
//================================================= |
41 |
//cle primaire automatique [automatic primary key] |
42 |
//================================================== |
43 |
|
44 |
function setId(&$db) { |
45 |
//numero automatique |
46 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
47 |
} |
48 |
|
49 |
function setValFAjout($val) { |
50 |
//numero automatique -> pas de controle ajout cle primaire |
51 |
} |
52 |
|
53 |
function verifierAjout() { |
54 |
//numero automatique -> pas de verfication de cle primaire |
55 |
} |
56 |
|
57 |
//========================== |
58 |
// Formulaire [form] |
59 |
//========================== |
60 |
|
61 |
function setType(&$form,$maj) { |
62 |
//type |
63 |
if ($maj==0){ //ajout |
64 |
$form->setType('om_tdb','hidden');// cle automatique |
65 |
$form->setType('login','text'); |
66 |
$form->setType('bloc','text'); |
67 |
$form->setType('position','text'); |
68 |
|
69 |
if($this->retourformulaire=='om_widget' |
70 |
and $form->val['om_widget'] == $this->getParameter('idxformulaire')) { |
71 |
$form->setType('om_widget','selecthiddenstatic'); |
72 |
} else { |
73 |
$form->setType('om_widget','select'); |
74 |
} |
75 |
}// fin ajout |
76 |
if ($maj==1){ //modifier |
77 |
$form->setType('om_tdb','hiddenstatic'); |
78 |
$form->setType('login','text'); |
79 |
$form->setType('bloc','text'); |
80 |
$form->setType('position','text'); |
81 |
|
82 |
if($this->retourformulaire=='om_widget' |
83 |
and $form->val['om_widget'] == $this->getParameter('idxformulaire')) { |
84 |
$form->setType('om_widget','selecthiddenstatic'); |
85 |
} else { |
86 |
$form->setType('om_widget','select'); |
87 |
} |
88 |
}// fin modifier |
89 |
if ($maj==2){ //supprimer |
90 |
$form->setType('om_tdb','hiddenstatic'); |
91 |
$form->setType('login','hiddenstatic'); |
92 |
$form->setType('bloc','hiddenstatic'); |
93 |
$form->setType('position','hiddenstatic'); |
94 |
$form->setType('om_widget','selectstatic'); |
95 |
}//fin supprimer |
96 |
if ($maj==3){ //consulter |
97 |
$form->setType('om_tdb','static'); |
98 |
$form->setType('login','static'); |
99 |
$form->setType('bloc','static'); |
100 |
$form->setType('position','static'); |
101 |
$form->setType('om_widget','selectstatic'); |
102 |
}//fin consulter |
103 |
} |
104 |
|
105 |
function setOnchange(&$form,$maj) { |
106 |
//javascript controle client |
107 |
$form->setOnchange('om_tdb','VerifNum(this)'); |
108 |
$form->setOnchange('position','VerifNum(this)'); |
109 |
$form->setOnchange('om_widget','VerifNum(this)'); |
110 |
} |
111 |
/** |
112 |
* Methode setTaille |
113 |
*/ |
114 |
function setTaille(&$form, $maj) { |
115 |
$form->setTaille("om_tdb", 11); |
116 |
$form->setTaille("login", 30); |
117 |
$form->setTaille("bloc", 10); |
118 |
$form->setTaille("position", 11); |
119 |
$form->setTaille("om_widget", 11); |
120 |
} |
121 |
|
122 |
/** |
123 |
* Methode setMax |
124 |
*/ |
125 |
function setMax(&$form, $maj) { |
126 |
$form->setMax("om_tdb", 11); |
127 |
$form->setMax("login", 40); |
128 |
$form->setMax("bloc", 10); |
129 |
$form->setMax("position", 11); |
130 |
$form->setMax("om_widget", 11); |
131 |
} |
132 |
|
133 |
|
134 |
function setLib(&$form,$maj) { |
135 |
//libelle des champs |
136 |
$form->setLib('om_tdb',_('om_tdb')); |
137 |
$form->setLib('login',_('login')); |
138 |
$form->setLib('bloc',_('bloc')); |
139 |
$form->setLib('position',_('position')); |
140 |
$form->setLib('om_widget',_('om_widget')); |
141 |
} |
142 |
|
143 |
function setSelect(&$form, $maj,&$db,$debug) { |
144 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
145 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
146 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
147 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
148 |
|
149 |
// om_widget |
150 |
$this->init_select($form, $db, $maj, $debug, "om_widget", |
151 |
$sql_om_widget, $sql_om_widget_by_id, false); |
152 |
}// fin select |
153 |
|
154 |
//================================== |
155 |
// sous Formulaire [subform] |
156 |
//================================== |
157 |
|
158 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
159 |
$this->retourformulaire = $retourformulaire; |
160 |
if($validation == 0) { |
161 |
if($retourformulaire =='om_widget') |
162 |
$form->setVal('om_widget', $idxformulaire); |
163 |
}// fin validation |
164 |
}// fin setValsousformulaire |
165 |
|
166 |
//================================== |
167 |
// cle secondaire [secondary key] |
168 |
//================================== |
169 |
|
170 |
}// fin classe |
171 |
?> |