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

Last change on this file since 62 was 62, checked in by roby, 14 years ago

In client: corretto notice in widget 04_sezioni -
in admin: spostato elenco delle sezioni in alto e inserito controllo di congruenza generale

File size: 2.9 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 = mysql_query("select chiusa from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'",$dbi);
14 list($chiusa) = mysql_fetch_row($sql);
15 if($chiusa!='1') numeri_sezione();
16 //echo $chiusa;
17
18
19
20function numeri_sezione() {
21global $prefix, $dbi, $circo, $genere,$id_cons_gen,$id_cons,$id_circ,$tipo_cons,$votog;
22
23
24if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'";
25else $circos='';
26
27 if ($genere==0) $tab="ref";elseif($genere=='4' || $votog) $tab="lista";
28 else $tab="gruppo";
29
30 # numero sezioni
31 $res = mysql_query("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",$dbi);
32 $max = mysql_num_rows($res);
33 if(!isset($html)) $html='';
34 $html = "\n<table style=\"margin:0px auto;border=0px; width:90%\"><tr>";
35
36 $i=0;$id_circ_old=0;$e=0;
37 while(list($sez_id, $sez_num) = mysql_fetch_row($res)) {
38 $i++;
39 /****************************************************************/
40 /* suddivisione in circoscrizione - attivare se Ú il caso
41
42 $result = mysql_query("SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ", $dbi);
43 list($circ_id) = mysql_fetch_row($result);
44 if($circ_id!=$id_circ_old){
45 $id_circ_old=$circ_id;
46 $result2 = mysql_query("SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and id_circ='$circ_id' ", $dbi);
47 list($descrizione) = mysql_fetch_row($result2);
48 echo "</tr></table><table><tr><td>$descrizione</td></tr></table>";
49 echo "\n<table align=\"left\" border=\"0\" width=\"90%\"><tr bgcolor=\"$bgcolor1\">";
50 }
51 */
52
53 #colora la sezione
54 # verifica se la sezione Ú scrutinata
55 $res2 = mysql_query("select * from ".$prefix."_ele_voti_".$tab." where id_sez='$sez_id'",$dbi);
56 $numero=mysql_num_rows($res2);
57 if ($numero!=0){$e++;$bgsez="#FFFF00";}else{$bgsez="";}
58
59
60
61
62 $html .="<td style=\"margin:0px auto; text-align:center; width:5%;\" bgcolor=\"$bgsez\"><b>$sez_num</b></td>";
63
64 if (($i%8) ==0) $html .="</tr>\n<tr>";
65 }
66
67 $html .="</tr></table>\n";
68 // stampa
69 if($e!='0'){
70 echo "<div><h5>"._SEZSCRU."</h5></div>";
71 echo "<center> <img alt=\"Grafico\" src=\"modules/Elezioni/grafici/ledex2.php?sez=$e&max=$max\" /></center>";
72
73 echo $html; }
74}
75
76
77?>
Note: See TracBrowser for help on using the repository browser.