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