1 | <?php
|
---|
2 | /************************************************************************/
|
---|
3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
4 | /* by Luciano Apolito & Roberto Gigli */
|
---|
5 | /* http://www.eleonline.it */
|
---|
6 | /* info@eleonline.it rgigli@libero.it */
|
---|
7 | /************************************************************************/
|
---|
8 |
|
---|
9 | if (!defined('MODULE_FILE')) {
|
---|
10 | die ("You can't access this file directly...");
|
---|
11 | }
|
---|
12 |
|
---|
13 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
|
---|
14 | $_GET : $_POST;
|
---|
15 |
|
---|
16 | $id_comune= (isset($param['id_comune'])) ? $param['id_comune']:$siteistat;
|
---|
17 | if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
|
---|
18 | if (isset($param['op'])) $op=$param['op']; else $op='';
|
---|
19 | if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
|
---|
20 | if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
|
---|
21 | if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']);
|
---|
22 | if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
|
---|
23 | if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
|
---|
24 | if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
|
---|
25 | if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
|
---|
26 | if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
|
---|
27 | if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
|
---|
28 | if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
|
---|
29 | if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
|
---|
30 | if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
|
---|
31 | if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
|
---|
32 | if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
|
---|
33 | if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
|
---|
34 | if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
|
---|
35 | if (isset($param['xls'])) $xls=intval($param['xls']); else $xls='';
|
---|
36 | if (isset($param['pdf'])) $pdf=intval($param['pdf']); else $pdf='';
|
---|
37 |
|
---|
38 | # anti-xss nov. 2009
|
---|
39 | $id_comune=htmlentities($id_comune);
|
---|
40 | $perc=floatval($perc);
|
---|
41 | $perc_lista=floatval($perc_lista);
|
---|
42 | #$datipdf= htmlentities($datipdf);
|
---|
43 | $op= htmlentities($op);
|
---|
44 | $info= htmlentities($info);
|
---|
45 | $files=htmlentities($files);
|
---|
46 | $lettera=htmlentities($lettera);
|
---|
47 | $id_comune=intval($id_comune);
|
---|
48 |
|
---|
49 | //$id_cons_gen=$_GET['id_cons_gen'];
|
---|
50 | $sql="SELECT t1.tipo_cons,t3.genere,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" ;
|
---|
51 | $res = $dbi->prepare("$sql");
|
---|
52 | $res->execute();
|
---|
53 | list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
|
---|
54 | global $lang,$circo,$id_circ;
|
---|
55 | if(!isset($id_circ)) $id_circ=0;
|
---|
56 | if(isset($circo)) $_SESSION['id_circ']=$id_circ;
|
---|
57 | if (isset($circo) and $circo) {$circos="and t2.id_circ='$id_circ'"; $circos4="and t4.id_circ='$id_circ'";}
|
---|
58 | else {$circos=''; $circos4='';}
|
---|
59 | if (isset($param['ops'])) $ops=$param['ops']; else $ops='';
|
---|
60 | if (isset($param['pag'])) $pag=$param['pag']; else $pag=0;
|
---|
61 | if (isset($param['num_ref'])) $num_ref=$param['num_ref'];
|
---|
62 | if (isset($param['num_refs'])) $num_refs=$param['num_refs'];
|
---|
63 | $bgcolor2='#cacaca';
|
---|
64 | if (!IsSet($num_ref)) {
|
---|
65 | $num_ref=1;
|
---|
66 | $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons";
|
---|
67 | $resg = $dbi->prepare("$sql");
|
---|
68 | $resg->execute();
|
---|
69 | $num_refs= $resg->rowCount(); //quante pagine?
|
---|
70 | }
|
---|
71 | //**************************************************************************
|
---|
72 | // ELE
|
---|
73 | //**************************************************************************
|
---|
74 | //controllo_finale($id_cons);
|
---|
75 |
|
---|
76 | global $lang, $fascia, $limite, $votog;
|
---|
77 | include_once("modules/Elezioni/language/lang-$lang.php");
|
---|
78 | # testata
|
---|
79 | $datipdf='';
|
---|
80 | if($csv==1){
|
---|
81 | include_once("modules/Elezioni/funzioni.php");
|
---|
82 | $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
|
---|
83 | $res = $dbi->prepare("$sql");
|
---|
84 | $res->execute();
|
---|
85 | list($descr_com) = $res->fetch(PDO::FETCH_NUM);
|
---|
86 | $descr_com =stripslashes($descr_com);
|
---|
87 | $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">";
|
---|
88 | $siteistat=$id_comune;
|
---|
89 | # salva sull'hardisk lo stemma del comune style=\"vertical-align: text-bottom;\"
|
---|
90 | $logo=verificasimbolo();
|
---|
91 | $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
|
---|
92 | if($xls!=1) $datipdf .= "<table><tr><td>$immagine</td><td>";
|
---|
93 | $datipdf .= ""._COMUNE." $descr_com <br/>
|
---|
94 | "._RISULTA." "._CONSULTA."<br/>";
|
---|
95 | $datipdf .= "$descr_cons <br />"._DISCLAIMER."";
|
---|
96 | if($xls!=1) $datipdf .= "</td></tr></table>";
|
---|
97 | $datipdf .="</div>";
|
---|
98 | $html = "<style type=\"text/css\">
|
---|
99 | <!--
|
---|
100 |
|
---|
101 | .td-89 {
|
---|
102 | width: 89%;
|
---|
103 | border: 1px;
|
---|
104 | text-align: left;
|
---|
105 | }
|
---|
106 | .td-vuoto {
|
---|
107 | width: 100%;
|
---|
108 | border: 1px;
|
---|
109 | text-align: left;
|
---|
110 | }
|
---|
111 |
|
---|
112 | .td-5 {
|
---|
113 | margin: 0px 0 0 0px;
|
---|
114 | width: 5%;
|
---|
115 | /*border: none;*/
|
---|
116 | padding: 0px;
|
---|
117 | text-align: center;
|
---|
118 | }
|
---|
119 |
|
---|
120 | .bgw {
|
---|
121 | background: #ffffff;
|
---|
122 | font-size: 13px;
|
---|
123 | font-family: Helvetica;
|
---|
124 | text-align: right;
|
---|
125 | }
|
---|
126 |
|
---|
127 | .bggray {
|
---|
128 | background: #ffffff;
|
---|
129 | FONT-SIZE: 13px;
|
---|
130 | FONT-FAMILY: Helvetica;
|
---|
131 | border: 1px;
|
---|
132 | text-align:right;
|
---|
133 | }
|
---|
134 |
|
---|
135 | .bggray2 {
|
---|
136 | background: #EFEFEF;
|
---|
137 | FONT-SIZE: 13px;
|
---|
138 | FONT-FAMILY: Helvetica;
|
---|
139 | border: 1px;
|
---|
140 | text-align:right;
|
---|
141 | }
|
---|
142 | -->
|
---|
143 | </style>";
|
---|
144 | }
|
---|
145 | // icone stampa e grafici style=\"margin:0px auto;
|
---|
146 | if ($csv!=1){
|
---|
147 | if(isset($num_ref)) $curref="&num_ref=$num_ref"; else $curref='';
|
---|
148 | if (!isset($html)) $html='';
|
---|
149 | $html .= "<div>
|
---|
150 | <a href=\"modules.php?name=Elezioni&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&op=graf_votanti\">
|
---|
151 | "._VER_GRAF." <img class=\"image\" src=\"modules/Elezioni/images/grafici.png\" alt=\"\" /></a>
|
---|
152 | <a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&csv=1&pag=$pag&num_ref=$num_ref&num_refs=$num_refs\">"._VER_STAMPA."
|
---|
153 | <img class=\"image\" src=\"modules/Elezioni/images/printer.png\" alt=\"\" /></a>
|
---|
154 | <a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&xls=1&csv=1;&pag=$pag&num_ref=$num_ref&num_refs=$num_refs\">
|
---|
155 | <img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"\" /></a>
|
---|
156 | <a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&pdf=1&csv=1;&pag=$pag&num_ref=$num_ref&num_refs=$num_refs\">
|
---|
157 | <a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&pdf=1&csv=1;&pag=$pag$curref\">
|
---|
158 | <img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"\" /></a>
|
---|
159 | </div>";
|
---|
160 | }
|
---|
161 | if($circo)
|
---|
162 | $sql="SELECT sum(t1.maschi),sum(t1.femmine) FROM ".$prefix."_ele_sezioni as t1,".$prefix."_ele_sede as t2 where t1.id_sede=t2.id_sede $circos";
|
---|
163 | else
|
---|
164 | $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
165 | $res = $dbi->prepare("$sql");
|
---|
166 | $res->execute();
|
---|
167 | list($totm,$totf) = $res->fetch(PDO::FETCH_NUM);
|
---|
168 | $totel=$totm+$totf;
|
---|
169 | if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina
|
---|
170 | /*
|
---|
171 | if (!IsSet($num_ref)) {
|
---|
172 | $num_ref=1;
|
---|
173 | $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi);
|
---|
174 | $num_refs= mysql_num_rows($resg); //quante pagine?
|
---|
175 | }
|
---|
176 | */
|
---|
177 | if(($genere!=4) and $pag==0){ //diverso da liste a piu' candidati
|
---|
178 | $ops=4; //gestione gruppi (anche liste uninominali)
|
---|
179 | }else{
|
---|
180 | $ops=3; //gestione liste
|
---|
181 | }
|
---|
182 | $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref";
|
---|
183 | $resg = $dbi->prepare("$sql");
|
---|
184 | $resg->execute();
|
---|
185 | list($idg,$numg) = $resg->fetch(PDO::FETCH_NUM);
|
---|
186 | $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ FROM ".$prefix."_ele_sezioni as t1,".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez ";
|
---|
187 | $res = $dbi->prepare("$sql");
|
---|
188 | $res->execute();
|
---|
189 | $max = $res->rowCount(); //quante sezioni?
|
---|
190 | $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ FROM ".$prefix."_ele_sezioni as t1,".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez ";
|
---|
191 | $res = $dbi->prepare("$sql");
|
---|
192 | $res->execute();
|
---|
193 | $num_sez = $res->rowCount(); //quante sezioni?
|
---|
194 | #for ($i=1;$i<=$num_sez;$i++){
|
---|
195 | $i=1;
|
---|
196 | while ($sezione[$i] = $res->fetch(PDO::FETCH_BOTH)) $ar[$i++]=0;
|
---|
197 |
|
---|
198 | # $sezione[$i]=$res->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni
|
---|
199 |
|
---|
200 | #}
|
---|
201 | $tab3="_ele_voti_lista";
|
---|
202 | if ($genere>0) { //se non e' un referendum
|
---|
203 | if (!($genere==4) and $pag==0){ //se non e' una lista uninominale ed e' la prima pagina
|
---|
204 | $tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0',t2.voti_nulli FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 $circos4 group by t2.id_sez,t2.num_sez,t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,t2.voti_nulli order by t2.num_sez ";
|
---|
205 | }else{ // e' una lista uninominale o la seconda pagina
|
---|
206 | # voto disgiunto regione sicilia aggiunge il campo solo lista
|
---|
207 | if(isdisgiunto()){
|
---|
208 | $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli
|
---|
209 | FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
|
---|
210 | left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
|
---|
211 | where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circos4 group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez ";
|
---|
212 | }else{
|
---|
213 | $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli
|
---|
214 | FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
|
---|
215 | left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
|
---|
216 | where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circos4 group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez ";
|
---|
217 | }
|
---|
218 | }
|
---|
219 | $riga1 = "";
|
---|
220 | if($pag==0)$riga1 .="<div style=\"text-align: center;\"><h2>"._DETTAGLIO." "._VOTIE."</h2></div>";
|
---|
221 | else $riga1 .="<h4>"._DETTAGLIO." "._VOTIE." "._ASOLA_LISTA."</h4>";
|
---|
222 | }else{ // e' un referendum --> t3.id_gruppo vuota per allineare il while (da rifare con array)
|
---|
223 | $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo,'0'
|
---|
224 | FROM ".$prefix."_ele_voti_ref as t1 left join ".$prefix."_ele_sezioni as t2 on (t1.id_sez=t2.id_sez)
|
---|
225 | left join ".$prefix."_ele_gruppo as t3 on (t1.id_gruppo=t3.id_gruppo) left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede)
|
---|
226 | where t1.id_cons='$id_cons' and t1.id_gruppo='$idg' $circos4 order by t2.num_sez ";
|
---|
227 | $riga1 = "<div style=\"margin:0px auto;text-align:center;\">";
|
---|
228 | $riga1 .="<h2>"._DETTAGLIO." "._VOTIE."</h2></div>";
|
---|
229 | $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'";
|
---|
230 | $des = $dbi->prepare("$sql");
|
---|
231 | $des->execute();
|
---|
232 | list($descrizione)=$des->fetch(PDO::FETCH_BOTH);
|
---|
233 | $riga1 .="<h4>$descrizione</h4>";
|
---|
234 | }
|
---|
235 | $sql="$tab ";
|
---|
236 | $res = $dbi->prepare("$sql");
|
---|
237 | $res->execute();
|
---|
238 | $num_scr = $res->rowCount();
|
---|
239 | //$riga2= "<div>"._SEZSCR." $num_scr su $num_sez</div>";//sezioni scrutinate
|
---|
240 | $riga2 = "<table style=\"border:1px solid #6A6A6A;\" summary=\"Tabella dei voti espressi\">";
|
---|
241 | $riga3 = "<tr class=\"bggray2\">
|
---|
242 | <td>"._SEZIONI."</td>
|
---|
243 | <td>"._VOTIU."</td>
|
---|
244 | <td>"._VOTID."</td>
|
---|
245 | <td>"._VOTIE."</td>"; //testata con nomi dei campi
|
---|
246 | if ($genere==0) { //se e' un referendum
|
---|
247 | $riga3 .= "<td>"._SI."</td><td>"._NO."</td>";
|
---|
248 | } elseif ((($genere==5) or ($genere==3)) and $pag==1){
|
---|
249 | $riga3 .= "<td>Voti "._LISTE."</td>";
|
---|
250 | if(isdisgiunto()){
|
---|
251 | $riga3 .= "<td>Voti "._PRESI."</td>";
|
---|
252 | $riga3 .= "<td>"._SOLO_LISTA."</td>";
|
---|
253 | } // voto disgiunto
|
---|
254 | if (!$votog) $riga3 .= "<td>"._ASOLO_GRUPPO."</td>";
|
---|
255 | }
|
---|
256 | $riga3 .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>"
|
---|
257 | ."</tr>\n";
|
---|
258 | $sql="$tab ";
|
---|
259 | $res = $dbi->prepare("$sql");
|
---|
260 | $res->execute();
|
---|
261 | $num_scr = $res->rowCount();
|
---|
262 | $righe= "";
|
---|
263 | $scrutinate=1;
|
---|
264 | $tot_u=0;$tot_d=0;$tot_voti=0; $tot_si=0;$tot_no=0;$tot_validi=0;$tot_nulli=0;$tot_bianchi=0;$tot_contestati=0;
|
---|
265 | $tot_sololista=0;$tot_gruppo=0;
|
---|
266 | #$si e $no sono valide anche per voti lista e solo gruppo per i non referendum
|
---|
267 | while (list($id_gruppo,$id,$num,$si,$no,$sololista,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$votinulli) = $res->fetch(PDO::FETCH_NUM)){
|
---|
268 | $nulli+=$votinulli;
|
---|
269 | // inserimento numeri di sez non scrutinate
|
---|
270 | while ($sezione[$scrutinate][1] < $num) {
|
---|
271 | $righe.= "<tr><td><span style=\"color: rgb(255, 0, 0);\">".$sezione[$scrutinate][1]."</span></td></tr>\n";
|
---|
272 | $scrutinate++;
|
---|
273 | }
|
---|
274 | # voti sindaco, gruppo o presidente
|
---|
275 | $tab5="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id'";
|
---|
276 | $sql="$tab5";
|
---|
277 | $res3 = $dbi->prepare("$sql");
|
---|
278 | $res3->execute();
|
---|
279 | list($sindaco) = $res3->fetch(PDO::FETCH_NUM);
|
---|
280 | $scrutinate++;
|
---|
281 | // fine inserimento
|
---|
282 | $tab2="SELECT max(voti_donne),max(voti_uomini),max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id'";
|
---|
283 | if ($genere==0) $tab2 .= " and id_gruppo=$id_gruppo";
|
---|
284 | $sql=$tab2;
|
---|
285 | $res2 = $dbi->prepare("$sql");
|
---|
286 | $res2->execute();
|
---|
287 | list($votid,$votiu,$voti) = $res2->fetch(PDO::FETCH_NUM);
|
---|
288 | // $voti=$votiu+$votid;
|
---|
289 | $tot_gruppo+=$sindaco;
|
---|
290 | $tot_u+=$votiu;
|
---|
291 | $tot_d+=$votid;
|
---|
292 | $tot_voti+=$voti;
|
---|
293 | $tot_si+=$si;
|
---|
294 | $tot_no+=$no;
|
---|
295 | $tot_validi+=$validi;
|
---|
296 | $tot_nulli+=$nulli;
|
---|
297 | $tot_bianchi+=$bianchi;
|
---|
298 | $tot_contestati+=$contestati;
|
---|
299 | $tot_sololista+=$sololista;
|
---|
300 | if($num % 2)
|
---|
301 | $righe .= "<tr class=\"bgw\">";
|
---|
302 | else
|
---|
303 | $righe .= "<tr class=\"bggray2\">";
|
---|
304 | $righe .= "<td>$num</td>
|
---|
305 | <td>".number_format($votiu,0,',','.')."</td>
|
---|
306 | <td>".number_format($votid,0,',','.')."</td>
|
---|
307 | <td>".number_format($voti,0,',','.')."</td>";
|
---|
308 | if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
|
---|
309 | $righe .= "<td>".number_format($si,0,',','.')."</td>";
|
---|
310 | if(isdisgiunto()){
|
---|
311 | $righe .= "<td>".number_format($sindaco,0,',','.')."</td>";
|
---|
312 | $righe .= "<td>".number_format($sololista,0,',','.')."</td>";
|
---|
313 | }
|
---|
314 | if (!$votog) $righe .= "<td>".number_format($no,0,',','.')."</td>";
|
---|
315 | }
|
---|
316 | $righe .= "<td>".number_format($validi,0,',','.')."</td>
|
---|
317 | <td>$nulli</td>
|
---|
318 | <td>$bianchi</td>
|
---|
319 | <td>$contestati</td></tr>";
|
---|
320 | }
|
---|
321 | #if ($num<$num_sez)
|
---|
322 | if(isset($sezione[$scrutinate][1]) and $num<$sezione[$scrutinate][1]) {
|
---|
323 | while(isset($sezione[$scrutinate][1])) {
|
---|
324 | $righe .= "<tr><td align=\"center\">";
|
---|
325 | $righe .="<span style=\"color: rgb(255, 0, 0);\">".$sezione[$scrutinate++][1]."</span></td></tr>";
|
---|
326 | }
|
---|
327 | }
|
---|
328 | $righet='';
|
---|
329 | if($num_scr){
|
---|
330 | $righet = "<tr class=\"bggray\">
|
---|
331 | <td ></td>
|
---|
332 | <td>"._VOTIU."</td>
|
---|
333 | <td>"._VOTID."</td>
|
---|
334 | <td>"._VOTIE."</td>"; //testata con nomi dei campi
|
---|
335 | if ($genere==0) { //se e' un referendum
|
---|
336 | $righet .= "<td>"._SI."</td><td>"._NO."</td>";
|
---|
337 | } elseif ((($genere==5) or ($genere==3)) and $pag==1){
|
---|
338 | $righet .= "<td>Voti "._LISTE."</td>";
|
---|
339 | if(isdisgiunto()){
|
---|
340 | $righet .= "<td>Voti "._PRESI."</td>";
|
---|
341 | $righet .= "<td>"._SOLO_LISTA."</td>";
|
---|
342 | } // voto disgiunto
|
---|
343 | if (!$votog) $righet .= "<td>"._ASOLO_GRUPPO."</td>";
|
---|
344 | }
|
---|
345 | if($totel==0) $totelrip="0.00"; else $totelrip=number_format($tot_voti*100/$totel,2);
|
---|
346 | if($totf==0) $totfrip="0.00"; else $totfrip=number_format($tot_d*100/$totf,2);
|
---|
347 | if($totm==0) $totmrip="0.00"; else $totmrip=number_format($tot_u*100/$totm,2);
|
---|
348 | $righet .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>"
|
---|
349 | ."</tr><tr class=\"bgw\"><td><b>"._TOT."</b></td><td><b>".number_format($tot_u,0,',','.')."</b><br /><i>(".$totmrip."%)</i></td><td><b>".number_format($tot_d,0,',','.')."</b><br /><i>(".$totfrip."%)</i></td><td><b>".number_format($tot_voti,0,',','.')."</b><br /><i>(".$totelrip."%)</i></td>";
|
---|
350 | // se e' un referendum o una consultazione con raggruppamenti
|
---|
351 | if($tot_validi){
|
---|
352 | if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
|
---|
353 | $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(".number_format($tot_si*100/$tot_validi,2)."%)</i></td>";
|
---|
354 | if(isdisgiunto()){
|
---|
355 | $righet .="<td><b>".number_format($tot_gruppo,0,',','.')."</b><br /><i>(".number_format($tot_gruppo*100/$tot_validi,2)."%)</i></td>";
|
---|
356 | $righet .="<td><b>".number_format($tot_sololista,0,',','.')."</b><br /><i>(".number_format($tot_sololista*100/$tot_validi,2)."%)</i></td>";
|
---|
357 | }
|
---|
358 | if(!$votog) $righet .="<td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(".number_format($tot_no*100/$tot_validi,2)."%)</i></td>";
|
---|
359 | }
|
---|
360 | $righet .= "<td><b>".number_format($tot_validi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_validi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>"
|
---|
361 | .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0.00')."%)</i></td></tr>";
|
---|
362 | }else{
|
---|
363 | if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
|
---|
364 | $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(0.00%)</i></td><td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(0.00%)</i></td>";
|
---|
365 | }
|
---|
366 | $righet .= "<td><b>0</b><br /><i>(0.00%)</i></td><td><b>"
|
---|
367 | .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0,00')."%)</i></td></tr>";
|
---|
368 | }
|
---|
369 | }
|
---|
370 | $righe .= "</table>";
|
---|
371 | if(!isset($html)) $html='';
|
---|
372 | $html .= "$riga1";
|
---|
373 | $html .= $riga2."";
|
---|
374 | $html .= $righet;
|
---|
375 | $html .= $riga3;
|
---|
376 | $html .= $righe;
|
---|
377 | $html .="<div>";
|
---|
378 | if($genere==0){ //se e' referendum
|
---|
379 | if ($xls!='1' && $pdf!='1' && $csv!='1'){
|
---|
380 | #'Pagina precedente' e 'Pagina Successiva'
|
---|
381 | $cur=$num_ref;
|
---|
382 | if ($cur>1) {
|
---|
383 | $num_ref--;
|
---|
384 | $html .= "<a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&num_ref=$num_ref&num_refs=$num_refs&csv=$csv&xls=$xls&pdf=$pdf\">";
|
---|
385 | $html .= "[ <b>"._PREV_MATCH."</b> ]</a>";
|
---|
386 | }
|
---|
387 | if ($cur<$num_refs) {
|
---|
388 | $cur++;
|
---|
389 | $html .= "<a href=\"modules.php?name=Elezioni&op=come&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&info=votanti&num_ref=$cur&num_refs=$num_refs&csv=$csv&xls=$xls&pdf=$pdf\">";
|
---|
390 |
|
---|
391 | $html .= "[ <b>"._NEXT_MATCH."</b> ]</a>";
|
---|
392 | }
|
---|
393 | }
|
---|
394 | }
|
---|
395 | if($genere==5 or $genere==3){ //se vi sono raggruppamenti
|
---|
396 | if($csv!=1 and $fascia>$limite){
|
---|
397 | $pag=($pag==0 ? 1:0);
|
---|
398 | $html .= "<a href=\"modules.php?name=Elezioni&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&op=come&info=votanti&pag=$pag&csv=$csv\"><b>";
|
---|
399 | if($pag) $html .= _VOTIL;
|
---|
400 | //_CONTR_CONS;
|
---|
401 | else $html .= _VOTIE;
|
---|
402 | //_CONTR_ESPR;
|
---|
403 | $html .= "</b></a>";
|
---|
404 | }
|
---|
405 | }
|
---|
406 | if($csv==1){
|
---|
407 | $data=date("d-m-y G:i");
|
---|
408 | $html .="<br/><div style=\"margin:0 auto;text-align:center;\"><i>Stampato: $data</i>";
|
---|
409 | $html .="<br/><i>Eleonline by l. apolito & r. gigli - www.eleonline.it</i></div>";
|
---|
410 | }
|
---|
411 | $html .= "</div>";
|
---|
412 | ?>
|
---|