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