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