[2] | 1 | <?php
|
---|
| 2 | /************************************************************************/
|
---|
| 3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 4 | /* by Luciano Apolito & Roberto Gigli */
|
---|
| 5 | /* http://www.eleonline.it */
|
---|
| 6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 7 | /************************************************************************/
|
---|
| 8 |
|
---|
| 9 | if (!defined('MODULE_FILE')) {
|
---|
| 10 | die ("You can't access this file directly...");
|
---|
| 11 | }
|
---|
| 12 | if ($xls=='1') include("modules/Elezioni/language/lang-$lang.php");
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
|
---|
| 16 | $_GET : $_POST;
|
---|
| 17 |
|
---|
| 18 | if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
|
---|
| 19 | //if (isset($param['op'])) $op=$param['op']; else $op='';
|
---|
| 20 | if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
|
---|
| 21 | if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
|
---|
| 22 | if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else $id_circ='';
|
---|
| 23 | if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
|
---|
| 24 | if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
|
---|
| 25 | if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
|
---|
| 26 | if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
|
---|
| 27 | if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
|
---|
| 28 | if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
|
---|
| 29 | if (isset($param['info'])) get_magic_quotes_gpc() ? $info=$param['info']:$info=addslashes($param['info']); else $info='';
|
---|
| 30 | if (isset($param['files'])) get_magic_quotes_gpc() ? $files=$param['files']:$files=addslashes($param['files']); else $files='';
|
---|
| 31 | if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
|
---|
| 32 | if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
|
---|
| 33 | if (isset($param['lettera'])) get_magic_quotes_gpc() ? $lettera=$param['lettera']:$lettera=addslashes($param['lettera']); else $lettera='';
|
---|
| 34 | if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
|
---|
| 35 | #if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
|
---|
| 36 |
|
---|
[12] | 37 | # anti-xss nov. 2009
|
---|
| 38 | $id_comune=htmlentities($id_comune);
|
---|
| 39 | $id_comune=intval($id_comune);
|
---|
[39] | 40 | $perc=htmlentities($perc);
|
---|
[12] | 41 | $perc_lista=floatval($perc_lista);
|
---|
[39] | 42 | #$datipdf= htmlentities($datipdf);
|
---|
[12] | 43 | $op= htmlentities($op);
|
---|
| 44 | $info= htmlentities($info);
|
---|
| 45 | $files=htmlentities($files);
|
---|
| 46 | $lettera=htmlentities($lettera);
|
---|
[2] | 47 |
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
[12] | 53 |
|
---|
[2] | 54 | include("crea_pagina.php");
|
---|
| 55 | $res = mysql_query("SELECT descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'" , $dbi);
|
---|
| 56 | list($descr_comune) = mysql_fetch_row($res);
|
---|
| 57 |
|
---|
| 58 | $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);
|
---|
| 59 | list($descr_cons,$tipo_cons,$genere,$votog,$votol,$votoc,$circo) = mysql_fetch_row($res);
|
---|
| 60 | $res = mysql_query("SELECT t2.id_cons 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);
|
---|
| 61 | list($id_cons) = mysql_fetch_row($res);
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | ////////////////////////////////////////////////////////////
|
---|
| 70 | // Visualizza i dati per liste, gruppi e referendum, per sezione o circoscrizione
|
---|
| 71 | ////////////////////////////////////////////////////////////
|
---|
| 72 |
|
---|
| 73 | function gruppo_circo(){
|
---|
| 74 | 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;
|
---|
| 75 | global $id_comune,$id_cons_gen,$op,$minsez,$id_lista,$id_circ,$csv,$min,
|
---|
| 76 | $orvert,$offset,$offsetsez,$perc,$info,$files;
|
---|
| 77 | #Denominazione pagine
|
---|
| 78 | if($op=="gruppo_circo") $pagina=_GRUPPO." "._PER." "._CIRCO;
|
---|
| 79 | if($op=="gruppo_sezione") $pagina=_GRUPPO." "._PER." "._SEZIONI;
|
---|
| 80 | if($op=="lista_circo") $pagina=_LISTA." "._PER." "._CIRCO;
|
---|
| 81 | if($op=="lista_sezione") $pagina=_LISTA." "._PER." "._SEZIONI;
|
---|
| 82 | if($op=="candidato_circo") $pagina=_CONSI." "._PER." "._CIRCO;
|
---|
| 83 | if($op=="candidato_sezione") $pagina=_CONSI." "._PER." "._SEZIONI;
|
---|
| 84 | if($op=="consiglieri") $pagina=_CALCONS;
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 |
|
---|
[20] | 89 | if (strstr( $op,'circo')) { //$op=='gruppo_circo' or $op=='lista_circo') {
|
---|
[2] | 90 | $tab1="circ";
|
---|
| 91 | $tab2="t5.num_circ,t5.descrizione";
|
---|
| 92 | $tab3="t5.num_circ";
|
---|
| 93 | $tipo1=_DA." "._CIRCO;
|
---|
| 94 | $tipo2=_CIRCOS;
|
---|
| 95 | $tipo3=_CIRCO;
|
---|
| 96 | }else{
|
---|
| 97 | $tab1="sez";
|
---|
| 98 | $tab2="t3.num_sez,''";
|
---|
| 99 | $tab3="t3.num_sez";
|
---|
| 100 | $tipo1=_DA." "._SEZIONE;
|
---|
| 101 | $tipo2=_SEZIONI;
|
---|
| 102 | $tipo3=_SEZIONE;
|
---|
| 103 | }
|
---|
[20] | 104 | if (strstr( $op,"gruppo")){
|
---|
[2] | 105 | $tab="gruppo";
|
---|
[20] | 106 | }elseif (strstr( $op,'lista')) {
|
---|
[2] | 107 | $tab="lista";
|
---|
| 108 | }else{
|
---|
| 109 | $tab="candidati";
|
---|
| 110 | }
|
---|
| 111 | if ($orvert) {
|
---|
| 112 | $righe='';
|
---|
| 113 | $colonne='checked';
|
---|
| 114 | }else{
|
---|
| 115 | $righe='checked';
|
---|
| 116 | $colonne='';
|
---|
| 117 | }
|
---|
| 118 | if ($genere>0) { //se non e' un referendum
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | $voticompl=0;
|
---|
| 122 | if (!($offset)) $offset=25;
|
---|
| 123 | if (!($min)) $min=1;
|
---|
| 124 | if (!($offsetsez)) $offsetsez=20;
|
---|
| 125 | if (!($minsez)) $minsez=1;
|
---|
| 126 | if ($min>$offset) {
|
---|
| 127 | $appo=$min;
|
---|
| 128 | $min=$offset;
|
---|
| 129 | $offset=$appo;
|
---|
| 130 | }
|
---|
| 131 | if ($minsez>$offsetsez) {
|
---|
| 132 | $appo=$minsez;
|
---|
| 133 | $minsez=$offsetsez;
|
---|
| 134 | $offsetsez=$appo;
|
---|
| 135 | }
|
---|
| 136 | if (!$csv){
|
---|
| 137 | echo "<form id=\"voti\" method=\"post\" action=\"modules.php\">";
|
---|
| 138 | 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>";
|
---|
| 139 | 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>";
|
---|
| 140 | }
|
---|
| 141 | $condcirc='';
|
---|
| 142 | if ($circo){ //gestione circoscrizionali
|
---|
| 143 | if(!$id_circ){
|
---|
| 144 | $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
|
---|
| 145 | list($id_circ)=mysql_fetch_row($res_cir);
|
---|
| 146 | }
|
---|
| 147 | $res_cir = mysql_query("SELECT num_circ from ".$prefix."_ele_circoscrizione where id_circ=$id_circ",$dbi); //estrae il numero della circoscrizione
|
---|
| 148 | list($num_circ)=mysql_fetch_row($res_cir);
|
---|
| 149 | $condcirc="and id_circ=$id_circ"; //variabile aggiunta nelle select per le circ.
|
---|
| 150 | $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
|
---|
| 151 | $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
|
---|
| 152 | list($minsez)=mysql_fetch_row($res_min);
|
---|
| 153 | }
|
---|
| 154 | else
|
---|
| 155 | $res_sez = mysql_query("SELECT count(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons",$dbi);
|
---|
| 156 | list($tot_sez)=mysql_fetch_row($res_sez);
|
---|
| 157 | $num_sez=$tot_sez;//mysql_data_seek($res_sez,0);
|
---|
| 158 | if ($circo) $offsetsez=$num_sez+$minsez-1;//setta offsetsez sull'ultima sezione della circoscrizione
|
---|
[20] | 159 | if(strstr( $op,"circo")) {
|
---|
[2] | 160 | $res_sez = mysql_query("SELECT count(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons",$dbi); //estrae il numero delle circoscrizioni
|
---|
| 161 | list($num_sez)=mysql_fetch_row($res_sez);
|
---|
| 162 | }
|
---|
| 163 | #Tolgo la scelta della circoscrizione o collegio perché gestita per tutte le pagine in index.php
|
---|
| 164 | /* if ($circo){ // elenco per scelta circoscrizione
|
---|
| 165 | $res_sez = mysql_query("SELECT id_circ,descrizione,num_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons",$dbi);
|
---|
| 166 | echo "<div >"._SCELTA_CIR.":
|
---|
| 167 | <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\">";
|
---|
| 168 | while(list($id_rif,$descrizione,$num_cir)=mysql_fetch_row($res_sez)) {
|
---|
| 169 | if (!$id_circ) $id_circ=$id_rif;
|
---|
| 170 | $sel = ($id_rif == $id_circ) ? "selected=\"selected\"" : "";
|
---|
| 171 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 172 | for ($j=strlen($num_cir);$j<2;$j++) { echo " ";}
|
---|
| 173 | echo $num_cir.") ".$descrizione."</option>";
|
---|
| 174 | }
|
---|
| 175 | echo "</select></div>";
|
---|
| 176 |
|
---|
| 177 | }
|
---|
| 178 | */
|
---|
| 179 | $visvot='';
|
---|
[20] | 180 | if(strstr( $op,'candidato')){
|
---|
[2] | 181 | // $numliste=mysql_num_rows($res_lis);
|
---|
| 182 | $visvot="cand";
|
---|
| 183 | if (!$csv){
|
---|
| 184 | $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);
|
---|
| 185 | //elenco delle liste per la scelta
|
---|
| 186 | echo "<p>Scegli la lista:
|
---|
| 187 | <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\">";
|
---|
| 188 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_lis)) {
|
---|
| 189 | if (!$id_lista) $id_lista=$id_rif;
|
---|
| 190 | $sel = ($id_rif == $id_lista) ? "selected=\"selected\"" : "";
|
---|
| 191 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 192 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 193 | echo $num_lis.") ".$descrizione."</option>";
|
---|
| 194 | }
|
---|
| 195 | echo "</select></p>";
|
---|
| 196 | }
|
---|
| 197 | $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);
|
---|
| 198 | $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);
|
---|
| 199 | if ($circo) $condcirc="and t5.id_circ=$id_circ";
|
---|
| 200 | $res_voti = mysql_query("select $tab2, t1.num_cand, concat(t1.cognome,' ', t1.nome), sum(t2.voti),'','','','',''
|
---|
| 201 | from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2, "
|
---|
| 202 | .$prefix."_ele_sezioni as t3, ".$prefix."_ele_sede as t4, ".$prefix."_ele_circoscrizione as t5
|
---|
| 203 | where t1.id_lista=$id_lista
|
---|
| 204 | and t1.id_cons=$id_cons
|
---|
| 205 | and t1.id_cand=t2.id_cand
|
---|
| 206 | and t2.id_sez=t3.id_sez
|
---|
| 207 | and t3.id_sede=t4.id_sede
|
---|
| 208 | and t4.id_circ=t5.id_circ $condcirc
|
---|
| 209 | group by t1.num_cand,$tab3
|
---|
| 210 | order by $tab3,t1.num_cand",$dbi);
|
---|
| 211 |
|
---|
| 212 | }else{
|
---|
| 213 | if (!$csv)
|
---|
| 214 | echo "<input type=\"hidden\" name=\"id_lista\" value=\"\"></input>";
|
---|
| 215 |
|
---|
| 216 | // camera e senato nel 2006 aggiunte le somme della coalizione
|
---|
| 217 | // divise per circo e sez. in quanto nella tabella del gruppo
|
---|
| 218 | // all'atto dell'immsione non viene fatta la somma
|
---|
| 219 | // quindi leggere prima i voti di lista e poi agganciali al gruppo
|
---|
| 220 | // la var $tab diviene lista, $tab15 diviene gruppo in caso di somma
|
---|
| 221 | // dei voti di lista...oltre naturalmnte alle condizioni messe in variabile
|
---|
| 222 | // 4 aprile 2006 by luc
|
---|
| 223 | if ($votog && $tab=="gruppo"){ // camera e senato 2006
|
---|
| 224 | $t="t9";
|
---|
| 225 | $tab="lista";
|
---|
| 226 | $tab15="gruppo";
|
---|
| 227 | $add_1= ",".$prefix."_ele_gruppo as t9";
|
---|
| 228 | $and_1="and t1.id_gruppo=t9.id_gruppo";
|
---|
| 229 | }else{
|
---|
| 230 | $t="t1";
|
---|
| 231 | $tab15=$tab;
|
---|
| 232 | $add_1='';
|
---|
| 233 | $and_1='';
|
---|
| 234 | }
|
---|
| 235 | // fine della modifica
|
---|
| 236 |
|
---|
| 237 | $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
|
---|
| 238 | $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);
|
---|
| 239 | if ($circo) $condcirc="and t5.id_circ=$id_circ";
|
---|
| 240 | if ($tab=="gruppo")
|
---|
| 241 | $votigl=" sum(t3.validi),sum(t3.nulli),sum(t3.bianchi),sum(t3.contestati),sum(t3.voti_nulli)";
|
---|
| 242 | else
|
---|
| 243 | if ($votog) $votigl=" (t3.validi_lista),(t3.nulli),(t3.bianchi),(t3.contestati_lista),(t3.voti_nulli_lista)";
|
---|
| 244 | else $votigl=" sum(t3.validi_lista),sum(t3.nulli),sum(t3.bianchi),sum(t3.contestati_lista),sum(t3.voti_nulli_lista)";
|
---|
| 245 |
|
---|
| 246 |
|
---|
| 247 |
|
---|
| 248 |
|
---|
| 249 |
|
---|
| 250 | $res_voti = mysql_query("select $tab2, $t.num_$tab15, $t.descrizione, sum(t2.voti), $votigl
|
---|
| 251 | from
|
---|
| 252 | ".$prefix."_ele_$tab as t1,
|
---|
| 253 | ".$prefix."_ele_voti_$tab as t2,
|
---|
| 254 | ".$prefix."_ele_sezioni as t3,
|
---|
| 255 | ".$prefix."_ele_sede as t4,
|
---|
| 256 | ".$prefix."_ele_circoscrizione as t5
|
---|
| 257 | $add_1
|
---|
| 258 |
|
---|
| 259 | where t1.id_cons=$id_cons
|
---|
| 260 | and t1.id_$tab=t2.id_$tab
|
---|
| 261 | $and_1
|
---|
| 262 |
|
---|
| 263 | and t2.id_sez=t3.id_sez
|
---|
| 264 | and t3.id_sede=t4.id_sede
|
---|
| 265 | and t4.id_circ=t5.id_circ $condcirc
|
---|
| 266 |
|
---|
| 267 |
|
---|
| 268 | group by $t.num_$tab15,$tab3
|
---|
| 269 | order by $tab3,$t.num_$tab15",$dbi);
|
---|
| 270 | }
|
---|
| 271 | if ($res_scr) list($tot_scr)=mysql_fetch_row($res_scr);else $tot_scr=0;
|
---|
| 272 | if ($res_cand) $num_cand=mysql_num_rows($res_cand); else $num_cand=0;
|
---|
| 273 | if(!$circo){
|
---|
| 274 | if (!(0 < $minsez and $minsez<=$num_sez)) $minsez=1;
|
---|
| 275 | if (!(0<$offsetsez and $offsetsez<=$num_sez)) $offsetsez=$num_sez;
|
---|
| 276 | }
|
---|
| 277 | if (!(0 < $min and $min<=$num_cand)) $min=1;
|
---|
| 278 | if (!(0<$offset and $offset<=$num_cand)) $offset=$num_cand;
|
---|
| 279 | if (!$csv) {
|
---|
| 280 | echo "<br /><table>
|
---|
| 281 | <tr><td><h5>$pagina</h5></td></tr>";
|
---|
| 282 | echo "<tr><td>"._DA.": <select name=\"min\" class=\"modulo\">";
|
---|
| 283 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_cand)) {
|
---|
| 284 | if (!$min) $min=$num_lis;
|
---|
| 285 | $sel = ($num_lis == $min) ? "selected=\"selected\"" : "";
|
---|
| 286 | echo "<option value=\"$num_lis\" $sel>";
|
---|
| 287 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 288 | echo $num_lis.") ".$descrizione."</option>";
|
---|
| 289 |
|
---|
| 290 | }
|
---|
| 291 | echo "</select></td></tr>";
|
---|
| 292 | echo "<tr><td> "._A.": <select name=\"offset\" class=\"modulo\">";
|
---|
| 293 | mysql_data_seek($res_cand,0);
|
---|
| 294 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_cand)) {
|
---|
| 295 | if (!$offset) $offset=$num_lis;
|
---|
| 296 | $sel = ($num_lis == $offset) ? "selected=\"selected\"" : "";
|
---|
| 297 | echo "<option value=\"$num_lis\" $sel>";
|
---|
| 298 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 299 | echo $num_lis.") ".$descrizione."</option>";
|
---|
| 300 |
|
---|
| 301 | }
|
---|
| 302 | echo "</select></td></tr></table>";
|
---|
| 303 | echo "<table><tr><td>";
|
---|
| 304 | if(!$circo)
|
---|
| 305 | echo "$tipo1 n. <input name=\"minsez\" value=\"$minsez\" size=\"4\" ></input>";
|
---|
| 306 | echo "</td>";
|
---|
| 307 | echo "<td>";
|
---|
| 308 | if(!$circo)
|
---|
| 309 | echo _A." n. <input name=\"offsetsez\" value=\"$offsetsez\" size=\"4\" ></input> (max. $num_sez)";
|
---|
| 310 | echo "</td>
|
---|
| 311 | <td align=\"right\">"._MOSTRA." $tipo2 <br/>"._PERCOL."<input type=\"radio\" name=\"orvert\" $righe value=\"0\"></input><br/>"._PERRIGHE." <input
|
---|
| 312 | type=\"radio\" name=\"orvert\" $colonne value=\"1\"></input>";
|
---|
| 313 | echo "<input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>
|
---|
| 314 | </td></tr>";
|
---|
| 315 | $diff=($offsetsez-$minsez);
|
---|
| 316 | if ($minsez>1){
|
---|
| 317 | $minsez_p= ($minsez-$diff)>1 ? $minsez-$diff-1:1;
|
---|
| 318 |
|
---|
| 319 | $offsetsez_p=$offsetsez-$diff-1;
|
---|
| 320 | echo "<tr><td valign=\"middle\"><div align=\"right\"><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\"> <- Precedenti</a></div></td>";
|
---|
| 321 | }else{echo "<tr><td></td>";}
|
---|
| 322 | if ($offsetsez<$num_sez){
|
---|
| 323 | $minsez_s=$minsez+$diff+1;
|
---|
| 324 | $offsetsez_s= ($offsetsez+$diff)>$num_sez ? $num_sez: $offsetsez+$diff+1;
|
---|
| 325 |
|
---|
| 326 | echo "<td><div><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\"> Successive -></a></div></td><td></td></tr>";
|
---|
| 327 | }else{echo "<td></td><td></td></tr>";}
|
---|
| 328 |
|
---|
| 329 |
|
---|
| 330 |
|
---|
| 331 | echo "<tr>";
|
---|
[20] | 332 | if (!strstr( $op,'candidato')) {
|
---|
[2] | 333 | echo "<td>"._VIS_PERC.": <input type=\"checkbox\" name=\"perc\" value=\"true\"";
|
---|
| 334 | if($perc=='true') echo " checked=\"true\"";
|
---|
| 335 | echo "></input></td>";
|
---|
| 336 | }
|
---|
| 337 | echo "<td>";
|
---|
| 338 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 339 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 340 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 341 |
|
---|
| 342 | 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>";
|
---|
| 343 |
|
---|
| 344 | echo "<input type=\"submit\" name=\"update\" value=\""._OK."\"></input>";
|
---|
| 345 |
|
---|
| 346 |
|
---|
| 347 | #### recupera dati stampa supporti diversi dati
|
---|
| 348 | //echo "</tr><tr><td><b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons <br/>";
|
---|
| 349 | //echo "tot:$tot_scr";
|
---|
| 350 | //if ($tipo_cons!=4 && $tot_scr) echo " - Sezioni scrutinate: $tot_scr su $tot_sez";
|
---|
| 351 |
|
---|
| 352 | # liste e gruppi da.... a
|
---|
[20] | 353 | if (!strstr( $op,'candidato')) {
|
---|
[2] | 354 | $res_cand2 = mysql_query("SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$min'",$dbi);
|
---|
| 355 | list($descrizione)= mysql_fetch_row($res_cand2);
|
---|
| 356 | $list1 ="da $descrizione ";
|
---|
| 357 |
|
---|
| 358 |
|
---|
| 359 |
|
---|
| 360 | $res_cand3 = mysql_query("SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$offset'",$dbi);
|
---|
| 361 | list($descrizione)= mysql_fetch_row($res_cand3);
|
---|
| 362 | $list1 .=" a $descrizione <br/>";
|
---|
| 363 |
|
---|
| 364 | }else{$list1='';}
|
---|
| 365 |
|
---|
| 366 | # nome della lista
|
---|
[30] | 367 | if (!isset($list2)) $list2='';
|
---|
[20] | 368 | if (strstr( $op,'candidato')) {
|
---|
[2] | 369 | $res_lis2 = mysql_query("SELECT num_lista, descrizione from ".$prefix."_ele_lista where id_lista=$id_lista",$dbi);
|
---|
| 370 | list($num_lista2,$descr_lista2)= mysql_fetch_row($res_lis2);
|
---|
| 371 | $list2 .=" Lista n. $num_lista2 - $descr_lista2 <br/>";
|
---|
| 372 |
|
---|
| 373 | $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);
|
---|
| 374 | list($descrizione)= mysql_fetch_row($res_cand4);
|
---|
| 375 | $list3 ="da $descrizione ";
|
---|
| 376 | $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);
|
---|
| 377 | list($descrizione)= mysql_fetch_row($res_cand5);
|
---|
| 378 | $list3 .="a $descrizione <br/>";
|
---|
| 379 |
|
---|
| 380 | }else{ $list2 .='';$list3='';}
|
---|
| 381 |
|
---|
| 382 |
|
---|
| 383 | $datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> $list1 $list2 $list3
|
---|
| 384 | dalla $tipo3 n. <b>$minsez</b> alla $tipo3 n. <b>$offsetsez</b> di <b>$num_sez</b> $tipo2<br/><br/>";
|
---|
| 385 |
|
---|
| 386 |
|
---|
| 387 |
|
---|
| 388 |
|
---|
| 389 |
|
---|
| 390 | # verificare la stampa sulle circoscrizioni
|
---|
| 391 | if(!$circo){
|
---|
| 392 | echo "</td><td><a href=\"".$_SERVER['PHP_SELF']."?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>";
|
---|
| 393 | echo "<a href=\"".$_SERVER['PHP_SELF']."?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>";
|
---|
| 394 | echo "<a href=\"".$_SERVER['PHP_SELF']."?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&pdf=1&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"Export Pdf\" /></a>";
|
---|
| 395 | }
|
---|
| 396 | echo "</td></tr></table></div></form>";
|
---|
| 397 |
|
---|
[20] | 398 | if (strstr( $op,'candidato')) echo $list2;
|
---|
[2] | 399 |
|
---|
| 400 |
|
---|
| 401 | }
|
---|
| 402 | if (!$csv){
|
---|
| 403 | //echo "<table border=\"0\" width=\"100%\"><tr><td align=\"center\"><h5> Sezioni scrutinate";
|
---|
| 404 | //if ($tipo_cons!=4) echo ": $tot_scr su $tot_sez";
|
---|
| 405 | //echo "</h5></td></tr></table>";
|
---|
| 406 | }
|
---|
| 407 | $y=1;
|
---|
| 408 | $ar[0][0]=$tipo2;
|
---|
| 409 | $ra[0][0]=$tipo2;
|
---|
| 410 | $num_sez++;
|
---|
| 411 | $voticompl=0;
|
---|
| 412 | $ominsez=$minsez-1;
|
---|
| 413 | $sevaltot=0;
|
---|
| 414 | $senultot=0;
|
---|
| 415 | $sebiatot=0;
|
---|
| 416 | $secontot=0;
|
---|
| 417 | $sevnutot=0;
|
---|
[66] | 418 | $valar=array();$percar=array();
|
---|
[14] | 419 | ////////////////////////////////////////////////////////////////////
|
---|
| 420 | // sandro: carica i numeri di sezione dal DB - giugno 2009
|
---|
| 421 | // caso: sezioni in collegi diversi non consecutive
|
---|
| 422 | if($circo) { $secirco=" and t2.id_circ=$id_circ";} else $secirco="and t1.num_sez >= $minsez and t1.num_sez <= $offsetsez";
|
---|
| 423 | $numsezioni = $offsetsez-$ominsez;
|
---|
| 424 | $res_numsez = mysql_query("SELECT 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 $secirco order by t1.num_sez",$dbi);
|
---|
| 425 | for ($z=1;$z<=($offsetsez-$ominsez);$z++) {
|
---|
| 426 | $res=mysql_fetch_row($res_numsez);
|
---|
| 427 | $ar[$z][0]=$res[0];
|
---|
| 428 | $pos[$z]=$res[0];
|
---|
[66] | 429 | #$valar[$z]=array();
|
---|
[14] | 430 | }
|
---|
[30] | 431 | if (!isset($pos)) $pos[0]=0;
|
---|
[14] | 432 | $minpos=min($pos);
|
---|
| 433 | $maxpos=max($pos);
|
---|
| 434 | ////////////////////////////////////////////////////////////////////
|
---|
[2] | 435 | if ($res_voti)
|
---|
| 436 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
|
---|
[14] | 437 | if ($num_circ<$minpos or $num_circ>$maxpos) continue;
|
---|
| 438 | $z=array_search($num_circ, $pos);
|
---|
| 439 | if (!isset($votitot[($z)])) {
|
---|
| 440 | $votitot[($z)]=0;
|
---|
[2] | 441 | $sevaltot+=$sevalidi;
|
---|
| 442 | $senultot+=$senulli;
|
---|
| 443 | $sebiatot+=$sebianchi;
|
---|
| 444 | $secontot+=$secontestati;
|
---|
| 445 | $sevnutot+=$sevonulli;
|
---|
| 446 | }
|
---|
[14] | 447 | $votitot[($z)]+=$voti;
|
---|
[2] | 448 | $voticompl+=$voti;
|
---|
| 449 | }
|
---|
| 450 | if ($voticompl) mysql_data_seek($res_voti,0);
|
---|
| 451 | $piuvot=0;
|
---|
| 452 | if ($visvot!='cand') $piuvot=5;
|
---|
| 453 |
|
---|
| 454 |
|
---|
| 455 |
|
---|
| 456 |
|
---|
| 457 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]=" ";
|
---|
| 458 | for ($z=1;$z<=($offsetsez-$ominsez);$z++)
|
---|
[14] | 459 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]=" "; //inizializza le celle interne
|
---|
[16] | 460 | $onetime="";
|
---|
[2] | 461 | if ($res_voti)
|
---|
[66] | 462 | {
|
---|
| 463 | if ($perc=='true'){
|
---|
| 464 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti))
|
---|
| 465 | if ($num_cand>=$min and $num_cand<=$offset){
|
---|
| 466 | $z=array_search($num_circ, $pos);
|
---|
| 467 | if($num_circ>=$minpos and $num_circ <=$maxpos){
|
---|
| 468 | $valar[($z)][$num_cand]=$voti;
|
---|
| 469 | }
|
---|
| 470 | foreach ($valar as $key=>$val){
|
---|
| 471 | $percar[$key]=arrayperc($val,$votitot[($key)]);
|
---|
| 472 | foreach($percar as $key2=>$val2);
|
---|
| 473 | }
|
---|
| 474 | }
|
---|
| 475 | mysql_data_seek($res_voti,0);
|
---|
| 476 | }
|
---|
[2] | 477 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
|
---|
| 478 | if ($num_cand>=$min and $num_cand<=$offset){
|
---|
[14] | 479 | $z=array_search($num_circ, $pos);
|
---|
| 480 | if($num_circ>=$minpos and $num_circ <=$maxpos){
|
---|
[2] | 481 | $ar[0][$num_cand]=$num_cand.") ".$nome;
|
---|
[16] | 482 | if ($desc_circ && $onetime!=$desc_circ) {$ar[($z)][0].=") ".$desc_circ; $onetime=$desc_circ;}
|
---|
[2] | 483 | $percento=$voti;
|
---|
[14] | 484 | if ($perc=='true' and $votitot[($z)])
|
---|
[2] | 485 | {
|
---|
[66] | 486 | $percento=$voti."<br /><span class=\"red\"><i>".number_format($percar[$z][$num_cand],2)." %</i></span>";
|
---|
[2] | 487 | }
|
---|
[14] | 488 | $ar[($z)][$num_cand]=$percento;
|
---|
[2] | 489 | }
|
---|
| 490 | if (!isset($temp[$num_cand])) $temp[$num_cand]=0;
|
---|
| 491 | $temp[$num_cand]+=$voti;
|
---|
[14] | 492 |
|
---|
[2] | 493 | }
|
---|
| 494 | if ($visvot!='cand'){
|
---|
| 495 | $posvoti=($offset);
|
---|
| 496 | $ar[0][$posvoti+1]='<b>Voti Validi</b>';
|
---|
| 497 | $ar[0][$posvoti+2]='<b>Schede Nulle</b>';
|
---|
| 498 | $ar[0][$posvoti+3]='<b>Schede Bianche</b>';
|
---|
| 499 | $ar[0][$posvoti+4]='<b>Voti Contestati</b>';
|
---|
| 500 | $ar[0][$posvoti+5]='<b>Voti Nulli</b>';
|
---|
[14] | 501 | if (($maxpos)>=$num_circ and $minpos<=$num_circ){
|
---|
[2] | 502 | $posvoti++;
|
---|
[14] | 503 | $ar[($z)][$posvoti++]="<b>$sevalidi</b>";
|
---|
| 504 | $ar[($z)][$posvoti++]="<b>$senulli</b>";
|
---|
| 505 | $ar[($z)][$posvoti++]="<b>$sebianchi</b>";
|
---|
| 506 | $ar[($z)][$posvoti++]="<b>$secontestati</b>";
|
---|
| 507 | $ar[($z)][$posvoti]="<b>$sevonulli</b>";
|
---|
[2] | 508 | }
|
---|
| 509 | }
|
---|
| 510 | }
|
---|
[66] | 511 | }
|
---|
[2] | 512 | if (($offsetsez+1)>=$num_sez){
|
---|
| 513 | $ar[(2+$offsetsez-$minsez)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>";
|
---|
| 514 | if(isset($temp)) {
|
---|
[64] | 515 | if($tab15=="gruppo"){
|
---|
| 516 | $votigl=" sum(validi),sum(nulli),sum(bianchi),sum(contestati),sum(voti_nulli)";
|
---|
| 517 | }else{
|
---|
| 518 | $votigl=" sum(validi_lista),sum(nulli),sum(bianchi),sum(contestati_lista),sum(voti_nulli_lista)";
|
---|
| 519 | }
|
---|
| 520 | $resv = mysql_query("SELECT $votigl from ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
|
---|
| 521 | list ($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot)= mysql_fetch_row($resv);
|
---|
| 522 | $voticompl=$sevaltot+$senultot+$sebiatot+$secontot+$sevnutot;
|
---|
| 523 | $resvt = mysql_query("SELECT voti from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons'",$dbi);
|
---|
| 524 | list($votlt)=mysql_fetch_row($resvt);
|
---|
[65] | 525 | $temp3=arrayperc($temp,$sevaltot);
|
---|
[2] | 526 | while (list($key,$voti)= each($temp)) {
|
---|
| 527 | if ($perc=='true' and $voticompl)
|
---|
| 528 | {
|
---|
[65] | 529 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$key]." %</i></span></b>";
|
---|
[66] | 530 | } else
|
---|
| 531 | $percento="<b>$voti</b>";
|
---|
[2] | 532 | $ar[2+$offsetsez-$minsez][$key]=$percento;
|
---|
| 533 | }
|
---|
| 534 | }
|
---|
| 535 | if ($visvot!='cand') {
|
---|
| 536 | $key=$offset+1;
|
---|
| 537 | $tmp=array($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot);
|
---|
[65] | 538 | $temp3=arrayperc($tmp,$voticompl);
|
---|
| 539 | while(list($k,$voti)= each($tmp)) {
|
---|
| 540 |
|
---|
| 541 | if ($perc=='true' and $voticompl)
|
---|
| 542 | {
|
---|
| 543 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$k]." %</i></span></b>";
|
---|
| 544 | } else $percento="<b>$voti</b>";
|
---|
| 545 | $ar[2+$offsetsez-$minsez][++$key]=$percento;
|
---|
[2] | 546 |
|
---|
| 547 | }
|
---|
| 548 | }
|
---|
| 549 | }
|
---|
| 550 | if($orvert!=1) {
|
---|
| 551 | $i=0;
|
---|
| 552 | foreach ( $ar as $riga) {
|
---|
| 553 | $y=0;
|
---|
| 554 | foreach($riga as $cella) {
|
---|
| 555 | $ra[$y++][$i]=$cella;
|
---|
| 556 | }
|
---|
| 557 | $i++;
|
---|
| 558 | }
|
---|
| 559 | crea_tabella($ra);
|
---|
| 560 | }else{
|
---|
| 561 | crea_tabella($ar);
|
---|
| 562 | }
|
---|
| 563 | //e' un referendum
|
---|
| 564 | }else{
|
---|
| 565 | $res_lis = mysql_query("SELECT id_gruppo, descrizione,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons order by num_gruppo",$dbi);
|
---|
| 566 | $numliste=mysql_num_rows($res_lis);
|
---|
| 567 |
|
---|
| 568 | if (!isset($offset)) $offset=10;
|
---|
| 569 | if (!isset($min)) $min=1;
|
---|
| 570 | if (!isset($offsetsez)) $offsetsez=25; //lo 0 viene sostituito dal totale di sezioni presenti
|
---|
| 571 | if (!isset($minsez)) $minsez=1;
|
---|
| 572 | echo "<form id=\"voti\" method=\"post\" action=\"modules.php\">";
|
---|
| 573 | echo "<div><input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>";
|
---|
| 574 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 575 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 576 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 577 | echo "<table><tr><td>"._SCELTA." "._CONSULTAZIONE.": <select name=\"id_gruppo\">";
|
---|
| 578 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_lis)) {
|
---|
| 579 | if (!$id_gruppo) $id_gruppo=$id_rif;
|
---|
| 580 | $sel = ($id_rif == $id_gruppo) ? "selected=\"selected\"" : "";
|
---|
| 581 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 582 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 583 | echo $num_lis.") ".strip_tags(substr($descrizione,0,50))."</option>";
|
---|
| 584 | }
|
---|
| 585 | echo "</select></td></tr>";
|
---|
| 586 | echo "<tr><td>"._VIS_PERC.": <input type=\"checkbox\" name=\"perc\" value=\"true\"";
|
---|
| 587 | if($perc=='true') echo " checked=\"true\"";
|
---|
| 588 | echo "></td>";
|
---|
| 589 | echo "<td><input type=\"submit\" name=\"update\" value=\""._OK."\"></td></tr></table></form>";
|
---|
| 590 | $res_ref= mysql_query("select num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id_gruppo", $dbi);
|
---|
| 591 | $res = mysql_query("select $tab2, t1.num_gruppo, t1.descrizione , t1.simbolo,
|
---|
| 592 | sum(t2.si), sum(t2.no),sum(t2.validi), sum(t2.nulli),sum(t2.bianchi), sum(t2.contestati)
|
---|
| 593 | from ".$prefix."_ele_gruppo as t1
|
---|
| 594 | left join ".$prefix."_ele_voti_ref as t2 on (t1.id_gruppo=t2.id_gruppo)
|
---|
| 595 | left join ".$prefix."_ele_sezioni as t3 on (t2.id_sez=t3.id_sez)
|
---|
| 596 | left join ".$prefix."_ele_sede as t4 on (t3.id_sede=t4.id_sede)
|
---|
| 597 | left join ".$prefix."_ele_circoscrizione as t5 on (t4.id_circ=t5.id_circ)
|
---|
| 598 | where t1.id_cons='$id_cons' and t1.id_gruppo=$id_gruppo
|
---|
| 599 | group by t2.id_gruppo,$tab3
|
---|
| 600 | order by $tab3, t1.num_gruppo
|
---|
| 601 | ", $dbi);
|
---|
| 602 | $num_sez=mysql_num_rows($res);
|
---|
| 603 | list($num_gruppo,$descr)= mysql_fetch_row($res_ref);
|
---|
| 604 | echo "<table><tr><td><b>Referendum n. ".$num_gruppo.") </b></td><td>".$descr."</td></tr></table></form>";
|
---|
| 605 | $y=1;
|
---|
| 606 | $ar[0][0]=$tipo2;
|
---|
| 607 | $ar[0][1]=_SI;
|
---|
| 608 | $ar[0][2]=_NO;
|
---|
| 609 | $ar[0][3]=_VALIDI;
|
---|
| 610 | $ar[0][4]=_NULLI;
|
---|
| 611 | $ar[0][5]=_BIANCHI;
|
---|
| 612 | $ar[0][6]=_CONTESTATI;
|
---|
| 613 |
|
---|
| 614 | while (list($num_gruppo,$desc_ref) = mysql_fetch_row($res_ref)){
|
---|
| 615 | $ar[0][$i++]= $num_gruppo.") ".$desc_ref;
|
---|
| 616 | $ar[1][$y++]= "SI";
|
---|
| 617 | $ar[1][$y++]= "NO";
|
---|
| 618 | }
|
---|
| 619 | $num_sez++;
|
---|
| 620 | $tot_si=0;
|
---|
| 621 | $tot_no=0;
|
---|
| 622 | $tot_va=0;
|
---|
| 623 | $tot_nu=0;
|
---|
| 624 | $tot_bi=0;
|
---|
| 625 | $tot_co=0;
|
---|
| 626 | while (list($num_circ,$desc_circ,$num_gruppo,$desc_ref,$simbolo,$si,$no,$validi,$nulli,$bianchi, $contestati) = mysql_fetch_row($res)){
|
---|
| 627 | $i=1;
|
---|
| 628 | $votanti=$validi+$nulli+$bianchi+$contestati;
|
---|
| 629 | $tot_si+=$si;
|
---|
| 630 | $tot_no+=$no;
|
---|
| 631 | $tot_va+=$validi;
|
---|
| 632 | $tot_nu+=$nulli;
|
---|
| 633 | $tot_bi+=$bianchi;
|
---|
| 634 | $tot_co+=$contestati;
|
---|
| 635 | $ar[$num_circ][0]=$num_circ."<br />".$desc_circ;
|
---|
| 636 | if($validi){
|
---|
| 637 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\">".number_format($si*100/$validi,2)."%</span>":$si;
|
---|
| 638 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\">".number_format($no*100/$validi,2)."%</span>":$no;
|
---|
| 639 | }else{
|
---|
| 640 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\">0.00%</span>":$si;
|
---|
| 641 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\">0.00%</span>":$no;
|
---|
| 642 | }
|
---|
| 643 | if($votanti){
|
---|
| 644 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\">".number_format($validi*100/$votanti,2)."%</span>":$validi;
|
---|
| 645 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\">".number_format($nulli*100/$votanti,2)."%</span>":$nulli;
|
---|
| 646 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\">".number_format($bianchi*100/$votanti,2)."%</span>":$bianchi;
|
---|
| 647 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\">".number_format($contestati*100/$votanti,2)."%</span>":$contestati;
|
---|
| 648 | }else{
|
---|
| 649 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\">0.00%</span>":$validi;
|
---|
| 650 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\">0.00%</span>":$nulli;
|
---|
| 651 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\">0.00%</span>":$bianchi;
|
---|
| 652 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\">0.00%</span>":$contestati;
|
---|
| 653 | }
|
---|
| 654 | }
|
---|
| 655 | $i=1;
|
---|
| 656 | $tot_vo=$tot_va+$tot_nu+$tot_bi+$tot_co;
|
---|
| 657 | # if($tot_va==0) $tot_va=1;
|
---|
| 658 | # if($tot_vo==0) $tot_vo=1;
|
---|
| 659 | $ar[$num_sez][0]=_TOT."<br />"._COMPLESSIVO;
|
---|
| 660 | if($tot_va){
|
---|
| 661 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">".number_format($tot_si*100/$tot_va,2)."%</span>":$tot_si;
|
---|
| 662 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">".number_format($tot_no*100/$tot_va,2)."%</span>":$tot_no;
|
---|
| 663 | }else{
|
---|
| 664 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">0.00%</span>":$tot_si;
|
---|
| 665 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">0.00%</span>":$tot_no;
|
---|
| 666 | }
|
---|
| 667 | if($tot_vo){
|
---|
| 668 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">".number_format($tot_va*100/$tot_vo,2)."%</span>":$tot_va;
|
---|
| 669 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">".number_format($tot_nu*100/$tot_vo,2)."%</span>":$tot_nu;
|
---|
| 670 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">".number_format($tot_bi*100/$tot_vo,2)."%</span>":$tot_bi;
|
---|
| 671 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">".number_format($tot_co*100/$tot_vo,2)."%</span>":$tot_co;
|
---|
| 672 | }else{
|
---|
| 673 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">0.00%</span>":$tot_va;
|
---|
| 674 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">0.00%</span>":$tot_nu;
|
---|
| 675 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">0.00%</span>":$tot_bi;
|
---|
| 676 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">0.00%</span>":$tot_co;
|
---|
| 677 | }
|
---|
| 678 | crea_tabella($ar);
|
---|
| 679 | }
|
---|
| 680 | if ($csv) echo "</body>\n</html>";
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 | ?>
|
---|