1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 06/04/2011 08:33 |
4 |
require_once ("../gen/obj/om_sig_point.class.php"); |
5 |
|
6 |
class om_sig_point extends om_sig_point_gen { |
7 |
|
8 |
var $maj; // pour verification actif |
9 |
|
10 |
function om_sig_point($id,&$db,$debug) { |
11 |
$this->constructeur($id,$db,$debug); |
12 |
}// fin constructeur |
13 |
|
14 |
function setType(&$form,$maj) { |
15 |
parent::setType($form,$maj); |
16 |
if($maj<2){ |
17 |
$form->setType('etendue','select'); |
18 |
$form->setType('projection_externe','select'); |
19 |
$form->setType('layer_info', 'checkbox'); |
20 |
$form->setType('fond_osm','checkbox'); |
21 |
$form->setType('fond_bing','checkbox'); |
22 |
$form->setType('fond_sat','checkbox'); |
23 |
$form->setType('maj','checkbox'); |
24 |
$form->setType('actif', 'checkbox'); |
25 |
} |
26 |
} |
27 |
|
28 |
function verifier($val, &$db, $DEBUG) { |
29 |
parent::verifier($val, $db, $DEBUG); |
30 |
$f=" ! "; |
31 |
$imgv="<img src='../app/img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
32 |
if ($this->valF['id']==""){ |
33 |
$this->msg= $this->msg.$imgv._('identifiant')." "._('obligatoire').$f; |
34 |
$this->correct=False; |
35 |
}else |
36 |
// verification si il y a un autre id "actif" pour la collectivite |
37 |
if($this->valF['actif']=="Oui") |
38 |
if($this->maj==0) |
39 |
$this->verifieractif($db, $val, $DEBUG,']'); |
40 |
else |
41 |
$this->verifieractif($db, $val, $DEBUG,$val['om_sig_point']); |
42 |
} |
43 |
|
44 |
|
45 |
function setTaille(&$form,$maj) { |
46 |
parent::setTaille($form,$maj); |
47 |
//taille des champs affiches (text) |
48 |
$form->setTaille('om_sig_point',4); |
49 |
$form->setTaille('om_collectivite',4); |
50 |
$form->setTaille('id',20); |
51 |
$form->setTaille('libelle',50); |
52 |
$form->setTaille('zoom',3); |
53 |
$form->setTaille('fond_osm',1); |
54 |
$form->setTaille('fond_bing',1); |
55 |
$form->setTaille('fond_sat',1); |
56 |
$form->setTaille('etendue',60); |
57 |
$form->setTaille('projection_externe',20); |
58 |
$form->setTaille('maj',1); |
59 |
$form->setTaille('table_update',30); |
60 |
$form->setTaille('champ',30); |
61 |
$form->setTaille('retour',50); |
62 |
} |
63 |
|
64 |
function setMax(&$form,$maj) { |
65 |
parent::setMax($form,$maj); |
66 |
$form->setMax('om_sig_point',4); |
67 |
$form->setMax('om_collectivite',4); |
68 |
$form->setMax('id',50); |
69 |
$form->setMax('libelle',50); |
70 |
$form->setMax('zoom',3); |
71 |
$form->setMax('fond_osm',1); |
72 |
$form->setMax('fond_bing',1); |
73 |
$form->setMax('fond_sat',1); |
74 |
$form->setMax('etendue',60); |
75 |
$form->setMax('projection_externe',60); |
76 |
$form->setMax('url',2); |
77 |
$form->setMax('maj',1); |
78 |
$form->setMax('table_update',30); |
79 |
$form->setMax('champ',30); |
80 |
$form->setMax('retour',50); |
81 |
} |
82 |
|
83 |
function setOnchange(&$form,$maj) { |
84 |
parent::setOnchange($form,$maj); |
85 |
$form->setOnchange('zoom','VerifNum(this)'); |
86 |
} |
87 |
|
88 |
function setSelect(&$form, $maj,&$db,$debug) { |
89 |
parent::setSelect($form, $maj,$db,$debug); |
90 |
if($maj<2){ |
91 |
if(file_exists ("../dyn/var_sig.inc")) |
92 |
include ("../dyn/var_sig.inc"); |
93 |
$form->setSelect("etendue",$contenu_etendue); |
94 |
$form->setSelect("projection_externe",$contenu_epsg); |
95 |
}// fin maj |
96 |
} |
97 |
|
98 |
function setGroupe (&$form, $maj) { |
99 |
|
100 |
$form->setGroupe('id','D'); |
101 |
$form->setGroupe('libelle','G'); |
102 |
$form->setGroupe('actif','F'); |
103 |
|
104 |
$form->setGroupe('zoom','D'); |
105 |
$form->setGroupe('fond_osm','G'); |
106 |
$form->setGroupe('fond_bing','G'); |
107 |
$form->setGroupe('fond_sat','G'); |
108 |
$form->setGroupe('layer_info','F'); |
109 |
|
110 |
$form->setGroupe('etendue','D'); |
111 |
$form->setGroupe('projection_externe','F'); |
112 |
|
113 |
$form->setGroupe('maj','D'); |
114 |
$form->setGroupe('table_update','G'); |
115 |
$form->setGroupe('champ','F'); |
116 |
} |
117 |
|
118 |
function setRegroupe (&$form, $maj) { |
119 |
|
120 |
$form->setRegroupe('zoom','D',' '._('fond').' ', "collapsible"); |
121 |
$form->setRegroupe('fond_osm','G',''); |
122 |
$form->setRegroupe('fond_bing','G',''); |
123 |
$form->setRegroupe('fond_sat','G',''); |
124 |
$form->setRegroupe('layer_info','F',''); |
125 |
|
126 |
$form->setRegroupe('id','D',' '._('titre').' ', "collapsible"); |
127 |
$form->setRegroupe('libelle','G',''); |
128 |
$form->setRegroupe('actif','F',''); |
129 |
|
130 |
$form->setRegroupe('etendue','D',' '._('etendue').' ', "collapsible"); |
131 |
$form->setRegroupe('projection_externe','F',''); |
132 |
|
133 |
$form->setRegroupe('maj','D',' '._('Mise a jour').' ', "startClosed"); |
134 |
$form->setRegroupe('table_update','G',''); |
135 |
$form->setRegroupe('champ','F',''); |
136 |
|
137 |
} |
138 |
|
139 |
function setLib(&$form,$maj) { |
140 |
parent::setLib($form,$maj); |
141 |
//libelle des champs |
142 |
$form->setLib('fond_osm',_('osm : ')); |
143 |
$form->setLib('fond_bing',_('bing : ')); |
144 |
$form->setLib('fond_sat',_('sat : ')); |
145 |
$form->setLib('etendue',_('etendue')); |
146 |
$form->setLib('projection_externe',_('projection')); |
147 |
$form->setLib('url',_('url')); |
148 |
$form->setLib('om_sql',_('requete sql')); |
149 |
$form->setLib('maj',_('maj')); |
150 |
$form->setLib('table_update',_(' table :')); |
151 |
} |
152 |
|
153 |
function setVal(&$form, $maj, $validation, &$db, $DEBUG=null) { |
154 |
parent::setVal($form, $maj, $validation, $db, $DEBUG=null); |
155 |
$this->maj=$maj; |
156 |
} |
157 |
|
158 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$db, $DEBUG=null) { |
159 |
parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, $db, $DEBUG=null); |
160 |
$this->maj=$maj; |
161 |
} |
162 |
|
163 |
/** |
164 |
* verification sur existence d un etat deja actif pour la collectivite |
165 |
*/ |
166 |
function verifieractif(&$db, $val, $DEBUG,$id){ |
167 |
$sql = "select om_sig_point from ".DB_PREFIXE."om_sig_point where id ='".$val['id']."'"; |
168 |
$sql.= " and om_collectivite ='".$val['om_collectivite']."'"; |
169 |
$sql.= " and actif ='Oui'"; |
170 |
if($id!=']') |
171 |
$sql.=" and om_sig_point !='".$id."'"; |
172 |
$res = $db->query($sql); |
173 |
if($DEBUG==1) echo $sql; |
174 |
if (database::isError($res)) |
175 |
die($res->getMessage(). " => Echec ".$sql); |
176 |
else{ |
177 |
$nbligne=$res->numrows(); |
178 |
if ($nbligne>0){ |
179 |
$this->msg= $this->msg." ".$nbligne." "._("sig_point")." "._("existant"). |
180 |
" "._("actif")." ! "._("vous ne pouvez avoir qu un sig_point")." '". |
181 |
$val['id']."' "._("actif")." "._("par collectivite"); |
182 |
$this->correct=False; |
183 |
} |
184 |
} |
185 |
} |
186 |
|
187 |
}// fin classe |
188 |
?> |