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

Contents of /trunk/gen/obj/direction.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3292 - (show annotations)
Mon Feb 16 09:31:42 2015 UTC (9 years, 11 months ago) by vpihour
File size: 8433 byte(s)
Mise à jour des fichiers générés

1 <?php
2 //$Id$
3 //gen openMairie le 16/02/2015 10:29
4
5 require_once "../obj/om_dbform.class.php";
6
7 class direction_gen extends om_dbform {
8
9 var $table = "direction";
10 var $clePrimaire = "direction";
11 var $typeCle = "N";
12 var $required_field = array(
13 "chef",
14 "code",
15 "direction",
16 "libelle"
17 );
18
19 var $foreign_keys_extended = array(
20 );
21
22
23
24 function setvalF($val) {
25 //affectation valeur formulaire
26 if (!is_numeric($val['direction'])) {
27 $this->valF['direction'] = ""; // -> requis
28 } else {
29 $this->valF['direction'] = $val['direction'];
30 }
31 $this->valF['code'] = $val['code'];
32 $this->valF['libelle'] = $val['libelle'];
33 $this->valF['description'] = $val['description'];
34 $this->valF['chef'] = $val['chef'];
35 if ($val['om_validite_debut'] != "") {
36 $this->valF['om_validite_debut'] = $this->dateDB($val['om_validite_debut']);
37 } else {
38 $this->valF['om_validite_debut'] = NULL;
39 }
40 if ($val['om_validite_fin'] != "") {
41 $this->valF['om_validite_fin'] = $this->dateDB($val['om_validite_fin']);
42 } else {
43 $this->valF['om_validite_fin'] = NULL;
44 }
45 }
46
47 //=================================================
48 //cle primaire automatique [automatic primary key]
49 //==================================================
50
51 function setId(&$dnu1 = null) {
52 //numero automatique
53 $this->valF[$this->clePrimaire] = $this->f->db->nextId(DB_PREFIXE.$this->table);
54 }
55
56 function setValFAjout($val) {
57 //numero automatique -> pas de controle ajout cle primaire
58 }
59
60 function verifierAjout() {
61 //numero automatique -> pas de verfication de cle primaire
62 }
63 /**
64 * Methode verifier
65 */
66 function verifier($val = array(), &$dnu1 = null, $dnu2 = null) {
67 // On appelle la methode de la classe parent
68 parent::verifier($val, $this->f->db, null);
69
70 // gestion des dates de validites
71 $date_debut = $this->valF['om_validite_debut'];
72 $date_fin = $this->valF['om_validite_fin'];
73
74 if ($date_debut != '' and $date_fin != '') {
75
76 $date_debut = explode('-', $this->valF['om_validite_debut']);
77 $date_fin = explode('-', $this->valF['om_validite_fin']);
78
79 $time_debut = mktime(0, 0, 0, $date_debut[1], $date_debut[2],
80 $date_debut[0]);
81 $time_fin = mktime(0, 0, 0, $date_fin[1], $date_fin[2],
82 $date_fin[0]);
83
84 if ($time_debut > $time_fin or $time_debut == $time_fin) {
85 $this->correct = false;
86 $this->addToMessage(_('La date de fin de validite doit etre future a la de debut de validite.'));
87 }
88 }
89 }
90
91
92 //==========================
93 // Formulaire [form]
94 //==========================
95 /**
96 *
97 */
98 function setType(&$form, $maj) {
99
100 // MODE AJOUTER
101 if ($maj == 0) {
102 $form->setType("direction", "hidden");
103 $form->setType("code", "text");
104 $form->setType("libelle", "text");
105 $form->setType("description", "textarea");
106 $form->setType("chef", "text");
107 if ($this->f->isAccredited(array($this->table."_modifier_validite", $this->table, ))) {
108 $form->setType("om_validite_debut", "date");
109 } else {
110 $form->setType("om_validite_debut", "hiddenstaticdate");
111 }
112 if ($this->f->isAccredited(array($this->table."_modifier_validite", $this->table, ))) {
113 $form->setType("om_validite_fin", "date");
114 } else {
115 $form->setType("om_validite_fin", "hiddenstaticdate");
116 }
117 }
118
119 // MDOE MODIFIER
120 if ($maj == 1) {
121 $form->setType("direction", "hiddenstatic");
122 $form->setType("code", "text");
123 $form->setType("libelle", "text");
124 $form->setType("description", "textarea");
125 $form->setType("chef", "text");
126 if ($this->f->isAccredited(array($this->table."_modifier_validite", $this->table, ))) {
127 $form->setType("om_validite_debut", "date");
128 } else {
129 $form->setType("om_validite_debut", "hiddenstaticdate");
130 }
131 if ($this->f->isAccredited(array($this->table."_modifier_validite", $this->table, ))) {
132 $form->setType("om_validite_fin", "date");
133 } else {
134 $form->setType("om_validite_fin", "hiddenstaticdate");
135 }
136 }
137
138 // MODE SUPPRIMER
139 if ($maj == 2) {
140 $form->setType("direction", "hiddenstatic");
141 $form->setType("code", "hiddenstatic");
142 $form->setType("libelle", "hiddenstatic");
143 $form->setType("description", "hiddenstatic");
144 $form->setType("chef", "hiddenstatic");
145 $form->setType("om_validite_debut", "hiddenstatic");
146 $form->setType("om_validite_fin", "hiddenstatic");
147 }
148
149 // MODE CONSULTER
150 if ($maj == 3) {
151 $form->setType("direction", "static");
152 $form->setType("code", "static");
153 $form->setType("libelle", "static");
154 $form->setType("description", "textareastatic");
155 $form->setType("chef", "static");
156 $form->setType("om_validite_debut", "datestatic");
157 $form->setType("om_validite_fin", "datestatic");
158 }
159
160 }
161
162
163 function setOnchange(&$form, $maj) {
164 //javascript controle client
165 $form->setOnchange('direction','VerifNum(this)');
166 $form->setOnchange('om_validite_debut','fdate(this)');
167 $form->setOnchange('om_validite_fin','fdate(this)');
168 }
169 /**
170 * Methode setTaille
171 */
172 function setTaille(&$form, $maj) {
173 $form->setTaille("direction", 11);
174 $form->setTaille("code", 20);
175 $form->setTaille("libelle", 30);
176 $form->setTaille("description", 80);
177 $form->setTaille("chef", 30);
178 $form->setTaille("om_validite_debut", 12);
179 $form->setTaille("om_validite_fin", 12);
180 }
181
182 /**
183 * Methode setMax
184 */
185 function setMax(&$form, $maj) {
186 $form->setMax("direction", 11);
187 $form->setMax("code", 20);
188 $form->setMax("libelle", 100);
189 $form->setMax("description", 6);
190 $form->setMax("chef", 100);
191 $form->setMax("om_validite_debut", 12);
192 $form->setMax("om_validite_fin", 12);
193 }
194
195
196 function setLib(&$form, $maj) {
197 //libelle des champs
198 $form->setLib('direction',_('direction'));
199 $form->setLib('code',_('code'));
200 $form->setLib('libelle',_('libelle'));
201 $form->setLib('description',_('description'));
202 $form->setLib('chef',_('chef'));
203 $form->setLib('om_validite_debut',_('om_validite_debut'));
204 $form->setLib('om_validite_fin',_('om_validite_fin'));
205 }
206 /**
207 *
208 */
209 function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) {
210
211 // Inclusion du fichier de requêtes
212 if (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) {
213 include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php";
214 } elseif (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) {
215 include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc";
216 }
217
218 }
219
220
221 //==================================
222 // sous Formulaire
223 //==================================
224
225
226 function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) {
227 $this->retourformulaire = $retourformulaire;
228 $this->set_form_default_values($form, $maj, $validation);
229 }// fin setValsousformulaire
230
231 //==================================
232 // cle secondaire
233 //==================================
234
235 /**
236 * Methode clesecondaire
237 */
238 function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) {
239 // On appelle la methode de la classe parent
240 parent::cleSecondaire($id);
241 // Verification de la cle secondaire : division
242 $this->rechercheTable($this->f->db, "division", "direction", $id);
243 }
244
245
246 }
247
248 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26