1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 16/02/2015 10:30 |
4 |
|
5 |
require_once "../obj/om_dbform.class.php"; |
6 |
|
7 |
class parcelle_lot_gen extends om_dbform { |
8 |
|
9 |
var $table = "parcelle_lot"; |
10 |
var $clePrimaire = "parcelle_lot"; |
11 |
var $typeCle = "N"; |
12 |
var $required_field = array( |
13 |
"lotissement", |
14 |
"parcelle_lot" |
15 |
); |
16 |
|
17 |
var $foreign_keys_extended = array( |
18 |
); |
19 |
|
20 |
|
21 |
|
22 |
function setvalF($val) { |
23 |
//affectation valeur formulaire |
24 |
if (!is_numeric($val['parcelle_lot'])) { |
25 |
$this->valF['parcelle_lot'] = ""; // -> requis |
26 |
} else { |
27 |
$this->valF['parcelle_lot'] = $val['parcelle_lot']; |
28 |
} |
29 |
$this->valF['lotissement'] = $val['lotissement']; |
30 |
if ($val['numero'] == "") { |
31 |
$this->valF['numero'] = NULL; |
32 |
} else { |
33 |
$this->valF['numero'] = $val['numero']; |
34 |
} |
35 |
if (!is_numeric($val['surface'])) { |
36 |
$this->valF['surface'] = NULL; |
37 |
} else { |
38 |
$this->valF['surface'] = $val['surface']; |
39 |
} |
40 |
if ($val['geom'] == "") { |
41 |
unset($this->valF['geom']); |
42 |
} else { |
43 |
$this->valF['geom'] = $val['geom']; |
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 |
//========================== |
65 |
// Formulaire [form] |
66 |
//========================== |
67 |
/** |
68 |
* |
69 |
*/ |
70 |
function setType(&$form, $maj) { |
71 |
|
72 |
// MODE AJOUTER |
73 |
if ($maj == 0) { |
74 |
$form->setType("parcelle_lot", "hidden"); |
75 |
$form->setType("lotissement", "text"); |
76 |
$form->setType("numero", "text"); |
77 |
$form->setType("surface", "text"); |
78 |
$form->setType("geom", "geom"); |
79 |
} |
80 |
|
81 |
// MDOE MODIFIER |
82 |
if ($maj == 1) { |
83 |
$form->setType("parcelle_lot", "hiddenstatic"); |
84 |
$form->setType("lotissement", "text"); |
85 |
$form->setType("numero", "text"); |
86 |
$form->setType("surface", "text"); |
87 |
$form->setType("geom", "geom"); |
88 |
} |
89 |
|
90 |
// MODE SUPPRIMER |
91 |
if ($maj == 2) { |
92 |
$form->setType("parcelle_lot", "hiddenstatic"); |
93 |
$form->setType("lotissement", "hiddenstatic"); |
94 |
$form->setType("numero", "hiddenstatic"); |
95 |
$form->setType("surface", "hiddenstatic"); |
96 |
$form->setType("geom", "geom"); |
97 |
} |
98 |
|
99 |
// MODE CONSULTER |
100 |
if ($maj == 3) { |
101 |
$form->setType("parcelle_lot", "static"); |
102 |
$form->setType("lotissement", "static"); |
103 |
$form->setType("numero", "static"); |
104 |
$form->setType("surface", "static"); |
105 |
$form->setType("geom", "geom"); |
106 |
} |
107 |
|
108 |
} |
109 |
|
110 |
|
111 |
function setOnchange(&$form, $maj) { |
112 |
//javascript controle client |
113 |
$form->setOnchange('parcelle_lot','VerifNum(this)'); |
114 |
$form->setOnchange('surface','VerifFloat(this)'); |
115 |
} |
116 |
/** |
117 |
* Methode setTaille |
118 |
*/ |
119 |
function setTaille(&$form, $maj) { |
120 |
$form->setTaille("parcelle_lot", 11); |
121 |
$form->setTaille("lotissement", 30); |
122 |
$form->setTaille("numero", 16); |
123 |
$form->setTaille("surface", 30); |
124 |
$form->setTaille("geom", 30); |
125 |
} |
126 |
|
127 |
/** |
128 |
* Methode setMax |
129 |
*/ |
130 |
function setMax(&$form, $maj) { |
131 |
$form->setMax("parcelle_lot", 11); |
132 |
$form->setMax("lotissement", 50); |
133 |
$form->setMax("numero", 16); |
134 |
$form->setMax("surface", 655363); |
135 |
$form->setMax("geom", 551432); |
136 |
} |
137 |
|
138 |
|
139 |
function setLib(&$form, $maj) { |
140 |
//libelle des champs |
141 |
$form->setLib('parcelle_lot',_('parcelle_lot')); |
142 |
$form->setLib('lotissement',_('lotissement')); |
143 |
$form->setLib('numero',_('numero')); |
144 |
$form->setLib('surface',_('surface')); |
145 |
$form->setLib('geom',_('geom')); |
146 |
} |
147 |
/** |
148 |
* |
149 |
*/ |
150 |
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
151 |
|
152 |
// Inclusion du fichier de requêtes |
153 |
if (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) { |
154 |
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"; |
155 |
} elseif (file_exists("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) { |
156 |
include "../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"; |
157 |
} |
158 |
|
159 |
// geom |
160 |
if ($maj == 1 || $maj == 3) { |
161 |
$contenu = array(); |
162 |
$contenu[0] = array("parcelle_lot", $this->getParameter("idx"), "0"); |
163 |
$form->setSelect("geom", $contenu); |
164 |
} |
165 |
} |
166 |
|
167 |
|
168 |
//================================== |
169 |
// sous Formulaire |
170 |
//================================== |
171 |
|
172 |
|
173 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
174 |
$this->retourformulaire = $retourformulaire; |
175 |
$this->set_form_default_values($form, $maj, $validation); |
176 |
}// fin setValsousformulaire |
177 |
|
178 |
//================================== |
179 |
// cle secondaire |
180 |
//================================== |
181 |
|
182 |
/** |
183 |
* Methode clesecondaire |
184 |
*/ |
185 |
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
186 |
// On appelle la methode de la classe parent |
187 |
parent::cleSecondaire($id); |
188 |
// Verification de la cle secondaire : dossier |
189 |
$this->rechercheTable($this->f->db, "dossier", "parcelle_lot", $id); |
190 |
} |
191 |
|
192 |
|
193 |
} |
194 |
|
195 |
?> |