[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>";
|
---|
[82] | 339 | if($circo)
|
---|
| 340 | echo "<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"></input>";
|
---|
[2] | 341 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 342 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 343 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 344 |
|
---|
| 345 | 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>";
|
---|
| 346 |
|
---|
| 347 | echo "<input type=\"submit\" name=\"update\" value=\""._OK."\"></input>";
|
---|
| 348 |
|
---|
| 349 |
|
---|
| 350 | #### recupera dati stampa supporti diversi dati
|
---|
| 351 | //echo "</tr><tr><td><b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons <br/>";
|
---|
| 352 | //echo "tot:$tot_scr";
|
---|
| 353 | //if ($tipo_cons!=4 && $tot_scr) echo " - Sezioni scrutinate: $tot_scr su $tot_sez";
|
---|
| 354 |
|
---|
| 355 | # liste e gruppi da.... a
|
---|
[20] | 356 | if (!strstr( $op,'candidato')) {
|
---|
[2] | 357 | $res_cand2 = mysql_query("SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$min'",$dbi);
|
---|
| 358 | list($descrizione)= mysql_fetch_row($res_cand2);
|
---|
| 359 | $list1 ="da $descrizione ";
|
---|
| 360 |
|
---|
| 361 |
|
---|
| 362 |
|
---|
| 363 | $res_cand3 = mysql_query("SELECT descrizione from ".$prefix."_ele_$tab15 where id_cons='$id_cons' and num_$tab15 ='$offset'",$dbi);
|
---|
| 364 | list($descrizione)= mysql_fetch_row($res_cand3);
|
---|
| 365 | $list1 .=" a $descrizione <br/>";
|
---|
| 366 |
|
---|
| 367 | }else{$list1='';}
|
---|
| 368 |
|
---|
| 369 | # nome della lista
|
---|
[30] | 370 | if (!isset($list2)) $list2='';
|
---|
[20] | 371 | if (strstr( $op,'candidato')) {
|
---|
[2] | 372 | $res_lis2 = mysql_query("SELECT num_lista, descrizione from ".$prefix."_ele_lista where id_lista=$id_lista",$dbi);
|
---|
| 373 | list($num_lista2,$descr_lista2)= mysql_fetch_row($res_lis2);
|
---|
| 374 | $list2 .=" Lista n. $num_lista2 - $descr_lista2 <br/>";
|
---|
| 375 |
|
---|
| 376 | $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);
|
---|
| 377 | list($descrizione)= mysql_fetch_row($res_cand4);
|
---|
| 378 | $list3 ="da $descrizione ";
|
---|
| 379 | $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);
|
---|
| 380 | list($descrizione)= mysql_fetch_row($res_cand5);
|
---|
| 381 | $list3 .="a $descrizione <br/>";
|
---|
| 382 |
|
---|
| 383 | }else{ $list2 .='';$list3='';}
|
---|
| 384 |
|
---|
| 385 |
|
---|
[82] | 386 | $datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> $list1 $list2 $list3 ";
|
---|
| 387 | if (!$circo)
|
---|
| 388 | echo "dalla $tipo3 n. <b>$minsez</b> alla $tipo3 n. <b>$offsetsez</b> di <b>$num_sez</b> $tipo2<br/><br/>";
|
---|
| 389 | else echo "<br/><br/>";
|
---|
[2] | 390 |
|
---|
| 391 |
|
---|
| 392 |
|
---|
| 393 |
|
---|
| 394 |
|
---|
| 395 | # verificare la stampa sulle circoscrizioni
|
---|
[82] | 396 | if($circo) 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&id_circ=$id_circ&datipdf=$datipdf\" ><img class=\"image\" src=\"modules/Elezioni/images/printer.gif\" alt=\"Stampa\" /></a>";
|
---|
| 397 | else{
|
---|
[2] | 398 | 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>";
|
---|
| 399 | 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>";
|
---|
| 400 | 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>";
|
---|
| 401 | }
|
---|
| 402 | echo "</td></tr></table></div></form>";
|
---|
| 403 |
|
---|
[20] | 404 | if (strstr( $op,'candidato')) echo $list2;
|
---|
[2] | 405 |
|
---|
| 406 |
|
---|
| 407 | }
|
---|
| 408 | if (!$csv){
|
---|
| 409 | //echo "<table border=\"0\" width=\"100%\"><tr><td align=\"center\"><h5> Sezioni scrutinate";
|
---|
| 410 | //if ($tipo_cons!=4) echo ": $tot_scr su $tot_sez";
|
---|
| 411 | //echo "</h5></td></tr></table>";
|
---|
| 412 | }
|
---|
| 413 | $y=1;
|
---|
| 414 | $ar[0][0]=$tipo2;
|
---|
| 415 | $ra[0][0]=$tipo2;
|
---|
| 416 | $num_sez++;
|
---|
| 417 | $voticompl=0;
|
---|
| 418 | $ominsez=$minsez-1;
|
---|
| 419 | $sevaltot=0;
|
---|
| 420 | $senultot=0;
|
---|
| 421 | $sebiatot=0;
|
---|
| 422 | $secontot=0;
|
---|
| 423 | $sevnutot=0;
|
---|
[66] | 424 | $valar=array();$percar=array();
|
---|
[14] | 425 | ////////////////////////////////////////////////////////////////////
|
---|
| 426 | // sandro: carica i numeri di sezione dal DB - giugno 2009
|
---|
| 427 | // caso: sezioni in collegi diversi non consecutive
|
---|
| 428 | if($circo) { $secirco=" and t2.id_circ=$id_circ";} else $secirco="and t1.num_sez >= $minsez and t1.num_sez <= $offsetsez";
|
---|
| 429 | $numsezioni = $offsetsez-$ominsez;
|
---|
[82] | 430 | $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);
|
---|
[14] | 431 | for ($z=1;$z<=($offsetsez-$ominsez);$z++) {
|
---|
| 432 | $res=mysql_fetch_row($res_numsez);
|
---|
[82] | 433 | ##############inserimento percentuale di scrutinio nella sezione
|
---|
| 434 | $grpercscru=0;
|
---|
| 435 | if($op=="gruppo_sezione")
|
---|
| 436 | $resperc=mysql_query("select sum(validi),sum(nulli+bianchi+contestati+voti_nulli) from ".$prefix."_ele_sezioni where id_sez='".$res[1]."'",$dbi);
|
---|
| 437 | elseif($op=="lista_sezione")
|
---|
| 438 | $resperc=mysql_query("select sum(validi_lista),sum(nulli+bianchi+contestati_lista+solo_gruppo+voti_nulli_lista) from ".$prefix."_ele_sezioni where id_sez='".$res[1]."'",$dbi);
|
---|
| 439 | if ($resperc)
|
---|
| 440 | list($scruvalidi,$scrunulli)=mysql_fetch_row($resperc);
|
---|
| 441 | $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);
|
---|
| 442 | if ($resperc)
|
---|
| 443 | list($totschede)=mysql_fetch_row($resperc);
|
---|
| 444 | if (isset($totschede) and $totschede>0 )
|
---|
| 445 | $grpercscru=number_format(($scruvalidi+$scrunulli)*100/$totschede,0);
|
---|
| 446 |
|
---|
| 447 | ################### <span class=\"red\"><i>".$temp3[$key]." %</i></span>
|
---|
| 448 | $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] | 449 | $pos[$z]=$res[0];
|
---|
[66] | 450 | #$valar[$z]=array();
|
---|
[14] | 451 | }
|
---|
[30] | 452 | if (!isset($pos)) $pos[0]=0;
|
---|
[14] | 453 | $minpos=min($pos);
|
---|
| 454 | $maxpos=max($pos);
|
---|
| 455 | ////////////////////////////////////////////////////////////////////
|
---|
[2] | 456 | if ($res_voti)
|
---|
| 457 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
|
---|
[14] | 458 | if ($num_circ<$minpos or $num_circ>$maxpos) continue;
|
---|
| 459 | $z=array_search($num_circ, $pos);
|
---|
| 460 | if (!isset($votitot[($z)])) {
|
---|
| 461 | $votitot[($z)]=0;
|
---|
[2] | 462 | $sevaltot+=$sevalidi;
|
---|
| 463 | $senultot+=$senulli;
|
---|
| 464 | $sebiatot+=$sebianchi;
|
---|
| 465 | $secontot+=$secontestati;
|
---|
| 466 | $sevnutot+=$sevonulli;
|
---|
| 467 | }
|
---|
[14] | 468 | $votitot[($z)]+=$voti;
|
---|
[2] | 469 | $voticompl+=$voti;
|
---|
| 470 | }
|
---|
| 471 | if ($voticompl) mysql_data_seek($res_voti,0);
|
---|
| 472 | $piuvot=0;
|
---|
| 473 | if ($visvot!='cand') $piuvot=5;
|
---|
| 474 |
|
---|
| 475 |
|
---|
| 476 |
|
---|
| 477 |
|
---|
| 478 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]=" ";
|
---|
| 479 | for ($z=1;$z<=($offsetsez-$ominsez);$z++)
|
---|
[14] | 480 | for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]=" "; //inizializza le celle interne
|
---|
[16] | 481 | $onetime="";
|
---|
[2] | 482 | if ($res_voti)
|
---|
[66] | 483 | {
|
---|
| 484 | if ($perc=='true'){
|
---|
| 485 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti))
|
---|
| 486 | if ($num_cand>=$min and $num_cand<=$offset){
|
---|
| 487 | $z=array_search($num_circ, $pos);
|
---|
| 488 | if($num_circ>=$minpos and $num_circ <=$maxpos){
|
---|
| 489 | $valar[($z)][$num_cand]=$voti;
|
---|
| 490 | }
|
---|
[82] | 491 | }
|
---|
| 492 | foreach ($valar as $key=>$val){
|
---|
[66] | 493 | $percar[$key]=arrayperc($val,$votitot[($key)]);
|
---|
| 494 | }
|
---|
[82] | 495 |
|
---|
[66] | 496 | mysql_data_seek($res_voti,0);
|
---|
| 497 | }
|
---|
[2] | 498 | while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
|
---|
| 499 | if ($num_cand>=$min and $num_cand<=$offset){
|
---|
[14] | 500 | $z=array_search($num_circ, $pos);
|
---|
| 501 | if($num_circ>=$minpos and $num_circ <=$maxpos){
|
---|
[2] | 502 | $ar[0][$num_cand]=$num_cand.") ".$nome;
|
---|
[16] | 503 | if ($desc_circ && $onetime!=$desc_circ) {$ar[($z)][0].=") ".$desc_circ; $onetime=$desc_circ;}
|
---|
[2] | 504 | $percento=$voti;
|
---|
[14] | 505 | if ($perc=='true' and $votitot[($z)])
|
---|
[2] | 506 | {
|
---|
[66] | 507 | $percento=$voti."<br /><span class=\"red\"><i>".number_format($percar[$z][$num_cand],2)." %</i></span>";
|
---|
[2] | 508 | }
|
---|
[14] | 509 | $ar[($z)][$num_cand]=$percento;
|
---|
[2] | 510 | }
|
---|
| 511 | if (!isset($temp[$num_cand])) $temp[$num_cand]=0;
|
---|
| 512 | $temp[$num_cand]+=$voti;
|
---|
[14] | 513 |
|
---|
[2] | 514 | }
|
---|
| 515 | if ($visvot!='cand'){
|
---|
| 516 | $posvoti=($offset);
|
---|
| 517 | $ar[0][$posvoti+1]='<b>Voti Validi</b>';
|
---|
| 518 | $ar[0][$posvoti+2]='<b>Schede Nulle</b>';
|
---|
| 519 | $ar[0][$posvoti+3]='<b>Schede Bianche</b>';
|
---|
| 520 | $ar[0][$posvoti+4]='<b>Voti Contestati</b>';
|
---|
| 521 | $ar[0][$posvoti+5]='<b>Voti Nulli</b>';
|
---|
[14] | 522 | if (($maxpos)>=$num_circ and $minpos<=$num_circ){
|
---|
[2] | 523 | $posvoti++;
|
---|
[14] | 524 | $ar[($z)][$posvoti++]="<b>$sevalidi</b>";
|
---|
| 525 | $ar[($z)][$posvoti++]="<b>$senulli</b>";
|
---|
| 526 | $ar[($z)][$posvoti++]="<b>$sebianchi</b>";
|
---|
| 527 | $ar[($z)][$posvoti++]="<b>$secontestati</b>";
|
---|
| 528 | $ar[($z)][$posvoti]="<b>$sevonulli</b>";
|
---|
[2] | 529 | }
|
---|
| 530 | }
|
---|
| 531 | }
|
---|
[66] | 532 | }
|
---|
[2] | 533 | if (($offsetsez+1)>=$num_sez){
|
---|
| 534 | $ar[(2+$offsetsez-$minsez)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>";
|
---|
| 535 | if(isset($temp)) {
|
---|
[79] | 536 | if (!isset($tab15)) $tab15="candidati";
|
---|
[64] | 537 | if($tab15=="gruppo"){
|
---|
| 538 | $votigl=" sum(validi),sum(nulli),sum(bianchi),sum(contestati),sum(voti_nulli)";
|
---|
| 539 | }else{
|
---|
| 540 | $votigl=" sum(validi_lista),sum(nulli),sum(bianchi),sum(contestati_lista),sum(voti_nulli_lista)";
|
---|
| 541 | }
|
---|
[82] | 542 | if($circo)
|
---|
| 543 | $resv = mysql_query("SELECT $votigl from ".$prefix."_ele_sezioni AS t1
|
---|
| 544 | 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);
|
---|
| 545 | else
|
---|
| 546 | $resv = mysql_query("SELECT $votigl from ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
|
---|
[64] | 547 | list ($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot)= mysql_fetch_row($resv);
|
---|
| 548 | $voticompl=$sevaltot+$senultot+$sebiatot+$secontot+$sevnutot;
|
---|
| 549 | $resvt = mysql_query("SELECT voti from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons'",$dbi);
|
---|
| 550 | list($votlt)=mysql_fetch_row($resvt);
|
---|
[65] | 551 | $temp3=arrayperc($temp,$sevaltot);
|
---|
[2] | 552 | while (list($key,$voti)= each($temp)) {
|
---|
| 553 | if ($perc=='true' and $voticompl)
|
---|
| 554 | {
|
---|
[65] | 555 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$key]." %</i></span></b>";
|
---|
[66] | 556 | } else
|
---|
| 557 | $percento="<b>$voti</b>";
|
---|
[2] | 558 | $ar[2+$offsetsez-$minsez][$key]=$percento;
|
---|
| 559 | }
|
---|
| 560 | }
|
---|
| 561 | if ($visvot!='cand') {
|
---|
| 562 | $key=$offset+1;
|
---|
| 563 | $tmp=array($sevaltot,$senultot,$sebiatot,$secontot,$sevnutot);
|
---|
[65] | 564 | $temp3=arrayperc($tmp,$voticompl);
|
---|
| 565 | while(list($k,$voti)= each($tmp)) {
|
---|
| 566 |
|
---|
| 567 | if ($perc=='true' and $voticompl)
|
---|
| 568 | {
|
---|
| 569 | $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$k]." %</i></span></b>";
|
---|
| 570 | } else $percento="<b>$voti</b>";
|
---|
| 571 | $ar[2+$offsetsez-$minsez][++$key]=$percento;
|
---|
[2] | 572 |
|
---|
| 573 | }
|
---|
| 574 | }
|
---|
| 575 | }
|
---|
| 576 | if($orvert!=1) {
|
---|
| 577 | $i=0;
|
---|
| 578 | foreach ( $ar as $riga) {
|
---|
| 579 | $y=0;
|
---|
| 580 | foreach($riga as $cella) {
|
---|
| 581 | $ra[$y++][$i]=$cella;
|
---|
| 582 | }
|
---|
| 583 | $i++;
|
---|
| 584 | }
|
---|
| 585 | crea_tabella($ra);
|
---|
| 586 | }else{
|
---|
| 587 | crea_tabella($ar);
|
---|
| 588 | }
|
---|
| 589 | //e' un referendum
|
---|
| 590 | }else{
|
---|
| 591 | $res_lis = mysql_query("SELECT id_gruppo, descrizione,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons order by num_gruppo",$dbi);
|
---|
| 592 | $numliste=mysql_num_rows($res_lis);
|
---|
| 593 |
|
---|
| 594 | if (!isset($offset)) $offset=10;
|
---|
| 595 | if (!isset($min)) $min=1;
|
---|
| 596 | if (!isset($offsetsez)) $offsetsez=25; //lo 0 viene sostituito dal totale di sezioni presenti
|
---|
| 597 | if (!isset($minsez)) $minsez=1;
|
---|
| 598 | echo "<form id=\"voti\" method=\"post\" action=\"modules.php\">";
|
---|
| 599 | echo "<div><input type=\"hidden\" name=\"name\" value=\"Elezioni\"></input>";
|
---|
| 600 | echo "<input type=\"hidden\" name=\"op\" value=\"$op\"></input>";
|
---|
| 601 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"></input>";
|
---|
| 602 | echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"></input>";
|
---|
| 603 | echo "<table><tr><td>"._SCELTA." "._CONSULTAZIONE.": <select name=\"id_gruppo\">";
|
---|
| 604 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_lis)) {
|
---|
| 605 | if (!$id_gruppo) $id_gruppo=$id_rif;
|
---|
| 606 | $sel = ($id_rif == $id_gruppo) ? "selected=\"selected\"" : "";
|
---|
| 607 | echo "<option value=\"$id_rif\" $sel>";
|
---|
| 608 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 609 | echo $num_lis.") ".strip_tags(substr($descrizione,0,50))."</option>";
|
---|
| 610 | }
|
---|
| 611 | echo "</select></td></tr>";
|
---|
| 612 | echo "<tr><td>"._VIS_PERC.": <input type=\"checkbox\" name=\"perc\" value=\"true\"";
|
---|
| 613 | if($perc=='true') echo " checked=\"true\"";
|
---|
| 614 | echo "></td>";
|
---|
| 615 | echo "<td><input type=\"submit\" name=\"update\" value=\""._OK."\"></td></tr></table></form>";
|
---|
| 616 | $res_ref= mysql_query("select num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id_gruppo", $dbi);
|
---|
| 617 | $res = mysql_query("select $tab2, t1.num_gruppo, t1.descrizione , t1.simbolo,
|
---|
| 618 | sum(t2.si), sum(t2.no),sum(t2.validi), sum(t2.nulli),sum(t2.bianchi), sum(t2.contestati)
|
---|
| 619 | from ".$prefix."_ele_gruppo as t1
|
---|
| 620 | left join ".$prefix."_ele_voti_ref as t2 on (t1.id_gruppo=t2.id_gruppo)
|
---|
| 621 | left join ".$prefix."_ele_sezioni as t3 on (t2.id_sez=t3.id_sez)
|
---|
| 622 | left join ".$prefix."_ele_sede as t4 on (t3.id_sede=t4.id_sede)
|
---|
| 623 | left join ".$prefix."_ele_circoscrizione as t5 on (t4.id_circ=t5.id_circ)
|
---|
| 624 | where t1.id_cons='$id_cons' and t1.id_gruppo=$id_gruppo
|
---|
| 625 | group by t2.id_gruppo,$tab3
|
---|
| 626 | order by $tab3, t1.num_gruppo
|
---|
| 627 | ", $dbi);
|
---|
| 628 | $num_sez=mysql_num_rows($res);
|
---|
| 629 | list($num_gruppo,$descr)= mysql_fetch_row($res_ref);
|
---|
| 630 | echo "<table><tr><td><b>Referendum n. ".$num_gruppo.") </b></td><td>".$descr."</td></tr></table></form>";
|
---|
| 631 | $y=1;
|
---|
| 632 | $ar[0][0]=$tipo2;
|
---|
| 633 | $ar[0][1]=_SI;
|
---|
| 634 | $ar[0][2]=_NO;
|
---|
| 635 | $ar[0][3]=_VALIDI;
|
---|
| 636 | $ar[0][4]=_NULLI;
|
---|
| 637 | $ar[0][5]=_BIANCHI;
|
---|
| 638 | $ar[0][6]=_CONTESTATI;
|
---|
| 639 |
|
---|
| 640 | while (list($num_gruppo,$desc_ref) = mysql_fetch_row($res_ref)){
|
---|
| 641 | $ar[0][$i++]= $num_gruppo.") ".$desc_ref;
|
---|
| 642 | $ar[1][$y++]= "SI";
|
---|
| 643 | $ar[1][$y++]= "NO";
|
---|
| 644 | }
|
---|
| 645 | $num_sez++;
|
---|
| 646 | $tot_si=0;
|
---|
| 647 | $tot_no=0;
|
---|
| 648 | $tot_va=0;
|
---|
| 649 | $tot_nu=0;
|
---|
| 650 | $tot_bi=0;
|
---|
| 651 | $tot_co=0;
|
---|
| 652 | while (list($num_circ,$desc_circ,$num_gruppo,$desc_ref,$simbolo,$si,$no,$validi,$nulli,$bianchi, $contestati) = mysql_fetch_row($res)){
|
---|
| 653 | $i=1;
|
---|
| 654 | $votanti=$validi+$nulli+$bianchi+$contestati;
|
---|
| 655 | $tot_si+=$si;
|
---|
| 656 | $tot_no+=$no;
|
---|
| 657 | $tot_va+=$validi;
|
---|
| 658 | $tot_nu+=$nulli;
|
---|
| 659 | $tot_bi+=$bianchi;
|
---|
| 660 | $tot_co+=$contestati;
|
---|
| 661 | $ar[$num_circ][0]=$num_circ."<br />".$desc_circ;
|
---|
| 662 | if($validi){
|
---|
| 663 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\">".number_format($si*100/$validi,2)."%</span>":$si;
|
---|
| 664 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\">".number_format($no*100/$validi,2)."%</span>":$no;
|
---|
| 665 | }else{
|
---|
| 666 | $ar[$num_circ][$i++]= $perc=='true' ? $si."<br /><span class=\"red\">0.00%</span>":$si;
|
---|
| 667 | $ar[$num_circ][$i++]= $perc=='true' ? $no."<br /><span class=\"red\">0.00%</span>":$no;
|
---|
| 668 | }
|
---|
| 669 | if($votanti){
|
---|
| 670 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\">".number_format($validi*100/$votanti,2)."%</span>":$validi;
|
---|
| 671 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\">".number_format($nulli*100/$votanti,2)."%</span>":$nulli;
|
---|
| 672 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\">".number_format($bianchi*100/$votanti,2)."%</span>":$bianchi;
|
---|
| 673 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\">".number_format($contestati*100/$votanti,2)."%</span>":$contestati;
|
---|
| 674 | }else{
|
---|
| 675 | $ar[$num_circ][$i++]= $perc=='true' ? $validi."<br /><span class=\"red\">0.00%</span>":$validi;
|
---|
| 676 | $ar[$num_circ][$i++]= $perc=='true' ? $nulli."<br /><span class=\"red\">0.00%</span>":$nulli;
|
---|
| 677 | $ar[$num_circ][$i++]= $perc=='true' ? $bianchi."<br /><span class=\"red\">0.00%</span>":$bianchi;
|
---|
| 678 | $ar[$num_circ][$i++]= $perc=='true' ? $contestati."<br /><span class=\"red\">0.00%</span>":$contestati;
|
---|
| 679 | }
|
---|
| 680 | }
|
---|
| 681 | $i=1;
|
---|
| 682 | $tot_vo=$tot_va+$tot_nu+$tot_bi+$tot_co;
|
---|
| 683 | # if($tot_va==0) $tot_va=1;
|
---|
| 684 | # if($tot_vo==0) $tot_vo=1;
|
---|
| 685 | $ar[$num_sez][0]=_TOT."<br />"._COMPLESSIVO;
|
---|
| 686 | if($tot_va){
|
---|
| 687 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">".number_format($tot_si*100/$tot_va,2)."%</span>":$tot_si;
|
---|
| 688 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">".number_format($tot_no*100/$tot_va,2)."%</span>":$tot_no;
|
---|
| 689 | }else{
|
---|
| 690 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_si."<br /><span class=\"red\">0.00%</span>":$tot_si;
|
---|
| 691 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_no."<br /><span class=\"red\">0.00%</span>":$tot_no;
|
---|
| 692 | }
|
---|
| 693 | if($tot_vo){
|
---|
| 694 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">".number_format($tot_va*100/$tot_vo,2)."%</span>":$tot_va;
|
---|
| 695 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">".number_format($tot_nu*100/$tot_vo,2)."%</span>":$tot_nu;
|
---|
| 696 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">".number_format($tot_bi*100/$tot_vo,2)."%</span>":$tot_bi;
|
---|
| 697 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">".number_format($tot_co*100/$tot_vo,2)."%</span>":$tot_co;
|
---|
| 698 | }else{
|
---|
| 699 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_va."<br /><span class=\"red\">0.00%</span>":$tot_va;
|
---|
| 700 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_nu."<br /><span class=\"red\">0.00%</span>":$tot_nu;
|
---|
| 701 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_bi."<br /><span class=\"red\">0.00%</span>":$tot_bi;
|
---|
| 702 | $ar[$num_sez][$i++]= $perc=='true' ? $tot_co."<br /><span class=\"red\">0.00%</span>":$tot_co;
|
---|
| 703 | }
|
---|
| 704 | crea_tabella($ar);
|
---|
| 705 | }
|
---|
| 706 | if ($csv) echo "</body>\n</html>";
|
---|
| 707 | }
|
---|
| 708 |
|
---|
| 709 | ?>
|
---|