/[openfoncier]/trunk/obj/om_sig_map.class.php
ViewVC logotype

Contents of /trunk/obj/om_sig_map.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2278 - (show annotations)
Wed Sep 11 12:31:38 2013 UTC (11 years, 4 months ago) by fmichon
File size: 8373 byte(s)
Mise à niveau openmairie_exemple 4.4.0

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

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26