1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 27/06/2012 11:36 |
4 |
require_once ("../gen/obj/om_sig_map.class.php"); |
5 |
|
6 |
class om_sig_map extends om_sig_map_gen { |
7 |
|
8 |
function om_sig_map($id,&$db,$debug) { |
9 |
$this->constructeur($id,$db,$debug); |
10 |
}// fin constructeur |
11 |
|
12 |
function setType(&$form,$maj) { |
13 |
parent::setType($form,$maj); |
14 |
if($maj<2){ |
15 |
$form->setType('etendue','select'); |
16 |
$form->setType('projection_externe','select'); |
17 |
$form->setType('layer_info', 'checkbox'); |
18 |
$form->setType('fond_osm','checkbox'); |
19 |
$form->setType('fond_bing','checkbox'); |
20 |
$form->setType('fond_sat','checkbox'); |
21 |
$form->setType('maj','checkbox'); |
22 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
23 |
$form->setType('type_geometrie','select'); |
24 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
25 |
$form->setType('actif', 'checkbox'); |
26 |
} |
27 |
|
28 |
if ($maj == 2 or $maj == 3) { |
29 |
$form->setType('etendue','selectstatic'); |
30 |
$form->setType('projection_externe','selectstatic'); |
31 |
$form->setType('type_geometrie','selectstatic'); |
32 |
} |
33 |
} |
34 |
|
35 |
/** |
36 |
* Methode verifier |
37 |
*/ |
38 |
function verifier($val = array(), &$db = NULL, $DEBUG = false) { |
39 |
// On appelle la methode de la classe parent |
40 |
parent::verifier($val, $db, $DEBUG); |
41 |
// On verifie si le champ n'est pas vide |
42 |
if ($this->valF['id'] != '') { |
43 |
// On verifie si il y a un autre id 'actif' pour la collectivite |
44 |
if ($this->valF['actif'] == "Oui") { |
45 |
if ($this->maj == 0) { |
46 |
// |
47 |
$this->verifieractif($db, $val, $DEBUG, ']'); |
48 |
} else { |
49 |
// |
50 |
$this->verifieractif($db, $val, $DEBUG, $val['om_sig_map']); |
51 |
} |
52 |
} |
53 |
} |
54 |
} |
55 |
|
56 |
function setTaille(&$form,$maj) { |
57 |
parent::setTaille($form,$maj); |
58 |
//taille des champs affiches (text) |
59 |
$form->setTaille('om_sig_map',4); |
60 |
$form->setTaille('om_collectivite',4); |
61 |
$form->setTaille('id',20); |
62 |
$form->setTaille('libelle',50); |
63 |
$form->setTaille('zoom',3); |
64 |
$form->setTaille('fond_osm',1); |
65 |
$form->setTaille('fond_bing',1); |
66 |
$form->setTaille('fond_sat',1); |
67 |
$form->setTaille('etendue',60); |
68 |
$form->setTaille('projection_externe',20); |
69 |
$form->setTaille('maj',1); |
70 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
71 |
$form->setTaille('lib_geometrie',50); |
72 |
$form->setTaille('type_geometrie',30); |
73 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
74 |
$form->setTaille('table_update',30); |
75 |
$form->setTaille('champ',30); |
76 |
$form->setTaille('retour',50); |
77 |
} |
78 |
|
79 |
function setMax(&$form,$maj) { |
80 |
parent::setMax($form,$maj); |
81 |
$form->setMax('om_sig_map',4); |
82 |
$form->setMax('om_collectivite',4); |
83 |
$form->setMax('id',50); |
84 |
$form->setMax('libelle',50); |
85 |
$form->setMax('zoom',3); |
86 |
$form->setMax('fond_osm',1); |
87 |
$form->setMax('fond_bing',1); |
88 |
$form->setMax('fond_sat',1); |
89 |
$form->setMax('etendue',60); |
90 |
$form->setMax('projection_externe',60); |
91 |
$form->setMax('url',2); |
92 |
$form->setMax('maj',1); |
93 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
94 |
$form->setMax('lib_geometrie',50); |
95 |
$form->setMax('table_update',30); |
96 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
97 |
$form->setMax('table_update',30); |
98 |
$form->setMax('champ',30); |
99 |
$form->setMax('retour',50); |
100 |
} |
101 |
|
102 |
function setOnchange(&$form,$maj) { |
103 |
parent::setOnchange($form,$maj); |
104 |
$form->setOnchange('zoom','VerifNum(this)'); |
105 |
} |
106 |
|
107 |
function setSelect(&$form, $maj,&$db,$debug) { |
108 |
parent::setSelect($form, $maj,$db,$debug); |
109 |
|
110 |
if(file_exists ("../dyn/var_sig.inc")) { |
111 |
include ("../dyn/var_sig.inc"); |
112 |
} |
113 |
|
114 |
$form->setSelect("etendue",$contenu_etendue); |
115 |
$form->setSelect("projection_externe",$contenu_epsg); |
116 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
117 |
$form->setSelect("type_geometrie",$type_geometrie); |
118 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
119 |
} |
120 |
|
121 |
function setGroupe (&$form, $maj) { |
122 |
|
123 |
$form->setGroupe('id','D'); |
124 |
$form->setGroupe('libelle','G'); |
125 |
$form->setGroupe('actif','F'); |
126 |
|
127 |
$form->setGroupe('zoom','D'); |
128 |
$form->setGroupe('fond_osm','G'); |
129 |
$form->setGroupe('fond_bing','G'); |
130 |
$form->setGroupe('fond_sat','G'); |
131 |
$form->setGroupe('layer_info','F'); |
132 |
|
133 |
$form->setGroupe('etendue','D'); |
134 |
$form->setGroupe('projection_externe','F'); |
135 |
|
136 |
$form->setGroupe('maj','D'); |
137 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
138 |
$form->setGroupe('lib_geometrie','G'); |
139 |
$form->setGroupe('type_geometrie','G'); |
140 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
141 |
$form->setGroupe('table_update','G'); |
142 |
$form->setGroupe('champ','F'); |
143 |
} |
144 |
|
145 |
function setRegroupe (&$form, $maj) { |
146 |
|
147 |
$form->setRegroupe('zoom','D',' '._('fond').' ', "collapsible"); |
148 |
$form->setRegroupe('fond_osm','G',''); |
149 |
$form->setRegroupe('fond_bing','G',''); |
150 |
$form->setRegroupe('fond_sat','G',''); |
151 |
$form->setRegroupe('layer_info','F',''); |
152 |
|
153 |
$form->setRegroupe('id','D',' '._('titre').' ', "collapsible"); |
154 |
$form->setRegroupe('libelle','G',''); |
155 |
$form->setRegroupe('actif','F',''); |
156 |
|
157 |
$form->setRegroupe('etendue','D',' '._('etendue').' ', "collapsible"); |
158 |
$form->setRegroupe('projection_externe','F',''); |
159 |
|
160 |
$form->setRegroupe('maj','D',' '._('Mise a jour').' ', "startClosed"); |
161 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
162 |
$form->setRegroupe('lib_geometrie','G',''); |
163 |
$form->setRegroupe('type_geometrie','G',''); |
164 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
165 |
$form->setRegroupe('table_update','G',''); |
166 |
$form->setRegroupe('champ','F',''); |
167 |
|
168 |
} |
169 |
|
170 |
function setLib(&$form,$maj) { |
171 |
parent::setLib($form,$maj); |
172 |
//libelle des champs |
173 |
$form->setLib('fond_osm',_('osm : ')); |
174 |
$form->setLib('fond_bing',_('bing : ')); |
175 |
$form->setLib('fond_sat',_('sat : ')); |
176 |
$form->setLib('etendue',_('etendue')); |
177 |
$form->setLib('projection_externe',_('projection')); |
178 |
$form->setLib('url',_('url')); |
179 |
$form->setLib('om_sql',_('requete sql')); |
180 |
$form->setLib('maj',_('maj')); |
181 |
// AB-DEB 2012-05-14 - gestion champs geometrie |
182 |
$form->setLib('lib_geometrie',_('nom geometrie')); |
183 |
$form->setLib('type_geometrie',_('type de geometrie')); |
184 |
// AB-FIN 2012-05-14 - gestion champs geometrie |
185 |
$form->setLib('table_update',_(' table :')); |
186 |
} |
187 |
|
188 |
function setVal(&$form, $maj, $validation, &$db, $DEBUG=null) { |
189 |
parent::setVal($form, $maj, $validation, $db, $DEBUG=null); |
190 |
$this->maj=$maj; |
191 |
} |
192 |
|
193 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$db, $DEBUG=null) { |
194 |
parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, $db, $DEBUG=null); |
195 |
$this->maj=$maj; |
196 |
} |
197 |
|
198 |
/** |
199 |
* verification sur existence d un etat deja actif pour la collectivite |
200 |
*/ |
201 |
function verifieractif(&$db, $val, $DEBUG,$id){ |
202 |
$sql = "select om_sig_map from ".DB_PREFIXE."om_sig_map where id ='".$val['id']."'"; |
203 |
$sql.= " and om_collectivite ='".$val['om_collectivite']."'"; |
204 |
$sql.= " and actif ='Oui'"; |
205 |
if($id!=']') |
206 |
$sql.=" and om_sig_map !='".$id."'"; |
207 |
$res = $db->query($sql); |
208 |
if($DEBUG==1) echo $sql; |
209 |
if (database::isError($res)) |
210 |
die($res->getMessage(). " => Echec ".$sql); |
211 |
else{ |
212 |
$nbligne=$res->numrows(); |
213 |
if ($nbligne>0){ |
214 |
$this->addToMessage($nbligne." "._("sig_map")." "._("existant"). |
215 |
" "._("actif")." ! "._("vous ne pouvez avoir qu un sig_map")." '". |
216 |
$val['id']."' "._("actif")." "._("par collectivite")); |
217 |
$this->correct=False; |
218 |
} |
219 |
} |
220 |
} |
221 |
}// fin classe |
222 |
?> |