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