[254] | 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 | if ($xls=='1' or $pdf=='1') {
|
---|
| 13 | include_once("modules/Elezioni/language/lang-$lang.php");
|
---|
| 14 | include_once("modules/Elezioni/funzioni.php");
|
---|
| 15 | }
|
---|
| 16 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
|
---|
| 17 | $_GET : $_POST;
|
---|
| 18 |
|
---|
| 19 | if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
|
---|
| 20 | //if (isset($param['op'])) $op=$param['op']; else $op='';
|
---|
| 21 | if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
|
---|
| 22 | if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
|
---|
| 23 | if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else $id_circ='';
|
---|
| 24 | if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
|
---|
| 25 | if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
|
---|
| 26 | if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
|
---|
| 27 | if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
|
---|
| 28 | if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
|
---|
| 29 | if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
|
---|
| 30 | if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
|
---|
| 31 | if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
|
---|
| 32 | if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
|
---|
| 33 | if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
|
---|
| 34 | if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
|
---|
| 35 | if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
|
---|
| 36 | #if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
|
---|
| 37 | if (isset($param['pdf'])) $pdf=intval($param['pdf']); else $pdf='';
|
---|
| 38 | if (isset($param['orienta'])) $orienta=addslashes($param['orienta']); else $orienta='';
|
---|
| 39 | if (isset($param['datipdf'])) $datipdf=addslashes($param['datipdf']); else $datipdf='';
|
---|
| 40 | if (isset($param['formato'])) $formato=addslashes($param['formato']); else $formato='';
|
---|
| 41 | # anti-xss nov. 2009
|
---|
| 42 | $id_comune=htmlentities($id_comune);
|
---|
| 43 | $id_comune=intval($id_comune);
|
---|
| 44 | $perc=htmlentities($perc);
|
---|
| 45 | $perc_lista=floatval($perc_lista);
|
---|
| 46 | #$datipdf= htmlentities($datipdf);
|
---|
| 47 | $op= htmlentities($op);
|
---|
| 48 | $info= htmlentities($info);
|
---|
| 49 | $files=htmlentities($files);
|
---|
| 50 | $lettera=htmlentities($lettera);
|
---|
| 51 | $orienta=htmlentities($orienta);
|
---|
| 52 | $formato=htmlentities($formato);
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | include("crea_pagina.php");
|
---|
| 59 |
|
---|
[318] | 60 | $sql="SELECT descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'" ;
|
---|
| 61 | $res = $dbi->prepare("$sql");
|
---|
| 62 | $res->execute();
|
---|
[254] | 63 |
|
---|
[265] | 64 | list($descr_comune) = $res->fetch(PDO::FETCH_NUM);
|
---|
[254] | 65 |
|
---|
[318] | 66 | $sql="SELECT t1.descrizione, t1.tipo_cons,t2.genere, t2.voto_g, t2.voto_l, t2.voto_c, t2.circo FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_tipo as t2 where t1.tipo_cons=t2.tipo_cons and t1.id_cons_gen='$id_cons_gen' ";
|
---|
| 67 | $res = $dbi->prepare("$sql");
|
---|
| 68 | $res->execute();
|
---|
[254] | 69 |
|
---|
[265] | 70 | list($descr_cons,$tipo_cons,$genere,$votog,$votol,$votoc,$circo) = $res->fetch(PDO::FETCH_NUM);
|
---|
[318] | 71 | $sql="SELECT t2.id_cons,t2.solo_gruppo,t2.disgiunto FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" ;
|
---|
| 72 | $res = $dbi->prepare("$sql");
|
---|
| 73 | $res->execute();
|
---|
[254] | 74 |
|
---|
[265] | 75 | list($id_cons,$dettnulli,$disgiunto) = $res->fetch(PDO::FETCH_NUM);
|
---|
[254] | 76 |
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 |
|
---|
[265] | 80 |
|
---|
| 81 |
|
---|
| 82 |
|
---|
[254] | 83 | ////////////////////////////////////////////////////////////
|
---|
| 84 | // Visualizza i dati per liste, gruppi e referendum, per sezione o circoscrizione
|
---|
| 85 | ////////////////////////////////////////////////////////////
|
---|
| 86 |
|
---|
| 87 | function gruppo_circo(){
|
---|
| 88 | global $prefix, $dbi, $descr_cons, $id_cons, $id_cons_gen,$tipo_cons,$votog,$votol,$votoc,$circo, $genere,$id_gruppo,$id_lista,$bgcolor1,$bgcolor2,$id_comune,$descr_comune,$id_circ;
|
---|
| 89 | global $id_comune,$id_cons_gen,$op,$minsez,$id_lista,$id_circ,$csv,$min,$orienta,$formato,$dettnulli,$disgiunto,
|
---|
| 90 | $orvert,$offset,$offsetsez,$perc,$info,$files,$nomefile;
|
---|
| 91 | $nomefile="";
|
---|
| 92 | #Denominazione pagine
|
---|
| 93 | if($op=="gruppo_circo") $pagina=_GRUPPO." "._PER." "._CIRCO;
|
---|
| 94 | if($op=="gruppo_sezione") $pagina=_GRUPPO." "._PER." "._SEZIONI;
|
---|
| 95 | if($op=="lista_circo") $pagina=_LISTA." "._PER." "._CIRCO;
|
---|
| 96 | if($op=="lista_sezione") $pagina=_LISTA." "._PER." "._SEZIONI;
|
---|
| 97 | if($op=="candidato_circo") $pagina=_CONSI." "._PER." "._CIRCO;
|
---|
| 98 | if($op=="candidato_sezione") $pagina=_CONSI." "._PER." "._SEZIONI;
|
---|
| 99 | if($op=="consiglieri") $pagina=_CALCONS;
|
---|
| 100 | if (strstr( $op,'circo')) { //$op=='gruppo_circo' or $op=='lista_circo') {
|
---|
| 101 | $tab1="circ";
|
---|
| 102 | $tab2="t5.num_circ,t5.descrizione";
|
---|
| 103 | $tab3="t5.num_circ";
|
---|
| 104 | $tipo1=_DA." "._CIRCO;
|
---|
| 105 | $tipo2=_CIRCOS;
|
---|
| 106 | $tipo3=_CIRCO;
|
---|
| 107 | }else{
|
---|
| 108 | $tab1="sez";
|
---|
| 109 | $tab2="t3.num_sez,''";
|
---|
| 110 | $tab3="t3.num_sez";
|
---|
| 111 | $tipo1=_DA." "._SEZIONE;
|
---|
| 112 | $tipo2=_SEZIONI;
|
---|
| 113 | $tipo3=_SEZIONE;
|
---|
| 114 | }
|
---|
| 115 | if (strstr( $op,"gruppo")){
|
---|
| 116 | $tab="gruppo";
|
---|
| 117 | }elseif (strstr( $op,'lista')) {
|
---|
| 118 | $tab="lista";
|
---|
| 119 | }else{
|
---|
| 120 | $tab="candidati";
|
---|
| 121 | }
|
---|
| 122 | if ($orvert) {
|
---|
| 123 | $righe='';
|
---|
| 124 | $colonne='checked';
|
---|
| 125 | }else{
|
---|
| 126 | $righe='checked';
|
---|
| 127 | $colonne='';
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | if ($orienta) {
|
---|
| 131 | $land='';
|
---|
| 132 | $port='checked';
|
---|
| 133 | }else{
|
---|
| 134 | $land='checked';
|
---|
| 135 | $port='';
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | if ($formato) {
|
---|
| 139 | $A3='';
|
---|
| 140 | $A4='checked';
|
---|
| 141 | }else{
|
---|
| 142 | $A3='checked';
|
---|
| 143 | $A4='';
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 |
|
---|
| 148 | if ($genere>0) { //se non e' un referendum
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | $voticompl=0;
|
---|
| 152 | if (!($offset)) $offset=25;
|
---|
| 153 | if (!($min)) $min=1;
|
---|
| 154 | if (!($offsetsez)) $offsetsez=22;
|
---|
| 155 | if (!($minsez)) $minsez=1;
|
---|
| 156 | if ($min>$offset) {
|
---|
| 157 | $appo=$min;
|
---|
| 158 | $min=$offset;
|
---|
| 159 | $offset=$appo;
|
---|
| 160 | }
|
---|
| 161 | if ($minsez>$offsetsez) {
|
---|
| 162 | $appo=$minsez;
|
---|
| 163 | $minsez=$offsetsez;
|
---|
| 164 | $offsetsez=$appo;
|
---|
| 165 | }
|
---|
| 166 | if (!$csv){
|
---|
[265] | 167 | echo "<form id=\"voti\" method=\"post\" action=\"modules.php\">";
|
---|
| 168 | echo "<div><input type=\"hidden\" name=\"pag\" value=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&id_lista=\"></input>";
|
---|
| 169 | echo "<input type=\"hidden\" name=\"pagina\" value=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=\"></input>";
|
---|
[254] | 170 | }
|
---|
| 171 | $condcirc='';
|
---|
| 172 | if ($circo){ //gestione circoscrizionali
|
---|
| 173 | if(!$id_circ){
|
---|
[318] | 174 | $sql="SELECT id_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons and num_circ=1";
|
---|
| 175 | $res_cir = $dbi->prepare("$sql");
|
---|
| 176 | $res_cir->execute();
|
---|
[265] | 177 | //se non si e' scelta una circoscr. prende la prima
|
---|
| 178 | list($id_circ)=$res_cir->fetch(PDO::FETCH_NUM);
|
---|
[254] | 179 | }
|
---|
[318] | 180 | $sql="SELECT num_circ from ".$prefix."_ele_circoscrizione where id_circ=$id_circ";
|
---|
| 181 | $res_cir = $dbi->prepare("$sql");
|
---|
| 182 | $res_cir->execute();
|
---|
[265] | 183 | //estrae il numero della circoscrizione
|
---|
| 184 | list($num_circ)=$res_cir->fetch(PDO::FETCH_NUM);
|
---|
[254] | 185 | $condcirc="and id_circ=$id_circ"; //variabile aggiunta nelle select per le circ.
|
---|
[318] | 186 | $sql="SELECT count(t1.num_sez) from ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons=$id_cons and t1.id_sede=t2.id_sede and t2.id_circ=$id_circ";
|
---|
| 187 | $res_sez = $dbi->prepare("$sql");
|
---|
| 188 | $res_sez->execute();
|
---|
[265] | 189 | //numero di sezioni nella circoscrizione
|
---|
[318] | 190 | $sql="SELECT min(t1.num_sez) from ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons=$id_cons and t1.id_sede=t2.id_sede and t2.id_circ=$id_circ";
|
---|
| 191 | $res_min = $dbi->prepare("$sql");
|
---|
| 192 | $res_min->execute();
|
---|
[265] | 193 | //setta minsez sulla prima sezione della circoscrizione
|
---|
| 194 | list($minsez)=$res_min->fetch(PDO::FETCH_NUM);
|
---|
| 195 | }
|
---|
| 196 | elseif (strstr( $op,'circo')){
|
---|
[318] | 197 | $sql="SELECT count(num_circ),min(num_circ),max(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons";
|
---|
| 198 | $res_sez = $dbi->prepare("$sql");
|
---|
| 199 | $res_sez->execute();
|
---|
[265] | 200 | }
|
---|
| 201 | else{
|
---|
[318] | 202 | $sql="SELECT count(num_sez),min(num_sez),max(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons";
|
---|
| 203 | $res_sez = $dbi->prepare("$sql");
|
---|
| 204 | $res_sez->execute();
|
---|
[265] | 205 | }
|
---|
[318] | 206 | if($res_sez->rowCount()) list($tot_sez,$numsezmin,$numsezmax)=$res_sez->fetch(PDO::FETCH_NUM);
|
---|
| 207 | $sql="SELECT count(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons";
|
---|
| 208 | $res_sez = $dbi->prepare("$sql");
|
---|
| 209 | $res_sez->execute();
|
---|
[254] | 210 |
|
---|
[265] | 211 | list($tuttelesez)=$res_sez->fetch(PDO::FETCH_NUM);
|
---|
| 212 |
|
---|
[254] | 213 | $num_sez=$tot_sez;//mysql_data_seek($res_sez,0);
|
---|
| 214 | if ($circo) $offsetsez=$numsezmax; //$num_sez+$minsez-1;//setta offsetsez sull'ultima sezione della circoscrizione
|
---|
| 215 |
|
---|
[265] | 216 | $visvot='';
|
---|
[254] | 217 |
|
---|
[265] | 218 | if (!$csv) echo "<div><h5>$pagina</h5></div>";
|
---|
| 219 | if (!$csv) echo "<div style=\" text-align:left; margin-left:20px;\">";
|
---|
| 220 |
|
---|
| 221 | if(strstr( $op,'candidato')){
|
---|
[254] | 222 | // $numliste=mysql_num_rows($res_lis);
|
---|
[265] | 223 | $visvot="cand";
|
---|
| 224 | if (!$csv){
|
---|
[318] | 225 | $sql="SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $condcirc order by num_lista";
|
---|
| 226 | $res_lis = $dbi->prepare("$sql");
|
---|
| 227 | $res_lis->execute();
|
---|
[254] | 228 |
|
---|
[265] | 229 | //elenco delle liste per la scelta
|
---|
| 230 | echo "<p>"._SCEGLI_LISTA.":
|
---|
| 231 | <select name=\"id_lista\" class=\"modulo\" onChange=\"top.location.href=this.form.pag.value+this.form.id_lista.options[this.form.id_lista.selectedIndex].value;return false\">";
|
---|
| 232 | while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {
|
---|
| 233 | if (!$id_lista) $id_lista=$id_rif;
|
---|
| 234 | $sel = ($id_rif == $id_lista) ? "selected=\"selected\"" : "";
|
---|
| 235 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 236 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 237 | echo $num_lis.") ".$descrizione."</option>";
|
---|
[254] | 238 | }
|
---|
[265] | 239 | echo "</select></p>";
|
---|
| 240 | }
|
---|
[318] | 241 | $sql="SELECT count(t1.id_sez) from ".$prefix."_ele_voti_$tab as t1, ".$prefix."_ele_$tab as t2 where t2.id_lista=$id_lista and t1.id_cand=t2.id_cand group by t1.id_cand";
|
---|
| 242 | $res_scr = $dbi->prepare("$sql");
|
---|
| 243 | $res_scr->execute();
|
---|
[254] | 244 |
|
---|
[318] | 245 | $sqlc="SELECT id_cand, concat(cognome,' ', nome), num_cand from ".$prefix."_ele_$tab where id_cons=$id_cons and id_lista=$id_lista order by num_cand";
|
---|
| 246 | $res_cand = $dbi->prepare("$sqlc");
|
---|
| 247 | $res_cand->execute();
|
---|
[254] | 248 |
|
---|
[265] | 249 | if ($circo) $condcirc="and t5.id_circ=$id_circ";
|
---|
| 250 |
|
---|
[318] | 251 | $sqlvoti="select $tab2, t1.num_cand, concat(t1.cognome,' ', t1.nome) as nome, sum(t2.voti),'','','','',''
|
---|
[265] | 252 | from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2, "
|
---|
| 253 | .$prefix."_ele_sezioni as t3, ".$prefix."_ele_sede as t4, ".$prefix."_ele_circoscrizione as t5
|
---|
| 254 | where t1.id_lista=$id_lista
|
---|
| 255 | and t1.id_cons=$id_cons
|
---|
| 256 | and t1.id_cand=t2.id_cand
|
---|
| 257 | and t2.id_sez=t3.id_sez
|
---|
| 258 | and t3.id_sede=t4.id_sede
|
---|
| 259 | and t4.id_circ=t5.id_circ $condcirc
|
---|
[320] | 260 | group by t1.num_cand,$tab2, t1.cognome,t1.nome
|
---|
[318] | 261 | order by $tab3,t1.num_cand";
|
---|
| 262 | $res_voti = $dbi->prepare("$sqlvoti");
|
---|
| 263 | $res_voti->execute();
|
---|
[254] | 264 | }else{
|
---|
| 265 | if (!$csv)
|
---|
| 266 | echo "<input type=\"hidden\" name=\"id_lista\" value=\"\"></input>";
|
---|
| 267 |
|
---|
[265] | 268 | // camera e senato nel 2006 aggiunte le somme della coalizione
|
---|
| 269 | // divise per circo e sez. in quanto nella tabella del gruppo
|
---|
| 270 | // all'atto dell'immsione non viene fatta la somma
|
---|
| 271 | // quindi leggere prima i voti di lista e poi agganciali al gruppo
|
---|
| 272 | // la var $tab diviene lista, $tab15 diviene gruppo in caso di somma
|
---|
| 273 | // dei voti di lista...oltre naturalmnte alle condizioni messe in variabile
|
---|
| 274 | // 4 aprile 2006 by luc
|
---|
| 275 | if ($votog && $tab=="gruppo"){ // camera e senato 2006
|
---|
| 276 | $t="t9";
|
---|
| 277 | $tab="lista";
|
---|
| 278 | $tab15="gruppo";
|
---|
| 279 | $add_1= ",".$prefix."_ele_gruppo as t9";
|
---|
| 280 | $and_1="and t1.id_gruppo=t9.id_gruppo";
|
---|
| 281 | }else{
|
---|
| 282 | $t="t1";
|
---|
| 283 | $tab15=$tab;
|
---|
| 284 | $add_1='';
|
---|
| 285 | $and_1='';
|
---|
| 286 | }
|
---|
| 287 | // fine della modifica
|
---|
| 288 |
|
---|
[318] | 289 | $sql="SELECT count(id_sez) from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons' group by id_$tab15";
|
---|
| 290 | $res_scr = $dbi->prepare("$sql");
|
---|
| 291 | $res_scr->execute();
|
---|
[265] | 292 | //numero sezioni scrutinate
|
---|
[318] | 293 | $sqlc="SELECT id_$tab15, descrizione, num_$tab15 from ".$prefix."_ele_$tab15 where id_cons='$id_cons' $condcirc order by num_$tab15";
|
---|
| 294 | $res_cand = $dbi->prepare("$sqlc");
|
---|
| 295 | $res_cand->execute();
|
---|
[254] | 296 |
|
---|
[265] | 297 | if ($circo) $condcirc="and t5.id_circ=$id_circ";
|
---|
[318] | 298 | if ($tab=="gruppo" or $genere==4)
|
---|
[265] | 299 | $votigl=" sum(t3.validi),sum(t3.nulli),sum(t3.bianchi),sum(t3.contestati),sum(t3.voti_nulli)";
|
---|
| 300 | else
|
---|
| 301 | if ($votog) $votigl=" (t3.validi_lista),(t3.nulli),(t3.bianchi),(t3.contestati),(t3.voti_nulli)";
|
---|
| 302 | else $votigl=" sum(t3.validi_lista),sum(t3.nulli),sum(t3.bianchi),sum(t3.contestati_lista),sum(t3.voti_nulli_lista+t3.voti_nulli)";
|
---|
| 303 | $sqlvoti="select $tab2, $t.num_$tab15, $t.descrizione, sum(t2.voti), $votigl
|
---|
| 304 | from
|
---|
| 305 | ".$prefix."_ele_$tab as t1,
|
---|
| 306 | ".$prefix."_ele_voti_$tab as t2,
|
---|
| 307 | ".$prefix."_ele_sezioni as t3,
|
---|
| 308 | ".$prefix."_ele_sede as t4,
|
---|
| 309 | ".$prefix."_ele_circoscrizione as t5
|
---|
| 310 | $add_1
|
---|
| 311 |
|
---|
| 312 | where t1.id_cons=$id_cons
|
---|
| 313 | and t1.id_$tab=t2.id_$tab
|
---|
| 314 | $and_1
|
---|
| 315 |
|
---|
| 316 | and t2.id_sez=t3.id_sez
|
---|
| 317 | and t3.id_sede=t4.id_sede
|
---|
| 318 | and t4.id_circ=t5.id_circ $condcirc
|
---|
| 319 |
|
---|
| 320 |
|
---|
[318] | 321 | group by $t.num_$tab15,$tab3,$tab2, $t.descrizione
|
---|
| 322 | order by $tab3,$t.num_$tab15";
|
---|
| 323 | $res_voti = $dbi->prepare("$sqlvoti");
|
---|
| 324 | $res_voti->execute();
|
---|
[265] | 325 | }
|
---|
| 326 | if ($res_scr) list($tot_scr)=$res_scr->fetch(PDO::FETCH_NUM);else $tot_scr=0;
|
---|
| 327 | if ($res_cand) $num_cand=$res_cand->rowCount(); else $num_cand=0;
|
---|
| 328 | if(!$circo){
|
---|
| 329 | if (!(0 < $minsez and $minsez<=$numsezmax)) $minsez=1;
|
---|
| 330 | if (!(0<$offsetsez and $offsetsez<=$numsezmax)) $offsetsez=$numsezmax;
|
---|
| 331 | }
|
---|
| 332 | if (!(0 < $min and $min<=$num_cand)) $min=1;
|
---|
| 333 | if (!(0<$offset and $offset<=$num_cand)) $offset=$num_cand;
|
---|
| 334 | if (!$csv) {
|
---|
| 335 | if(strstr( $op,'lista')){$scelta=_SCEGLI_LISTA;}else{$scelta=_SCEGLI_CANDI;}
|
---|
| 336 | echo "<p>$scelta "._DA.": <select name=\"min\" class=\"modulo\">";
|
---|
| 337 | while(list($id_rif,$descrizione,$num_lis) = $res_cand->fetch(PDO::FETCH_NUM)) {
|
---|
| 338 | if (!$min) $min=$num_lis;
|
---|
| 339 | $sel = ($num_lis == $min) ? "selected=\"selected\"" : "";
|
---|
| 340 | echo "<option value=\"$num_lis\" $sel>";
|
---|
| 341 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 342 | echo $num_lis.") ".$descrizione."</option>";
|
---|
| 343 | }
|
---|
| 344 | echo "</select>";
|
---|
| 345 | echo " "._A.": <select name=\"offset\" class=\"modulo\">";
|
---|
| 346 | $res_cand = $dbi->prepare("$sqlc");
|
---|
| 347 | $res_cand->execute();
|
---|
[254] | 348 |
|
---|
[265] | 349 | while(list($id_rif,$descrizione,$num_lis) = $res_cand->fetch(PDO::FETCH_NUM)) {
|
---|
| 350 | if (!$offset) $offset=$num_lis;
|
---|
| 351 | $sel = ($num_lis == $offset) ? "selected=\"selected\"" : "";
|
---|
| 352 | echo "<option value=\"$num_lis\" $sel>";
|
---|
| 353 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 354 | echo $num_lis.") ".$descrizione."</option>";
|
---|
[254] | 355 |
|
---|
| 356 | }
|
---|
[265] | 357 | echo "</select></p>";
|
---|
| 358 | //echo "<div style=\"text-align:left; margin-left:20px;\">";
|
---|
| 359 | if(!$circo){
|
---|
[254] | 360 | echo "<p>"._SCEGLI." $tipo1 n. <input name=\"minsez\" value=\"$minsez\" size=\"4\" ></input>";
|
---|
| 361 | echo _A." n. <input name=\"offsetsez\" value=\"$offsetsez\" size=\"4\" ></input> (max. $numsezmax)";
|
---|
[265] | 362 | }
|
---|
| 363 | # pagine
|
---|
[254] | 364 | ############
|
---|
[265] | 365 | if (strstr( $op,'circo'))
|
---|
[318] | 366 | $sql="SELECT count(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons and num_circ>=$minsez and num_circ<=$offsetsez";
|
---|
[265] | 367 |
|
---|
[318] | 368 |
|
---|
[265] | 369 | else
|
---|
[318] | 370 | $sql="SELECT count(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons and num_sez>=$minsez and num_sez<=$offsetsez";
|
---|
| 371 |
|
---|
[265] | 372 | $resnsez = $dbi->prepare("$sql");
|
---|
| 373 | $resnsez->execute();
|
---|
| 374 | list($diff)=$resnsez->fetch(PDO::FETCH_NUM);
|
---|
| 375 | ########
|
---|
[254] | 376 | # $diff=($offsetsez-$minsez);
|
---|
| 377 | if ($minsez>1){
|
---|
[265] | 378 | $minsez_p= ($minsez-$diff)>1 ? $minsez-$diff:1;
|
---|
| 379 | $offsetsez_p=$offsetsez-$diff;
|
---|
| 380 | echo "<div style=\"float: right; width:200px;margin-left:10px;margin-right:400px;font-size:12px \"><a href=\"modules.php?name=Elezioni&file=index&id_cons_gen=$id_cons_gen&id_comune=$id_comune&op=$op&min=$min&offset=$offset&minsez=$minsez_p&offsetsez=$offsetsez_p&perc=$perc&id_lista=$id_lista\"> <- $tipo2 Precedenti</a></div>";
|
---|
| 381 | }else{echo "";}
|
---|
| 382 | if ($offsetsez<$numsezmax){
|
---|
| 383 | $minsez_s=$minsez+$diff;
|
---|
| 384 | $offsetsez_s= ($offsetsez+$diff)>$num_sez ? $num_sez: $offsetsez+$diff;
|
---|
| 385 | echo "<div style=\"float: left; width:200px; margin-left:10px;\"><a href=\"modules.php?name=Elezioni&file=index&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&orvert=$orvert&min=$min&offset=$offset&minsez=$minsez_s&offsetsez=$offsetsez_s&perc=$perc&id_lista=$id_lista\"> $tipo2 Successive -></a></div>";
|
---|
| 386 | }else{echo "";}
|
---|
| 387 | if(!$circo)
|
---|
[254] | 388 | echo "<div style=\"margin-left:10px;\"><br/>"._MOSTRA." $tipo2 "._PERCOL."<input type=\"radio\" name=\"orvert\" $righe value=\"0\"></input>"._PERRIGHE." <input
|
---|
| 389 | type=\"radio\" name=\"orvert\" $colonne value=\"1\"></input>";
|
---|
[265] | 390 | echo "<input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input></div>";
|
---|
| 391 | echo "<p>";
|
---|
| 392 | if (!strstr( $op,'candidato')) {
|
---|
| 393 | echo ""._VIS_PERC.": <input type=\"checkbox\" name=\"perc\" value=\"true\"";
|
---|
| 394 | if($perc=='true') echo " checked=\"true\"";
|
---|
| 395 | echo "></input><br/>";
|
---|
| 396 | }
|
---|
| 397 | echo "";
|
---|
[254] | 398 | if($circo)
|
---|
| 399 | echo "<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"></input>";
|
---|
| 400 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 401 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 402 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 403 |
|
---|
| 404 | echo "<input type=\"hidden\" name=\"pag2\" value=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&orvert=$orvert&min=$min&offset=$offset&minsez=$minsez&offsetsez=$offsetsez&perc=$perc&id_lista=\"></input>";
|
---|
| 405 |
|
---|
| 406 | echo " <input type=\"submit\" name=\"update\" value=\""._RICARICA."\"></input></p></div></form>";
|
---|
| 407 |
|
---|
| 408 |
|
---|
| 409 | #### recupera dati stampa supporti diversi dati
|
---|
| 410 | //echo "</tr><tr><td><b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons <br/>";
|
---|
| 411 | //echo "tot:$tot_scr";
|
---|
| 412 | //if ($tipo_cons!=4 && $tot_scr) echo " - Sezioni scrutinate: $tot_scr su $tuttelez";
|
---|
| 413 |
|
---|
| 414 | # liste e gruppi da.... a
|
---|
| 415 | if (!strstr( $op,'candidato')) {
|
---|
[318] | 416 | $sql="SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$min'";
|
---|
| 417 | $res_cand2 = $dbi->prepare("$sql");
|
---|
| 418 | $res_cand2->execute();
|
---|
[265] | 419 |
|
---|
| 420 | list($descrizione)= $res_cand2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 421 | $list1 ="da $descrizione ";
|
---|
| 422 |
|
---|
| 423 |
|
---|
| 424 |
|
---|
[318] | 425 | $sql="SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$offset'";
|
---|
| 426 | $res_cand3 = $dbi->prepare("$sql");
|
---|
| 427 | $res_cand3->execute();
|
---|
[265] | 428 |
|
---|
| 429 | list($descrizione)= $res_cand3->fetch(PDO::FETCH_NUM);
|
---|
[254] | 430 | $list1 .=" a $descrizione <br/>";
|
---|
| 431 |
|
---|
| 432 | }else{$list1='';}
|
---|
| 433 |
|
---|
| 434 | # nome della lista
|
---|
| 435 | if (!isset($list2)) $list2='';
|
---|
| 436 | if (strstr( $op,'candidato')) {
|
---|
[318] | 437 | $sql="SELECT num_lista, descrizione from ".$prefix."_ele_lista where id_lista=$id_lista";
|
---|
| 438 | $res_lis2 = $dbi->prepare("$sql");
|
---|
| 439 | $res_lis2->execute();
|
---|
[265] | 440 |
|
---|
| 441 | list($num_lista2,$descr_lista2)= $res_lis2->fetch(PDO::FETCH_NUM);
|
---|
[254] | 442 | $nomefile=" Lista n. $num_lista2 - $descr_lista2 ";
|
---|
| 443 | $list2 .=" Lista n. $num_lista2 - $descr_lista2 <br/>";
|
---|
| 444 |
|
---|
[318] | 445 | $sql="SELECT concat(cognome,' ', nome) from ".$prefix."_ele_$tab where id_cons=$id_cons and id_lista=$id_lista and num_cand=$min";
|
---|
| 446 | $res_cand4 = $dbi->prepare("$sql");
|
---|
| 447 | $res_cand4->execute();
|
---|
[265] | 448 |
|
---|
| 449 | list($descrizione)= $res_cand4->fetch(PDO::FETCH_NUM);
|
---|
[254] | 450 | $list3 ="da $descrizione ";
|
---|
[318] | 451 | $sql="SELECT concat(cognome,' ', nome) from ".$prefix."_ele_$tab where id_cons=$id_cons and id_lista=$id_lista and num_cand=$offset";
|
---|
| 452 | $res_cand5 = $dbi->prepare("$sql");
|
---|
| 453 | $res_cand5->execute();
|
---|
[265] | 454 |
|
---|
| 455 | list($descrizione)= $res_cand5->fetch(PDO::FETCH_NUM);
|
---|
[254] | 456 | $list3 .="a $descrizione <br/>";
|
---|
| 457 |
|
---|
| 458 | }else{ $list2 .='';$list3='';}
|
---|
| 459 | if(!isset($tab15)) $tab15='';
|
---|
| 460 | $nomefile.="$descr_cons $tab15";
|
---|
| 461 | $_SESSION['nomefile']=strip_tags(str_replace(" ", "_", $nomefile));
|
---|
[265] | 462 | $datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> $list1 $list2 $list3 ";
|
---|
| 463 | # verificare la stampa sulle circoscrizioni
|
---|
| 464 | echo "<div style=\"text-align:right;width:900px;margin-left:10px;margin-right:0px;font-size:12px; \">";
|
---|
| 465 | echo "<table style=\"text-align:center;margin-right:0px;border-top : 1px solid Blue;width: 140px;\"><tr style=\" background:#eceff5;\"><td>"._ESPORTA."<br />";
|
---|
| 466 | if($circo){ echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&orvert=$orvert&min=$min&offset=$offset&minsez=$minsez&offsetsez=$offsetsez&perc=$perc&id_lista=$id_lista&id_circ=$id_circ&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/printer.gif\" alt=\"Stampa\" /></a>";
|
---|
[254] | 467 | }else{
|
---|
[265] | 468 | echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&orvert=$orvert&min=$min&offset=$offset&minsez=$minsez&offsetsez=$offsetsez&perc=$perc&id_lista=$id_lista&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/printer.gif\" alt=\"Stampa\" /></a>";
|
---|
| 469 | echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&orvert=$orvert&min=$min&offset=$offset&minsez=$minsez&offsetsez=$offsetsez&perc=$perc&id_lista=$id_lista&xls=1&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"Export Csv\" /></a>";
|
---|
| 470 | echo "<img class=\"image\" src=\"modules/Elezioni/images/rss.png\" alt=\"Export rss\" />";
|
---|
| 471 | echo " </td></tr> ";
|
---|
| 472 | # stampa pdf
|
---|
| 473 | echo "<form id=\"pdf\" method=\"post\" action=\"modules.php\">";
|
---|
| 474 | echo "<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"></input>";
|
---|
| 475 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 476 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 477 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 478 | echo "<input type=\"hidden\" name=\"csv\" value=\"1\"></input>";
|
---|
| 479 | echo "<input type=\"hidden\" name=\"orvert\" value=\"$orvert\"></input>";
|
---|
| 480 | echo "<input type=\"hidden\" name=\"min\" value=\"$min\"></input>";
|
---|
[254] | 481 | echo "<input type=\"hidden\" name=\"offset\" value=\"$offset\"></input>";
|
---|
[265] | 482 | echo "<input type=\"hidden\" name=\"minsez\" value=\"$minsez\"></input>";
|
---|
| 483 | echo "<input type=\"hidden\" name=\"offsetsez\" value=\"$offsetsez\"></input>";
|
---|
| 484 | echo "<input type=\"hidden\" name=\"perc\" value=\"$perc\"></input>";
|
---|
| 485 | echo "<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\"></input>";
|
---|
| 486 | echo "<input type=\"hidden\" name=\"pdf\" value=\"1\"></input>";
|
---|
| 487 | echo "<input type=\"hidden\" name=\"datipdf\" value=\"$datipdf\"></input>";
|
---|
| 488 | # echo "<input type=\"hidden\" name=\"name\" value=\"$elezioni\"></input>";
|
---|
| 489 | echo "<input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>";
|
---|
| 490 | echo "<tr><td>";
|
---|
| 491 | echo "<input type=\"image\" name=\"submit\" src=\"modules/Elezioni/images/pdf.gif\" align=\"left\">";
|
---|
| 492 | echo " L <input type=\"radio\" name=\"orienta\" $land value=\"L\"></input>P <input
|
---|
| 493 | type=\"radio\" name=\"orienta\" $port value=\"P\"></input><br />";
|
---|
| 494 | echo " A3<input type=\"radio\" name=\"formato\" $A3 value=\"A3\"></input>A4<input
|
---|
| 495 | type=\"radio\" name=\"formato\" $A4 value=\"A4\"></input>";
|
---|
| 496 | echo " </td></tr></table></form> ";
|
---|
[254] | 497 | }
|
---|
| 498 | echo "</div></br />";
|
---|
[265] | 499 | }
|
---|
[254] | 500 | if (!$csv){
|
---|
| 501 | echo "<h5> Sezioni scrutinate";
|
---|
| 502 | if ($tipo_cons!=4) echo ": $tot_scr su $tuttelesez ";
|
---|
| 503 | echo "</h5> ";
|
---|
| 504 | }
|
---|
| 505 | $y=1;
|
---|
| 506 | $ar[0][0]=$tipo3;
|
---|
| 507 | $ra[0][0]=$tipo3;
|
---|
| 508 | $num_sez++;
|
---|
| 509 | $voticompl=0;
|
---|
| 510 | $ominsez=$minsez-1;
|
---|
| 511 | $valar=array();$percar=array();
|
---|
| 512 | ////////////////////////////////////////////////////////////////////
|
---|
| 513 | // sandro: carica i numeri di sezione dal DB - giugno 2009
|
---|
| 514 | // caso: sezioni in collegi diversi non consecutive
|
---|
| 515 | if (strstr( $op,'circo'))
|
---|
[318] | 516 | $sql="select num_circ,id_circ from ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and num_circ>='$minsez' and num_circ<='$offsetsez' order by num_circ";
|
---|
[254] | 517 | else{
|
---|
| 518 | if($circo) { $secirco=" and t2.id_circ=$id_circ";} else $secirco="and t1.num_sez >= $minsez and t1.num_sez <= $offsetsez";
|
---|
| 519 | $numsezioni = $offsetsez-$ominsez;
|
---|
[318] | 520 | $sql="SELECT t1.num_sez,t1.id_sez from ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons=$id_cons and t1.id_sede=t2.id_sede $secirco order by t1.num_sez";
|
---|
[254] | 521 | }
|
---|
[265] | 522 | $res_numsez = $dbi->prepare("$sql");
|
---|
| 523 | $res_numsez->execute();# for ($z=1;$z<=($offsetsez-$ominsez);$z++) {
|
---|
| 524 | while($res=$res_numsez->fetch(PDO::FETCH_NUM)) {
|
---|
[318] | 525 | $sevaltot=0;
|
---|
| 526 | $senultot=0;
|
---|
| 527 | $sebiatot=0;
|
---|
| 528 | $secontot=0;
|
---|
| 529 | $sevnutot=0;
|
---|
[265] | 530 | $z=$res[0];
|
---|
[254] | 531 | ##############inserimento percentuale di scrutinio nella sezione
|
---|
[265] | 532 | $scruvalidi=0;
|
---|
| 533 | $scrunulli=0;
|
---|
| 534 | $grpercscru=0;
|
---|
| 535 | $altri=0;
|
---|
| 536 | $votiscru=0;
|
---|
| 537 | if($op=="gruppo_sezione"){
|
---|
| 538 | $sqlr="select sum(validi),sum(solo_lista) from ".$prefix."_ele_sezioni where id_sez='".$res[1]."'";
|
---|
| 539 | $sqlv="select sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='".$res[1]."'";
|
---|
| 540 | $resperc = $dbi->prepare("$sqlr");
|
---|
| 541 | $resperc->execute();
|
---|
| 542 | $votiperc = $dbi->prepare("$sqlv");
|
---|
| 543 | $votiperc->execute();
|
---|
| 544 | }
|
---|
| 545 | elseif($op=="lista_sezione"){
|
---|
[318] | 546 | $sqlr="select sum(validi),sum(contestati_lista+solo_gruppo+voti_nulli_lista) from ".$prefix."_ele_sezioni where id_sez='".$res[1]."'";
|
---|
| 547 | $sqlv="select sum(voti) from ".$prefix."_ele_voti_lista where id_sez='".$res[1]."'";
|
---|
[265] | 548 | $resperc = $dbi->prepare("$sqlr");
|
---|
| 549 | $resperc->execute();
|
---|
| 550 | $votiperc = $dbi->prepare("$sqlv");
|
---|
| 551 | $votiperc->execute();
|
---|
| 552 | }
|
---|
| 553 | if (isset($resperc) and $resperc)
|
---|
| 554 | list($scruvalidi,$scrunulli)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
| 555 | if (isset($votiperc) and $votiperc)
|
---|
| 556 | list($votiscru)=$votiperc->fetch(PDO::FETCH_NUM);
|
---|
[318] | 557 | $sql="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_sez='".$res[1]."' group by data,orario order by data desc, orario desc limit 0,1 ";
|
---|
| 558 | $resperc = $dbi->prepare("$sql");
|
---|
| 559 | $resperc->execute();
|
---|
[254] | 560 |
|
---|
[265] | 561 | if ($resperc)
|
---|
| 562 | list($totschede)=$resperc->fetch(PDO::FETCH_NUM);
|
---|
| 563 | if (isset($scruvalidi) and $scruvalidi>0 )
|
---|
| 564 | $grpercscru=$votiscru ? number_format(($votiscru+$scrunulli)*100/$scruvalidi,0) : 0;
|
---|
| 565 |
|
---|
[254] | 566 | ################### <span class=\"red\"><i>".$temp3[$key]." %</i></span>
|
---|
[265] | 567 | $ar[$z][0]=$res[0]; if($grpercscru) {$ar[$z][0].="<br /><span class=\"red\"><i>$grpercscru%</i></span>";if(!strstr($ar[0][0],'scrutinio')) $ar[0][0].="<br /><span class=\"red\"><i>% scrutinio</i></span>"; }
|
---|
| 568 | $pos[$z]=$res[0];
|
---|
| 569 | #$valar[$z]=array();
|
---|
| 570 | }
|
---|
[254] | 571 | if (!isset($pos)) $pos[0]=0;
|
---|
| 572 | $minpos=min($pos);
|
---|
| 573 | $maxpos=max($pos);
|
---|
| 574 | ////////////////////////////////////////////////////////////////////
|
---|
[318] | 575 |
|
---|
[265] | 576 | if ($res_voti->rowCount())
|
---|
| 577 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = $res_voti->fetch(PDO::FETCH_NUM)){
|
---|
[318] | 578 | # if($genere==4) $sevalidi=$voti;
|
---|
[265] | 579 | $z=array_search($num_circ, $pos);
|
---|
[254] | 580 | if (!isset($votitot[($z)])) {
|
---|
[265] | 581 | $votitot[($z)]=0;
|
---|
| 582 | if($sevalidi) $sevaltot+=$sevalidi;
|
---|
| 583 | if($senulli) $senultot+=$senulli;
|
---|
| 584 | if($sebianchi) $sebiatot+=$sebianchi;
|
---|
| 585 | if($secontestati) $secontot+=$secontestati;
|
---|
| 586 | if($sevonulli) $sevnutot+=$sevonulli;
|
---|
[254] | 587 | }
|
---|
| 588 | $votitot[($z)]+=$voti;
|
---|
[318] | 589 | if(!isset($valsez[$z])) $valsez[$z]=0;
|
---|
| 590 | $valsez[$z]=$sevalidi;
|
---|
[254] | 591 | $voticompl+=$voti;
|
---|
| 592 | }
|
---|
[265] | 593 | if ($voticompl) {
|
---|
| 594 | $res_voti = $dbi->prepare("$sqlvoti");
|
---|
| 595 | $res_voti->execute();
|
---|
| 596 | }
|
---|
[254] | 597 | $piuvot=0;
|
---|
| 598 | if ($visvot!='cand') $piuvot=5;
|
---|
[265] | 599 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]=" ";
|
---|
| 600 | if (strstr( $op,'circo'))
|
---|
[318] | 601 | $sql="select num_circ from ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and num_circ>='$minsez' and num_circ<='$offsetsez' order by num_circ";
|
---|
[265] | 602 | else
|
---|
[318] | 603 | $sql="select num_sez from ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez>='$minsez' and num_sez<='$offsetsez' order by num_sez";
|
---|
[265] | 604 | $lis_sez = $dbi->prepare("$sql");
|
---|
| 605 | $lis_sez->execute();
|
---|
| 606 | $nsezsel=$lis_sez->rowCount();
|
---|
| 607 | while(list($z)=$lis_sez->fetch(PDO::FETCH_NUM))
|
---|
| 608 | {
|
---|
| 609 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]=" ";} //inizializza le celle interne
|
---|
[254] | 610 |
|
---|
| 611 | ###################################################################
|
---|
| 612 | # for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]=" ";
|
---|
| 613 | # for ($z=1;$z<=($offsetsez-$ominsez);$z++)
|
---|
| 614 | # for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]=" "; //inizializza le celle interne
|
---|
[265] | 615 | $onetime="";
|
---|
| 616 | if ($res_voti)
|
---|
| 617 | {
|
---|
| 618 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = $res_voti->fetch(PDO::FETCH_NUM)){
|
---|
[254] | 619 | $z=array_search($num_circ, $pos);
|
---|
[265] | 620 | $valar[($z)][$num_cand]=$voti;
|
---|
[254] | 621 | }
|
---|
[318] | 622 |
|
---|
[254] | 623 | foreach ($valar as $key=>$val){
|
---|
| 624 | if(isset($votitot[($key)]))
|
---|
| 625 | $percar[$key]=arrayperc($val,$votitot[($key)]);
|
---|
[318] | 626 |
|
---|
| 627 | }
|
---|
| 628 | # if($res_voti->rowCount()) {
|
---|
| 629 | $res_voti = $dbi->prepare("$sqlvoti");
|
---|
| 630 | $res_voti->execute();
|
---|
| 631 | #}
|
---|
| 632 |
|
---|
[265] | 633 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = $res_voti->fetch(PDO::FETCH_NUM)){
|
---|
| 634 | if($num_cand<$min or $num_cand>$offset) continue;
|
---|
[318] | 635 | if($genere==4) $sevalidi=$voti;
|
---|
| 636 |
|
---|
[265] | 637 | if (!isset($temp[$num_cand])) $temp[$num_cand]=0;
|
---|
| 638 | $temp[$num_cand]+=$voti;
|
---|
| 639 | $z=array_search($num_circ, $pos);
|
---|
| 640 | if (!$z) continue;
|
---|
| 641 | if ($num_cand>=$min and $num_cand<=$offset){
|
---|
| 642 | if($num_circ>=$minpos and $num_circ <=$maxpos){
|
---|
| 643 | $ar[0][$num_cand]=$num_cand.") ".$nome;
|
---|
| 644 | if ($desc_circ && $onetime!=$desc_circ) {$ar[($z)][0].=") ".$desc_circ; $onetime=$desc_circ;}
|
---|
| 645 | $percento=$voti;
|
---|
| 646 | if ($perc=='true' and $votitot[($z)])
|
---|
| 647 | {
|
---|
| 648 | $percento=$voti."<br /><span class=\"red\" style=\"font-size:80%;\"><i>".number_format($percar[$z][$num_cand],2)." %</i></span>";
|
---|
| 649 | }
|
---|
[318] | 650 |
|
---|
[265] | 651 | $ar[($z)][$num_cand]=$percento;
|
---|
| 652 | }
|
---|
[254] | 653 | }
|
---|
[265] | 654 | if (!strstr( $op,'candidato')){
|
---|
| 655 | if (!isset($tempar[$num_cand])) $tempar[$num_cand]=0;
|
---|
| 656 | $tempar[$num_cand]+=$voti;
|
---|
| 657 | }
|
---|
| 658 | if ($visvot!='cand'){
|
---|
| 659 | $posvoti=($offset);
|
---|
| 660 | $ar[0][$posvoti+1]='<b>Voti Validi</b>';
|
---|
| 661 | $ar[0][$posvoti+2]='<b>Schede Nulle</b>';
|
---|
| 662 | $ar[0][$posvoti+3]='<b>Schede Bianche</b>';
|
---|
| 663 | $ar[0][$posvoti+4]='<b>Voti Contestati</b>';
|
---|
| 664 | $ar[0][$posvoti+5]='<b>Voti Nulli</b>';
|
---|
| 665 | if (($maxpos)>=$num_circ and $minpos<=$num_circ){
|
---|
| 666 | //$posvoti++;
|
---|
[318] | 667 | $ar[($z)][$posvoti+1]="<b>$valsez[$z]</b>";
|
---|
[265] | 668 | $ar[($z)][$posvoti+2]="<b>$senulli</b>";
|
---|
| 669 | $ar[($z)][$posvoti+3]="<b>$sebianchi</b>";
|
---|
| 670 | $ar[($z)][$posvoti+4]="<b>$secontestati</b>";
|
---|
| 671 | $ar[($z)][$posvoti+5]="<b>$sevonulli</b>";
|
---|
| 672 | }
|
---|
| 673 | }
|
---|
[254] | 674 | }
|
---|
| 675 | }
|
---|
| 676 |
|
---|
[265] | 677 | if (($offsetsez+1)>=$num_sez){
|
---|
| 678 | $ar[(1+$numsezmax)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>";
|
---|
| 679 | if(isset($temp)) {
|
---|
| 680 | if (!isset($tab15) or !$tab15) $tab15="candidati";
|
---|
[318] | 681 | if($tab15=="gruppo" or $genere==4){
|
---|
[254] | 682 | $votigl=" sum(validi),sum(nulli),sum(bianchi),sum(contestati),sum(voti_nulli)";
|
---|
[265] | 683 | }elseif($votog){
|
---|
[318] | 684 | $votigl=" sum(validi),sum(nulli),sum(bianchi),sum(contestati),sum(voti_nulli)";
|
---|
[265] | 685 | }else{
|
---|
[319] | 686 | if($dettnulli) $votigl=" sum(validi_lista),sum(nulli),sum(bianchi),sum(contestati_lista),sum(voti_nulli_lista+voti_nulli)";
|
---|
[265] | 687 | else $votigl=" sum(validi_lista),sum(nulli),sum(bianchi),sum(contestati_lista),sum(voti_nulli)";
|
---|
| 688 | }
|
---|
[254] | 689 | if($circo)
|
---|
[318] | 690 | $sql="SELECT $votigl from ".$prefix."_ele_sezioni AS t1 LEFT JOIN soraldo_ele_sede AS t2 ON t1.id_sede = t2.id_sede WHERE t1.id_cons='$id_cons' and t2.id_circ=$id_circ";
|
---|
[254] | 691 | else
|
---|
[318] | 692 | $sql="SELECT $votigl from ".$prefix."_ele_sezioni as t1 where t1.id_cons='$id_cons' and t1.id_sez=(select t2.id_sez from ".$prefix."_ele_voti_$tab15 as t2 where t2.id_sez=t1.id_sez group by t2.id_sez)";
|
---|
[265] | 693 | $resv = $dbi->prepare("$sql");
|
---|
[318] | 694 | $resv->execute();
|
---|
[265] | 695 | list ($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot)= $resv->fetch(PDO::FETCH_NUM);
|
---|
[254] | 696 | $voticompl=$sevaltot+$senultot+$sebiatot+$secontot+$sevnutot;
|
---|
[318] | 697 | $sql="SELECT voti from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons'";
|
---|
| 698 | $resvt = $dbi->prepare("$sql");
|
---|
[265] | 699 | $resvt->execute();
|
---|
| 700 | if($resvt) list($votlt)=$resvt->fetch(PDO::FETCH_NUM); else $votlt=0;
|
---|
[254] | 701 | if($perc) $temp3=arrayperc($temp,$sevaltot);
|
---|
| 702 | while (list($key,$voti)= each($temp)) {
|
---|
| 703 | if ($perc=='true' and $voticompl)
|
---|
| 704 | {
|
---|
| 705 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$key]." %</i></span></b>";
|
---|
| 706 | } else
|
---|
| 707 | $percento="<b>$voti</b>";
|
---|
| 708 | $ar[1+$numsezmax][$key]=$percento;
|
---|
| 709 | }
|
---|
| 710 | }
|
---|
| 711 | if ($visvot!='cand') {
|
---|
| 712 | $key=$offset+1;
|
---|
| 713 | $tmp=array($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot);
|
---|
| 714 | if($perc) $temp3=arrayperc($tmp,$voticompl);
|
---|
| 715 | while(list($k,$voti)= each($tmp)) {
|
---|
| 716 |
|
---|
| 717 | if ($perc=='true' and $voticompl)
|
---|
| 718 | {
|
---|
| 719 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$k]." %</i></span></b>";
|
---|
| 720 | } else $percento="<b>$voti</b>";
|
---|
| 721 | $ar[1+$numsezmax][++$key]=$percento;
|
---|
| 722 |
|
---|
| 723 | }
|
---|
| 724 | }
|
---|
| 725 | }
|
---|
| 726 | if($orvert!=1) {
|
---|
| 727 | $i=0;
|
---|
| 728 | foreach ( $ar as $riga) {
|
---|
| 729 | $y=0;
|
---|
| 730 | foreach($riga as $cella) {
|
---|
| 731 | $ra[$y++][$i]=$cella;
|
---|
| 732 | }
|
---|
| 733 | $i++;
|
---|
| 734 | }
|
---|
| 735 | crea_tabella($ra);
|
---|
| 736 | }else{
|
---|
| 737 | crea_tabella($ar);
|
---|
| 738 | }
|
---|
| 739 | //e' un referendum
|
---|
| 740 | }else{
|
---|
[318] | 741 | $sql="SELECT id_gruppo, descrizione,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons order by num_gruppo";
|
---|
| 742 | $res_lis = $dbi->prepare("$sql");
|
---|
| 743 | $res_lis->execute();
|
---|
[254] | 744 |
|
---|
[265] | 745 | if($res_lis) $numliste=$res_lis->rowCount(); else $numliste=0;
|
---|
| 746 |
|
---|
[254] | 747 | if (!isset($offset)) $offset=10;
|
---|
| 748 | if (!isset($min)) $min=1;
|
---|
| 749 | if (!isset($offsetsez)) $offsetsez=25; //lo 0 viene sostituito dal totale di sezioni presenti
|
---|
| 750 | if (!isset($minsez)) $minsez=1;
|
---|
| 751 | if (!$csv){
|
---|
| 752 | echo "<div><h5>$pagina</h5></div>";
|
---|
| 753 | echo "<form id=\"voti\" method=\"post\" action=\"modules.php\">";
|
---|
| 754 | echo "<div style=\"text-align:left;width:700px;margin:auto;font-size:12px \">
|
---|
| 755 | <input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>";
|
---|
| 756 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 757 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 758 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 759 | echo ""._SCELTA." "._CONSULTAZIONE.": <select name=\"id_gruppo\">";
|
---|
| 760 | if($res_lis)
|
---|
[265] | 761 | while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {
|
---|
[254] | 762 | if (!$id_gruppo) $id_gruppo=$id_rif;
|
---|
| 763 | $sel = ($id_rif == $id_gruppo) ? "selected=\"selected\"" : "";
|
---|
| 764 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 765 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 766 | echo $num_lis.") ".strip_tags(substr($descrizione,0,50))."</option>";
|
---|
| 767 | }
|
---|
| 768 | echo "</select>";
|
---|
| 769 | echo "<br />"._VIS_PERC.": <input type=\"checkbox\" name=\"perc\" value=\"true\"";
|
---|
| 770 | if($perc=='true') echo " checked=\"true\"";
|
---|
| 771 | echo ">";
|
---|
| 772 | echo "<br /><input type=\"submit\" name=\"update\" value=\""._RICARICA."\"></form></div>";
|
---|
| 773 |
|
---|
| 774 |
|
---|
| 775 |
|
---|
| 776 | }
|
---|
| 777 |
|
---|
[318] | 778 | $sql="select num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id_gruppo";
|
---|
| 779 | $res_ref = $dbi->prepare("$sql");
|
---|
| 780 | $res_ref ->execute();
|
---|
[265] | 781 |
|
---|
| 782 | $sql="select $tab2, t1.num_gruppo, t1.descrizione , t1.simbolo,
|
---|
[254] | 783 | sum(t2.si), sum(t2.no),sum(t2.validi), sum(t2.nulli),sum(t2.bianchi), sum(t2.contestati)
|
---|
| 784 | from ".$prefix."_ele_gruppo as t1
|
---|
| 785 | left join ".$prefix."_ele_voti_ref as t2 on (t1.id_gruppo=t2.id_gruppo)
|
---|
| 786 | left join ".$prefix."_ele_sezioni as t3 on (t2.id_sez=t3.id_sez)
|
---|
| 787 | left join ".$prefix."_ele_sede as t4 on (t3.id_sede=t4.id_sede)
|
---|
| 788 | left join ".$prefix."_ele_circoscrizione as t5 on (t4.id_circ=t5.id_circ)
|
---|
| 789 | where t1.id_cons='$id_cons' and t1.id_gruppo=$id_gruppo
|
---|
[320] | 790 | group by t2.id_gruppo,$tab2, t1.num_gruppo, t1.descrizione , t1.simbolo
|
---|
[254] | 791 | order by $tab3, t1.num_gruppo
|
---|
[318] | 792 | ";
|
---|
| 793 | $res = $dbi->prepare("$sql");
|
---|
| 794 | $res->execute();
|
---|
[265] | 795 |
|
---|
| 796 | if($res) $num_sez=$res->rowCount(); else $num_sez=0;
|
---|
| 797 | if($res_ref) list($num_gruppo,$descr)= $res_ref->fetch(PDO::FETCH_NUM); else {$num_gruppo=0;$descr='';}
|
---|
[254] | 798 |
|
---|
| 799 | if (!$csv){
|
---|
| 800 | # stampa
|
---|
| 801 |
|
---|
| 802 | $datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> ";
|
---|
| 803 | $datipdf .="<br/><b>Referendum n. ".$num_gruppo." </b><br/>".$descr."";
|
---|
| 804 | echo "<div style=\"text-align:right;width:900px;margin-left:10px;margin-right:20px;font-size:12px \">";
|
---|
| 805 | echo "<table style=\"text-align:center;margin-right:0px;border-top : 1px solid Blue;width: 140px;\"><tr style=\" background:#eceff5;\"><td>"._ESPORTA."<br />";
|
---|
| 806 |
|
---|
| 807 | echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&perc=$perc&id_gruppo=$id_gruppo&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/printer.gif\" alt=\"Stampa\" /></a>";
|
---|
| 808 | echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&perc=$perc&id_gruppo=$id_gruppo&xls=1&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"Export Csv\" /></a>";
|
---|
| 809 |
|
---|
| 810 | //echo "<a href=\"modules.php?name=Elezioni&op=$op&id_cons_gen=$id_cons_gen&id_comune=$id_comune&csv=1&perc=$perc&id_gruppo=$id_gruppo&pdf=1&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"Export Pdf\" /></a>";
|
---|
| 811 |
|
---|
| 812 |
|
---|
| 813 | echo "<img class=\"image\" src=\"modules/Elezioni/images/rss.png\" alt=\"Export rss\" />";
|
---|
| 814 |
|
---|
| 815 | echo " </td></tr>";
|
---|
| 816 |
|
---|
| 817 |
|
---|
| 818 | echo "<form id=\"pdf\" method=\"post\" action=\"modules.php\">";
|
---|
| 819 |
|
---|
| 820 | echo "<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"></input>";
|
---|
| 821 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 822 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 823 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 824 | echo "<input type=\"hidden\" name=\"csv\" value=\"1\"></input>";
|
---|
| 825 | echo "<input type=\"hidden\" name=\"orvert\" value=\"$orvert\"></input>";
|
---|
| 826 | echo "<input type=\"hidden\" name=\"min\" value=\"$min\"></input>";
|
---|
| 827 | echo "<input type=\"hidden\" name=\"offset\" value=\"$offset\"></input>";
|
---|
| 828 | echo "<input type=\"hidden\" name=\"minsez\" value=\"$minsez\"></input>";
|
---|
| 829 | echo "<input type=\"hidden\" name=\"offsetsez\" value=\"$offsetsez\"></input>";
|
---|
| 830 | echo "<input type=\"hidden\" name=\"perc\" value=\"$perc\"></input>";
|
---|
| 831 | echo "<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"></input>";
|
---|
| 832 | echo "<input type=\"hidden\" name=\"pdf\" value=\"1\"></input>";
|
---|
| 833 | echo "<input type=\"hidden\" name=\"datipdf\" value=\"$datipdf\"></input>";
|
---|
| 834 | echo "<input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>";
|
---|
| 835 |
|
---|
| 836 | echo "<tr><td>";
|
---|
| 837 | echo "<input type=\"image\" name=\"submit\" src=\"modules/Elezioni/images/pdf.gif\" align=\"left\">";
|
---|
| 838 | echo " L <input type=\"radio\" name=\"orienta\" $land value=\"L\"></input>P <input
|
---|
| 839 | type=\"radio\" name=\"orienta\" $port value=\"P\"></input><br />";
|
---|
| 840 | echo " A3<input type=\"radio\" name=\"formato\" $A3 value=\"A3\"></input>A4<input
|
---|
| 841 | type=\"radio\" name=\"formato\" $A4 value=\"A4\"></input>";
|
---|
| 842 |
|
---|
| 843 |
|
---|
| 844 | echo " </td></tr></table></form> ";
|
---|
| 845 |
|
---|
| 846 |
|
---|
| 847 |
|
---|
| 848 |
|
---|
| 849 |
|
---|
| 850 |
|
---|
| 851 |
|
---|
| 852 |
|
---|
| 853 |
|
---|
| 854 | echo "</div>";
|
---|
| 855 |
|
---|
| 856 |
|
---|
| 857 | // numero sezioni scrutinate
|
---|
[320] | 858 | $sql="select t3.id_sez from ".$prefix."_ele_voti_ref as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' group by t3.id_sez ";
|
---|
[318] | 859 | $res4 = $dbi->prepare("$sql");
|
---|
| 860 | $res4->execute();
|
---|
[265] | 861 |
|
---|
| 862 | $numero=$res4->rowCount();
|
---|
[318] | 863 | $sql="select t1.* from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' ";
|
---|
| 864 | $res5 = $dbi->prepare("$sql");
|
---|
| 865 | $res5->execute();
|
---|
[265] | 866 |
|
---|
| 867 | $sezioni=$res5->rowCount();
|
---|
[254] | 868 | if ($numero!=0) echo "<h5><i> "._SEZSCRU." $numero "._SU." $sezioni </i></h5>";
|
---|
| 869 |
|
---|
| 870 | }
|
---|
[318] | 871 | $sql="select count(0) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
|
---|
| 872 | $res5 = $dbi->prepare("$sql");
|
---|
| 873 | $res5->execute();
|
---|
[254] | 874 |
|
---|
[265] | 875 | list($num_sez) = $res5->fetch(PDO::FETCH_NUM);
|
---|
[254] | 876 |
|
---|
| 877 |
|
---|
| 878 |
|
---|
| 879 |
|
---|
[265] | 880 |
|
---|
[254] | 881 | if (!$csv)echo "<b>Referendum n. ".$num_gruppo." </b><br />".$descr."";
|
---|
| 882 |
|
---|
| 883 | $y=1;
|
---|
| 884 | $ar[0][0]=$tipo2;
|
---|
| 885 | $ar[0][1]=_SI;
|
---|
| 886 | $ar[0][2]=_NO;
|
---|
| 887 | $ar[0][3]=_VALIDI;
|
---|
| 888 | $ar[0][4]=_NULLI;
|
---|
| 889 | $ar[0][5]=_BIANCHI;
|
---|
| 890 | $ar[0][6]=_CONTESTATI;
|
---|
| 891 | if($res_ref)
|
---|
[265] | 892 | while (list($num_gruppo,$desc_ref) = $res_ref->fetch(PDO::FETCH_NUM)){
|
---|
[254] | 893 | $ar[0][$i++]= $num_gruppo.") ".$desc_ref;
|
---|
| 894 | $ar[1][$y++]= "SI";
|
---|
| 895 | $ar[1][$y++]= "NO";
|
---|
| 896 | }
|
---|
| 897 | $num_sez++;
|
---|
| 898 | $tot_si=0;
|
---|
| 899 | $tot_no=0;
|
---|
| 900 | $tot_va=0;
|
---|
| 901 | $tot_nu=0;
|
---|
| 902 | $tot_bi=0;
|
---|
| 903 | $tot_co=0;
|
---|
| 904 | if($res)
|
---|
[265] | 905 | while (list($num_circ,$desc_circ,$num_gruppo,$desc_ref,$simbolo,$si,$no,$validi,$nulli,$bianchi, $contestati) = $res->fetch(PDO::FETCH_NUM)){
|
---|
[254] | 906 | $i=1;
|
---|
| 907 | $votanti=$validi+$nulli+$bianchi+$contestati;
|
---|
| 908 | $tot_si+=$si;
|
---|
| 909 | $tot_no+=$no;
|
---|
| 910 | $tot_va+=$validi;
|
---|
| 911 | $tot_nu+=$nulli;
|
---|
| 912 | $tot_bi+=$bianchi;
|
---|
| 913 | $tot_co+=$contestati;
|
---|
| 914 | $ar[$num_circ][0]=$num_circ."<br />".$desc_circ;
|
---|
| 915 | if($validi){
|
---|
| 916 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\"><i>".number_format($si*100/$validi,2)."%</i></span>":$si;
|
---|
| 917 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\"><i>".number_format($no*100/$validi,2)."%</i></span>":$no;
|
---|
| 918 | }else{
|
---|
| 919 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\"><i>0.00%</i></span>":$si;
|
---|
| 920 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\"><i>0.00%</i></span>":$no;
|
---|
| 921 | }
|
---|
| 922 | if($votanti){
|
---|
| 923 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\"><i>".number_format($validi*100/$votanti,2)."%</i></span>":$validi;
|
---|
| 924 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\"><i>".number_format($nulli*100/$votanti,2)."%</i></span>":$nulli;
|
---|
| 925 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\"><i>".number_format($bianchi*100/$votanti,2)."%</i></span>":$bianchi;
|
---|
| 926 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\"><i>".number_format($contestati*100/$votanti,2)."%</i></span>":$contestati;
|
---|
| 927 | }else{
|
---|
| 928 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\"><i>0.00%</i></span>":$validi;
|
---|
| 929 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\"><i>0.00%</i></span>":$nulli;
|
---|
| 930 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\"><i>0.00%</i></span>":$bianchi;
|
---|
| 931 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\"><i>0.00%</i></span>":$contestati;
|
---|
| 932 | }
|
---|
| 933 | }
|
---|
| 934 | $i=1;
|
---|
| 935 | $tot_vo=$tot_va+$tot_nu+$tot_bi+$tot_co;
|
---|
| 936 | # if($tot_va==0) $tot_va=1;
|
---|
| 937 | # if($tot_vo==0) $tot_vo=1;
|
---|
| 938 | $ar[$num_sez][0]=_TOT."<br />"._COMPLESSIVO;
|
---|
| 939 | if($tot_va){
|
---|
| 940 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">".number_format($tot_si*100/$tot_va,2)."%</span>":$tot_si;
|
---|
| 941 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">".number_format($tot_no*100/$tot_va,2)."%</span>":$tot_no;
|
---|
| 942 | }else{
|
---|
| 943 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">0.00%</span>":$tot_si;
|
---|
| 944 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">0.00%</span>":$tot_no;
|
---|
| 945 | }
|
---|
| 946 | if($tot_vo){
|
---|
| 947 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">".number_format($tot_va*100/$tot_vo,2)."%</span>":$tot_va;
|
---|
| 948 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">".number_format($tot_nu*100/$tot_vo,2)."%</span>":$tot_nu;
|
---|
| 949 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">".number_format($tot_bi*100/$tot_vo,2)."%</span>":$tot_bi;
|
---|
| 950 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">".number_format($tot_co*100/$tot_vo,2)."%</span>":$tot_co;
|
---|
| 951 | }else{
|
---|
| 952 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">0.00%</span>":$tot_va;
|
---|
| 953 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">0.00%</span>":$tot_nu;
|
---|
| 954 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">0.00%</span>":$tot_bi;
|
---|
| 955 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">0.00%</span>":$tot_co;
|
---|
| 956 | }
|
---|
| 957 | crea_tabella($ar);
|
---|
| 958 | }
|
---|
| 959 | if ($csv) echo "</body>\n</html>";
|
---|
| 960 | }
|
---|
| 961 |
|
---|
| 962 | ?>
|
---|