source: trunk/admin/modules/Elezioni/ele_voti.php@ 404

Last change on this file since 404 was 384, checked in by roby, 22 months ago
  • ADMIN
  • Continua lo sviluppo della funzione di aggiornamento.
  • Modifiche alla gestione di consultazioni circoscrizionali
  • CLIENT
  • Modifica alla funzione di proiezione dell'assegnazione dei seggi per gestire il caso della legge regionale siciliana relativamente a comuni sotto i 15.000 abitanti (da completare, non tutti i casi sono ancora gestiti).
  • Modifiche alla gestione di consultazioni circoscrizionali
  • Modifiche ai link dei menu per il cambio di tema
File size: 19.4 KB
RevLine 
[254]1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Roberto Gigli & Luciano Apolito */
5/* http://www.eleonline.it */
[384]6/* info@eleonline.it rgigli@libero.it */
[254]7/************************************************************************/
8/* Modulo Inserimento dati */
9/* Amministrazione */
10/************************************************************************/
11
12if (!defined('ADMIN_FILE')) {
13 die ("You can't access this file directly...");
14}
[257]15global $dbi;
[254]16$aid=$_SESSION['aid'];
17$prefix=$_SESSION['prefix'];
18$currentlang=$_SESSION['lang'];
19$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
20$vari= implode(',',$_GET);//param);
21$id_comune=$_SESSION['id_comune'];
22$id_cons_gen=intval($_GET['id_cons_gen']);
23$perms=ChiSei($id_cons_gen);
24if ($perms<16 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
[344]25if (isset($param['do'])) $do=addslashes($param['do']); else $do='';
[254]26//if (isset($param['id_cons'])) $id_cons=intval($param['id_cons']); else $id_cons='';
27if (isset($param['ops'])) $ops=intval($param['ops']); else $ops='';
28if (isset($param['min'])) $min=intval($param['min']); else $min=0;
29if (isset($param['ok'])) $ok=intval($param['ok']); else $ok='';
30if (isset($param['ov'])) $ov=intval($param['ov']); else $ov='';
31if (isset($param['mv'])) $mv=intval($param['mv']); else $mv='';
32if (isset($param['gv'])) $gv=intval($param['gv']); else $gv='';
33if (isset($param['msv'])) $msv=intval($param['msv']); else $msv='';
34if (isset($param['av'])) $av=intval($param['av']); else $av='';
35if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else
36 if (isset($_SESSION['id_circ'])) $id_circ=intval($_SESSION['id_circ']); else $id_circ='0';
37if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede='0';
38if (isset($param['id_sez'])) $id_sez=intval($param['id_sez']); else $id_sez='';
39if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='0';
40if (isset($param['prev_sez'])) $prev_sez=intval($param['prev_sez']); else $prev_sez='0';
41if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='0';
42if (isset($param['update'])) $update=intval($param['update']); else $update='';
43include("modules/Elezioni/funzionidata.php");
44include("modules/Elezioni/ele.php");
[360]45include_once("modules/Elezioni/ele_spoglio.php");
[254]46global $votolista, $limite, $dettnulli,$disgiunto;
47if(!isset($votolista)) $votolista=0;
[257]48$sql="SELECT tipo_cons FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'" ;
49$res = $dbi->prepare("$sql");
50$res->execute();
51
52
53list($tipo_cons) = $res->fetch(PDO::FETCH_NUM);
[254]54if ($tipo_cons!=3 or $votolista==1) $limite=0; #die ("limite: $limite");}
[257]55$sql="SELECT count(id_circ) FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' ";
56$res = $dbi->prepare("$sql");
57$res->execute();
58
59
60list($num_circ)=$res->fetch(PDO::FETCH_NUM);
61$sql="SELECT solo_gruppo,disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";
62$res = $dbi->prepare("$sql");
63$res->execute();
64
65
[338]66
[257]67list($dettnulli,$disgiunto)=$res->fetch(PDO::FETCH_NUM);
[338]68
69$sql="SELECT circo FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' ";
70$res = $dbi->prepare("$sql");
71$res->execute();
72list($conscirc)=$res->fetch(PDO::FETCH_NUM);
[254]73if ($conscirc){ // or $num_circ==1
74 if (!$id_circ){
75 if (!$id_sez){
[257]76 $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez='1'";
77$res = $dbi->prepare("$sql");
78$res->execute();
79
80
81 list($id_sez)=$res->fetch(PDO::FETCH_NUM);
[254]82 }
[257]83 $sql="SELECT t1.id_circ FROM ".$prefix."_ele_sede as t1 left join ".$prefix."_ele_sezioni as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and t2.id_sez='$id_sez'";
84$res = $dbi->prepare("$sql");
85$res->execute();
86
87
88 #$sql="SELECT id_circ FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ limit 0,1";
[338]89//$res = $dbi->prepare("$sql");
90//$res->execute();
[257]91
92
[361]93 if (!$res->rowCount()) die("Errore, non trovo circoscrizioni inserite! Consultare l'amministratore");
[257]94 list($id_circ)=$res->fetch(PDO::FETCH_NUM);
[254]95 $_SESSION['id_circ']=$id_circ;
96 }
[361]97 $sql="select id_sede from ".$prefix."_ele_sede where id_circ='$id_circ'";
[257]98$result = $dbi->prepare("$sql");
99$result->execute();
100
101
[254]102 $i=0;
[257]103 while(list($tmp) = $result->fetch(PDO::FETCH_NUM)) $idsedi[$i++]=$tmp;$tmp=implode (",",$idsedi);
[254]104 unset($idsedi);$i=0;$idsezi=array();unset($result);
[257]105 $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_sede in ($tmp)";
106$result = $dbi->prepare("$sql");
107$result->execute();
108
109
[254]110 unset($tmp);
[257]111 while(list($tmp) = $result->fetch(PDO::FETCH_NUM)) $idsezi[$i++]=$tmp;
[254]112 $tmp=implode (",",$idsezi);
113 $sezi = "and id_sez in ($tmp)";
[338]114 $circo = "and id_circ=$id_circ";
[254]115}else{
116 $sezi='';
117 $circo='';
118}
119
120// Offset - visualizza il numero di elementi per pagina
121$offset=2;
122if (!isset($min)) $min=0;
123$hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
124
125function numeri_sezione($nums) {
126// tabella visualizzazione sezioni per numero
[329]127global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$id_cons,$id_lista,$ops, $perms,$id_sez,$num_ril,$status,$idrefgruppo,$votog,$votol,$votoc;
[254]128$idrefgruppo='';
129 $solosede='';
130 if ($perms<32) {
[257]131 $sql="SELECT id_sede FROM ".$prefix."_ele_operatori where aid='$aid' and id_cons=$id_cons";
132$res = $dbi->prepare("$sql");
133$res->execute();
134
135
[254]136 if ($res) {
[257]137 list($solouna)=$res->fetch(PDO::FETCH_NUM);
[254]138 if ($solouna>0) $solosede="and id_sede='$solouna'";
139 }
140 }
[258]141 $sql="SELECT num_sez, id_sez ,id_sede,colore FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $solosede order by num_sez";
[257]142$res = $dbi->prepare("$sql");
143$res->execute();
144
145
146 $max = $res->rowCount();
[254]147 //if ($max>=64){
148 $i=0;
149 echo "\n<table align=\"left\" width=\"100%\" border=\"3\"><tr bgcolor=\"$bgcolor1\"><td>";
150
151
152 echo "<div id=\"navmenu\"> <ul>";
[260]153 while(list($sez_num, $sez_id ,$sede_id,$colore) = $res->fetch(PDO::FETCH_NUM)) {
[307]154# $ops='';
[254]155 if(!$id_sez) {$id_sez=$sez_id; $id_sede=$sede_id;}
156 $i++;
[258]157 $sql="SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ";
[257]158$result = $dbi->prepare("$sql");
159$result->execute();
160
161
162 list($circ_id) = $result->fetch(PDO::FETCH_NUM);
[260]163
[254]164 if(!$ops) $ops=1;
[257]165 $sql="SELECT num_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'";
166$res2 = $dbi->prepare("$sql");
167$res2->execute();
168
169
170 list($numero_sez) = $res2->fetch(PDO::FETCH_NUM);
[260]171 if ($sez_num==$numero_sez) {
172 $cursez= "style=\" background: $colore; border: solid; border-color: YELLOW; border-width: 4px; border-left: solid gray 4px; border-top: solid gray 4px; \"";}
173 else $cursez="style=\" background: $colore; \"";
[254]174 echo "\n<li $cursez><b><a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;id_circ=$circ_id&amp;id_sede=$sede_id&amp;id_sez=$sez_id&amp;ops=$ops&amp;do=spoglio&amp;id_lista=$id_lista\">$sez_num</a></b></li>\n";
175 }
176 //}
177echo "</ul></div></td></tr></table>\n";
178 //}// fine tabella per numero sezioni
179}
180///////////////////////////////////////////////////////////////////////////////////
181
182
183function voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista) {
[338]184 global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$prev_sez,$votog,$votol,$votoc,$conscirc,$id_sez,$ops,$circo;
[254]185
186 echo "<table border=\"0\" width=\"760\" align=\"left\"><tr>";
187 echo "\n<td bgcolor=\"$bgcolor1\" align=\"left\">";
188 numeri_sezione(22);
189 echo "\n</td></tr><tr><td>\n";
190
191
192 ///////////////////////
193 // Circoscrizione : scelta
194 ///////////////////////
[368]195# if($id_sez) $consez=" and id_sez
196 $sql="SELECT t1.id_sede,t2.id_circ,t1.id_sez FROM ".$prefix."_ele_operatori as t1,
[254]197 ".$prefix."_ele_sede as t2
[257]198 where t1.id_cons='$id_cons' AND t1.id_sede=t2.id_sede and t1.aid='$aid'";
199$resoper = $dbi->prepare("$sql");
200$resoper->execute();
201
202
[368]203 list($id_sede2,$id_circ2,$id_sez2) = $resoper->fetch(PDO::FETCH_NUM);
204 if($id_sez2) $id_sez=$id_sez2;
[254]205 if ($id_sede2 and !($id_sede==$id_sede2)) {
206 $id_sede=$id_sede2;
207 $id_circ=$id_circ2;
208 $do="spoglio";
[368]209 $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'";
210 $res = $dbi->prepare("$sql");
211 $res->execute();
212 if(!$res->rowCount()) {
213 $sql="SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sede=$id_sede order by num_sez limit 0,1";
214 $res = $dbi->prepare("$sql");
215 $res->execute();
216 list($id_sez) = $res->fetch(PDO::FETCH_NUM);
217 }
[254]218 }
219 if ($do == "circo") {
220 OpenTable();
221 echo "<tr><td><form name=\"voti\" action=\"admin.php\">"
222 ."<input type=\"hidden\" name=\"op\" value=\"voti\">"
223 ."<input type=\"hidden\" name=\"do\" value=\"sede\">"
224 // Circoscrizione: lista
225 //**************************************
226 .""._CIRCO.": "
227 ."<select name=\"id_circ\">";
[257]228 $sql="SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ";
229$res = $dbi->prepare("$sql");
230$res->execute();
231
232
233 while(list($id,$descr) = $res->fetch(PDO::FETCH_NUM)) {
[254]234 if ($descr!="Tutte"){
235 if ($id == $id_circ) {
236 $sel = "selected";
237 } else {
238 $sel = "";
239 }
240 echo "<option value=\"$id\" $sel>$descr";
241 }
242 }
243 echo "</select>"
244 //***********************************
245 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
246 ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
247 ."</form></td></tr>";
248 CloseTable();
249 }
250
251 ///////////////////////
252 // sede : scelta
253 ///////////////////////
254
255
256 if ($do == "sede") {
257 OpenTable();
258 echo "\n<tr><td><form name=\"sede\" action=\"admin.php\">";
[257]259 $sql="SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' AND id_circ='$id_circ' order by num_circ";
260$res = $dbi->prepare("$sql");
261$res->execute();
262
263
264 list( $descr_circ) = $res->fetch(PDO::FETCH_NUM);
[254]265 echo "<a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;do=circo\">"._CIRCO."</a> $descr_circ ->";
266 echo "<input type=\"hidden\" name=\"op\" value=\"voti\">"
267 ."<input type=\"hidden\" name=\"do\" value=\"spoglio\">"
268
269 // Indirizzo: lista
270 //**************************************
271 .""._INDIRIZZO.": "
272 ."<select name=\"id_sede\">";
[257]273 $sql="SELECT id_sede,indirizzo FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_circ='$id_circ' order by indirizzo";
274$res = $dbi->prepare("$sql");
275$res->execute();
276
277
[254]278// echo "$id_circ - $id_cons";
[257]279 while(list($id,$indir) = $res->fetch(PDO::FETCH_NUM)) {
[254]280 if ($id == $id_sede) {
281 $sel = "selected";
282 } else {
283 $sel = "";
284 }
285 echo "<option value=\"$id\" $sel>$indir";
286 }
287 echo "</select>"
288 //*************************************
289 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
290 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
291 ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
292 ."</form></td></tr>\n";
293 CloseTable();
294 }
295
296 ///////////////////////
297 // sezione : scelta
298 ///////////////////////
299 if ($do == "spoglio") {
300
301
302 //************************************
303 // Menu spoglio
304 //************************************
[342]305 $sql="select id_cons,id_sez,id_sede,num_sez, maschi, femmine from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";
306 $result = $dbi->prepare("$sql");
307 $result->execute();
308 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = $result->fetch(PDO::FETCH_NUM);
[360]309 $sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' group by tipo";
310$rese = $dbi->prepare("$sql");
311$rese->execute();
312$id_comune=$_SESSION['id_comune'];
[361]313$bordoini="style='cursor: pointer;";
314$errbordoa='';
315$errbordog='';
316$errbordol='';
[360]317while (list($tipo)=$rese->fetch(PDO::FETCH_NUM)) {
[361]318 if ($tipo=='affluenze') $errbordoa="border: 6px solid; border-color: rgb(255, 0, 0);";
319 if ($tipo=='gruppo' or $tipo=='referendum') $errbordog="border: 6px solid; border-color: rgb(255, 0, 0);";
320 if ($tipo=='lista') $errbordol="border: 6px solid; border-color: rgb(255, 0, 0);";
[360]321}
[361]322$bordoa=$bordoini.$errbordoa."'";
323$bordog=$bordoini.$errbordog."'";
324$bordol=$bordoini.$errbordol."'";
[360]325echo "<SCRIPT type=\"text/javascript\">\n";
326echo "function vai_scelta(idrif){\n";
327echo "window.document.location.href=idrif\n";
328echo "}\n";
329echo "</script>\n";
330if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\""; else $segna='';
331if($ops=="4" ) {$bgcolorg="yellow"; $tcolorg='blue';} else {$bgcolorg="grey"; $tcolorg='white';} #$active_gruppo=" class=\"ui-btn-active\""; else $active_gruppo='';
332if($ops=="3") {$bgcolorl="yellow"; $tcolorl='blue';} else {$bgcolorl="grey"; $tcolorl='white';} # $active_lista=" class=\"ui-btn-active\""; else $active_lista='';
333if($ops=="1") {$bgcolora="yellow"; $tcolora='blue';} else {$bgcolora="grey"; $tcolora='white';} # $active_aff=" class=\"ui-btn-active\""; else $active_aff='';
[365]334echo "<div data-role=\"content\" data-theme=\"a\"><hr><h2>Sezione n. $num_sez</h2><table style=\"margin-left:auto; margin-right:auto;\"><tr>";
[360]335#<a href=\"admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=1\"></a>
[384]336echo "\n<td bgcolor=\"$bgcolora\" align=\"center\" $bordoa onClick=\"vai_scelta('admin.php?op=voti&amp;id_comune=$id_comune&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio&amp;ops=1');\"><p style=\"margin-left:10px;margin-right:10px;\"><font color=\"$tcolora\"><b>"._AFFLUENZE."</font></b></p></td>\n";
[360]337if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){
[384]338 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?op=voti&amp;id_comune=$id_comune&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio&amp;ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n";
[360]339}
340if($genere==2 and $votog)
[384]341 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?op=voti&amp;id_comune=$id_comune&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio&amp;ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n";
[362]342elseif($genere>=4 and !$votoc)
[384]343 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?op=voti&amp;id_comune=$id_comune&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio&amp;ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTAPREF."</font></b></p></td>\n";
[360]344elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){
[384]345 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?op=voti&amp;id_comune=$id_comune&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio&amp;ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTA."</font></b></p></td>\n";
[360]346}
347echo "</tr></table><hr></div>\n";
348/*
[342]349 echo "<hr><table><tr><td width=\"200\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione N. $num_sez</b></font></td><td><table><tr>";
350 echo "\n<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_sede=$id_sede&amp;do=spoglio&amp;ops=1\">"._AFFLUENZE."</a></b></p></td>\n";
351 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){
352 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_sede=$id_sede&amp;do=spoglio&amp;ops=4\">"._GRUPPO."</a></b></p></td>\n";
353 }
354 if($genere==2 and $votog)
355 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_sede=$id_sede&amp;do=spoglio&amp;ops=4\">"._GRUPPO."</a></b></p></td>\n";
356 elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){
357 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_sede=$id_sede&amp;do=spoglio&amp;ops=3\">"._LISTA."</a></b></p></td>\n";
358 }
359 echo "</tr></table></td></tr></table><hr>\n";
[360]360*/
[254]361#############
362# posizionamento in mancanza di scelta
363#############
364if (!$ops){
365 if (!$id_sez) { echo"";#import( pagina di help );
366 } else{
[257]367 $sql="SELECT data, orario from ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1";
[342]368 $res = $dbi->prepare("$sql");
369 $res->execute();
[257]370 list($data,$orario)=$res->fetch(PDO::FETCH_NUM);
371 $sql="SELECT voti_complessivi from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and orario='$orario' and data='$data'";
[342]372 $res = $dbi->prepare("$sql");
373 $res->execute();
[257]374 list($voti) = $res->fetch(PDO::FETCH_NUM);
[254]375 if (!$voti) $ops=1;
376 else {
377 if($genere<4){
[257]378 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'";
[342]379 $res = $dbi->prepare("$sql");
380 $res->execute();
[257]381 list($voti) = $res->fetch(PDO::FETCH_NUM);
[254]382 if ($voti==0 or $genere<3) $ops=4;
383 }
384 if(!$ops) $ops=3;
385 }
386
387 }
388}
389############ fine posizionamento
390
391 ///////////////////////////////////////////
392 // opzioni per le funzioni di immissione
393
394 if ($ops == 1) {
395 votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av);
396 }else{
397############# Controllo flag per cancellazione consultazione
398 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
399 ."//-->\n";
400 echo "function del_dati() {\n";
401 echo "if (document.getElementById('pwd3').checked==false) {\n";
402 echo "document.getElementById('update').value=\""._OK."\" \n";
403 echo "document.getElementById('do').value=\"0\" \n";
404 echo "}else{\n";
405 echo "document.getElementById('update').value=\""._DELETE."\" \n";
406 echo "document.getElementById('do').value=\"1\" \n";
407 echo "} \n";
408 echo "} \n";
409 echo "</script>\n";
410 }
411 if ($ops == 3) {
412 preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
413 }
414 if ($ops == 4) {
415 preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
416
417 }
418
419 }
420 CloseTable();
421
422}
423
[324]424
425
426
[254]427 if (!preg_match("/rec/",$op)) {
428 ele(); //menu
429/* echo "\n<table align=\"left\" border=\"0\" width=\"200\"><tr bgcolor=\"$bgcolor1\">";
430 numeri_sezione(8);
431 echo "<td></td></tr></table>\n";*/
432 echo"</td></tr></table>";
433 }
434
435 switch ($op){
436 case "voti": //fa eccezione perche' chiamata con minor numero di parametri - riesaminare
437# voti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
438 voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
439 break;
[258]440 case "rec_add_votanti":
441 rec_add_votanti($vari);
442 break;
[254]443 default :
444 $op($vari); //chiamata a funzione variabile con parametri variabili (da cambiare!)
445 }
446echo"</td></tr></table>";
447 include_once("modules/Elezioni/language/lang-$currentlang.php");
448 include ("footer.php");
449?>
450
Note: See TracBrowser for help on using the repository browser.