source: trunk/client/modules/Elezioni/blocchi/04_sezioni.php@ 354

Last change on this file since 354 was 347, checked in by roby, 3 years ago

Aggiornamento per compatibilità con php7.4

File size: 3.5 KB
Line 
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
9if (!defined('MODULE_FILE')) {
10 die ("You can't access this file dirrectly...");
11}
12global $prefix, $dbi,$id_cons_gen;
13$sql = "select chiusa from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'";
14 $res = $dbi->prepare("$sql");
15 $res->execute();
16
17 list($chiusa) = $res->fetch(PDO::FETCH_NUM);
18
19 //if($chiusa!='1') numeri_sezione(); # se la consultazione non Ú chiusa
20
21
22
23numeri_sezione(); //lancia la funzione
24
25function numeri_sezione() {
26global $prefix, $dbi, $circo, $genere,$id_cons_gen,$id_cons,$id_circ,$tipo_cons,$votog,$id_comune;
27
28
29if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'";
30else $circos='';
31
32 if ($genere==0) $tab="ref";elseif($genere=='4' || $votog) $tab="lista";
33 else $tab="gruppo";
34
35
36
37 # numero sezioni
38 $sql="select t1.id_sez,t1.num_sez 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' $circos order by t1.num_sez";
39 $res = $dbi->prepare("$sql");
40 $res->execute();
41
42 $max = $res->rowCount();
43 if(!isset($html)) $html='';
44 $html = "\n<table style=\"margin:0px auto;border:0px; width:90%\"><tr>";
45
46 $i=0;$id_circ_old=0;$e=0;
47 while(list($sez_id, $sez_num) = $res->fetch(PDO::FETCH_NUM)) {
48 $i++;
49 /****************************************************************/
50 /* suddivisione in circoscrizione - attivare se Ú il caso
51
52 $result = mysql_query("SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ", $dbi);
53 list($circ_id) = mysql_fetch_row($result);
54 if($circ_id!=$id_circ_old){
55 $id_circ_old=$circ_id;
56 $result2 = mysql_query("SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and id_circ='$circ_id' ", $dbi);
57 list($descrizione) = mysql_fetch_row($result2);
58 echo "</tr></table><table><tr><td>$descrizione</td></tr></table>";
59 echo "\n<table align=\"left\" border=\"0\" width=\"90%\"><tr bgcolor=\"$bgcolor1\">";
60 }
61 */
62
63 #colora la sezione
64 # verifica se la sezione Ú scrutinata
65 $sql="select * from ".$prefix."_ele_voti_".$tab." where id_sez='$sez_id'";
66 $res2 = $dbi->prepare("$sql");
67 $res2->execute();
68
69 $numero=$res2->rowCount();
70 if ($numero!=0){$e++;$bgsez="#FFFF00";}else{$bgsez="";}
71
72
73 if ($genere==0) $pos="gruppo_sezione";elseif($genere=='4' || $votog) $pos="lista_sezione";
74 else $pos="gruppo_sezione";
75
76 $html .="<td style=\"margin:0px auto; text-align:center; width:5%;background-color:$bgsez;\" ><a href=\"modules.php?id_cons_gen=$id_cons_gen&amp;name=Elezioni&amp;id_comune=$id_comune&amp;perc=true&amp;file=index&amp;op=$pos&amp;minsez=$sez_num&amp;offsetsez=$sez_num\"><b>$sez_num</b></a></td>";
77
78 if (($i%5) ==0) $html .="</tr>\n<tr>";
79 }
80 while($i%5!=0) {$i++; $html.="<td></td>";}
81 $html .="</tr></table>\n";
82 // stampa
83 if($e!='0'){
84 echo "<div><h5>"._SEZSCRU."</h5></div>";
85 echo "<img style=\"display:block;margin:0px auto;text-align:center;\" alt=\"Grafico\" src=\"modules/Elezioni/grafici/ledex2.php?sez=$e&amp;max=$max\" />";
86
87 echo $html; }
88}
89
90
91?>
Note: See TracBrowser for help on using the repository browser.