1 | <?php
|
---|
2 | /************************************************************************/
|
---|
3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
4 | /* by Roberto Gigli & Luciano Apolito */
|
---|
5 | /* http://www.eleonline.it */
|
---|
6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
7 | /************************************************************************/
|
---|
8 | /* Modulo Inserimento dati */
|
---|
9 | /* Amministrazione */
|
---|
10 | /************************************************************************/
|
---|
11 |
|
---|
12 | if (!defined('ADMIN_FILE')) {
|
---|
13 | die ("You can't access this file directly...");
|
---|
14 | }
|
---|
15 | global $dbi;
|
---|
16 | $aid=$_SESSION['aid'];
|
---|
17 | $prefix=$_SESSION['prefix'];
|
---|
18 | $currentlang=$_SESSION['lang'];
|
---|
19 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
|
---|
20 | $vari= implode(',',$_GET);//param);
|
---|
21 | $id_comune=$_SESSION['id_comune'];
|
---|
22 | $id_cons_gen=intval($_GET['id_cons_gen']);
|
---|
23 | $perms=ChiSei($id_cons_gen);
|
---|
24 | if ($perms<16 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
25 | if (isset($_GET['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do='';
|
---|
26 | //if (isset($param['id_cons'])) $id_cons=intval($param['id_cons']); else $id_cons='';
|
---|
27 | if (isset($param['ops'])) $ops=intval($param['ops']); else $ops='';
|
---|
28 | if (isset($param['min'])) $min=intval($param['min']); else $min=0;
|
---|
29 | if (isset($param['ok'])) $ok=intval($param['ok']); else $ok='';
|
---|
30 | if (isset($param['ov'])) $ov=intval($param['ov']); else $ov='';
|
---|
31 | if (isset($param['mv'])) $mv=intval($param['mv']); else $mv='';
|
---|
32 | if (isset($param['gv'])) $gv=intval($param['gv']); else $gv='';
|
---|
33 | if (isset($param['msv'])) $msv=intval($param['msv']); else $msv='';
|
---|
34 | if (isset($param['av'])) $av=intval($param['av']); else $av='';
|
---|
35 | if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else
|
---|
36 | if (isset($_SESSION['id_circ'])) $id_circ=intval($_SESSION['id_circ']); else $id_circ='0';
|
---|
37 | if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede='0';
|
---|
38 | if (isset($param['id_sez'])) $id_sez=intval($param['id_sez']); else $id_sez='';
|
---|
39 | if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='0';
|
---|
40 | if (isset($param['prev_sez'])) $prev_sez=intval($param['prev_sez']); else $prev_sez='0';
|
---|
41 | if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='0';
|
---|
42 | if (isset($param['update'])) $update=intval($param['update']); else $update='';
|
---|
43 | include("modules/Elezioni/funzionidata.php");
|
---|
44 | include("modules/Elezioni/ele.php");
|
---|
45 | global $votolista, $limite, $dettnulli,$disgiunto;
|
---|
46 | if(!isset($votolista)) $votolista=0;
|
---|
47 | $sql="SELECT tipo_cons FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'" ;
|
---|
48 | $res = $dbi->prepare("$sql");
|
---|
49 | $res->execute();
|
---|
50 |
|
---|
51 |
|
---|
52 | list($tipo_cons) = $res->fetch(PDO::FETCH_NUM);
|
---|
53 | if ($tipo_cons!=3 or $votolista==1) $limite=0; #die ("limite: $limite");}
|
---|
54 | $sql="SELECT count(id_circ) FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' ";
|
---|
55 | $res = $dbi->prepare("$sql");
|
---|
56 | $res->execute();
|
---|
57 |
|
---|
58 |
|
---|
59 | list($num_circ)=$res->fetch(PDO::FETCH_NUM);
|
---|
60 | $sql="SELECT solo_gruppo,disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
61 | $res = $dbi->prepare("$sql");
|
---|
62 | $res->execute();
|
---|
63 |
|
---|
64 |
|
---|
65 | list($dettnulli,$disgiunto)=$res->fetch(PDO::FETCH_NUM);
|
---|
66 | if ($conscirc){ // or $num_circ==1
|
---|
67 | if (!$id_circ){
|
---|
68 | if (!$id_sez){
|
---|
69 | $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez='1'";
|
---|
70 | $res = $dbi->prepare("$sql");
|
---|
71 | $res->execute();
|
---|
72 |
|
---|
73 |
|
---|
74 | list($id_sez)=$res->fetch(PDO::FETCH_NUM);
|
---|
75 | }
|
---|
76 | $sql="SELECT t1.id_circ FROM ".$prefix."_ele_sede as t1 left join ".$prefix."_ele_sezioni as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and t2.id_sez='$id_sez'";
|
---|
77 | $res = $dbi->prepare("$sql");
|
---|
78 | $res->execute();
|
---|
79 |
|
---|
80 |
|
---|
81 | #$sql="SELECT id_circ FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ limit 0,1";
|
---|
82 | $res = $dbi->prepare("$sql");
|
---|
83 | $res->execute();
|
---|
84 |
|
---|
85 |
|
---|
86 | if (!$res->rowCount()) die("Errore, non trovo circoscrizioni inserite! Consultare l'amministratore");
|
---|
87 | list($id_circ)=$res->fetch(PDO::FETCH_NUM);
|
---|
88 | $_SESSION['id_circ']=$id_circ;
|
---|
89 | }
|
---|
90 | $sql="select id_sede from ".$prefix."_ele_sede where id_circ='$id_circ'";
|
---|
91 | $result = $dbi->prepare("$sql");
|
---|
92 | $result->execute();
|
---|
93 |
|
---|
94 |
|
---|
95 | $i=0;
|
---|
96 | while(list($tmp) = $result->fetch(PDO::FETCH_NUM)) $idsedi[$i++]=$tmp;$tmp=implode (",",$idsedi);
|
---|
97 | unset($idsedi);$i=0;$idsezi=array();unset($result);
|
---|
98 | $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_sede in ($tmp)";
|
---|
99 | $result = $dbi->prepare("$sql");
|
---|
100 | $result->execute();
|
---|
101 |
|
---|
102 |
|
---|
103 | unset($tmp);
|
---|
104 | while(list($tmp) = $result->fetch(PDO::FETCH_NUM)) $idsezi[$i++]=$tmp;
|
---|
105 | $tmp=implode (",",$idsezi);
|
---|
106 | $sezi = "and id_sez in ($tmp)";
|
---|
107 | $circo = "and id_circ='$id_circ'";
|
---|
108 | }else{
|
---|
109 | $sezi='';
|
---|
110 | $circo='';
|
---|
111 | }
|
---|
112 |
|
---|
113 | // Offset - visualizza il numero di elementi per pagina
|
---|
114 | $offset=2;
|
---|
115 | if (!isset($min)) $min=0;
|
---|
116 | $hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
|
---|
117 |
|
---|
118 | function numeri_sezione($nums) {
|
---|
119 | // tabella visualizzazione sezioni per numero
|
---|
120 | global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$id_cons,$id_lista,$ops, $perms,$id_sez,$num_ril,$status,$idrefgruppo,$votog,$votol,$votoc,$ops;
|
---|
121 | $idrefgruppo='';
|
---|
122 | $solosede='';
|
---|
123 | if ($perms<32) {
|
---|
124 | $sql="SELECT id_sede FROM ".$prefix."_ele_operatori where aid='$aid' and id_cons=$id_cons";
|
---|
125 | $res = $dbi->prepare("$sql");
|
---|
126 | $res->execute();
|
---|
127 |
|
---|
128 |
|
---|
129 | if ($res) {
|
---|
130 | list($solouna)=$res->fetch(PDO::FETCH_NUM);
|
---|
131 | if ($solouna>0) $solosede="and id_sede='$solouna'";
|
---|
132 | }
|
---|
133 | }
|
---|
134 | $sql="SELECT num_sez, id_sez ,id_sede,colore FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $solosede order by num_sez";
|
---|
135 | $res = $dbi->prepare("$sql");
|
---|
136 | $res->execute();
|
---|
137 |
|
---|
138 |
|
---|
139 | $max = $res->rowCount();
|
---|
140 | //if ($max>=64){
|
---|
141 | $i=0;
|
---|
142 | echo "\n<table align=\"left\" width=\"100%\" border=\"3\"><tr bgcolor=\"$bgcolor1\"><td>";
|
---|
143 |
|
---|
144 |
|
---|
145 | echo "<div id=\"navmenu\"> <ul>";
|
---|
146 | while(list($sez_num, $sez_id ,$sede_id,$colore) = $res->fetch(PDO::FETCH_NUM)) {
|
---|
147 | # $ops='';
|
---|
148 | if(!$id_sez) {$id_sez=$sez_id; $id_sede=$sede_id;}
|
---|
149 | $i++;
|
---|
150 | $sql="SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ";
|
---|
151 | $result = $dbi->prepare("$sql");
|
---|
152 | $result->execute();
|
---|
153 |
|
---|
154 |
|
---|
155 | list($circ_id) = $result->fetch(PDO::FETCH_NUM);
|
---|
156 |
|
---|
157 | if(!$ops) $ops=1;
|
---|
158 | $sql="SELECT num_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'";
|
---|
159 | $res2 = $dbi->prepare("$sql");
|
---|
160 | $res2->execute();
|
---|
161 |
|
---|
162 |
|
---|
163 | list($numero_sez) = $res2->fetch(PDO::FETCH_NUM);
|
---|
164 | if ($sez_num==$numero_sez) {
|
---|
165 | $cursez= "style=\" background: $colore; border: solid; border-color: YELLOW; border-width: 4px; border-left: solid gray 4px; border-top: solid gray 4px; \"";}
|
---|
166 | else $cursez="style=\" background: $colore; \"";
|
---|
167 | echo "\n<li $cursez><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$circ_id&id_sede=$sede_id&id_sez=$sez_id&ops=$ops&do=spoglio&id_lista=$id_lista\">$sez_num</a></b></li>\n";
|
---|
168 | }
|
---|
169 | //}
|
---|
170 | echo "</ul></div></td></tr></table>\n";
|
---|
171 | //}// fine tabella per numero sezioni
|
---|
172 | }
|
---|
173 | ///////////////////////////////////////////////////////////////////////////////////
|
---|
174 |
|
---|
175 |
|
---|
176 | function voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista) {
|
---|
177 | global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$prev_sez,$votog,$votol,$votoc,$conscirc,$id_sez,$ops;
|
---|
178 |
|
---|
179 | echo "<table border=\"0\" width=\"760\" align=\"left\"><tr>";
|
---|
180 | echo "\n<td bgcolor=\"$bgcolor1\" align=\"left\">";
|
---|
181 | numeri_sezione(22);
|
---|
182 | echo "\n</td></tr><tr><td>\n";
|
---|
183 |
|
---|
184 |
|
---|
185 | ///////////////////////
|
---|
186 | // Circoscrizione : scelta
|
---|
187 | ///////////////////////
|
---|
188 |
|
---|
189 | $sql="SELECT t1.id_sede,t2.id_circ FROM ".$prefix."_ele_operatori as t1,
|
---|
190 | ".$prefix."_ele_sede as t2
|
---|
191 | where t1.id_cons='$id_cons' AND t1.id_sede=t2.id_sede and t1.aid='$aid'";
|
---|
192 | $resoper = $dbi->prepare("$sql");
|
---|
193 | $resoper->execute();
|
---|
194 |
|
---|
195 |
|
---|
196 | list($id_sede2,$id_circ2) = $resoper->fetch(PDO::FETCH_NUM);
|
---|
197 | if ($id_sede2 and !($id_sede==$id_sede2)) {
|
---|
198 | $id_sede=$id_sede2;
|
---|
199 | $id_circ=$id_circ2;
|
---|
200 | $do="spoglio";
|
---|
201 | $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sede=$id_sede order by num_sez limit 0,1";
|
---|
202 | $res = $dbi->prepare("$sql");
|
---|
203 | $res->execute();
|
---|
204 |
|
---|
205 |
|
---|
206 | list($id_sez) = $res->fetch(PDO::FETCH_NUM);
|
---|
207 | }
|
---|
208 | if ($do == "circo") {
|
---|
209 | OpenTable();
|
---|
210 | echo "<tr><td><form name=\"voti\" action=\"admin.php\">"
|
---|
211 | ."<input type=\"hidden\" name=\"op\" value=\"voti\">"
|
---|
212 | ."<input type=\"hidden\" name=\"do\" value=\"sede\">"
|
---|
213 | // Circoscrizione: lista
|
---|
214 | //**************************************
|
---|
215 | .""._CIRCO.": "
|
---|
216 | ."<select name=\"id_circ\">";
|
---|
217 | $sql="SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ";
|
---|
218 | $res = $dbi->prepare("$sql");
|
---|
219 | $res->execute();
|
---|
220 |
|
---|
221 |
|
---|
222 | while(list($id,$descr) = $res->fetch(PDO::FETCH_NUM)) {
|
---|
223 | if ($descr!="Tutte"){
|
---|
224 | if ($id == $id_circ) {
|
---|
225 | $sel = "selected";
|
---|
226 | } else {
|
---|
227 | $sel = "";
|
---|
228 | }
|
---|
229 | echo "<option value=\"$id\" $sel>$descr";
|
---|
230 | }
|
---|
231 | }
|
---|
232 | echo "</select>"
|
---|
233 | //***********************************
|
---|
234 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
235 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
236 | ."</form></td></tr>";
|
---|
237 | CloseTable();
|
---|
238 | }
|
---|
239 |
|
---|
240 | ///////////////////////
|
---|
241 | // sede : scelta
|
---|
242 | ///////////////////////
|
---|
243 |
|
---|
244 |
|
---|
245 | if ($do == "sede") {
|
---|
246 | OpenTable();
|
---|
247 | echo "\n<tr><td><form name=\"sede\" action=\"admin.php\">";
|
---|
248 | $sql="SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' AND id_circ='$id_circ' order by num_circ";
|
---|
249 | $res = $dbi->prepare("$sql");
|
---|
250 | $res->execute();
|
---|
251 |
|
---|
252 |
|
---|
253 | list( $descr_circ) = $res->fetch(PDO::FETCH_NUM);
|
---|
254 | echo "<a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=circo\">"._CIRCO."</a> $descr_circ ->";
|
---|
255 | echo "<input type=\"hidden\" name=\"op\" value=\"voti\">"
|
---|
256 | ."<input type=\"hidden\" name=\"do\" value=\"spoglio\">"
|
---|
257 |
|
---|
258 | // Indirizzo: lista
|
---|
259 | //**************************************
|
---|
260 | .""._INDIRIZZO.": "
|
---|
261 | ."<select name=\"id_sede\">";
|
---|
262 | $sql="SELECT id_sede,indirizzo FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_circ='$id_circ' order by indirizzo";
|
---|
263 | $res = $dbi->prepare("$sql");
|
---|
264 | $res->execute();
|
---|
265 |
|
---|
266 |
|
---|
267 | // echo "$id_circ - $id_cons";
|
---|
268 | while(list($id,$indir) = $res->fetch(PDO::FETCH_NUM)) {
|
---|
269 | if ($id == $id_sede) {
|
---|
270 | $sel = "selected";
|
---|
271 | } else {
|
---|
272 | $sel = "";
|
---|
273 | }
|
---|
274 | echo "<option value=\"$id\" $sel>$indir";
|
---|
275 | }
|
---|
276 | echo "</select>"
|
---|
277 | //*************************************
|
---|
278 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
279 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
280 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
281 | ."</form></td></tr>\n";
|
---|
282 | CloseTable();
|
---|
283 | }
|
---|
284 |
|
---|
285 | ///////////////////////
|
---|
286 | // sezione : scelta
|
---|
287 | ///////////////////////
|
---|
288 | if ($do == "spoglio") {
|
---|
289 |
|
---|
290 |
|
---|
291 | //************************************
|
---|
292 | // Menu spoglio
|
---|
293 | //************************************
|
---|
294 | $sql="select id_cons,id_sez,id_sede,num_sez, maschi, femmine from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
295 | $result = $dbi->prepare("$sql");
|
---|
296 | $result->execute();
|
---|
297 |
|
---|
298 |
|
---|
299 | list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = $result->fetch(PDO::FETCH_NUM);
|
---|
300 |
|
---|
301 | echo "<hr><table><tr><td width=\"200\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione N. $num_sez</b></font></td><td><table><tr>";
|
---|
302 | echo "\n<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=1\">"._AFFLUENZE."</a></b></p></td>\n";
|
---|
303 | if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){
|
---|
304 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=4\">"._GRUPPO."</a></b></p></td>\n";
|
---|
305 | }
|
---|
306 | if(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){
|
---|
307 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3\">"._LISTA."</a></b></p></td>\n";
|
---|
308 | }
|
---|
309 | echo "</tr></table></td></tr></table><hr>\n";
|
---|
310 |
|
---|
311 | #############
|
---|
312 | # posizionamento in mancanza di scelta
|
---|
313 | #############
|
---|
314 | if (!$ops){
|
---|
315 | if (!$id_sez) { echo"";#import( pagina di help );
|
---|
316 | } else{
|
---|
317 | $sql="SELECT data, orario from ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1";
|
---|
318 | $res = $dbi->prepare("$sql");
|
---|
319 | $res->execute();
|
---|
320 |
|
---|
321 |
|
---|
322 | list($data,$orario)=$res->fetch(PDO::FETCH_NUM);
|
---|
323 | $sql="SELECT voti_complessivi from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and orario='$orario' and data='$data'";
|
---|
324 | $res = $dbi->prepare("$sql");
|
---|
325 | $res->execute();
|
---|
326 |
|
---|
327 |
|
---|
328 | list($voti) = $res->fetch(PDO::FETCH_NUM);
|
---|
329 | if (!$voti) $ops=1;
|
---|
330 | else {
|
---|
331 | if($genere<4){
|
---|
332 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'";
|
---|
333 | $res = $dbi->prepare("$sql");
|
---|
334 | $res->execute();
|
---|
335 |
|
---|
336 |
|
---|
337 | list($voti) = $res->fetch(PDO::FETCH_NUM);
|
---|
338 | if ($voti==0 or $genere<3) $ops=4;
|
---|
339 | }
|
---|
340 | if(!$ops) $ops=3;
|
---|
341 | }
|
---|
342 |
|
---|
343 | }
|
---|
344 | }
|
---|
345 | ############ fine posizionamento
|
---|
346 |
|
---|
347 | ///////////////////////////////////////////
|
---|
348 | // opzioni per le funzioni di immissione
|
---|
349 |
|
---|
350 | if ($ops == 1) {
|
---|
351 | votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av);
|
---|
352 | }else{
|
---|
353 | ############# Controllo flag per cancellazione consultazione
|
---|
354 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
355 | ."//-->\n";
|
---|
356 | echo "function del_dati() {\n";
|
---|
357 | echo "if (document.getElementById('pwd3').checked==false) {\n";
|
---|
358 | echo "document.getElementById('update').value=\""._OK."\" \n";
|
---|
359 | echo "document.getElementById('do').value=\"0\" \n";
|
---|
360 | echo "}else{\n";
|
---|
361 | echo "document.getElementById('update').value=\""._DELETE."\" \n";
|
---|
362 | echo "document.getElementById('do').value=\"1\" \n";
|
---|
363 | echo "} \n";
|
---|
364 | echo "} \n";
|
---|
365 | echo "</script>\n";
|
---|
366 | }
|
---|
367 | if ($ops == 3) {
|
---|
368 | preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
369 | }
|
---|
370 | if ($ops == 4) {
|
---|
371 | preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
372 |
|
---|
373 | }
|
---|
374 |
|
---|
375 | }
|
---|
376 | CloseTable();
|
---|
377 |
|
---|
378 | }
|
---|
379 | ////////////////////////////////////////////////////////////////////////////////
|
---|
380 | // FUNZIONI DI IMMISSIONE
|
---|
381 | // - preferenze (candidati consiglieri)
|
---|
382 | // - preferenze_gruppi
|
---|
383 | // - votanti
|
---|
384 | ////////////////////////////////////////////////////////////////////////////////
|
---|
385 |
|
---|
386 | //////////////////////////////////////////////////////////////////////
|
---|
387 | // da qui va la sezione per le preferenze candidati consiglieri
|
---|
388 | //////////////////////////////////////////////////////////////////////
|
---|
389 | function preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
390 | global $aid, $prefix, $dbi, $id_lista,$genere,$id_cons_gen,$id_gruppo,$sezi,$circo,$votog,$votol,$votoc,$conscirc;
|
---|
391 | global $tipo_cons,$limite,$dettnulli,$disgiunto;
|
---|
392 |
|
---|
393 | $bgcolor1="#7777ff";
|
---|
394 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
395 | //controlla se sono stati inseriti i votanti
|
---|
396 | $sql="SELECT preferenze, id_fascia, id_conf,solo_gruppo, disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
|
---|
397 | $result = $dbi->prepare("$sql");
|
---|
398 | $result->execute();
|
---|
399 |
|
---|
400 |
|
---|
401 | list($numprefs,$fascia,$id_conf,$flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);
|
---|
402 |
|
---|
403 | ####### 06-11-2014 - circoscrizionali - nello spostamento ad altra sezione resta sullo stesso numero di lista anche se sono sezioni di diverse circoscrizioni
|
---|
404 | if ($circo and $id_lista){
|
---|
405 | $sql="SELECT num_lista from ".$prefix."_ele_lista where id_lista=$id_lista";
|
---|
406 | $res_lis = $dbi->prepare("$sql");
|
---|
407 | $res_lis->execute();
|
---|
408 |
|
---|
409 |
|
---|
410 | list($num_lista)=$res_lis->fetch(PDO::FETCH_NUM);
|
---|
411 | $sql="SELECT id_lista from ".$prefix."_ele_lista where num_lista=$num_lista and id_cons='$id_cons' $circo";
|
---|
412 | $res_lis = $dbi->prepare("$sql");
|
---|
413 | $res_lis->execute();
|
---|
414 |
|
---|
415 |
|
---|
416 | list($id_lista)=$res_lis->fetch(PDO::FETCH_NUM);
|
---|
417 | }
|
---|
418 |
|
---|
419 | if(!$votog and ($genere==3 or $genere==5)){
|
---|
420 | $sql="select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
421 | $result = $dbi->prepare("$sql");
|
---|
422 | $result->execute();
|
---|
423 |
|
---|
424 |
|
---|
425 | }else{
|
---|
426 | $sql="select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
427 | $result = $dbi->prepare("$sql");
|
---|
428 | $result->execute();
|
---|
429 | }
|
---|
430 |
|
---|
431 | list($validi,$nulli,$bianchi,$contestati,$votinulli) = $result->fetch(PDO::FETCH_NUM);
|
---|
432 | echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>";
|
---|
433 | $sql="SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista";
|
---|
434 | $res_lis = $dbi->prepare("$sql");
|
---|
435 | $res_lis->execute();
|
---|
436 |
|
---|
437 |
|
---|
438 | $num_liste = $res_lis->rowCount();
|
---|
439 | $ele_lista='';
|
---|
440 | if (($genere==4 or $genere==5) and !$votoc) { //liste a piu' candidati
|
---|
441 | if(($genere==5 and $id_conf and $fascia<=$limite and !$disgiunto) and !$id_lista) { //esclude il voto di lista per le comunali nei comuni sotto fascia limite
|
---|
442 | $sql="SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons limit 0,1";
|
---|
443 | $result = $dbi->prepare("$sql");
|
---|
444 | $result->execute();
|
---|
445 |
|
---|
446 |
|
---|
447 | list($id_lista)=$result->fetch(PDO::FETCH_NUM);
|
---|
448 | }
|
---|
449 | echo "<td> </td></tr><tr><td style=\"vertical-align: top;\">";
|
---|
450 | echo "<form name=\"liste\" action=\"modules/Elezioni/salva_liste.php\">";
|
---|
451 | echo "<input type=\"hidden\" name=\"pag\" value=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3&id_lista=\">";
|
---|
452 | echo "<select name=\"id_lista\" size=\"".($num_liste+1)."\" onChange=\"vai_lista()\">";
|
---|
453 | if ($id_lista){
|
---|
454 | echo "<option value=\"0\">"._VOTI_LISTA;
|
---|
455 | $ele_lista=" and t1.id_lista='$id_lista' ";
|
---|
456 | }else{
|
---|
457 | echo "<option value=\"0\" selected>"._VOTI_LISTA;
|
---|
458 | $ele_lista=" group by t1.id_lista ";
|
---|
459 | if(!isset($votolista)) $votolista=0;
|
---|
460 |
|
---|
461 | }
|
---|
462 | while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {
|
---|
463 | $segna='';
|
---|
464 | $sql="SELECT count(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";
|
---|
465 | $result = $dbi->prepare("$sql");
|
---|
466 | $result->execute();
|
---|
467 |
|
---|
468 |
|
---|
469 | list($ctrvoticand)=$result->fetch(PDO::FETCH_NUM);
|
---|
470 | $sql="SELECT sum(t1.voti),0,0 from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";
|
---|
471 | $result = $dbi->prepare("$sql");
|
---|
472 | $result->execute();
|
---|
473 |
|
---|
474 |
|
---|
475 | list($votisezcand)=$result->fetch(PDO::FETCH_NUM);
|
---|
476 | if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4){
|
---|
477 | $sql="SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'";
|
---|
478 | $result = $dbi->prepare("$sql");
|
---|
479 | $result->execute();
|
---|
480 | }else{
|
---|
481 | $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'";
|
---|
482 | $result = $dbi->prepare("$sql");
|
---|
483 | $result->execute();
|
---|
484 | list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
485 | $sql="SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
486 | $result = $dbi->prepare("$sql");
|
---|
487 | $result->execute();
|
---|
488 | }
|
---|
489 | list($votisezlis,$sgpl)=$result->fetch(PDO::FETCH_NUM);
|
---|
490 | if($votisezcand>($votisezlis*$numprefs))
|
---|
491 | {$segna="style=\"background-color: #dd0000;\"";}
|
---|
492 | elseif($ctrvoticand)
|
---|
493 | $segna="style=\"background-color: #99CC33;\"";
|
---|
494 | $sql="SELECT t1.voti,t2.num_cand FROM ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$id_rif'";
|
---|
495 | $res4 = $dbi->prepare("$sql");
|
---|
496 | $res4->execute();
|
---|
497 |
|
---|
498 |
|
---|
499 | $errcand[$id_rif]=array();
|
---|
500 | while(list($testvotic,$numcand)=$res4->fetch(PDO::FETCH_NUM))
|
---|
501 | if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;}
|
---|
502 |
|
---|
503 | $sel = ($id_rif == $id_lista) ? "selected" : "";
|
---|
504 | echo "<option $segna value=\"$id_rif\" $sel>";
|
---|
505 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
506 | echo $num_lis.") ".substr($descrizione,0,30);
|
---|
507 | }
|
---|
508 | echo "</select></form></td>\n";
|
---|
509 | }else {
|
---|
510 | $id_lista=0;
|
---|
511 | }
|
---|
512 | echo "<td style=\"vertical-align: top;\">";
|
---|
513 |
|
---|
514 | if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";}
|
---|
515 | if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) {
|
---|
516 | $sql="SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,t2.contestati,0,0 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez=$id_sez group by t1.id_sez";
|
---|
517 | $result = $dbi->prepare("$sql");
|
---|
518 | $result->execute();
|
---|
519 |
|
---|
520 |
|
---|
521 | }else{
|
---|
522 | $sql="SELECT sum(t1.voti),t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo,t1.id_sez from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez='$id_sez' group by t1.id_sez,t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo";
|
---|
523 | $result = $dbi->prepare("$sql");
|
---|
524 | $result->execute();
|
---|
525 | }
|
---|
526 |
|
---|
527 | // aggiunte le variabili $sgpl e $vnulli2 per la gestione dei voti 1) al solo presidente per singola lista - 2) al solo presidente per singola lista perché nullo o contestato quello di lista
|
---|
528 | $isscr= $result->rowCount();
|
---|
529 | list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2,$sgpl) = $result->fetch(PDO::FETCH_NUM);
|
---|
530 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
531 | $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";
|
---|
532 | $resg = $dbi->prepare("$sql");
|
---|
533 | $resg->execute();
|
---|
534 |
|
---|
535 |
|
---|
536 | list($sgpl)=$resg->fetch(PDO::FETCH_NUM);
|
---|
537 | if ($sg != $sgpl) echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></table>";
|
---|
538 | }
|
---|
539 | $valista=$validi2;
|
---|
540 | if(!$id_lista or $genere==3){ //controllo di congruenza
|
---|
541 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
542 | $res2 = $dbi->prepare("$sql");
|
---|
543 | $res2->execute();
|
---|
544 |
|
---|
545 |
|
---|
546 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
547 | ####### controlli
|
---|
548 | $sql="select * from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
549 | $resc = $dbi->prepare("$sql");
|
---|
550 | $resc->execute();
|
---|
551 | if($resc->rowCount()){ if ($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2!=$tot and $validi+$sg>0){
|
---|
552 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2)."</b><br></td></table>";
|
---|
553 | }
|
---|
554 |
|
---|
555 | if((($voti_sez)!=$validi2) and ($voti_sez>0)){
|
---|
556 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".($voti_sez)." "._NO_VAL_VOTI." ".$validi2."</b><br></td></tr></table>";
|
---|
557 | }
|
---|
558 | }elseif($genere==5){
|
---|
559 | $sql="SELECT sum(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_lista";
|
---|
560 | $result = $dbi->prepare("$sql");
|
---|
561 | $result->execute();
|
---|
562 |
|
---|
563 |
|
---|
564 | list($votisezcand)=$result->fetch(PDO::FETCH_NUM);
|
---|
565 | if(($fascia>$limite or $disgiunto) or !$id_conf){
|
---|
566 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'";
|
---|
567 | $result = $dbi->prepare("$sql");
|
---|
568 | $result->execute();
|
---|
569 |
|
---|
570 |
|
---|
571 | }else{
|
---|
572 |
|
---|
573 | $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'";
|
---|
574 | $result = $dbi->prepare("$sql");
|
---|
575 | $result->execute();
|
---|
576 |
|
---|
577 |
|
---|
578 | list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
579 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
580 | $result = $dbi->prepare("$sql");
|
---|
581 | $result->execute();
|
---|
582 |
|
---|
583 |
|
---|
584 | }
|
---|
585 | list($votisezlis)=$result->fetch(PDO::FETCH_NUM);
|
---|
586 | if($votisezcand>($votisezlis*$numprefs))
|
---|
587 | {
|
---|
588 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza $votisezcand <br/>superano i voti di lista $votisezlis</b><br></td></tr></table>";
|
---|
589 | }
|
---|
590 | }
|
---|
591 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
592 | $errgrulis=array();
|
---|
593 | if($genere==5 and !$disgiunto and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
594 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'";
|
---|
595 | $resref = $dbi->prepare("$sql");
|
---|
596 | $resref->execute();
|
---|
597 |
|
---|
598 |
|
---|
599 | $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";
|
---|
600 | $res4 = $dbi->prepare("$sql");
|
---|
601 | $res4->execute();
|
---|
602 |
|
---|
603 |
|
---|
604 | list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);
|
---|
605 | if ($sezscrl)
|
---|
606 |
|
---|
607 | while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))
|
---|
608 | {
|
---|
609 | $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
610 | $res3 = $dbi->prepare("$sql");
|
---|
611 | $res3->execute();
|
---|
612 |
|
---|
613 |
|
---|
614 | $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
615 | $res4 = $dbi->prepare("$sql");
|
---|
616 | $res4->execute();
|
---|
617 |
|
---|
618 |
|
---|
619 | list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
620 | list($vliste)=$res4->fetch(PDO::FETCH_NUM);
|
---|
621 | if($vliste>$vgruppo)
|
---|
622 | {
|
---|
623 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
624 | $result = $dbi->prepare("$sql");
|
---|
625 | $result->execute();
|
---|
626 |
|
---|
627 |
|
---|
628 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
629 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr></table>";
|
---|
630 | $errgrulis[$id_gruppo]=1;
|
---|
631 | }
|
---|
632 | elseif($vliste<$vgruppo)
|
---|
633 | {
|
---|
634 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
635 | $result = $dbi->prepare("$sql");
|
---|
636 | $result->execute();
|
---|
637 |
|
---|
638 |
|
---|
639 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
640 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";
|
---|
641 | $errgrulis[$id_gruppo]=1;
|
---|
642 | }
|
---|
643 | }
|
---|
644 | }
|
---|
645 | }
|
---|
646 |
|
---|
647 |
|
---|
648 | echo "\n<form name=\"sezioni\" action=\"modules/Elezioni/salva_liste.php\">"
|
---|
649 | ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">"
|
---|
650 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
651 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
652 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
653 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
654 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
655 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
656 | ."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"
|
---|
657 | ."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"
|
---|
658 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";
|
---|
659 | echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";
|
---|
660 | echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";
|
---|
661 | if ($genere<4){
|
---|
662 | // echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._LISTA."</b></td>";
|
---|
663 | }
|
---|
664 | echo "<b>"._NUM."</b></td>";
|
---|
665 | if($id_lista){
|
---|
666 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._CANDIDATO."</b></td>"
|
---|
667 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";
|
---|
668 | }else{
|
---|
669 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._DESCR."</b></td>"
|
---|
670 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";
|
---|
671 | if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)
|
---|
672 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NULLI_LISTE."</b></td>";
|
---|
673 | if($disgiunto){
|
---|
674 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLOLIS."</b></td>";
|
---|
675 | }
|
---|
676 | }
|
---|
677 | echo "</tr>\n";
|
---|
678 |
|
---|
679 |
|
---|
680 |
|
---|
681 |
|
---|
682 |
|
---|
683 | if($id_lista) $sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista,t1.num_cand";
|
---|
684 | else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista";
|
---|
685 | $result = $dbi->prepare("$sql");
|
---|
686 | $result->execute();
|
---|
687 |
|
---|
688 |
|
---|
689 | $max = $result->rowCount();
|
---|
690 | $tot_pref=0;
|
---|
691 | $i=1;
|
---|
692 |
|
---|
693 | if($id_lista) {
|
---|
694 | while(list($id_cand,$id_cons2,$id_lista2,$nl, $cognome, $nome, $note, $simbolo, $num_cand) = $result->fetch(PDO::FETCH_NUM)){
|
---|
695 | // dati lista
|
---|
696 | $sql="select id_lista, descrizione,simbolo,num_lista from ".$prefix."_ele_lista where id_lista='$id_lista2'";
|
---|
697 | $result1 = $dbi->prepare("$sql");
|
---|
698 | $result1->execute();
|
---|
699 |
|
---|
700 |
|
---|
701 | list($id_lista3,$descr_lista,$simb_lista,$num_lista)=$result1->fetch(PDO::FETCH_NUM);
|
---|
702 | // dati gruppo
|
---|
703 | $sql="select descrizione,simbolo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
704 | $result2 = $dbi->prepare("$sql");
|
---|
705 | $result2->execute();
|
---|
706 |
|
---|
707 |
|
---|
708 | list($descr_gruppo,$simb_gruppo)=$result2->fetch(PDO::FETCH_NUM);
|
---|
709 |
|
---|
710 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
711 | if ($genere<4){
|
---|
712 | echo "<td align=\"left\"><b><img src=\"images/lista/$simb_lista \" width=\"32\" heigth=\"32\" align=\"center\" ALT=\"$descr_lista\" > </b></td>";
|
---|
713 | }
|
---|
714 | echo "<td align=\"center\"><b> $num_cand </b></td>"
|
---|
715 | ."<td align=\"left\"><b>$cognome $nome</b></td>";
|
---|
716 | $cond_sele="and id_cand=$id_cand";
|
---|
717 | $sql="SELECT voti FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele";
|
---|
718 | $res = $dbi->prepare("$sql");
|
---|
719 | $res->execute();
|
---|
720 |
|
---|
721 |
|
---|
722 | list($voti)= $res->fetch(PDO::FETCH_NUM);
|
---|
723 | if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor='';
|
---|
724 | echo "<td align=\"right\" $errcolor><input name=\"voti$num_cand\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";
|
---|
725 | echo "<input type=\"hidden\" name=\"id_cand$num_cand\" value=\"$id_cand\"></td></tr>\n";
|
---|
726 | $i++;
|
---|
727 | $tot_pref+=$voti;
|
---|
728 | }
|
---|
729 | }else {
|
---|
730 | $sql="select t2.voti,t1.id_lista, descrizione,simbolo,t1.num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo
|
---|
731 | from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2
|
---|
732 | where t1.id_cons='$id_cons'
|
---|
733 | and t1.id_lista=t2.id_lista
|
---|
734 | and t2.id_sez=$id_sez
|
---|
735 | order by t1.num_lista";
|
---|
736 |
|
---|
737 | try {
|
---|
738 | $result1 = $dbi->prepare("$sql");
|
---|
739 | $result1->execute();
|
---|
740 |
|
---|
741 | }
|
---|
742 | catch(PDOException $e)
|
---|
743 | {
|
---|
744 | echo $sql . "<br>" . $e->getMessage();
|
---|
745 | }
|
---|
746 |
|
---|
747 | $num_lista=$result1->rowCount();
|
---|
748 | if (!$num_lista){
|
---|
749 | $sql="select '0',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo
|
---|
750 | from ".$prefix."_ele_lista where id_cons='$id_cons' $circo
|
---|
751 | order by num_lista";
|
---|
752 | $result1 = $dbi->prepare("$sql");
|
---|
753 | $result1->execute();
|
---|
754 | }
|
---|
755 | $tvnpl=0;
|
---|
756 | $tslpl=0;
|
---|
757 | while (list($voti,$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){
|
---|
758 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
759 | // if ($genere<4 or $votoc){
|
---|
760 | // }
|
---|
761 | $errcolor='';
|
---|
762 | if(isset($errgrulis[$rifgruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";
|
---|
763 | echo "<td align=\"center\"><b> $num_lista </b></td>"
|
---|
764 | ."<td align=\"left\"><b> $descr_lista</b></td>";
|
---|
765 | $cond_sele="and id_lista=$id_lista3";
|
---|
766 | echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";
|
---|
767 | if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19) { echo "</td><td align=\"right\"><input name=\"vnpl$i\" value=\"".$vnpl."\" size=\"7\" style=\"text-align:right\">"; $tvnpl+=$vnpl;}
|
---|
768 | if($disgiunto) {echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\">"; $tslpl+=$slpl;}
|
---|
769 | echo "<input type=\"hidden\" name=\"id_lista$i\" value=\"$id_lista3\"></td>";
|
---|
770 | // echo "<td align=\"right\">$sgpl";
|
---|
771 | echo "</tr>\n";
|
---|
772 | $i++;
|
---|
773 | $tot_pref+=$voti;
|
---|
774 | }
|
---|
775 | }
|
---|
776 | if(!$id_lista) {
|
---|
777 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><font size=\"3\">"._TOT._VOTI_LISTA."</font></td><td align=\"center\"><font size=\"3\">$tot_pref</font></td>";
|
---|
778 | if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)
|
---|
779 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tvnpl."</font></td>";
|
---|
780 | if($disgiunto)
|
---|
781 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tslpl."</font></td>";
|
---|
782 | echo "</tr>";
|
---|
783 | }
|
---|
784 | else echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOTPREF."</td><td align=\"center\">$tot_pref</td></tr>";
|
---|
785 | // toglie ai candidati la visual... del solo_gruppo
|
---|
786 | if(!$votog) {
|
---|
787 | if (($genere==3 OR $genere==5) and (!$id_lista) and (($disgiunto or $fascia>$limite) or !$id_conf)) { //gruppo e liste
|
---|
788 | echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._VALIDI_LISTA."</b></td><td align=\"center\"><input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"><input name=\"valista\" value=\"$valista\" size=\"5\" style=\"text-align:right\"></td></tr>";
|
---|
789 | echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\"><input name=\"sg\" value=\"$sg\" size=\"5\" style=\"text-align:right\"></td></tr>";
|
---|
790 | echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._NULLI_LISTE."</b></td><td align=\"center\"><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"
|
---|
791 | ."</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._CONTESTATI_LISTE."</b></td><td align=\"center\"><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\"></td></tr>";
|
---|
792 |
|
---|
793 | }elseif (($genere==3 OR $genere==5) and !$votoc and (($disgiunto or $fascia>$limite) or !$id_conf)){ //}elseif ($tipo_cons!=10 and $tipo_cons!=11){
|
---|
794 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">$sg</td></tr>";
|
---|
795 | }
|
---|
796 | ######modifica del 16-04-2009 per visualizzare i voti al solo sindaco nei comuni con meno di 15000 abitanti
|
---|
797 | elseif(($genere==3 OR $genere==5) and ($id_lista) and ($fascia<=$limite or !$id_conf) and $numprefs==1) {
|
---|
798 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_lista where id_lista='$id_lista'";
|
---|
799 | $resvg = $dbi->prepare("$sql");
|
---|
800 | $resvg->execute();
|
---|
801 |
|
---|
802 |
|
---|
803 | list($id_gruppo) = $resvg->fetch(PDO::FETCH_NUM);
|
---|
804 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo' and id_sez='$id_sez'";
|
---|
805 | $resvg = $dbi->prepare("$sql");
|
---|
806 | $resvg->execute();
|
---|
807 |
|
---|
808 |
|
---|
809 | list($voti_sind) = $resvg;
|
---|
810 |
|
---|
811 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">".($voti_sind - $tot_pref)."</td></tr>";
|
---|
812 | }
|
---|
813 | ###### fine modifica del 16-04-2009
|
---|
814 |
|
---|
815 | }
|
---|
816 | echo "<tr>";
|
---|
817 | echo "<td></td><td></td>";
|
---|
818 | echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";
|
---|
819 | echo "</tr></table>";
|
---|
820 | if(chisei($id_cons_gen)>=64){
|
---|
821 | echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"1\">"._DELETE."</td>";
|
---|
822 | } # onclick=\"javascript:del_dati()\"
|
---|
823 | echo "</form></tr></table>";
|
---|
824 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
825 | ."document.sezioni.voti1.focus()\n"
|
---|
826 | ."document.sezioni.voti1.select()\n"
|
---|
827 | ."//-->\n";
|
---|
828 | echo "function vai_lista() {\n";
|
---|
829 | echo "window.document.location.href=document.liste.pag.value+document.liste.id_lista.value\n";
|
---|
830 | echo "}\n";
|
---|
831 | echo "</script>\n";
|
---|
832 |
|
---|
833 | #if (!((!$votog) and ($genere==3 OR $genere==5) and ($fascia>$limite)))
|
---|
834 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
835 | }
|
---|
836 |
|
---|
837 |
|
---|
838 | ////////////////////////////////////////////
|
---|
839 | // da qua va la sezione per i votanti
|
---|
840 | ///////////////////////////////////////////
|
---|
841 |
|
---|
842 | function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
|
---|
843 | //function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
|
---|
844 | global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$id_comune;
|
---|
845 | $bgcolor1=$_SESSION['bgcolor2'];
|
---|
846 |
|
---|
847 | #OpenTable();
|
---|
848 | $sql="SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
|
---|
849 | $res = $dbi->prepare("$sql");
|
---|
850 | $res->execute();
|
---|
851 |
|
---|
852 |
|
---|
853 | if($res) list($vismf)= $res->fetch(PDO::FETCH_NUM); else $vismf=0;
|
---|
854 | $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ";
|
---|
855 | $res = $dbi->prepare("$sql");
|
---|
856 | $res->execute();
|
---|
857 |
|
---|
858 | echo "<table><tr><td>";
|
---|
859 | $num = $res->rowCount();
|
---|
860 | $sql="SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez";
|
---|
861 | $ressez = $dbi->prepare("$sql");
|
---|
862 | $ressez->execute();
|
---|
863 | ##################
|
---|
864 | echo "<style>";
|
---|
865 | echo "DIV.table";
|
---|
866 | echo "{
|
---|
867 | display:table;
|
---|
868 | }
|
---|
869 | FORM.tr
|
---|
870 | {
|
---|
871 | display:table-row;
|
---|
872 | text-align: center;
|
---|
873 | }
|
---|
874 | DIV.tr
|
---|
875 | {
|
---|
876 | display:table-row;
|
---|
877 | background-color: #D3D3D3;
|
---|
878 | text-align: center;
|
---|
879 | }
|
---|
880 | SPAN.tdm
|
---|
881 | {
|
---|
882 | display:table-cell;
|
---|
883 | border: 1px solid black;
|
---|
884 | padding: 5px;
|
---|
885 | }
|
---|
886 | SPAN.td
|
---|
887 | {
|
---|
888 | display:table-cell;
|
---|
889 | }";
|
---|
890 | echo "</style>";
|
---|
891 |
|
---|
892 | /*
|
---|
893 | echo "<form class=\"tr\" name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
894 | echo "<span class=\"td\"><input type=\"text\"/></span>";
|
---|
895 | <span class="td"><input type="text"/></span>
|
---|
896 | </form>
|
---|
897 | <div class="tr">
|
---|
898 | <span class="td">(cell data)</span>
|
---|
899 | <span class="td">(cell data)</span>
|
---|
900 | </div>
|
---|
901 | ...
|
---|
902 | </div>
|
---|
903 | */
|
---|
904 | ##################
|
---|
905 |
|
---|
906 | list($maschi,$femmine)=$ressez->fetch(PDO::FETCH_NUM);
|
---|
907 | $y=0;
|
---|
908 | echo "<div class=\"table\">";
|
---|
909 | #echo "<tr><td> </td></tr>";
|
---|
910 | $riga=array();
|
---|
911 | $rigat=array();
|
---|
912 | while (list($ora,$giorno)= $res->fetch(PDO::FETCH_NUM)){
|
---|
913 | $y++;
|
---|
914 | $rigat[$y]='';
|
---|
915 | $riga[$y]='';
|
---|
916 | # echo "\n<tr><td>";
|
---|
917 | # echo "<form name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
918 | # echo "<table class=\"table-menu\" style=\"width: 100%; color: black;\"><tr>";
|
---|
919 | $rigat[$y]= "<div class=\"tr\">";
|
---|
920 | if ($genere==0){ //e' un referendum
|
---|
921 | # echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></td>";
|
---|
922 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></span>";
|
---|
923 | }
|
---|
924 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></span>"
|
---|
925 | ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._DATA."</b></span>";
|
---|
926 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></span>";
|
---|
927 | $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></span>"
|
---|
928 | ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b></span>";
|
---|
929 | if ($genere==0){
|
---|
930 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";
|
---|
931 | $res2 = $dbi->prepare("$sql");
|
---|
932 | $res2->execute();
|
---|
933 |
|
---|
934 |
|
---|
935 | $max = $res2->rowCount();
|
---|
936 | }else{ $max=1;} $op="rec_add_votanti";
|
---|
937 | $rigat[$y].= "</div>";
|
---|
938 |
|
---|
939 | for ($i=1;$i<=$max;$i++){
|
---|
940 | $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2
|
---|
941 | on (t1.id_gruppo=t2.id_gruppo) where t1.id_sez='$id_sez'
|
---|
942 | and t1.id_cons='$id_cons' and t1.orario='$ora' and t1.data='$giorno'";
|
---|
943 | if ($genere==0){
|
---|
944 | $query.=" and t2.num_gruppo=$i";
|
---|
945 | }
|
---|
946 | $sql=$query;
|
---|
947 | $result = $dbi->prepare("$sql");
|
---|
948 | $result->execute();
|
---|
949 |
|
---|
950 |
|
---|
951 | list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = $result->fetch(PDO::FETCH_NUM);
|
---|
952 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo' ";
|
---|
953 | $res2 = $dbi->prepare("$sql");
|
---|
954 | $res2->execute();
|
---|
955 |
|
---|
956 |
|
---|
957 | $sql="select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
958 | $resril = $dbi->prepare("$sql");
|
---|
959 | $resril->execute();
|
---|
960 |
|
---|
961 |
|
---|
962 | list($numril)=$resril->fetch(PDO::FETCH_NUM);
|
---|
963 | if ($res2)
|
---|
964 | list($gruppo)= $res2->fetch(PDO::FETCH_NUM);
|
---|
965 | else
|
---|
966 | $gruppo=0;
|
---|
967 | if (!$gruppo>0) {
|
---|
968 | $gruppo=$i;
|
---|
969 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where num_gruppo=$gruppo and id_cons=$id_cons";
|
---|
970 | $res3 = $dbi->prepare("$sql");
|
---|
971 | $res3->execute();
|
---|
972 |
|
---|
973 |
|
---|
974 | if ($res3)
|
---|
975 | list($id_gruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
976 | }
|
---|
977 | if(!isset($precede[$id_gruppo])) $precede[$id_gruppo]=0; if(!isset($error)) $error=0;
|
---|
978 | if($precede[$id_gruppo]>($voti_t) and $voti_t!='') $error=1;
|
---|
979 | $precede[$id_gruppo]=$voti_t;
|
---|
980 | if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){
|
---|
981 | # echo "</tr><tr styl.e=\"background-color: rgb(255, 0, 0); text-align: center\">"; $error=0;
|
---|
982 | $riga[$y].= "<form class=\"tr\" style=\"background-color: rgb(255, 0, 0); text-align: center\" name=\"votanti\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
983 | }else{
|
---|
984 | $riga[$y].= "<form class=\"tr\" action=\"modules/Elezioni/salva_aff.php\">";
|
---|
985 | }
|
---|
986 | if ($genere==0){ // e' un referendum
|
---|
987 | $riga[$y].= "<span class=\"td\" align=\"center\">$gruppo</span>";
|
---|
988 | }
|
---|
989 |
|
---|
990 |
|
---|
991 | $riga[$y].= "<span class=\"td\"><input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\"/>";
|
---|
992 | $riga[$y].= "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>"
|
---|
993 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\"/>"
|
---|
994 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"/>"
|
---|
995 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"/>"
|
---|
996 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\"/>";
|
---|
997 | #$riga[$y].= "</span>";
|
---|
998 | list ($anno,$mese,$di)=explode('-',$giorno);
|
---|
999 | $riga[$y].= "$ora</span><span class=\"td\" align=\"center\">$di-$mese-$anno</span>";
|
---|
1000 | if ($voti_u > $maschi) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">";
|
---|
1001 | else $riga[$y].= "<span class=\"td\" align=\"center\">";
|
---|
1002 | if ($y<$num and $vismf==0 and $voti_u==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"'$voti_u'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"$voti_u\"";
|
---|
1003 | $riga[$y].= " size=\"5\"/></span>";
|
---|
1004 | if ($voti_d > $femmine) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\"/>";
|
---|
1005 | else $riga[$y].= "<span class=\"td\" align=\"center\">";
|
---|
1006 | if ($y<$num and $vismf==0 and $voti_d==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"'$voti_d'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"$voti_d\"";
|
---|
1007 | $riga[$y].= " size=\"5\"/></span>";
|
---|
1008 | if ($voti_t > ($maschi+$femmine)) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\" ><input type=\"text\" id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";
|
---|
1009 | else $riga[$y].= "<span class=\"td\" align=\"center\"><input id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";
|
---|
1010 | $riga[$y].= "<input type=\"hidden\" name=\"id_parz\" value=\"$id_parz\"/>"
|
---|
1011 | ."<input type=\"hidden\" name=\"data\" value=\"$giorno\"/>"
|
---|
1012 | ."<input type=\"hidden\" name=\"orario\" value=\"$ora\"/>"
|
---|
1013 | ."<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>"
|
---|
1014 | ."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>";
|
---|
1015 | $riga[$y].= "</span>";
|
---|
1016 |
|
---|
1017 | if (chisei($id_cons_gen)>=64 and $y==$numril) $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";
|
---|
1018 | else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>";
|
---|
1019 | $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>";
|
---|
1020 | $riga[$y].= "</form>";
|
---|
1021 |
|
---|
1022 | }
|
---|
1023 | # echo "</table></form>";
|
---|
1024 | echo "</div>";
|
---|
1025 |
|
---|
1026 |
|
---|
1027 | $sql="select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez";
|
---|
1028 | $compl = $dbi->prepare("$sql");
|
---|
1029 | $compl->execute();
|
---|
1030 |
|
---|
1031 |
|
---|
1032 | list ($complessivi)= $compl->fetch(PDO::FETCH_NUM);
|
---|
1033 | if (!$complessivi)
|
---|
1034 | {
|
---|
1035 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
1036 | $numy=$y.'1';
|
---|
1037 | if ($y==$num) {
|
---|
1038 | echo "document.votanti$y.voti_u$numy.focus()\n";
|
---|
1039 | echo "document.votanti$y.voti_u$numy.select()\n";
|
---|
1040 | }else{
|
---|
1041 | echo "this.voti_t$numy.focus()\n";
|
---|
1042 | echo "this.voti_t$numy.select()\n";
|
---|
1043 | }
|
---|
1044 | echo "//-->\n"
|
---|
1045 | ."</script>\n";
|
---|
1046 | break;
|
---|
1047 | }
|
---|
1048 | # echo "</td></tr>";
|
---|
1049 | }
|
---|
1050 | #CloseTable();
|
---|
1051 | foreach($riga as $key=>$val){
|
---|
1052 | echo $rigat[$key];
|
---|
1053 | echo $riga[$key];
|
---|
1054 | }
|
---|
1055 | echo "</div></td></tr></table>";
|
---|
1056 | }
|
---|
1057 |
|
---|
1058 |
|
---|
1059 |
|
---|
1060 | function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
1061 | global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;
|
---|
1062 | ////////////////////////////////////////////
|
---|
1063 | // da qua va la sezione per i voti finali
|
---|
1064 | ///////////////////////////////////////////
|
---|
1065 | $bgcolor1="#7777ff";
|
---|
1066 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
1067 |
|
---|
1068 |
|
---|
1069 |
|
---|
1070 | echo "<form name=\"spogliovoti\" action=\"modules/Elezioni/salva_voti.php\">"
|
---|
1071 | ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";
|
---|
1072 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
1073 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
1074 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
1075 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
1076 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
|
---|
1077 |
|
---|
1078 | echo "<table border=\"0\" width=\"90%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";
|
---|
1079 | /* if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
1080 | echo "<td width=\"32\"><b>"._VOTI_LISTA."</b></td>";
|
---|
1081 | else */
|
---|
1082 | echo "<td width=\"32\"><b>"._VALIDI."</b></td>";
|
---|
1083 | echo "<td width=\"82\"><b>"._NULLI."</b></td>"
|
---|
1084 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
1085 | ."<td width=\"32\"><b>"._VOTINULLI."</b></td>"
|
---|
1086 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
1087 | ."<td><b>"._TOTNON."</b></td>"
|
---|
1088 | ."<td><b>"._TOTALEVOTI."</b></td>"
|
---|
1089 | ."<td bgcolor=\"#ffffff\"></td> </tr>";
|
---|
1090 | /*if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
1091 | $result = mysql_query("select id_cons,id_sez,validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista,solo_gruppo,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
1092 | $res = $dbi->prepare("$sql");
|
---|
1093 | $res->execute();
|
---|
1094 |
|
---|
1095 |
|
---|
1096 | else */
|
---|
1097 | $sql = "select id_cons,id_sez,validi,nulli,bianchi,contestati,voti_nulli,'0','0','0',solo_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
1098 | $result = $dbi->prepare("$sql");
|
---|
1099 | $result->execute();
|
---|
1100 |
|
---|
1101 |
|
---|
1102 | list($id_cons2,$id_sez2,$validi, $nulli, $bianchi, $contestati,$votinulli,$sg,$conts,$nullis,$sololista) = $result->fetch(PDO::FETCH_NUM);
|
---|
1103 | $tot_nulli=$nulli+$bianchi+$contestati+$votinulli;
|
---|
1104 | $tot_voti=$validi+$tot_nulli+$conts+$nullis;
|
---|
1105 | // ."</td><td><input name=\"sololista\" value=\"$sololista\" size=\"5\" style=\"text-align:right\">" --- ."<td><b>"._SOLOLIS."</b></td>"
|
---|
1106 |
|
---|
1107 |
|
---|
1108 | echo "<tr bgcolor=\"$bgcolor2\" align=\"center\"><td align=\"left\"><input name=\"validi\" value=\"$validi\" size=\"5\" style=\"text-align:right\">";
|
---|
1109 | /* if(($genere==3 or $genere==5) and !$votog and $ops==3){
|
---|
1110 | echo "</td><td>$nulli"
|
---|
1111 | ."</td><td>$bianchi";
|
---|
1112 | echo "<input type=\"hidden\" name=\"nulli\" value=\"$nulli\"><input type=\"hidden\" name=\"bianchi\" value=\"$bianchi\">";
|
---|
1113 | }else{ */
|
---|
1114 | echo "</td><td><input name=\"nulli\" value=\"$nulli\" size=\"5\" style=\"text-align:right\">"
|
---|
1115 | ."</td><td><input name=\"bianchi\" value=\"$bianchi\" size=\"5\" style=\"text-align:right\">";
|
---|
1116 | // }
|
---|
1117 | echo "</td><td><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"
|
---|
1118 | ."</td><td><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\">"
|
---|
1119 | ."</td><td>$tot_nulli"
|
---|
1120 | ."</td><td>$tot_voti</td><td>"
|
---|
1121 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
1122 | ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">"
|
---|
1123 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
1124 | ."</td></tr></table></form>"; //</td></tr>";
|
---|
1125 |
|
---|
1126 |
|
---|
1127 | // echo "</table>";
|
---|
1128 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
1129 | if (!$validi) {
|
---|
1130 | echo "document.spogliovoti.validi.focus()\n";
|
---|
1131 | echo "document.spogliovoti.validi.select()\n";
|
---|
1132 | }
|
---|
1133 | echo "//-->\n"
|
---|
1134 | ."</script>\n";
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 |
|
---|
1140 | function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
1141 | global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;
|
---|
1142 | ////////////////////////////////////////////
|
---|
1143 | // da qua va la sezione per le preferenze ai gruppi
|
---|
1144 | ///////////////////////////////////////////
|
---|
1145 | // Controllo immmissioni
|
---|
1146 |
|
---|
1147 | $bgcolor1="#7777ff";
|
---|
1148 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
1149 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";
|
---|
1150 | $res = $dbi->prepare("$sql");
|
---|
1151 | $res->execute();
|
---|
1152 |
|
---|
1153 |
|
---|
1154 | $max = $res->rowCount();
|
---|
1155 | $max = $max-1;
|
---|
1156 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
1157 | if ($genere==0) {
|
---|
1158 | echo "document.sezioni.si1.focus()\n";
|
---|
1159 | echo "document.sezioni.si1.select()\n";
|
---|
1160 | } else {
|
---|
1161 | echo "document.sezioni.voti1.focus()\n"
|
---|
1162 | ."document.sezioni.voti1.select()\n";
|
---|
1163 | }
|
---|
1164 | echo "//-->\n"
|
---|
1165 | ."</script>\n";
|
---|
1166 | // tabella votanti
|
---|
1167 | echo "<center>";
|
---|
1168 | if ($genere!=0){
|
---|
1169 | $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";
|
---|
1170 | $result = $dbi->prepare("$sql");
|
---|
1171 | $result->execute();
|
---|
1172 |
|
---|
1173 |
|
---|
1174 | list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);
|
---|
1175 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"
|
---|
1176 | ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"
|
---|
1177 | ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";
|
---|
1178 | echo "</table>";
|
---|
1179 | }
|
---|
1180 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black\">";
|
---|
1181 | if ($genere==0){
|
---|
1182 | $sql="SELECT id_gruppo,si+no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' ";
|
---|
1183 | $res = $dbi->prepare("$sql");
|
---|
1184 | $res->execute();
|
---|
1185 |
|
---|
1186 |
|
---|
1187 | while (list($id_gruppo,$voti_parz,$validi,$nulli,$bianchi,$contestati) = $res->fetch(PDO::FETCH_NUM)){
|
---|
1188 | if ($voti_parz!=$validi){
|
---|
1189 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo' ";
|
---|
1190 | $res2 = $dbi->prepare("$sql");
|
---|
1191 | $res2->execute();
|
---|
1192 |
|
---|
1193 |
|
---|
1194 | list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);
|
---|
1195 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI_REF." $num_gruppo: ".$voti_parz." "._NO_VAL_VOTI.": ".$validi."</b><br></td></tr>";
|
---|
1196 | }
|
---|
1197 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
1198 | $res2 = $dbi->prepare("$sql");
|
---|
1199 | $res2->execute();
|
---|
1200 |
|
---|
1201 |
|
---|
1202 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
1203 | if (($validi+$nulli+$bianchi+$contestati)!= $tot ){
|
---|
1204 | $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'";
|
---|
1205 | $res2 = $dbi->prepare("$sql");
|
---|
1206 | $res2->execute();
|
---|
1207 |
|
---|
1208 |
|
---|
1209 | list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);
|
---|
1210 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI_REF." $num_gruppo: ".$tot." "._NO_SOMMA." ".($validi+$nulli+$bianchi+$contestati)."</b><br></td></tr>";
|
---|
1211 | }
|
---|
1212 | }
|
---|
1213 | }else{
|
---|
1214 | $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
1215 | $result = $dbi->prepare("$sql");
|
---|
1216 | $result->execute();
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);
|
---|
1220 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
1221 | $res = $dbi->prepare("$sql");
|
---|
1222 | $res->execute();
|
---|
1223 |
|
---|
1224 |
|
---|
1225 | list($voti_parz) = $res->fetch(PDO::FETCH_NUM);
|
---|
1226 | $sql="SELECT validi,nulli,bianchi,contestati,solo_lista,voti_nulli FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
1227 | $res = $dbi->prepare("$sql");
|
---|
1228 | $res->execute();
|
---|
1229 |
|
---|
1230 |
|
---|
1231 | list($validi,$nulli,$bianchi,$contestati,$solo_lista,$votinulli) = $res->fetch(PDO::FETCH_NUM);
|
---|
1232 | if ($voti_parz!=($validi-$solo_lista) and $voti_parz>0){
|
---|
1233 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".$voti_parz." "._NO_VAL_VOTI." ".($validi-$solo_lista)."</b><br></td><tr>";
|
---|
1234 | }
|
---|
1235 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";
|
---|
1236 | $res2 = $dbi->prepare("$sql");
|
---|
1237 | $res2->execute();
|
---|
1238 |
|
---|
1239 |
|
---|
1240 | list($tot) = $res2->fetch(PDO::FETCH_NUM);
|
---|
1241 | if ($validi+$nulli+$bianchi+$contestati+$votinulli!=$tot and $validi+$nulli+$bianchi+$contestati+$votinulli>0){
|
---|
1242 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi+$nulli+$bianchi+$contestati+$votinulli)."</b><br></td></tr>";
|
---|
1243 | }
|
---|
1244 | $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez";
|
---|
1245 | $resg = $dbi->prepare("$sql");
|
---|
1246 | $resg->execute();
|
---|
1247 |
|
---|
1248 |
|
---|
1249 | list($voti_sez)=$resg->fetch(PDO::FETCH_NUM);
|
---|
1250 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
1251 |
|
---|
1252 | $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";
|
---|
1253 | $resg = $dbi->prepare("$sql");
|
---|
1254 | $resg->execute();
|
---|
1255 |
|
---|
1256 |
|
---|
1257 | list($sgpl)=$resg->fetch(PDO::FETCH_NUM);
|
---|
1258 | $sql="SELECT solo_gruppo from ".$prefix."_ele_sezioni where id_cons=$id_cons and id_sez=$id_sez";
|
---|
1259 | $resg = $dbi->prepare("$sql");
|
---|
1260 | $resg->execute();
|
---|
1261 |
|
---|
1262 |
|
---|
1263 | list($sg)=$resg->fetch(PDO::FETCH_NUM);
|
---|
1264 | if ($sg != $sgpl) echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></tr>";
|
---|
1265 | }
|
---|
1266 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
1267 | if($genere==5 and !$disgiunto and $flagsg and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
1268 | $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'";
|
---|
1269 | $resref = $dbi->prepare("$sql");
|
---|
1270 | $resref->execute();
|
---|
1271 |
|
---|
1272 |
|
---|
1273 | $errgrulis=array();
|
---|
1274 | $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";
|
---|
1275 | $res4 = $dbi->prepare("$sql");
|
---|
1276 | $res4->execute();
|
---|
1277 |
|
---|
1278 |
|
---|
1279 | list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);
|
---|
1280 | if ($sezscrl)
|
---|
1281 | while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))
|
---|
1282 | {
|
---|
1283 | if($disgiunto || $flagsg){
|
---|
1284 | $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
1285 | $res3 = $dbi->prepare("$sql");
|
---|
1286 | $res3->execute();
|
---|
1287 | if($flagsg){
|
---|
1288 | $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
1289 | $res4 = $dbi->prepare("$sql");
|
---|
1290 | $res4->execute();
|
---|
1291 | }else{
|
---|
1292 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
1293 | $res4 = $dbi->prepare("$sql");
|
---|
1294 | $res4->execute();
|
---|
1295 | }
|
---|
1296 | }else{
|
---|
1297 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
1298 | $res3 = $dbi->prepare("$sql");
|
---|
1299 | $res3->execute();
|
---|
1300 | $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
1301 | $res4 = $dbi->prepare("$sql");
|
---|
1302 | $res4->execute();
|
---|
1303 | }
|
---|
1304 | list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
1305 | list($vliste)=$res4->fetch(PDO::FETCH_NUM);
|
---|
1306 | if($vliste>$vgruppo and !$disgiunto )
|
---|
1307 | {
|
---|
1308 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
1309 | $result = $dbi->prepare("$sql");
|
---|
1310 | $result->execute();
|
---|
1311 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
1312 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate $vliste<br/> superano i voti assegnati al gruppo $dgruppo $vgruppo</b><br></td></tr></table>";
|
---|
1313 | $errgrulis[$id_gruppo]=1;
|
---|
1314 | }
|
---|
1315 | elseif($vliste<$vgruppo and $disgiunto )
|
---|
1316 | {
|
---|
1317 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
1318 | $result = $dbi->prepare("$sql");
|
---|
1319 | $result->execute();
|
---|
1320 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
1321 | echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";
|
---|
1322 | $errgrulis[$id_gruppo]=1;
|
---|
1323 | }
|
---|
1324 | }
|
---|
1325 | /* {
|
---|
1326 | $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";
|
---|
1327 | $res3 = $dbi->prepare("$sql");
|
---|
1328 | $res3->execute();
|
---|
1329 |
|
---|
1330 |
|
---|
1331 | $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";
|
---|
1332 | $res4 = $dbi->prepare("$sql");
|
---|
1333 | $res4->execute();
|
---|
1334 |
|
---|
1335 |
|
---|
1336 | list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);
|
---|
1337 | list($vliste)=$res4->fetch(PDO::FETCH_NUM); //($tipo_cons=18 or $tipo_cons=19))
|
---|
1338 | if($vliste>$vgruppo and !$disgiunto)
|
---|
1339 | {
|
---|
1340 | $errgrulis[$id_gruppo]=1;
|
---|
1341 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
1342 | $result = $dbi->prepare("$sql");
|
---|
1343 | $result->execute();
|
---|
1344 |
|
---|
1345 |
|
---|
1346 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
1347 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr>";
|
---|
1348 | }
|
---|
1349 | elseif($vliste<$vgruppo and !($tipo_cons=18 or $tipo_cons=19))
|
---|
1350 | {
|
---|
1351 | $errgrulis[$id_gruppo]=1;
|
---|
1352 | $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
|
---|
1353 | $result = $dbi->prepare("$sql");
|
---|
1354 | $result->execute();
|
---|
1355 |
|
---|
1356 |
|
---|
1357 | list($dgruppo)=$result->fetch(PDO::FETCH_NUM);
|
---|
1358 | echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo <br/> superano i voti delle liste collegate</b><br></td></tr>";
|
---|
1359 | }
|
---|
1360 | }*/
|
---|
1361 | }
|
---|
1362 |
|
---|
1363 | }
|
---|
1364 | if(!isset($votinulli)) $votinulli=0;
|
---|
1365 | echo "<tr><td></td></tr></table>";
|
---|
1366 | if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {
|
---|
1367 | if($genere==0) echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_ref.php\">";
|
---|
1368 | else echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_gruppi.php\">";
|
---|
1369 | echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppiq\">"
|
---|
1370 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
1371 | ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"
|
---|
1372 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
1373 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
1374 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
1375 | ."<input type=\"hidden\" name=\"circo\" value=\"$circo\">"
|
---|
1376 | ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"
|
---|
1377 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";
|
---|
1378 | echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
|
---|
1379 | ."<td width=\"3%\"><b>"._NUM."</b></td>"
|
---|
1380 | ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";
|
---|
1381 | if ($genere==0){
|
---|
1382 | echo "<td><b>"._SI."</b></td>"
|
---|
1383 | ."<td><b>"._NO."</b></td>"
|
---|
1384 | ."<td><b>"._VALIDI."</b></td>"
|
---|
1385 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
1386 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
1387 | ."<td><b>"._NULLI."</b></td>"
|
---|
1388 | ."<td><b>"._TOTNON."</b></td>"
|
---|
1389 | ."<td><b>"._TOTALEVOTI."</b></td>"
|
---|
1390 | ."<td><b>"._VOTANTI."</b></td>";
|
---|
1391 | }else{
|
---|
1392 | echo "<td width=\"5%\"><b>"._VOTI."</b></td>";
|
---|
1393 | if($dettnulli) echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLO_GRUPPO."</b></td>";
|
---|
1394 | }
|
---|
1395 | echo "</tr>";
|
---|
1396 | $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ";
|
---|
1397 | $res = $dbi->prepare("$sql");
|
---|
1398 | $res->execute();
|
---|
1399 |
|
---|
1400 |
|
---|
1401 | $max = $res->rowCount();
|
---|
1402 | //echo "Massimo:$max - id=$id_cons - circo: $circo";
|
---|
1403 | $sql="select * from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";
|
---|
1404 | $result = $dbi->prepare("$sql");
|
---|
1405 | $result->execute();
|
---|
1406 |
|
---|
1407 |
|
---|
1408 | $i=1;
|
---|
1409 | $tot_pref=0;
|
---|
1410 | $totsg=0;
|
---|
1411 | while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = $result->fetch(PDO::FETCH_NUM)){
|
---|
1412 |
|
---|
1413 | //echo "test: $id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo";
|
---|
1414 |
|
---|
1415 |
|
---|
1416 | if ($num_gruppo != ''){
|
---|
1417 | if ($genere==0){
|
---|
1418 | $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
1419 | $res = $dbi->prepare("$sql");
|
---|
1420 | $res->execute();
|
---|
1421 |
|
---|
1422 |
|
---|
1423 | list($tot) = $res->fetch(PDO::FETCH_NUM);
|
---|
1424 | $sql="SELECT * FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
1425 | $res = $dbi->prepare("$sql");
|
---|
1426 | $res->execute();
|
---|
1427 |
|
---|
1428 |
|
---|
1429 | $pro= $res->fetch(PDO::FETCH_BOTH);
|
---|
1430 |
|
---|
1431 | if ($pro['si']+$pro['no']!=$pro['validi'] or ($pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=$tot and $pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=0)){
|
---|
1432 | echo "<tr style=\"background-color: rgb(255, 0, 0); text-align:center\">";
|
---|
1433 | }else{
|
---|
1434 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\">";
|
---|
1435 | }
|
---|
1436 | $descr = explode('.',$descr_gruppo, 100);
|
---|
1437 | echo "<td align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>"
|
---|
1438 | ."</td><td align=\"left\" width=\"50%\"><b> $descr[0] </b>";
|
---|
1439 | $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'0';
|
---|
1440 | $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'0';
|
---|
1441 | $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'0';
|
---|
1442 | $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'0';
|
---|
1443 | $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'0';
|
---|
1444 | $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'0';
|
---|
1445 | $tot_nulli=$pro['nulli']+$pro['bianchi']+$pro['contestati'];
|
---|
1446 | $tot_voti=$pro['validi']+$tot_nulli;
|
---|
1447 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"si$i\" value=\"".$pro['si']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1448 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"no$i\" value=\"".$pro['no']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1449 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"val$i\" value=\"".$pro['validi']."\" size=\"7\" style=\"text-align:right\" ></td>";
|
---|
1450 | echo "</td><td align=\"right\"><input name=\"bia$i\" value=\"".$pro['bianchi']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1451 | echo "</td><td align=\"right\"><input name=\"con$i\" value=\"".$pro['contestati']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1452 | echo "</td><td align=\"right\"><input name=\"nul$i\" value=\"".$pro['nulli']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1453 | echo "</td><td align=\"right\">$tot_nulli</td>";
|
---|
1454 | echo "</td><td align=\"right\">$tot_voti</td>";
|
---|
1455 | echo "</td><td align=\"right\">$tot</td>";
|
---|
1456 | }else{
|
---|
1457 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"num_gruppo$i\" value=\"$num_gruppo\"><b>$num_gruppo</b>"
|
---|
1458 | ."</td><td align=\"left\"><b> $descr_gruppo </b>";
|
---|
1459 | $sql="SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";
|
---|
1460 | $res = $dbi->prepare("$sql");
|
---|
1461 | $res->execute();
|
---|
1462 |
|
---|
1463 |
|
---|
1464 | $pro= $res->fetch(PDO::FETCH_BOTH);
|
---|
1465 | $errcolor='';
|
---|
1466 | if(isset($errgrulis[$id_gruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";
|
---|
1467 | echo "</td><td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
1468 |
|
---|
1469 | if($dettnulli) {echo "<td align=\"right\"><input name=\"solog$i\" value=\"".$pro['solo_gruppo']."\" size=\"7\" style=\"text-align:right\"></td>"; $totsg+=$pro['solo_gruppo'];}
|
---|
1470 | $tot_pref += $pro['voti'];
|
---|
1471 | echo "</tr>";
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | $i++;
|
---|
1475 | }
|
---|
1476 |
|
---|
1477 | }
|
---|
1478 | if ($genere!=0) {
|
---|
1479 | $sql="SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
|
---|
1480 | $res = $dbi->prepare("$sql");
|
---|
1481 | $res->execute();
|
---|
1482 |
|
---|
1483 |
|
---|
1484 | list($disgiunto)=$res->fetch(PDO::FETCH_NUM);
|
---|
1485 | $sql="SELECT solo_lista FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' ";
|
---|
1486 | $res = $dbi->prepare("$sql");
|
---|
1487 | $res->execute();
|
---|
1488 |
|
---|
1489 |
|
---|
1490 | list($sololis)=$res->fetch(PDO::FETCH_NUM);
|
---|
1491 | echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._TOTPREF."</td><td>$tot_pref</td>";
|
---|
1492 | if($dettnulli) echo "<td>$totsg</td>";
|
---|
1493 | echo "</tr>";
|
---|
1494 | if($disgiunto)
|
---|
1495 | echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._SOLOLIS."</td><td><input name=\"sololista\" value=\"".$sololis."\" size=\"7\" style=\"text-align:right\"></td></tr>";
|
---|
1496 | }
|
---|
1497 |
|
---|
1498 | echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";
|
---|
1499 |
|
---|
1500 | echo "</tr></table></form></td></tr>";
|
---|
1501 | if(chisei($id_cons_gen)>=64){
|
---|
1502 | echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";
|
---|
1503 | }
|
---|
1504 |
|
---|
1505 | echo "</td></tr></table></center>";
|
---|
1506 | }
|
---|
1507 | if ($genere!=0){
|
---|
1508 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
1509 | }
|
---|
1510 | }
|
---|
1511 |
|
---|
1512 |
|
---|
1513 |
|
---|
1514 |
|
---|
1515 | if (!preg_match("/rec/",$op)) {
|
---|
1516 | ele(); //menu
|
---|
1517 | /* echo "\n<table align=\"left\" border=\"0\" width=\"200\"><tr bgcolor=\"$bgcolor1\">";
|
---|
1518 | numeri_sezione(8);
|
---|
1519 | echo "<td></td></tr></table>\n";*/
|
---|
1520 | echo"</td></tr></table>";
|
---|
1521 | }
|
---|
1522 |
|
---|
1523 | switch ($op){
|
---|
1524 | case "voti": //fa eccezione perche' chiamata con minor numero di parametri - riesaminare
|
---|
1525 | # voti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
|
---|
1526 | voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
|
---|
1527 | break;
|
---|
1528 | case "rec_add_votanti":
|
---|
1529 | rec_add_votanti($vari);
|
---|
1530 | break;
|
---|
1531 | default :
|
---|
1532 | $op($vari); //chiamata a funzione variabile con parametri variabili (da cambiare!)
|
---|
1533 | }
|
---|
1534 | echo"</td></tr></table>";
|
---|
1535 | include_once("modules/Elezioni/language/lang-$currentlang.php");
|
---|
1536 | include ("footer.php");
|
---|
1537 | ?>
|
---|
1538 |
|
---|