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