- Timestamp:
- Mar 14, 2022, 5:13:56 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r359 r360 139 139 140 140 try{ 141 $dbi = new PDO("mysql:host=$dbhost;charset= latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));141 $dbi = new PDO("mysql:host=$dbhost;charset=utf8", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); 142 142 $sql = "use $dbname"; 143 143 $dbi->exec($sql); … … 147 147 echo $sql . "<br>" . $e->getMessage(); 148 148 } 149 150 149 $sth = $dbi->prepare("SET SESSION character_set_connection = 'utf8' "); 150 $sth->execute(); 151 $sth = $dbi->prepare("SET SESSION character_set_client = 'utf8' "); 152 $sth->execute(); 153 $sth = $dbi->prepare("SET SESSION character_set_database = 'utf8' "); 154 $sth->execute(); 155 $sth = $dbi->prepare("SET CHARACTER SET utf8"); 156 $sth->execute(); 157 158 $sth = $dbi->prepare("SET NAMES 'utf8'"); 159 $sth->execute(); 160 $sth = $dbi->prepare("select * from ".$prefix."_config"); 161 $sth->execute(); 162 151 163 # $dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error()); 152 164 # mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error()); … … 264 276 $id_comune=$_SESSION['id_comune']; 265 277 if($id_comune==0) $rifcomune='58047'; else $rifcomune=$id_comune; 266 if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']);278 if (isset($_GET['id_cons_gen'])) {$id_cons_gen=intval($_GET['id_cons_gen']);} 267 279 else { 268 $sql="SELECT t1.id_cons_gen FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons=t2.id_cons and t2.id_comune='$id_comune'"; 269 $sth = $dbi->prepare($sql); 270 $sth->execute(); 271 $row = $sth->fetch(PDO::FETCH_BOTH); 272 if($sth->rowCount()) 273 $id_cons_gen=$row[0]; 274 else 275 $id_cons_gen=0; #die("TEST IN CORSO : idconsgen: $id_cons_gen -- sql:select id_cons_gen from ".$prefix."_ele_cons_comune where preferita='1' and (id_comune='$id_comune' or id_comune=0)"); 276 } 280 $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y"))); 281 $sql="select t1.id_cons_gen from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.data_fine>'$oggi' and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and id_sez>0 and permessi>0) limit 0,1"; 282 $rese = $dbi->prepare("$sql"); 283 $rese->execute(); 284 if($rese->rowCount()) 285 {list($id_cons_gen)=$rese->fetch(PDO::FETCH_NUM); } 286 else { 287 $sql="SELECT t1.id_cons_gen FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons=t2.id_cons and t2.id_comune='$id_comune'"; 288 $sth = $dbi->prepare($sql); 289 $sth->execute(); 290 $row = $sth->fetch(PDO::FETCH_BOTH); 291 if($sth->rowCount()) 292 $id_cons_gen=$row[0]; 293 else 294 $id_cons_gen=0; #die("TEST IN CORSO : idconsgen: $id_cons_gen -- sql:$sql"); 295 } 296 } 277 297 $currentlang=$_SESSION['lang']; 278 298 #$bgcolor1=$_SESSION['bgcolor1']; … … 281 301 $session=$_SESSION['remote']; 282 302 283 $perms=ChiSei($id_cons_gen); 284 if($perms==0) logout();303 $perms=ChiSei($id_cons_gen); #die("qui".$_SESSION['aid']); 304 if($perms==0) {logout();} 285 305 } 286 306 … … 296 316 $pwd=$_SESSION['pwd']; 297 317 $id_comune=$_SESSION['id_comune']; 298 299 318 300 319 $perms=0; … … 325 344 if($row[0]==0) $msglogout=1; 326 345 if ($sth->rowCount()==1) $perms=$row[0]; else { $msglogout=1; $perms=0; } 346 327 347 return $perms; 328 348 #} else return 0; … … 404 424 Header("Location: admin.php?id_comune=$id_comune&language=$lang"); 405 425 */ 426 406 427 global $siteistat,$perms,$msglogout; 407 428 $language=$_SESSION['lang']; … … 432 453 $sth = $dbi->prepare("$sql"); 433 454 $sth->execute(); 434 if ($sth->rowCount()) list($id_cons) = $sth->fetch(PDO::FETCH_NUM); 435 $_SESSION['id_cons']=$id_cons; 455 if ($sth->rowCount()) { 456 list($id_cons) = $sth->fetch(PDO::FETCH_NUM); 457 $_SESSION['id_cons']=$id_cons; 458 } 436 459 } 437 460 if(isset($id_cons)) { 438 $sql="SELECT id_sez FROM ".$prefix."_ele_operatori where id_ cons=$id_consand aid='$aid' and id_comune=$id_comune";461 $sql="SELECT id_sez FROM ".$prefix."_ele_operatori where id_sez>0 and aid='$aid' and id_comune=$id_comune"; 439 462 $resmod = $dbi->prepare("$sql"); 440 463 $resmod->execute(); 441 list($id_sez) = $resmod->fetch(PDO::FETCH_NUM); 442 if($id_sez) $tema='Futura2';#die( "TEST id_cons:$id_cons:"); 443 $_SESSION['tema']=$tema; 464 list($id_sez) = $resmod->fetch(PDO::FETCH_NUM); #die("qui:$id_sez:$sql"); 465 if($id_sez) { 466 $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y"))); 467 $sql="select t1.id_cons_gen,t1.descrizione,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_comune=$id_comune and t1.data_fine>'$oggi' and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and id_sez>0 and permessi>0)"; 468 $resmod = $dbi->prepare("$sql"); 469 $resmod->execute(); 470 if ($resmod->rowCount()>0) { 471 $tema='Futura2'; #die( "TEST id_cons:$id_cons:".$_SESSION['aid']); 472 $_SESSION['tema']=$tema; 473 } else logout(); 474 } 444 475 } 445 476 } … … 449 480 if (isset($param['op'])) $op=addslashes($param['op']); else $op='ele'; 450 481 //if (isset($param['op'])) $op=$param['op']; else $op='ele'; 451 #die( "OP: $op"); 482 # 483 #die("TEST: qui $aid $id_cons $id_sez ".$_SESSION['aid']); 452 484 if (isset($_SESSION['aid']) AND $_SESSION['remote']==$_SERVER['REMOTE_ADDR']) { 453 485 if($tema=='Futura2' and $op!='logout') -
trunk/admin/aggiornadb.php
r359 r360 80 80 81 81 82 $num=0; 82 83 83 84 84 function controllo($tabella,$campo,$num) … … 93 93 } 94 94 95 $sql="SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '$dbname' AND COLUMN_NAME = 'Versione'"; 96 $res = $dbi->prepare("$sql"); 97 $res->execute(); 95 $num=0; 98 96 99 97 if(!controllo($prefix.'_config','versione',++$num)) -
trunk/admin/header.php
r359 r360 62 62 echo "<html>\n"; 63 63 echo "<head>\n"; 64 # echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso8859-1\">\n"; 64 65 echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; 65 66 echo "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n"; -
trunk/admin/modules/Elezioni/ele_candidato.php
r358 r360 283 283 }else{ 284 284 $pro= $sthcan->fetch(PDO::FETCH_BOTH); 285 $dati = htmlentities($_pro['cognome'], ENT_QUOTES, "UTF-8"); 285 286 $sql="delete from ".$prefix."_ele_candidati where id_cand='$id_cand'"; 286 287 $sth = $dbi->prepare("$sql"); 287 288 $sth->execute(); 288 289 $result=$sth->rowCount(); 289 $sql="insert into ".$prefix."_ele_log values ('$id_cons','$id_sez','$username','$data','$tempo','DELETE:id_lista:$pro[id_lista],cognome:$ pro[cognome],nome:$pro[nome]','','".$prefix."_ele_candidati')";290 $sql="insert into ".$prefix."_ele_log values ('$id_cons','$id_sez','$username','$data','$tempo','DELETE:id_lista:$pro[id_lista],cognome:$dati,nome:$codifica:$pro[nome]','','".$prefix."_ele_candidati')"; 290 291 $sth = $dbi->prepare("$sql"); 291 292 $sth->execute(); -
trunk/admin/modules/Elezioni/ele_controlli.php
r358 r360 16 16 list($maschi,$femmine)=$res->fetch(PDO::FETCH_NUM); 17 17 18 $sql="select voti_uomini,voti_donne,voti_complessivi from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_parz='$id_parz'"; 19 $res = $dbi->prepare("$sql"); 20 $res->execute(); 21 while(list($voti_u,$voti_d,$voti_t)=$res->fetch(PDO::FETCH_NUM)) 22 if((($voti_u+$voti_d!=$voti_t && $voti_u+$voti_d>0) || $voti_u>$maschi || $voti_d>$femmine || $voti_t>$maschi+$femmine) ) {$err=1; break;} 23 18 $sql="select voti_uomini,voti_donne,voti_complessivi,id_gruppo from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' order by id_gruppo,data,orario"; 19 $res = $dbi->prepare("$sql"); 20 $res->execute(); 21 $votiu2=0;$votid2=0;$votit2=0;$idg2=-1; 22 while(list($voti_u,$voti_d,$voti_t,$idg)=$res->fetch(PDO::FETCH_NUM)) { 23 if($idg2!=$idg) { 24 $votiu2=0;$votid2=0;$votit2=0; 25 $idg2=$idg; 26 } 27 if((($voti_u+$voti_d!=$voti_t && $voti_u+$voti_d>0) || $voti_u>$maschi || $voti_d>$femmine || $voti_t>$maschi+$femmine ||$voti_u<$votiu2 ||$voti_d<$votid2 || $voti_t<$votit2) ) { 28 $err=1; break;} 29 $votiu2=$voti_u;$votid2=$voti_d;$votit2=$voti_t; 30 } 24 31 $tipo='affluenze'; 25 32 $sql="select id from ".$prefix."_ele_controlli where tipo='$tipo' and id_sez='$id_sez' "; … … 28 35 $righe=$res->rowCount(); 29 36 if($righe){ 30 while(list($id)=$res->fetch(PDO::FETCH_NUM)){ 31 if($id==$id_parz){37 while(list($id)=$res->fetch(PDO::FETCH_NUM)){#die("$sql"); 38 # if($id==$id_parz){ 32 39 if(!$err){ 33 $sql="delete from ".$prefix."_ele_controlli where tipo='$tipo' and id ='$id_parz' ";40 $sql="delete from ".$prefix."_ele_controlli where tipo='$tipo' and id_sez='$id_sez' "; 34 41 $res = $dbi->prepare("$sql"); 35 42 $res->execute(); … … 38 45 $err=0; 39 46 break; 40 }47 # } 41 48 } 42 49 } 43 50 if($err){ 44 $sql="insert into ".$prefix."_ele_controlli value('$id_cons','$id_sez','$tipo','$id _parz')";51 $sql="insert into ".$prefix."_ele_controlli value('$id_cons','$id_sez','$tipo','$idg2')";#die("$sql"); 45 52 $res = $dbi->prepare("$sql"); 46 53 $res->execute(); … … 141 148 ############################## 142 149 $err=0; $err2=0; 143 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 150 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'"; 144 151 $resref = $dbi->prepare("$sql"); 145 152 $resref->execute(); 146 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'";153 $sql="SELECT sum(voti),count(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'"; 147 154 $resref = $dbi->prepare("$sql"); 148 155 $resref->execute(); 149 list($votig )=$resref->fetch(PDO::FETCH_NUM);156 list($votig,$numrec)=$resref->fetch(PDO::FETCH_NUM); 150 157 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez'"; 151 158 $res3 = $dbi->prepare("$sql"); … … 156 163 $res2->execute(); 157 164 list($validi) = $res2->fetch(PDO::FETCH_NUM); 158 if($validi ) {165 if($validi and $numrec) { 159 166 $status=0; 160 167 $query="SELECT validi,nulli,bianchi,contestati,voti_nulli,solo_gruppo,validi_lista,contestati_lista,voti_nulli_lista,solo_lista FROM ".$prefix."_ele_sezioni as t1 where t1.id_sez='$id_sez'"; … … 382 389 383 390 if(!$err){ 384 $sql="delete from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' ";391 $sql="delete from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' and id='$id_lista'"; 385 392 $res = $dbi->prepare("$sql"); 386 393 $res->execute(); … … 388 395 389 396 if($err){ 390 $sql="select * from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' ";397 $sql="select * from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' and id='$id_lista'"; 391 398 $res = $dbi->prepare("$sql"); 392 399 $res->execute(); … … 395 402 $sql="insert into ".$prefix."_ele_controlli value('$id_cons','$id_sez','$tipo','$id_lista')"; 396 403 $res = $dbi->prepare("$sql"); 397 $res->execute(); 404 $res->execute(); #die("TEST $sql"); 398 405 } 399 406 } -
trunk/admin/modules/Elezioni/ele_lista.php
r344 r360 26 26 include("modules/Elezioni/funzionidata.php"); 27 27 include("modules/Elezioni/ele.php"); 28 if (isset($param['mex'])) $mex= addslashes($param['mex']); else $mex='';29 if (isset($param['do'])) $do= addslashes($param['do']); else $do='';28 if (isset($param['mex'])) $mex=htmlentities($param['mex'], ENT_QUOTES, "UTF-8"); else $mex=''; 29 if (isset($param['do'])) $do=htmlentities($param['do'], ENT_QUOTES, "UTF-8"); else $do=''; 30 30 if (isset($param['min'])) $min=intval($param['min']); else $min=0; 31 if (isset($param['ok'])) $ok= addslashes($param['ok']); else $ok='';31 if (isset($param['ok'])) $ok=htmlentities($param['ok'], ENT_QUOTES, "UTF-8"); else $ok=''; 32 32 if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista=0; 33 33 if (isset($param['id_circ'])) {$id_circ=intval($param['id_circ']); $_SESSION['id_circ']=$id_circ;} else … … 36 36 if (isset($param['id_gruppo2'])) $id_gruppo2=intval($param['id_gruppo2']); else $id_gruppo2=0; 37 37 if (isset($param['num_lista'])) $num_lista=intval($param['num_lista']); else $num_lista=0; 38 #if (isset($param['descr_lista'])) $descr_lista=htmlentities($param['descr_lista']); else $descr_lista=''; 38 39 if (isset($param['descr_lista'])) $descr_lista=addslashes($param['descr_lista']); else $descr_lista=''; 39 40 if (isset($param['simbolo'])) $simbolo=addslashes($param['simbolo']); else $simbolo=''; … … 268 269 $stemmacontents = fread ($fdstemma, filesize ("$filestemma")); 269 270 fclose ($fdstemma); 270 $stemmablob=addslashes($stemmacontents); 271 $stemmanome= addslashes($nomestemma);271 $stemmablob=addslashes($stemmacontents); 272 $stemmanome=($nomestemma); 272 273 $cond=", simbolo='$stemmanome', stemma='$stemmablob'"; 273 274 } else {$cond='';} 274 275 $sql="update ".$prefix."_ele_lista set num_lista='$num_lista' , id_gruppo='$id_gruppo',descrizione='$descr_lista' $cond where id_lista='$id_lista'"; 276 #die("TEST: $sql"); 275 277 $result = $dbi->prepare("$sql"); 276 278 $result->execute(); -
trunk/admin/modules/Elezioni/ele_voti.php
r358 r360 43 43 include("modules/Elezioni/funzionidata.php"); 44 44 include("modules/Elezioni/ele.php"); 45 include_once("modules/Elezioni/ele_spoglio.php"); 45 46 global $votolista, $limite, $dettnulli,$disgiunto; 46 47 if(!isset($votolista)) $votolista=0; … … 302 303 $result->execute(); 303 304 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = $result->fetch(PDO::FETCH_NUM); 305 $sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' group by tipo"; 306 $rese = $dbi->prepare("$sql"); 307 $rese->execute(); 308 $id_comune=$_SESSION['id_comune']; 309 $bordoa=''; 310 $bordog=''; 311 $bordol=''; 312 while (list($tipo)=$rese->fetch(PDO::FETCH_NUM)) { 313 if ($tipo=='affluenze') $bordoa="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 314 if ($tipo=='gruppo' or $tipo=='referendum') $bordog="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 315 if ($tipo=='lista') $bordol="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 316 } 317 echo "<SCRIPT type=\"text/javascript\">\n"; 318 echo "function vai_scelta(idrif){\n"; 319 echo "window.document.location.href=idrif\n"; 320 echo "}\n"; 321 echo "</script>\n"; 322 if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\""; else $segna=''; 323 if($ops=="4" ) {$bgcolorg="yellow"; $tcolorg='blue';} else {$bgcolorg="grey"; $tcolorg='white';} #$active_gruppo=" class=\"ui-btn-active\""; else $active_gruppo=''; 324 if($ops=="3") {$bgcolorl="yellow"; $tcolorl='blue';} else {$bgcolorl="grey"; $tcolorl='white';} # $active_lista=" class=\"ui-btn-active\""; else $active_lista=''; 325 if($ops=="1") {$bgcolora="yellow"; $tcolora='blue';} else {$bgcolora="grey"; $tcolora='white';} # $active_aff=" class=\"ui-btn-active\""; else $active_aff=''; 326 echo "<div data-role=\"content\" data-theme=\"a\"><hr><table style=\"margin-left:auto; margin-right:auto;\"><tr>"; 327 #<a href=\"admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=1\"></a> 328 echo "\n<td bgcolor=\"$bgcolora\" align=\"center\" $bordoa onClick=\"vai_scelta('admin.php?op=voti&id_comune=$id_comune&id_sez=$id_sez&id_cons_gen=$id_cons_gen&do=spoglio&ops=1');\"><p style=\"margin-left:10px;margin-right:10px;\"><font color=\"$tcolora\"><b>"._AFFLUENZE."</font></b></p></td>\n"; 329 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){ 330 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?op=voti&id_comune=$id_comune&id_sez=$id_sez&id_cons_gen=$id_cons_gen&do=spoglio&ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n"; 331 } 332 if($genere==2 and $votog) 333 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?op=voti&id_comune=$id_comune&id_sez=$id_sez&id_cons_gen=$id_cons_gen&do=spoglio&ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n"; 334 elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){ 335 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?op=voti&id_comune=$id_comune&id_sez=$id_sez&id_cons_gen=$id_cons_gen&do=spoglio&ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTA."</font></b></p></td>\n"; 336 } 337 echo "</tr></table><hr></div>\n"; 338 /* 304 339 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>"; 305 340 echo "\n<td bgcolor=\"$bgcolor1\" align=\"center\"><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=1\">"._AFFLUENZE."</a></b></p></td>\n"; … … 313 348 } 314 349 echo "</tr></table></td></tr></table><hr>\n"; 315 350 */ 316 351 ############# 317 352 # posizionamento in mancanza di scelta … … 376 411 377 412 } 378 ////////////////////////////////////////////////////////////////////////////////379 // FUNZIONI DI IMMISSIONE380 // - preferenze (candidati consiglieri)381 // - preferenze_gruppi382 // - votanti383 ////////////////////////////////////////////////////////////////////////////////384 385 //////////////////////////////////////////////////////////////////////386 // da qui va la sezione per le preferenze candidati consiglieri387 //////////////////////////////////////////////////////////////////////388 function preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){389 global $aid, $prefix, $dbi, $id_lista,$genere,$id_cons_gen,$id_gruppo,$sezi,$circo,$votog,$votol,$votoc,$conscirc;390 global $tipo_cons,$limite,$dettnulli,$disgiunto;391 $bgcolor1="#7777ff";392 $bgcolor2=$_SESSION['bgcolor2'];393 394 if ($genere==4){395 $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";396 $result = $dbi->prepare("$sql");397 $result->execute();398 399 400 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);401 echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"402 ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"403 ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";404 echo "</table>";405 }406 $sql="select validi,nulli,bianchi,contestati from ".$prefix."_ele_sezioni where id_sez='$id_sez' ";407 $result = $dbi->prepare("$sql");408 $result->execute();409 list($v1,$v2,$v3,$v4)=$result->fetch(PDO::FETCH_NUM);410 if($v1+$v2+$v3+$v4>0){411 //controlla se sono stati inseriti i votanti412 $sql="SELECT preferenze, id_fascia, id_conf,solo_gruppo, disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";413 $result = $dbi->prepare("$sql");414 $result->execute();415 416 417 list($numprefs,$fascia,$id_conf,$flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);418 419 ####### 06-11-2014 - circoscrizionali - nello spostamento ad altra sezione resta sullo stesso numero di lista anche se sono sezioni di diverse circoscrizioni420 if ($circo and $id_lista){421 $sql="SELECT num_lista from ".$prefix."_ele_lista where id_lista=$id_lista";422 $res_lis = $dbi->prepare("$sql");423 $res_lis->execute();424 list($num_lista)=$res_lis->fetch(PDO::FETCH_NUM);425 }426 427 if(!$votog and ($genere==3 or $genere==5)){428 $sql="select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";429 $result = $dbi->prepare("$sql");430 $result->execute();431 432 433 }else{434 $sql="select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";435 $result = $dbi->prepare("$sql");436 $result->execute();437 }438 439 list($validi,$nulli,$bianchi,$contestati,$votinulli) = $result->fetch(PDO::FETCH_NUM);440 echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>";441 $sql="SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista";442 $res_lis = $dbi->prepare("$sql");443 $res_lis->execute();444 445 446 $num_liste = $res_lis->rowCount();447 $ele_lista='';448 if (($genere==4 or $genere==5) and !$votoc) { //liste a piu' candidati449 if(($genere==5 and $id_conf and $fascia<=$limite and !$disgiunto) and !$id_lista) { //esclude il voto di lista per le comunali nei comuni sotto fascia limite450 $sql="SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo limit 0,1";451 $result = $dbi->prepare("$sql");452 $result->execute();453 454 455 list($id_lista)=$result->fetch(PDO::FETCH_NUM);456 }457 echo "<td> </td></tr><tr><td style=\"vertical-align: top;\">";458 echo "<form name=\"liste\" action=\"modules/Elezioni/salva_liste.php\">";459 echo "<input type=\"hidden\" name=\"pag\" value=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3&id_lista=\">";460 echo "<select name=\"id_lista\" size=\"".($num_liste+1)."\" onChange=\"vai_lista()\">";461 if ($id_lista){462 echo "<option value=\"0\">"._VOTI_LISTA;463 $ele_lista=" and t1.id_lista='$id_lista' ";464 }else{465 echo "<option value=\"0\" selected>"._VOTI_LISTA;466 $ele_lista=" group by t1.id_lista ";467 if(!isset($votolista)) $votolista=0;468 469 }470 while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {471 $segna='';472 $sql="SELECT count(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";473 $result = $dbi->prepare("$sql");474 $result->execute();475 476 477 list($ctrvoticand)=$result->fetch(PDO::FETCH_NUM);478 $sql="SELECT sum(t1.voti),0,0 from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";479 $result = $dbi->prepare("$sql");480 $result->execute();481 482 483 list($votisezcand)=$result->fetch(PDO::FETCH_NUM);484 if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4){485 $sql="SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'";486 $result = $dbi->prepare("$sql");487 $result->execute();488 }else{489 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'";490 $result = $dbi->prepare("$sql");491 $result->execute();492 list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);493 $sql="SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";494 $result = $dbi->prepare("$sql");495 $result->execute();496 }497 list($votisezlis,$sgpl)=$result->fetch(PDO::FETCH_NUM);498 if($votisezcand>($votisezlis*$numprefs))499 {$segna="style=\"background-color: #dd0000;\"";}500 elseif($ctrvoticand)501 $segna="style=\"background-color: #99CC33;\"";502 $sql="SELECT t1.voti,t2.num_cand FROM ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$id_rif'";503 $res4 = $dbi->prepare("$sql");504 $res4->execute();505 506 507 $errcand[$id_rif]=array();508 while(list($testvotic,$numcand)=$res4->fetch(PDO::FETCH_NUM))509 if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;}510 511 $sel = ($id_rif == $id_lista) ? "selected" : "";512 echo "<option $segna value=\"$id_rif\" $sel>";513 for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}514 echo $num_lis.") ".substr($descrizione,0,30);515 }516 echo "</select></form></td>\n";517 }else {518 $id_lista=0;519 }520 echo "<td style=\"vertical-align: top;\">";521 522 if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";}523 if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) {524 $sql="SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,t2.contestati,0,0 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez=$id_sez group by t1.id_sez";525 $result = $dbi->prepare("$sql");526 $result->execute();527 528 529 }else{530 $sql="SELECT sum(t1.voti),t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo,t1.id_sez from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez='$id_sez' group by t1.id_sez,t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo";531 $result = $dbi->prepare("$sql");532 $result->execute();533 }534 535 // aggiunte le variabili $sgpl e $vnulli2 per la gestione dei voti 1) al solo presidente per singola lista - 2) al solo presidente per singola lista perché nullo o contestato quello di lista536 $isscr= $result->rowCount();537 list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2,$sgpl) = $result->fetch(PDO::FETCH_NUM);538 if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){539 $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";540 $resg = $dbi->prepare("$sql");541 $resg->execute();542 543 544 list($sgpl)=$resg->fetch(PDO::FETCH_NUM);545 if ($sg != $sgpl) echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></table>";546 }547 $valista=$validi2;548 if(!$id_lista or $genere==3){ //controllo di congruenza549 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";550 $res2 = $dbi->prepare("$sql");551 $res2->execute();552 553 554 list($tot) = $res2->fetch(PDO::FETCH_NUM);555 ####### controlli556 $sql="select * from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez='$id_sez' ";557 $resc = $dbi->prepare("$sql");558 $resc->execute();559 if($resc->rowCount()){ if ($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2!=$tot and $validi+$sg>0){560 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2)."</b><br></td></table>";561 }562 563 if((($voti_sez)!=$validi2) and ($voti_sez>0)){564 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".($voti_sez)." "._NO_VAL_VOTI." ".$validi2."</b><br></td></tr></table>";565 }566 }elseif($genere==5){567 $sql="SELECT sum(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_lista";568 $result = $dbi->prepare("$sql");569 $result->execute();570 571 572 list($votisezcand)=$result->fetch(PDO::FETCH_NUM);573 if(($fascia>$limite or $disgiunto) or !$id_conf){574 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'";575 $result = $dbi->prepare("$sql");576 $result->execute();577 578 579 }else{580 581 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'";582 $result = $dbi->prepare("$sql");583 $result->execute();584 585 586 list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);587 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";588 $result = $dbi->prepare("$sql");589 $result->execute();590 591 592 }593 list($votisezlis)=$result->fetch(PDO::FETCH_NUM);594 if($votisezcand>($votisezlis*$numprefs))595 {596 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza $votisezcand <br/>superano i voti di lista $votisezlis</b><br></td></tr></table>";597 }598 }599 #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto600 $errgrulis=array();601 if($genere==5 and !$disgiunto and ($tipo_cons==18 or $tipo_cons==19)){602 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";603 $resref = $dbi->prepare("$sql");604 $resref->execute();605 606 607 $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";608 $res4 = $dbi->prepare("$sql");609 $res4->execute();610 611 612 list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);613 if ($sezscrl)614 615 while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))616 {617 $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";618 $res3 = $dbi->prepare("$sql");619 $res3->execute();620 621 622 $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";623 $res4 = $dbi->prepare("$sql");624 $res4->execute();625 626 627 list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);628 list($vliste)=$res4->fetch(PDO::FETCH_NUM);629 if($vliste>$vgruppo)630 {631 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";632 $result = $dbi->prepare("$sql");633 $result->execute();634 635 636 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);637 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr></table>";638 $errgrulis[$id_gruppo]=1;639 }640 elseif($vliste<$vgruppo)641 {642 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";643 $result = $dbi->prepare("$sql");644 $result->execute();645 646 647 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);648 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";649 $errgrulis[$id_gruppo]=1;650 }651 }652 }653 }654 655 656 echo "\n<form name=\"sezioni\" action=\"modules/Elezioni/salva_liste.php\">"657 ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">"658 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"659 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"660 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"661 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"662 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"663 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"664 ."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"665 ."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"666 ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";667 echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";668 echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";669 if ($genere<4){670 // echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._LISTA."</b></td>";671 }672 echo "<b>"._NUM."</b></td>";673 if($id_lista){674 echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._CANDIDATO."</b></td>"675 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";676 }else{677 echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._DESCR."</b></td>"678 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";679 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)680 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NULLI_LISTE."</b></td>";681 if($disgiunto){682 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLOLIS."</b></td>";683 }684 }685 echo "</tr>\n";686 687 688 689 690 691 if($id_lista) $sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista,t1.num_cand";692 else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista";693 $result = $dbi->prepare("$sql");694 $result->execute();695 696 697 $max = $result->rowCount();698 $tot_pref=0;699 $i=1;700 701 if($id_lista) {702 while(list($id_cand,$id_cons2,$id_lista2,$nl, $cognome, $nome, $note, $simbolo, $num_cand) = $result->fetch(PDO::FETCH_NUM)){703 // dati lista704 $sql="select id_lista, descrizione,simbolo,num_lista from ".$prefix."_ele_lista where id_lista='$id_lista2'";705 $result1 = $dbi->prepare("$sql");706 $result1->execute();707 708 709 list($id_lista3,$descr_lista,$simb_lista,$num_lista)=$result1->fetch(PDO::FETCH_NUM);710 // dati gruppo711 $sql="select descrizione,simbolo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";712 $result2 = $dbi->prepare("$sql");713 $result2->execute();714 715 716 list($descr_gruppo,$simb_gruppo)=$result2->fetch(PDO::FETCH_NUM);717 718 echo "<tr bgcolor=\"$bgcolor2\">";719 if ($genere<4){720 echo "<td align=\"left\"><b><img src=\"images/lista/$simb_lista \" width=\"32\" heigth=\"32\" align=\"center\" ALT=\"$descr_lista\" > </b></td>";721 }722 echo "<td align=\"center\"><b> $num_cand </b></td>"723 ."<td align=\"left\"><b>$cognome $nome</b></td>";724 $cond_sele="and id_cand=$id_cand";725 $sql="SELECT voti FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele";726 $res = $dbi->prepare("$sql");727 $res->execute();728 729 730 list($voti)= $res->fetch(PDO::FETCH_NUM);731 if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor='';732 echo "<td align=\"right\" $errcolor><input name=\"voti$num_cand\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";733 echo "<input type=\"hidden\" name=\"id_cand$num_cand\" value=\"$id_cand\"></td></tr>\n";734 $i++;735 $tot_pref+=$voti;736 }737 }else {738 if($circo) $circot1=" and t1.id_circ=$id_circ"; else $circot1='';739 $sql="select t2.voti,t1.id_lista, descrizione,simbolo,t1.num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo740 from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2741 where t1.id_cons='$id_cons'742 and t1.id_lista=t2.id_lista743 and t2.id_sez=$id_sez744 $circot1745 order by t1.num_lista";746 747 try {748 $result1 = $dbi->prepare("$sql");749 $result1->execute();750 751 }752 catch(PDOException $e)753 {754 echo $sql . "<br>" . $e->getMessage();755 }756 757 $num_lista=$result1->rowCount();758 if (!$num_lista){759 $sql="select '0',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo760 from ".$prefix."_ele_lista where id_cons='$id_cons' $circo761 order by num_lista";762 $result1 = $dbi->prepare("$sql");763 $result1->execute();764 }765 $tvnpl=0;766 $tslpl=0;767 while (list($voti,$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){768 echo "<tr bgcolor=\"$bgcolor2\">";769 // if ($genere<4 or $votoc){770 // }771 $errcolor='';772 if(isset($errgrulis[$rifgruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";773 echo "<td align=\"center\"><b> $num_lista </b></td>"774 ."<td align=\"left\"><b> $descr_lista</b></td>";775 $cond_sele="and id_lista=$id_lista3";776 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";777 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19) { echo "</td><td align=\"right\"><input name=\"vnpl$i\" value=\"".$vnpl."\" size=\"7\" style=\"text-align:right\">"; $tvnpl+=$vnpl;}778 if($disgiunto) {echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\">"; $tslpl+=$slpl;}779 echo "<input type=\"hidden\" name=\"id_lista$i\" value=\"$id_lista3\"></td>";780 // echo "<td align=\"right\">$sgpl";781 echo "</tr>\n";782 $i++;783 $tot_pref+=$voti;784 }785 }786 if(!$id_lista) {787 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><font size=\"3\">"._TOT._VOTI_LISTA."</font></td><td align=\"center\"><font size=\"3\">$tot_pref</font></td>";788 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)789 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tvnpl."</font></td>";790 if($disgiunto)791 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tslpl."</font></td>";792 echo "</tr>";793 }794 else echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOTPREF."</td><td align=\"center\">$tot_pref</td></tr>";795 // toglie ai candidati la visual... del solo_gruppo796 if(!$votog) {797 if (($genere==3 OR $genere==5) and (!$id_lista) and (($disgiunto or $fascia>$limite) or !$id_conf)) { //gruppo e liste798 echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._VALIDI_LISTA."</b></td><td align=\"center\"><input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"><input name=\"valista\" value=\"$valista\" size=\"5\" style=\"text-align:right\"></td></tr>";799 echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\"><input name=\"sg\" value=\"$sg\" size=\"5\" style=\"text-align:right\">";800 if(defined('_NULLISTA'))801 echo "<input type=\"hidden\" name=\"votinulli\" value=\"$votinulli\"><input type=\"hidden\" name=\"contestati\" value=\"$contestati\"></td></tr>";802 else803 echo "</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._NULLI_LISTE."</b></td><td align=\"center\"><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"804 ."</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._CONTESTATI_LISTE."</b></td><td align=\"center\"><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\"></td></tr>";805 806 }elseif (($genere==3 OR $genere==5) and !$votoc and (($disgiunto or $fascia>$limite) or !$id_conf)){ //}elseif ($tipo_cons!=10 and $tipo_cons!=11){807 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">$sg</td></tr>";808 }809 ######modifica del 16-04-2009 per visualizzare i voti al solo sindaco nei comuni con meno di 15000 abitanti810 elseif(($genere==3 OR $genere==5) and ($id_lista) and ($fascia<=$limite or !$id_conf) and $numprefs==1) {811 $sql="SELECT id_gruppo FROM ".$prefix."_ele_lista where id_lista='$id_lista'";812 $resvg = $dbi->prepare("$sql");813 $resvg->execute();814 815 816 list($id_gruppo) = $resvg->fetch(PDO::FETCH_NUM);817 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo' and id_sez='$id_sez'";818 $resvg = $dbi->prepare("$sql");819 $resvg->execute();820 821 822 list($voti_sind) = $resvg->fetch(PDO::FETCH_NUM);823 824 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">".($voti_sind - $tot_pref)."</td></tr>";825 }826 ###### fine modifica del 16-04-2009827 828 }829 echo "<tr>";830 echo "<td></td><td></td>";831 echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";832 echo "</tr></table>";833 if(chisei($id_cons_gen)>=64){834 echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"1\">"._DELETE."</td>";835 } # onclick=\"javascript:del_dati()\"836 echo "</form></tr></table>";837 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"838 ."document.sezioni.voti1.focus()\n"839 ."document.sezioni.voti1.select()\n"840 ."//-->\n";841 echo "function vai_lista() {\n";842 echo "window.document.location.href=document.liste.pag.value+document.liste.id_lista.value\n";843 echo "}\n";844 echo "</script>\n";845 }846 #if (!((!$votog) and ($genere==3 OR $genere==5) and ($fascia>$limite)))847 finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);848 }849 850 851 ////////////////////////////////////////////852 // da qua va la sezione per i votanti853 ///////////////////////////////////////////854 855 function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){856 //function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){857 global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$id_comune;858 $bgcolor1=$_SESSION['bgcolor2'];859 860 #OpenTable();861 $sql="SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";862 $res = $dbi->prepare("$sql");863 $res->execute();864 865 866 if($res) list($vismf)= $res->fetch(PDO::FETCH_NUM); else $vismf=0;867 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ";868 $res = $dbi->prepare("$sql");869 $res->execute();870 871 echo "<table><tr><td>";872 $num = $res->rowCount();873 $sql="SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez";874 $ressez = $dbi->prepare("$sql");875 $ressez->execute();876 ##################877 echo "<style>";878 echo "DIV.table";879 echo "{880 display:table;881 }882 FORM.tr883 {884 display:table-row;885 text-align: center;886 }887 DIV.tr888 {889 display:table-row;890 background-color: #D3D3D3;891 text-align: center;892 }893 SPAN.tdm894 {895 display:table-cell;896 border: 1px solid black;897 padding: 5px;898 }899 SPAN.td900 {901 display:table-cell;902 }";903 echo "</style>";904 905 /*906 echo "<form class=\"tr\" name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">";907 echo "<span class=\"td\"><input type=\"text\"/></span>";908 <span class="td"><input type="text"/></span>909 </form>910 <div class="tr">911 <span class="td">(cell data)</span>912 <span class="td">(cell data)</span>913 </div>914 ...915 </div>916 */917 ##################918 919 list($maschi,$femmine)=$ressez->fetch(PDO::FETCH_NUM);920 $y=0;921 echo "<div class=\"table\">";922 #echo "<tr><td> </td></tr>";923 $riga=array();924 $rigat=array();925 while (list($ora,$giorno)= $res->fetch(PDO::FETCH_NUM)){926 $y++;927 $rigat[$y]='';928 $riga[$y]='';929 # echo "\n<tr><td>";930 # echo "<form name=\"votanti$y\" action=\"modules/Elezioni/salva_aff.php\">";931 # echo "<table class=\"table-menu\" style=\"width: 100%; color: black;\"><tr>";932 $rigat[$y]= "<div class=\"tr\">";933 if ($genere==0){ //e' un referendum934 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></td>";935 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></span>";936 }937 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></span>"938 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._DATA."</b></span>";939 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></span>";940 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></span>"941 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b></span>";942 if ($genere==0){943 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";944 $res2 = $dbi->prepare("$sql");945 $res2->execute();946 947 948 $max = $res2->rowCount();949 }else{ $max=1;}950 $op="rec_add_votanti";951 $rigat[$y].= "</div>";952 953 for ($i=1;$i<=$max;$i++){954 $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2955 on (t1.id_gruppo=t2.id_gruppo) where t1.id_sez='$id_sez'956 and t1.id_cons='$id_cons' and t1.orario='$ora' and t1.data='$giorno'";957 if ($genere==0){958 $query.=" and t2.num_gruppo=$i";959 }960 $sql=$query;961 $result = $dbi->prepare("$sql");962 $result->execute();963 964 965 list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = $result->fetch(PDO::FETCH_NUM);966 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo' ";967 $res2 = $dbi->prepare("$sql");968 $res2->execute();969 970 971 $sql="select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'";972 $resril = $dbi->prepare("$sql");973 $resril->execute();974 975 976 list($numril)=$resril->fetch(PDO::FETCH_NUM);977 if ($res2)978 list($gruppo)= $res2->fetch(PDO::FETCH_NUM);979 else980 $gruppo=0;981 if (!$gruppo>0) {982 $gruppo=$i;983 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where num_gruppo=$gruppo and id_cons=$id_cons";984 $res3 = $dbi->prepare("$sql");985 $res3->execute();986 987 988 if ($res3)989 list($id_gruppo)=$res3->fetch(PDO::FETCH_NUM);990 }991 if(!isset($precede[$id_gruppo])) $precede[$id_gruppo]=0; if(!isset($error)) $error=0;992 if($precede[$id_gruppo]>($voti_t) and $voti_t!='') $error=1;993 $precede[$id_gruppo]=$voti_t;994 if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){995 # echo "</tr><tr styl.e=\"background-color: rgb(255, 0, 0); text-align: center\">"; $error=0;996 $riga[$y].= "<form class=\"tr\" style=\"background-color: rgb(255, 0, 0); text-align: center\" name=\"votanti\" action=\"modules/Elezioni/salva_aff.php\">";997 }else{998 $riga[$y].= "<form class=\"tr\" action=\"modules/Elezioni/salva_aff.php\">";999 }1000 if ($genere==0){ // e' un referendum1001 $riga[$y].= "<span class=\"td\" align=\"center\">$gruppo</span>";1002 }1003 1004 1005 $riga[$y].= "<span class=\"td\"><input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\"/>";1006 $riga[$y].= "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>"1007 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\"/>"1008 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"/>"1009 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"/>"1010 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\"/>";1011 #$riga[$y].= "</span>";1012 list ($anno,$mese,$di)=explode('-',$giorno);1013 $riga[$y].= "$ora</span><span class=\"td\" align=\"center\">$di-$mese-$anno</span>";1014 if ($voti_u > $maschi) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">";1015 else $riga[$y].= "<span class=\"td\" align=\"center\">";1016 if ($y<$num and $vismf==0 and $voti_u==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"'$voti_u'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"$voti_u\"";1017 $riga[$y].= " size=\"5\"/></span>";1018 if ($voti_d > $femmine) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\"/>";1019 else $riga[$y].= "<span class=\"td\" align=\"center\">";1020 if ($y<$num and $vismf==0 and $voti_d==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"'$voti_d'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"$voti_d\"";1021 $riga[$y].= " size=\"5\"/></span>";1022 if ($voti_t > ($maschi+$femmine)) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\" ><input type=\"text\" id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";1023 else $riga[$y].= "<span class=\"td\" align=\"center\"><input id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";1024 $riga[$y].= "<input type=\"hidden\" name=\"id_parz\" value=\"$id_parz\"/>"1025 ."<input type=\"hidden\" name=\"data\" value=\"$giorno\"/>"1026 ."<input type=\"hidden\" name=\"orario\" value=\"$ora\"/>"1027 ."<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>"1028 ."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>";1029 $riga[$y].= "</span>";1030 1031 if (chisei($id_cons_gen)>=64 and $y==$numril) $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";1032 else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>";1033 $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>";1034 $riga[$y].= "</form>";1035 1036 }1037 # echo "</table></form>";1038 echo "</div>";1039 1040 1041 $sql="select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez";1042 $compl = $dbi->prepare("$sql");1043 $compl->execute();1044 1045 1046 list ($complessivi)= $compl->fetch(PDO::FETCH_NUM);1047 if (!$complessivi)1048 {1049 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";1050 $numy=$y.'1';1051 if ($y==$num) {1052 echo "document.votanti$y.voti_u$numy.focus()\n";1053 echo "document.votanti$y.voti_u$numy.select()\n";1054 }else{1055 echo "this.voti_t$numy.focus()\n";1056 echo "this.voti_t$numy.select()\n";1057 }1058 echo "//-->\n"1059 ."</script>\n";1060 break;1061 }1062 # echo "</td></tr>";1063 }1064 #CloseTable();1065 foreach($riga as $key=>$val){1066 echo $rigat[$key];1067 echo $riga[$key];1068 }1069 echo "</div></td></tr></table>";1070 }1071 1072 1073 1074 function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){1075 global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;1076 ////////////////////////////////////////////1077 // da qua va la sezione per i voti finali1078 ///////////////////////////////////////////1079 $bgcolor1="#7777ff";1080 $bgcolor2=$_SESSION['bgcolor2'];1081 1082 1083 1084 echo "<form name=\"spogliovoti\" action=\"modules/Elezioni/salva_voti.php\">"1085 ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";1086 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"1087 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"1088 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"1089 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"1090 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";1091 1092 echo "<table border=\"0\" width=\"90%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";1093 /* if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )1094 echo "<td width=\"32\"><b>"._VOTI_LISTA."</b></td>";1095 else */1096 echo "<td width=\"32\"><b>"._VALIDI."</b></td>";1097 echo "<td width=\"82\"><b>"._NULLI."</b></td>"1098 ."<td><b>"._BIANCHI."</b></td>"1099 ."<td width=\"32\"><b>"._VOTINULLI."</b></td>"1100 ."<td><b>"._CONTESTATI."</b></td>"1101 ."<td><b>"._TOTNON."</b></td>"1102 ."<td><b>"._TOTALEVOTI."</b></td>"1103 ."<td bgcolor=\"#ffffff\"></td> </tr>";1104 /*if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )1105 $result = mysql_query("select id_cons,id_sez,validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista,solo_gruppo,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";1106 $res = $dbi->prepare("$sql");1107 $res->execute();1108 1109 1110 else */1111 $sql = "select id_cons,id_sez,validi,nulli,bianchi,contestati,voti_nulli,'0','0','0',solo_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";1112 $result = $dbi->prepare("$sql");1113 $result->execute();1114 1115 1116 list($id_cons2,$id_sez2,$validi, $nulli, $bianchi, $contestati,$votinulli,$sg,$conts,$nullis,$sololista) = $result->fetch(PDO::FETCH_NUM);1117 $tot_nulli=$nulli+$bianchi+$contestati+$votinulli;1118 $tot_voti=$validi+$tot_nulli+$conts+$nullis;1119 // ."</td><td><input name=\"sololista\" value=\"$sololista\" size=\"5\" style=\"text-align:right\">" --- ."<td><b>"._SOLOLIS."</b></td>"1120 1121 1122 echo "<tr bgcolor=\"$bgcolor2\" align=\"center\"><td align=\"left\"><input name=\"validi\" value=\"$validi\" size=\"5\" style=\"text-align:right\">";1123 /* if(($genere==3 or $genere==5) and !$votog and $ops==3){1124 echo "</td><td>$nulli"1125 ."</td><td>$bianchi";1126 echo "<input type=\"hidden\" name=\"nulli\" value=\"$nulli\"><input type=\"hidden\" name=\"bianchi\" value=\"$bianchi\">";1127 }else{ */1128 echo "</td><td><input name=\"nulli\" value=\"$nulli\" size=\"5\" style=\"text-align:right\">"1129 ."</td><td><input name=\"bianchi\" value=\"$bianchi\" size=\"5\" style=\"text-align:right\">";1130 // }1131 echo "</td><td><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"1132 ."</td><td><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\">"1133 ."</td><td>$tot_nulli"1134 ."</td><td>$tot_voti</td><td>"1135 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"1136 ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">"1137 ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"1138 ."</td></tr></table></form>"; //</td></tr>";1139 1140 1141 // echo "</table>";1142 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";1143 if (!$validi) {1144 echo "document.spogliovoti.validi.focus()\n";1145 echo "document.spogliovoti.validi.select()\n";1146 }1147 echo "//-->\n"1148 ."</script>\n";1149 1150 1151 }1152 1153 1154 function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){1155 global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;1156 ////////////////////////////////////////////1157 // da qua va la sezione per le preferenze ai gruppi1158 ///////////////////////////////////////////1159 // Controllo immmissioni1160 1161 $bgcolor1="#7777ff";1162 $bgcolor2=$_SESSION['bgcolor2'];1163 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ";1164 $res = $dbi->prepare("$sql");1165 $res->execute();1166 1167 1168 $max = $res->rowCount();1169 $max = $max-1;1170 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";1171 if ($genere==0) {1172 echo "document.sezioni.si1.focus()\n";1173 echo "document.sezioni.si1.select()\n";1174 } else {1175 echo "document.sezioni.voti1.focus()\n"1176 ."document.sezioni.voti1.select()\n";1177 }1178 echo "//-->\n"1179 ."</script>\n";1180 // tabella votanti1181 echo "<center>";1182 if ($genere!=0){1183 $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";1184 $result = $dbi->prepare("$sql");1185 $result->execute();1186 1187 1188 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);1189 echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"1190 ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"1191 ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";1192 echo "</table>";1193 }1194 echo "<table class=\"table-menu\" style=\"width: 50%; color: black\">";1195 if ($genere==0){1196 $sql="SELECT id_gruppo,si+no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' ";1197 $res = $dbi->prepare("$sql");1198 $res->execute();1199 1200 1201 while (list($id_gruppo,$voti_parz,$validi,$nulli,$bianchi,$contestati) = $res->fetch(PDO::FETCH_NUM)){1202 if ($voti_parz!=$validi){1203 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo' ";1204 $res2 = $dbi->prepare("$sql");1205 $res2->execute();1206 1207 1208 list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);1209 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI_REF." $num_gruppo: ".$voti_parz." "._NO_VAL_VOTI.": ".$validi."</b><br></td></tr>";1210 }1211 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1212 $res2 = $dbi->prepare("$sql");1213 $res2->execute();1214 1215 1216 list($tot) = $res2->fetch(PDO::FETCH_NUM);1217 if (($validi+$nulli+$bianchi+$contestati)!= $tot ){1218 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'";1219 $res2 = $dbi->prepare("$sql");1220 $res2->execute();1221 1222 1223 list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);1224 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI_REF." $num_gruppo: ".$tot." "._NO_SOMMA." ".($validi+$nulli+$bianchi+$contestati)."</b><br></td></tr>";1225 }1226 }1227 }else{1228 $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";1229 $result = $dbi->prepare("$sql");1230 $result->execute();1231 1232 1233 list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);1234 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'";1235 $res = $dbi->prepare("$sql");1236 $res->execute();1237 1238 1239 list($voti_parz) = $res->fetch(PDO::FETCH_NUM);1240 $sql="SELECT validi,nulli,bianchi,contestati,solo_lista,voti_nulli FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";1241 $res = $dbi->prepare("$sql");1242 $res->execute();1243 1244 1245 list($validi,$nulli,$bianchi,$contestati,$solo_lista,$votinulli) = $res->fetch(PDO::FETCH_NUM);1246 if ($voti_parz!=($validi-$solo_lista) and $voti_parz>0){1247 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".$voti_parz." "._NO_VAL_VOTI." ".($validi-$solo_lista)."</b><br></td><tr>";1248 }1249 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";1250 $res2 = $dbi->prepare("$sql");1251 $res2->execute();1252 1253 1254 list($tot) = $res2->fetch(PDO::FETCH_NUM);1255 if ($validi+$nulli+$bianchi+$contestati+$votinulli!=$tot and $validi+$nulli+$bianchi+$contestati+$votinulli>0){1256 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi+$nulli+$bianchi+$contestati+$votinulli)."</b><br></td></tr>";1257 }1258 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez";1259 $resg = $dbi->prepare("$sql");1260 $resg->execute();1261 1262 1263 list($voti_sez)=$resg->fetch(PDO::FETCH_NUM);1264 if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){1265 1266 $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";1267 $resg = $dbi->prepare("$sql");1268 $resg->execute();1269 1270 1271 list($sgpl)=$resg->fetch(PDO::FETCH_NUM);1272 $sql="SELECT solo_gruppo from ".$prefix."_ele_sezioni where id_cons=$id_cons and id_sez=$id_sez";1273 $resg = $dbi->prepare("$sql");1274 $resg->execute();1275 1276 1277 list($sg)=$resg->fetch(PDO::FETCH_NUM);1278 if ($sg != $sgpl) echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></tr>";1279 }1280 #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto1281 if($genere==5 and !$disgiunto and $flagsg and ($tipo_cons==18 or $tipo_cons==19)){1282 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";1283 $resref = $dbi->prepare("$sql");1284 $resref->execute();1285 1286 1287 $errgrulis=array();1288 $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";1289 $res4 = $dbi->prepare("$sql");1290 $res4->execute();1291 1292 1293 list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);1294 if ($sezscrl)1295 while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))1296 {1297 if($disgiunto || $flagsg){1298 $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";1299 $res3 = $dbi->prepare("$sql");1300 $res3->execute();1301 if($flagsg){1302 $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1303 $res4 = $dbi->prepare("$sql");1304 $res4->execute();1305 }else{1306 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1307 $res4 = $dbi->prepare("$sql");1308 $res4->execute();1309 }1310 }else{1311 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";1312 $res3 = $dbi->prepare("$sql");1313 $res3->execute();1314 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1315 $res4 = $dbi->prepare("$sql");1316 $res4->execute();1317 }1318 list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);1319 list($vliste)=$res4->fetch(PDO::FETCH_NUM);1320 if($vliste>$vgruppo and !$disgiunto )1321 {1322 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";1323 $result = $dbi->prepare("$sql");1324 $result->execute();1325 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);1326 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate $vliste<br/> superano i voti assegnati al gruppo $dgruppo $vgruppo</b><br></td></tr></table>";1327 $errgrulis[$id_gruppo]=1;1328 }1329 elseif($vliste<$vgruppo and $disgiunto )1330 {1331 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";1332 $result = $dbi->prepare("$sql");1333 $result->execute();1334 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);1335 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";1336 $errgrulis[$id_gruppo]=1;1337 }1338 }1339 }1340 1341 }1342 if(!isset($votinulli)) $votinulli=0;1343 echo "<tr><td></td></tr></table>";1344 if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {1345 if($genere==0) echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_ref.php\">";1346 else echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"modules/Elezioni/salva_gruppi.php\">";1347 echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppiq\">"1348 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"1349 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"1350 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"1351 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"1352 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"1353 ."<input type=\"hidden\" name=\"circo\" value=\"$circo\">"1354 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"1355 ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";1356 echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"1357 ."<td width=\"3%\"><b>"._NUM."</b></td>"1358 ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";1359 if ($genere==0){1360 echo "<td><b>"._SI."</b></td>"1361 ."<td><b>"._NO."</b></td>"1362 ."<td><b>"._VALIDI."</b></td>"1363 ."<td><b>"._BIANCHI."</b></td>"1364 ."<td><b>"._CONTESTATI."</b></td>"1365 ."<td><b>"._NULLI."</b></td>"1366 ."<td><b>"._TOTNON."</b></td>"1367 ."<td><b>"._TOTALEVOTI."</b></td>"1368 ."<td><b>"._VOTANTI."</b></td>";1369 }else{1370 echo "<td width=\"5%\"><b>"._VOTI."</b></td>";1371 if($dettnulli) echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLO_GRUPPO."</b></td>";1372 }1373 echo "</tr>";1374 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";1375 $res = $dbi->prepare("$sql");1376 $res->execute();1377 1378 1379 $max = $res->rowCount();1380 //echo "Massimo:$max - id=$id_cons - circo: $circo";1381 $sql="select * from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";1382 $result = $dbi->prepare("$sql");1383 $result->execute();1384 1385 1386 $i=1;1387 $tot_pref=0;1388 $totsg=0;1389 while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = $result->fetch(PDO::FETCH_NUM)){1390 1391 //echo "test: $id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo";1392 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"1393 1394 ."//-->\n";1395 echo "function controlloref$i() {\n";1396 echo "var a=Number(window.document.sezioni.si$i.value); var b=Number(window.document.sezioni.no$i.value); if(a=='NaN') {a=0} if(b=='NaN') {b=0} var c=a + b; window.document.sezioni.val$i.value=c\n";1397 echo "}\n";1398 echo "</script>\n";1399 1400 if ($num_gruppo != ''){1401 if ($genere==0){1402 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1403 $res = $dbi->prepare("$sql");1404 $res->execute();1405 1406 1407 list($tot) = $res->fetch(PDO::FETCH_NUM);1408 $sql="SELECT * FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1409 $res = $dbi->prepare("$sql");1410 $res->execute();1411 1412 1413 $pro= $res->fetch(PDO::FETCH_BOTH);1414 1415 if ($pro['si']+$pro['no']!=$pro['validi'] or ($pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=$tot and $pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=0)){1416 echo "<tr style=\"background-color: rgb(255, 0, 0); text-align:center\">";1417 }else{1418 echo "<tr style=\"background-color: $bgcolor2; text-align:center\">";1419 }1420 $descr = explode('.',$descr_gruppo, 100);1421 echo "<td align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>"1422 ."</td><td align=\"left\" width=\"50%\"><b> $descr[0] </b>";1423 $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'';1424 $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'';1425 $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'';1426 $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'';1427 $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'';1428 $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'';1429 $tot_nulli=intval($pro['nulli'])+intval($pro['bianchi'])+intval($pro['contestati']);1430 $tot_voti=intval($pro['validi'])+$tot_nulli;1431 echo "</td><td align=\"right\" width=\"3%\"><input name=\"si$i\" value=\"".$pro['si']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i()></td>";1432 echo "</td><td align=\"right\" width=\"3%\"><input name=\"no$i\" value=\"".$pro['no']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i()></td>";1433 echo "</td><td align=\"right\" width=\"3%\"><input name=\"val$i\" value=\"".$pro['validi']."\" size=\"7\" style=\"text-align:right\" ></td>";1434 echo "</td><td align=\"right\"><input name=\"bia$i\" value=\"".$pro['bianchi']."\" size=\"7\" style=\"text-align:right\"></td>";1435 echo "</td><td align=\"right\"><input name=\"con$i\" value=\"".$pro['contestati']."\" size=\"7\" style=\"text-align:right\"></td>";1436 echo "</td><td align=\"right\"><input name=\"nul$i\" value=\"".$pro['nulli']."\" size=\"7\" style=\"text-align:right\"></td>";1437 echo "</td><td align=\"right\">$tot_nulli</td>";1438 echo "</td><td align=\"right\">$tot_voti</td>";1439 echo "</td><td align=\"right\">$tot</td>";1440 }else{1441 echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"num_gruppo$i\" value=\"$num_gruppo\"><b>$num_gruppo</b>"1442 ."</td><td align=\"left\"><b> $descr_gruppo </b>";1443 $sql="SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1444 $res = $dbi->prepare("$sql");1445 $res->execute();1446 1447 $pro= $res->fetch(PDO::FETCH_BOTH);1448 if(!$res->rowCount()) {$pro['voti']=''; $pro['solo_gruppo']='';}1449 $errcolor='';1450 if(isset($errgrulis[$id_gruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";1451 echo "</td><td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\"></td>";1452 1453 if($dettnulli) {echo "<td align=\"right\"><input name=\"solog$i\" value=\"".$pro['solo_gruppo']."\" size=\"7\" style=\"text-align:right\"></td>"; $totsg+=intval($pro['solo_gruppo']);}1454 $tot_pref += intval($pro['voti']);1455 echo "</tr>";1456 }1457 1458 $i++;1459 }1460 1461 }1462 if ($genere!=0) {1463 $sql="SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";1464 $res = $dbi->prepare("$sql");1465 $res->execute();1466 1467 1468 list($disgiunto)=$res->fetch(PDO::FETCH_NUM);1469 $sql="SELECT solo_lista FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' ";1470 $res = $dbi->prepare("$sql");1471 $res->execute();1472 1473 1474 list($sololis)=$res->fetch(PDO::FETCH_NUM);1475 echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._TOTPREF."</td><td>$tot_pref</td>";1476 if($dettnulli) echo "<td>$totsg</td>";1477 echo "</tr>";1478 if($disgiunto)1479 echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._SOLOLIS."</td><td><input name=\"sololista\" value=\"".$sololis."\" size=\"7\" style=\"text-align:right\"></td></tr>";1480 }1481 1482 echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";1483 1484 echo "</tr></table></form></td></tr>";1485 if(chisei($id_cons_gen)>=64){1486 echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";1487 }1488 1489 echo "</td></tr></table></center>";1490 }1491 if ($genere!=0){1492 finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);1493 }1494 }1495 413 1496 414 -
trunk/admin/modules/Elezioni/ele_widget.php
r344 r360 20 20 $currentlang=$_SESSION['lang']; 21 21 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST; 22 $id_cons_gen= $param['id_cons_gen'];22 $id_cons_gen=intval($param['id_cons_gen']); 23 23 $perms=ChiSei($id_cons_gen); 24 24 if ($perms<32) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!"); … … 41 41 if (isset($param['attivo'])) $attivo=intval($param['attivo']); else $attivo=''; 42 42 43 43 /* 44 44 ############# controllo dei widget 45 45 make_db_widget(); // crea tabella se non esiste … … 103 103 } 104 104 105 105 */ 106 106 107 107 /******************************************************/ -
trunk/admin/modules/Elezioni/importa.php
r344 r360 35 35 elseif ($key==1) {$valori.= "null"; $oldidg=$campo;} 36 36 elseif ($key==6) $valori.= ",0"; 37 else $valori.= ",'$campo'"; 37 elseif($key==4 || $key==8) $valori.=",'".utf8_encode($campo)."'"; 38 elseif($key==9) $valori.=",''"; 39 else $valori.= ",'".$campo."'"; 38 40 if ($key==2) $numgruppo= $campo; 39 41 if ($key==8) $isnew=1; … … 43 45 44 46 $sql="insert into ".$prefix."_ele_gruppo values($valori)"; 47 try { 45 48 $res_gruppo = $dbi->prepare("$sql"); 46 49 $res_gruppo->execute(); 50 } 51 catch(PDOException $e) 52 { 53 echo $sql . "<br>" . $e->getMessage(); 54 } 47 55 $sql="select id_gruppo from ".$prefix."_ele_gruppo where num_gruppo='$numgruppo' and id_cons='$idcns'"; 48 56 $resnew = $dbi->prepare("$sql"); … … 60 68 { 61 69 global $prefix, $dbi; 62 global $ar_lista,$ ar_candi,$idcns;63 64 foreach ($ar_lista as $rigalista){ 70 global $ar_lista,$idcns; 71 72 foreach ($ar_lista as $rigalista){ 65 73 if(!isset($rigalista[3])) continue; 66 74 $oldidl=0; 67 75 $okl=0; 68 76 $oldidg=$rigalista[3]; 69 $newidg=$_SESSION['gruppi']['idg_'.$oldidg];77 if(isset($_SESSION['gruppi'])) $newidg=$_SESSION['gruppi']['idg_'.$oldidg]; else $newidg=0; 70 78 foreach($rigalista as $key=>$campo){ 71 if ($key==0) $valori="'$idcns',"; 72 elseif ($key==1) {$valori.= "null";$oldidl=$campo;} 73 elseif ($key==3) {$valori.= ",'$newidg'"; if ($campo!=$oldidg) $okl=1;} 74 elseif ($key==4) $valori.= ",0"; 75 else $valori.= ",'$campo'"; 76 if ($key==2) $numlista= $campo; 79 if ($key==0) $valori=$idcns.","; 80 /* elseif ($key==1) {$oldidl=$campo;} 81 elseif ($key==2) {$num_lista=$campo;$numlista=$campo;} 82 elseif ($key==3) {$id_gruppo=$newidg; if ($campo!=$oldidg) $okl=1;} 83 elseif ($key==5) $id_circ=$campo; 84 elseif ($key==7) $descr_lista=$campo; 85 elseif ($key==8) $stemmanome=$campo; 86 elseif ($key==9) $stemmablob=$campo; 87 */ 88 elseif ($key==1) {$valori.= "null,";$oldidl=$campo;} 89 elseif ($key==2) {$valori.="'$campo',";$numlista= $campo;} 90 elseif ($key==3) {$valori.= "'$newidg',"; if ($campo!=$oldidg) $okl=1;} 91 elseif ($key==4) $valori.= "0,"; 92 elseif ($key==9 ) $valori.= "'$campo'"; 93 # else $valori.= "'$campo',"; # htmlentities(stripslashes(utf8_decode($_POST['parola']))); 94 else $valori.="'".utf8_encode($campo)."',"; 95 # else $valori.= "'".htmlentities($campo, ENT_QUOTES, "UTF-8")."',"; htmlspecialchars($str, ENT_QUOTES) 77 96 } 78 if( isset($valori)){97 if($key==9){ 79 98 if ($okl) {$okl=0;continue;} 99 # $valori2=htmlentities($valori); 100 # $sql="insert into ".$prefix."_ele_lista (id_cons,num_lista,id_gruppo,id_circ,descrizione,simbolo,stemma) values ('$id_cons','$num_lista','$id_gruppo','$id_circ','$descr_lista','$stemmanome','$stemmablob')"; 80 101 $sql="insert into ".$prefix."_ele_lista values($valori)"; 102 try { 81 103 $res_lista = $dbi->prepare("$sql"); 82 $res_lista->execute(); 104 $res_lista->execute(); 105 } 106 catch(PDOException $e) 107 { 108 echo $sql . "<br>" . $e->getMessage(); 109 } 110 83 111 $sql="select id_lista from ".$prefix."_ele_lista where num_lista='$numlista' and id_cons='$idcns'"; 84 112 $reslnew = $dbi->prepare("$sql"); … … 86 114 list ($newidl) = $reslnew->fetch(PDO::FETCH_NUM); 87 115 unset($valori); 88 if($oldidl) 116 if($oldidl){ 89 117 $_SESSION['liste']['idl_'.$oldidl]=$newidl; 90 118 echo "id_lista:$oldidl:$newidl<br>"; 119 } 91 120 # inscandi($oldidl,$newidl); 92 121 } 93 }122 } 94 123 } 95 124 … … 109 138 elseif ($key==1) $valori.="'$idcns',"; 110 139 elseif ($key==2) {$valori.= "'$newidl'"; if ($campo!=$oldidl) $okc=1;} 111 else $valori.= ",' $campo'";140 else $valori.= ",'".utf8_encode($campo)."'"; 112 141 } 113 if(isset($valori) ){142 if(isset($valori) and $valori!=''){ 114 143 if ($okc) {$okc=0;continue;} 144 # $valori2=addslashes($valori); 115 145 $sql="insert into ".$prefix."_ele_candidati values($valori)"; 116 $res_lista = $dbi->prepare("$sql"); 117 $res_lista->execute(); 146 # $res_lista = $dbi->prepare("$sql"); 147 # $res_lista->execute(); 148 try { 149 $res_lista = $dbi->prepare("$sql"); 150 $res_lista->execute(); 151 } 152 catch(PDOException $e) 153 { 154 echo "<br>key:$key sql:".$sql . "<br>" . $e->getMessage(); 155 } 118 156 } 119 157 } … … 268 306 } 269 307 elseif ($numlista) { 270 inslista(0,0);308 # inslista(); 271 309 Header("Location: admin.php?op=lista&id_cons_gen=$id_cons_gen"); 272 310 } -
trunk/admin/modules/Elezioni/salva_liste.php
r358 r360 41 41 if (isset($_GET['valista'])) $validi=intval($_GET['valista']); else $validi='0'; 42 42 if (isset($_GET['nulli'])) $nulli=intval($_GET['nulli']); else $nulli='0'; 43 if (isset($_GET['bianchi'])) $bianchi= addslashes($_GET['bianchi']); else $bianchi='0';44 if (isset($_GET['contestati'])) $contestati= addslashes($_GET['contestati']); else $contestati='0';45 if (isset($_GET['votinulli'])) $votinulli= addslashes($_GET['votinulli']); else $votinulli='0';43 if (isset($_GET['bianchi'])) $bianchi=intval($_GET['bianchi']); else $bianchi='0'; 44 if (isset($_GET['contestati'])) $contestati=intval($_GET['contestati']); else $contestati='0'; 45 if (isset($_GET['votinulli'])) $votinulli=intval($_GET['votinulli']); else $votinulli='0'; 46 46 if (isset($_GET['id_comune'])) $id_comune=intval($_GET['id_comune']); else $id_comune='0'; 47 47 if (isset($_GET['ops'])) $ops=intval($_GET['ops']); else $ops='3'; -
trunk/admin/modules/Elezioni/scarica.php
r344 r360 29 29 if (isset($param['fase'])) $fase=intval($param['fase']); else $fase=0; 30 30 if (isset($param['id_cons_gen2'])) $id_cons_gen2=intval($param['id_cons_gen2']); else $id_cons_gen2='0'; 31 if (isset($param['indirizzoweb'])) $indirizzoweb=addslashes($param['indirizzoweb']); else $indirizzoweb='http ://www.eleonline.it/client/';31 if (isset($param['indirizzoweb'])) $indirizzoweb=addslashes($param['indirizzoweb']); else $indirizzoweb='https://www.eleonline.it/client/'; 32 32 if (isset($param['id_comune2'])) $id_comune2=intval($param['id_comune2']); else $id_comune2='0'; 33 33 # htmlentities($param['indirizzoweb'], ENT_COMPAT, 'UTF-8') 34 34 /******************************************************/ 35 35 /*Funzione di visualizzazione globale */ … … 39 39 if (isset($help)) include("language/$language/ele_scarica.html"); 40 40 41 $bgcolor1=$_SESSION['bgcolor1']; 42 $bgcolor2=$_SESSION['bgcolor2']; 43 44 if ($fase=='0'){ 45 46 echo "<form name=\"import\" action=\"admin.php\">"; 47 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 48 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 49 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"1\"><input type=\"text\" name=\"indirizzoweb\" size=\"50\" value=\"".$indirizzoweb."\"></td></tr>"; 50 echo "<td><input type=\"submit\" name=\"add\" value=\""._OK."\"></td>"; 51 echo "</tr></table><br>"; 52 echo "</form>"; 53 }elseif ($fase=='1'){ 54 $rem_cons="<script type=\"text/javascript\" src=\"$indirizzoweb/file.php?fase=1\"></script>"; 55 56 echo "<form name=\"import\" action=\"admin.php\">"; 57 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 58 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 59 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"2\"><input type=\"hidden\" name=\"indirizzoweb\" value=\"$indirizzoweb\">$indirizzoweb</td></tr>"; 60 echo "<tr><td><b>"._SCARICACONS."</b></td>"; 61 62 echo "<td>$rem_cons</td></tr>"; 63 41 $bgcolor1=$_SESSION['bgcolor1']; 42 $bgcolor2=$_SESSION['bgcolor2']; 43 if ($fase=='0'){ 44 echo "<form name=\"import\" action=\"admin.php\">"; 45 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 46 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 47 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"1\"><input type=\"text\" name=\"indirizzoweb\" size=\"50\" value=\"".$indirizzoweb."\"></td></tr>"; 48 echo "<td><input type=\"submit\" name=\"add\" value=\""._OK."\"></td>"; 49 echo "</tr></table><br>"; 50 echo "</form>"; 51 }elseif ($fase=='1'){ 52 $urlrem="$indirizzoweb/file.php?fase=1"; 53 $rem_cons="<script type=\"text/javascript\" src=\"$urlrem\" crossorigin=\"anonymous\"></script>"; 54 echo "<form name=\"import\" action=\"admin.php\">"; 55 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 56 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 57 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"2\"><input type=\"hidden\" name=\"indirizzoweb\" value=\"$indirizzoweb\">$indirizzoweb</td></tr>"; 58 echo "<tr><td><b>"._SCARICACONS."</b></td>"; 59 echo "<td>".$rem_cons."</td></tr>"; 64 60 echo "<tr><td><input type=\"submit\" name=\"add\" value=\""._OK."\"></td>"; 65 66 echo "</tr></table><br>"; 67 echo "</form>"; 61 echo "</tr></table><br>"; 62 echo "</form>"; 68 63 }elseif($fase=='2'){ 69 70 $sql="SELECT descrizione from ".$prefix."_ele_consultazione WHERE id_cons_gen=$id_cons_gen2"; 71 $res = $dbi->prepare("$sql"); 72 $res->execute(); 73 list($descrcons) = $res->fetch(PDO::FETCH_NUM); 74 $rem_cons="<script type=\"text/javascript\" src=\"$indirizzoweb/file.php?fase=2&id_cons_gen2=$id_cons_gen2\"></script>"; 75 76 echo "<form name=\"import\" action=\"admin.php\">"; 77 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 78 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 79 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"3\"><input type=\"hidden\" name=\"indirizzoweb\" value=\"$indirizzoweb\">$indirizzoweb</td></td></tr>"; 80 $cons_rem=addslashes($_GET[($id_cons_gen2)]); 81 echo "<tr><td><b>"._CONSULTA.":</b></td><td>$cons_rem</td></tr>"; 82 echo "<tr><td><b>"._SCELTACOMUNE."</b></td><td>$rem_cons</td></tr>"; 83 64 $sql="SELECT descrizione from ".$prefix."_ele_consultazione WHERE id_cons_gen=$id_cons_gen2"; 65 $res = $dbi->prepare("$sql"); 66 $res->execute(); 67 list($descrcons) = $res->fetch(PDO::FETCH_NUM); 68 $rem_cons="<script type=\"text/javascript\" src=\"$indirizzoweb/file.php?fase=2&id_cons_gen2=$id_cons_gen2\"></script>"; 69 echo "<form name=\"import\" action=\"admin.php\">"; 70 echo "<table border=\"0\" width=\"100%\"><tr bgcolor=\"$bgcolor2\">"; 71 echo "<td><b>"._INDIRIZZOWEB1."</b></td>"; 72 echo "<td><input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"op\" value=\"scarica\"><input type=\"hidden\" name=\"fase\" value=\"3\"><input type=\"hidden\" name=\"indirizzoweb\" value=\"$indirizzoweb\">$indirizzoweb</td></td></tr>"; 73 $cons_rem=addslashes($_GET[($id_cons_gen2)]); 74 echo "<tr><td><b>"._CONSULTA.":</b></td><td>$cons_rem</td></tr>"; 75 echo "<tr><td><b>"._SCELTACOMUNE."</b></td><td>$rem_cons</td></tr>"; 84 76 echo "<tr><td><input type=\"submit\" name=\"add\" value=\""._OK."\"></td>"; 85 86 echo "</tr></table><br>"; 87 echo "</form>"; 88 77 echo "</tr></table><br>"; 78 echo "</form>"; 89 79 }elseif ($fase=='3'){ 90 91 $id_cons_gen2=$_GET['id_cons_gen2']; 92 $id_comune2=$_GET['id_comune2']; 93 Header("Location: $indirizzoweb/modules.php?op=backup&id_cons_gen=$id_cons_gen2&id_comune=$id_comune2"); 94 80 $id_cons_gen2=$_GET['id_cons_gen2']; 81 $id_comune2=$_GET['id_comune2']; 82 Header("Location: $indirizzoweb/modules.php?op=backup&id_cons_gen=$id_cons_gen2&id_comune=$id_comune2"); 95 83 } 96 84 } -
trunk/admin/temi/Futura2/index.php
r359 r360 16 16 } 17 17 18 include("header.php"); 18 19 20 include_once("header.php"); 19 21 $nometema=$tema; 22 #require_once("class/db/db.php"); //classe db 23 global $tema,$id_comune,$descr_cons,$multicomune,$dbi,$prefix,$currentlang,$ops,$id_sez,$id_cons,$id_cons_gen; 24 include_once("modules/Elezioni/query.sql"); 25 #if(($tema='Futura2' and !$id_sez) or $_SESSION['id_cons']!=$id_cons) {Header("Location: admin.php?id_comune=$id_comune&op=logout&is=$id_sez"); die();} 26 #die( "OP: $op - aid:".$_SESSION['aid']." - tema:$tema"); 27 include_once("modules/Elezioni/ele_spoglio.php"); 28 $row=setconsultazione(); 29 $sql="select id_sez from ".$prefix."_ele_operatori where aid='$aid' and id_cons=$id_cons"; 30 $res = $dbi->prepare("$sql"); 31 $res->execute(); 20 32 21 #require_once("class/db/db.php"); //classe db 22 global $tema,$id_comune,$descr_cons,$multicomune,$dbi,$prefix,$currentlang,$ops,$id_sez; 23 include_once("modules/Elezioni/query.sql"); 24 if(($tema='Futura2' and !$id_sez) or $_SESSION['id_cons']!=$id_cons) {Header("Location: admin.php?id_comune=$id_comune&op=logout&is=$id_sez"); die();} 33 list($id_sez) = $res->fetch(PDO::FETCH_NUM);#include("TEST:$id_sez:$sql:"); 25 34 26 $row=setconsultazione();27 35 if(isset($row[0])) { 28 36 $tipo_cons=$row[0]; $descr_cons=$row[1]; $id_cons_gen=$row[2]; … … 37 45 } 38 46 39 # colore tema mobile40 41 42 47 include("temi/$tema/config.php"); 43 48 … … 50 55 51 56 list($descr_com) = $res->fetch(PDO::FETCH_NUM); 52 include_once("header.php");57 #include_once("header.php"); 53 58 testata(); 54 59 … … 59 64 global $op,$tema,$dbi,$nometema,$file,$bgcolor,$sitename,$prefix,$blocco,$lang,$siteistat,$id_cons_gen,$descr_cons,$minsez,$offsetsez,$multicomune,$id_comune,$multicomune,$rss,$colortheme,$descr_com; 60 65 global $id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av,$votog,$genere,$aid,$bgcolor1,$language; 66 61 67 include("temi/$tema/function_theme.php"); 62 #$op='informazioni';63 #$logo= "<img src=\"admin.php?name=Elezioni&file=foto&id_comune=".$id_comune."\" alt=\"logo\" width=\"70\" align=\"left\"/>";64 68 $logo=''; 65 #echo"togliere combo consultazioni e impostare su consultazione predefinita e sezione fissata su autorizza operatori (nuovo tipo: per unica sezione - spostare voci di menu, affluenze, gruppi. liste al posto della combo e togliere menu verticale)"; 69 70 echo "<SCRIPT type=\"text/javascript\">\n"; 71 echo "function vai_cong(idrif){\n"; 72 echo "document.getElementById('frm').submit()\n"; 73 echo "}\n"; 74 echo "function vai_scelta(idrif){\n"; 75 echo "window.document.location.href=idrif\n"; 76 echo "}\n"; 77 echo "</script>\n"; 78 79 # 80 if(!$ops) $ops=1; 66 81 $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' "; 67 $res = $dbi->prepare("$sql"); 68 $res->execute(); 69 70 list($descr_com) = $res->fetch(PDO::FETCH_NUM); 71 $descr_com =stripslashes($descr_com); 82 $res = $dbi->prepare("$sql"); 83 $res->execute(); 84 list($descr_com) = $res->fetch(PDO::FETCH_NUM); 85 $descr_com =stripslashes($descr_com); 72 86 73 87 echo ' 74 88 <div data-role="page" data-theme="a"> 75 <div data-role="header" data-position="inline">'; 76 77 /* 78 if($op!="gruppo") 79 echo '<a href="#" onClick="javascript:history.back()" data-role="button" data-icon="arrow-left">indietro</a>'; 80 else echo '<a href="modules.php?tema=facebook" target="_blank" data-icon="off" data-role="button">Vers Web</a>'; 81 */ 82 // 83 # se aperta o sezioni scrutinate 84 # se non Ú il menu di config o about sceglie elezione 85 86 echo '<h2>Elezioni on line</h2>'; 87 88 # echo '<a href="admin.php?name=Elezioni&op=about&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-theme="c" data-icon="user">About</a>'; 89 90 91 ####### menu in alto 92 # definizione attivo 93 #echo "TEST: ".$_SESSION['BASE']; 94 #echo "TEST: ".$_SERVER['REQUEST_URI']; 95 #echo "TEST: ".$_SERVER['PHP_SELF']; 96 $sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' group by tipo"; 97 $rese = $dbi->prepare("$sql"); 98 $rese->execute(); 99 $bordoa=''; 100 $bordog=''; 101 $bordol=''; 102 while (list($tipo)=$rese->fetch(PDO::FETCH_NUM)) { 103 if ($tipo=='affluenze') $bordoa="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 104 if ($tipo=='gruppo') $bordog="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 105 if ($tipo=='lista') $bordol="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 106 } 107 if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\""; else $segna=''; 89 <div data-role="header" data-position="inline">'; 90 echo '<h2 style="color: white;">Elezioni on line</h2>'; 91 $oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y"))); 92 $sql="select t1.id_cons_gen,t1.descrizione from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.data_fine>'$oggi' and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and id_sez>0 and permessi>0)"; 93 $rese = $dbi->prepare("$sql"); 94 $rese->execute(); 95 if ($rese->rowCount()>1){ 96 echo "<form id=\"frm\" name=\"sceltacons\" data-ajax=\"false\" action=\"admin.php\">"; 97 echo "<input type=\"hidden\" name=\"id_comune=\" value=\"$id_comune\">"; 98 echo "<input type=\"hidden\" name=\"ops=\" value=\"$ops\">"; 99 echo "<select id=\"id_cong\" name=\"id_cons_gen\" onChange=\"vai_cong('id_cong');\">"; 100 while (list($id_cons_gen2,$desc2)=$rese->fetch(PDO::FETCH_NUM)) { 101 $sel = ($id_cons_gen == $id_cons_gen2) ? "selected" : ""; 102 echo "<option value=\"$id_cons_gen2\" $sel>"; 103 echo $desc2; 104 echo "</option>"; 105 } 106 echo "</select></form>"; 107 } 108 $sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' group by tipo"; 109 $rese = $dbi->prepare("$sql"); 110 $rese->execute(); 111 $bordoa=''; 112 $bordog=''; 113 $bordol=''; 114 while (list($tipo)=$rese->fetch(PDO::FETCH_NUM)) { 115 if ($tipo=='affluenze') $bordoa="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 116 if ($tipo=='gruppo' or $tipo=='referendum') $bordog="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 117 if ($tipo=='lista') $bordol="style=\"border: 6px solid; border-color: rgb(255, 0, 0);\""; 118 } 119 if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\""; else $segna=''; 108 120 if($ops=="4" ) {$bgcolorg="yellow"; $tcolorg='blue';} else {$bgcolorg="grey"; $tcolorg='white';} #$active_gruppo=" class=\"ui-btn-active\""; else $active_gruppo=''; 109 121 if($ops=="3") {$bgcolorl="yellow"; $tcolorl='blue';} else {$bgcolorl="grey"; $tcolorl='white';} # $active_lista=" class=\"ui-btn-active\""; else $active_lista=''; 110 122 if($ops=="1") {$bgcolora="yellow"; $tcolora='blue';} else {$bgcolora="grey"; $tcolora='white';} # $active_aff=" class=\"ui-btn-active\""; else $active_aff=''; 111 /*if($op=="risultati" || $op=="affluenze_all" || $op=="gruppo_mob" || $op=="candidato_mob" || $op=="liste_mob" || $op=="votanti_mob") $active_ris=" class=\"ui-btn-active\""; else $active_ris='';112 if($op=="conf_mob" ) $active_conf=" class=\"ui-btn-active\""; else $active_conf='';113 if($op=="grafica_mob" ) $active_graf=" class=\"ui-btn-active\""; else $active_graf='';114 115 */116 123 echo "</div>"; 117 118 119 # se non Ú il menu di config o about sceglie elezione 120 #if($op!="conf_mob" and $op!="about"){ 121 echo'<div data-role="fieldcontain" style="text-align:center;"> 122 <span style="text-align:center;width:100%;height:110px;background-color:#fff;color:#000;">'.$logo.' Comune di '.$descr_com.' <br>Consultazione: '.$descr_cons.'</span></div>'; 123 124 124 echo'<div data-role="fieldcontain" style="text-align:center;"> 125 <span style="text-align:center;width:100%;height:110px;background-color:#fff;color:#000;">'.$logo.' Comune di '.$descr_com.' <br><h2>Consultazione: '.$descr_cons.'</h2></span></div>'; 125 126 ############### 126 127 //************************************ 127 128 // Menu spoglio 128 129 //************************************ 129 #echo "TEST : select id_sez from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'"; 130 $sql="select id_sez from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'"; 131 $sth = $dbi->prepare("$sql"); #echo $sql; 132 $sth->execute(); 133 list($id_sez)=$sth->fetch(PDO::FETCH_NUM); 134 $sql="select id_cons,id_sez,id_sede,num_sez, maschi, femmine, colore from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'"; 135 $result = $dbi->prepare("$sql");#echo $sql; 136 $result->execute(); 137 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine, $colore) = $result->fetch(PDO::FETCH_NUM); 138 echo "<div data-role=\"content\" data-theme=\"a\"><hr><table><tr><td align=\"center\" width=\"100\" bgcolor=\"$colore\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione<br>N. $num_sez</b></font></td><td><table><tr>"; 139 echo "\n<td bgcolor=\"$bgcolora\" align=\"center\" $bordoa><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=1\"><font color=\"$tcolora\">"._AFFLUENZE."</font></a></b></p></td>\n"; 140 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){ 141 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=4\"><font color=\"$tcolorg\">"._GRUPPO."</font></a></b></p></td>\n"; 142 } 143 if($genere==2 and $votog) 144 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=4\"><font color=\"$tcolorg\">"._GRUPPO."</font></a></b></p></td>\n"; 145 elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){ 146 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol><p style=\"margin-left:10px;margin-right:10px;\"><b><a href=\"admin.php?id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3\"><font color=\"$tcolorl\">"._LISTA."</font></a></b></p></td>\n"; 147 } 148 echo "</tr></table></td></tr></table><hr></div>\n"; 149 150 130 $sql="select id_sez from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'"; 131 $sth = $dbi->prepare("$sql"); #echo $sql; 132 $sth->execute(); 133 list($id_sez)=$sth->fetch(PDO::FETCH_NUM); 134 $sql="select id_cons,id_sez,id_sede,num_sez, maschi, femmine, colore from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'"; 135 $result = $dbi->prepare("$sql");#echo $sql; 136 $result->execute(); 137 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine, $colore) = $result->fetch(PDO::FETCH_NUM); 138 echo "<div data-role=\"content\" data-theme=\"a\"><hr><table><tr><td align=\"center\" width=\"100\" bgcolor=\"$colore\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione<br>N. $num_sez</b></font></td><td><table><tr>"; 139 #<a href=\"admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=1\"></a> 140 echo "\n<td bgcolor=\"$bgcolora\" align=\"center\" $bordoa onClick=\"vai_scelta('admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=1');\"><p style=\"margin-left:10px;margin-right:10px;\"><font color=\"$tcolora\"><b>"._AFFLUENZE."</font></b></p></td>\n"; 141 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){ 142 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n"; 143 } 144 if($genere==2 and $votog) 145 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n"; 146 elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){ 147 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?id_comune=$id_comune&id_cons_gen=$id_cons_gen&ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTA."</font></b></p></td>\n"; 148 } 149 echo "</tr></table></td></tr></table><hr></div>\n"; 151 150 if($ops=="1")votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av); 152 151 elseif($ops=="3")preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops); 153 152 elseif($ops=="4")preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops); 154 155 156 153 footer_mon(); 157 158 154 die(); 159 }160 ########################################161 162 function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){163 //function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){164 global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen,$id_comune,$ops;165 166 $bgcolor1="#7777ff";167 $bgcolor2=$_SESSION['bgcolor2'];168 #OpenTable();169 $sql="SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";170 $res = $dbi->prepare("$sql");171 $res->execute();172 173 if($res) list($vismf)= $res->fetch(PDO::FETCH_NUM); else $vismf=0;174 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ";175 $res = $dbi->prepare("$sql");176 $res->execute();177 178 echo "<table><tr><td>";179 $num = $res->rowCount();180 $sql="SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez";181 $ressez = $dbi->prepare("$sql");182 $ressez->execute();183 ##################184 echo "<style>";185 echo "DIV.table";186 echo "{187 display:table;188 }189 FORM.tr190 {191 display:table-row;192 text-align: center;193 }194 DIV.tr195 {196 display:table-row;197 background-color: #D3D3D3;198 text-align: center;199 }200 SPAN.tdm201 {202 display:table-cell;203 border: 1px solid black;204 padding: 5px;205 }206 SPAN.td207 {208 display:table-cell;209 }";210 echo "</style>";211 212 ##################213 214 list($maschi,$femmine)=$ressez->fetch(PDO::FETCH_NUM);215 $y=0;216 echo "<div class=\"table\">";217 $riga=array();218 $rigat=array();219 while (list($ora,$giorno)= $res->fetch(PDO::FETCH_NUM)){220 $y++;221 $rigat[$y]='';222 $riga[$y]='';223 $rigat[$y]= "<div class=\"tr\">";224 if ($genere==0){ //e' un referendum225 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></span>";226 }227 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></span>"228 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._DATA."</b></span>";229 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></span>";230 $rigat[$y].= "<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></span>"231 ."<span class=\"tdm\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b></span>";232 if ($genere==0){233 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ";234 $res2 = $dbi->prepare("$sql");235 $res2->execute();236 $max = $res2->rowCount();237 }else{ $max=1;}238 $op="rec_add_votanti";239 $rigat[$y].= "</div>";240 for ($i=1;$i<=$max;$i++){241 $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2242 on (t1.id_gruppo=t2.id_gruppo) where t1.id_sez='$id_sez'243 and t1.id_cons='$id_cons' and t1.orario='$ora' and t1.data='$giorno'";244 if ($genere==0){245 $query.=" and t2.num_gruppo=$i";246 }247 $sql=$query;248 $result = $dbi->prepare("$sql");249 $result->execute();250 list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = $result->fetch(PDO::FETCH_NUM);251 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo' ";252 $res2 = $dbi->prepare("$sql");253 $res2->execute();254 $sql="select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'";255 $resril = $dbi->prepare("$sql");256 $resril->execute();257 list($numril)=$resril->fetch(PDO::FETCH_NUM);258 if ($res2)259 list($gruppo)= $res2->fetch(PDO::FETCH_NUM);260 else261 $gruppo=0;262 if (!$gruppo>0) {263 $gruppo=$i;264 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where num_gruppo=$gruppo and id_cons=$id_cons";265 $res3 = $dbi->prepare("$sql");266 $res3->execute();267 if ($res3)268 list($id_gruppo)=$res3->fetch(PDO::FETCH_NUM);269 }270 if(!isset($precede[$id_gruppo])) $precede[$id_gruppo]=0; if(!isset($error)) $error=0;271 if($precede[$id_gruppo]>($voti_t) and $voti_t!='') $error=1;272 $precede[$id_gruppo]=$voti_t;273 if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){274 $riga[$y].= "<form class=\"tr\" data-ajax=\"false\" style=\"background-color: rgb(255, 0, 0); text-align: center\" name=\"votanti\" action=\"modules/Elezioni/salva_aff.php\">";275 }else{276 $riga[$y].= "<form class=\"tr\" data-ajax=\"false\" action=\"modules/Elezioni/salva_aff.php\">";277 }278 if ($genere==0){ // e' un referendum279 $riga[$y].= "<span class=\"td\" align=\"center\">$gruppo</span>";280 }281 $riga[$y].= "<span class=\"td\"><input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\"/>";282 $riga[$y].= "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>"283 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\"/>"284 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"/>"285 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\"/>"286 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\"/>";287 list ($anno,$mese,$di)=explode('-',$giorno);288 $riga[$y].= "$ora</span><span class=\"td\" align=\"center\">$di-$mese-$anno</span>";289 if ($voti_u > $maschi) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\">";290 else $riga[$y].= "<span class=\"td\" align=\"center\">";291 if ($y<$num and $vismf==0 and $voti_u==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"'$voti_u'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_u$y$i\" name=\"voti_u\" value=\"$voti_u\"";292 $riga[$y].= " size=\"5\"/></span>";293 if ($voti_d > $femmine) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\"/>";294 else $riga[$y].= "<span class=\"td\" align=\"center\">";295 if ($y<$num and $vismf==0 and $voti_d==0) { $riga[$y].= "<input type=\"hidden\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"'$voti_d'\"";}else $riga[$y].= "<input type=\"text\" style=\"text-align:right\" id=\"voti_d$y$i\" name=\"voti_d\" value=\"$voti_d\"";296 $riga[$y].= " size=\"5\"/></span>";297 if ($voti_t > ($maschi+$femmine)) $riga[$y].= "<span class=\"td\" align=\"center\" bgcolor=\"red\" ><input type=\"text\" id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";298 else $riga[$y].= "<span class=\"td\" align=\"center\"><input id=\"voti_t$y$i\" name=\"voti_t\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\"/>";299 $riga[$y].= "<input type=\"hidden\" name=\"id_parz\" value=\"$id_parz\"/>"300 ."<input type=\"hidden\" name=\"data\" value=\"$giorno\"/>"301 ."<input type=\"hidden\" name=\"orario\" value=\"$ora\"/>"302 ."<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>"303 ."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>";304 $riga[$y].= "</span>";305 if (chisei($id_cons_gen)>=64 and $y==$numril) $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";306 else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>";307 $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>";308 $riga[$y].= "</form>";309 310 }311 echo "</div>";312 $sql="select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez";313 $compl = $dbi->prepare("$sql");314 $compl->execute();315 list ($complessivi)= $compl->fetch(PDO::FETCH_NUM);316 }317 foreach($riga as $key=>$val){318 echo $rigat[$key];319 echo $riga[$key];320 }321 echo "</div></td></tr></table>";322 155 } 323 156 … … 341 174 342 175 343 //////////////////////////////////////////////////////////////////////344 // da qui va la sezione per le preferenze candidati consiglieri345 //////////////////////////////////////////////////////////////////////346 function preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){347 global $aid, $prefix, $dbi, $id_lista,$genere,$id_cons_gen,$id_gruppo,$sezi,$circo,$votog,$votol,$votoc,$conscirc;348 global $tipo_cons,$limite,$dettnulli,$disgiunto;349 $bgcolor1="#7777ff";350 $bgcolor2=$_SESSION['bgcolor2'];351 echo "<SCRIPT type=\"text/javascript\">\n";352 echo "function vai_lista(){\n";353 echo "var element=document.getElementById('pag')\n";354 echo "var elista=document.getElementById('id_lista')\n";355 echo "var url=element.value+elista.value\n";356 echo "window.document.location.href=url \n";357 echo "}\n";358 echo "</script>\n";359 if ($genere==4){360 $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";361 $result = $dbi->prepare("$sql");362 $result->execute();363 364 365 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);366 echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"367 ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"368 ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";369 echo "</table>";370 }371 $sql="select validi,nulli,bianchi,contestati from ".$prefix."_ele_sezioni where id_sez='$id_sez' ";372 $result = $dbi->prepare("$sql");373 $result->execute();374 list($v1,$v2,$v3,$v4)=$result->fetch(PDO::FETCH_NUM);375 if($v1+$v2+$v3+$v4>0){376 //controlla se sono stati inseriti i votanti377 $sql="SELECT preferenze, id_fascia, id_conf,solo_gruppo, disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";378 $result = $dbi->prepare("$sql");379 $result->execute();380 381 382 list($numprefs,$fascia,$id_conf,$flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);383 $dettnulli=$flagsg;384 ####### 06-11-2014 - circoscrizionali - nello spostamento ad altra sezione resta sullo stesso numero di lista anche se sono sezioni di diverse circoscrizioni385 if ($circo and $id_lista){386 $sql="SELECT num_lista from ".$prefix."_ele_lista where id_lista=$id_lista";387 $res_lis = $dbi->prepare("$sql");388 $res_lis->execute();389 list($num_lista)=$res_lis->fetch(PDO::FETCH_NUM);390 }391 392 if(!$votog and ($genere==3 or $genere==5)){393 $sql="select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";394 $result = $dbi->prepare("$sql");395 $result->execute();396 397 398 }else{399 $sql="select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";400 $result = $dbi->prepare("$sql");401 $result->execute();402 }403 404 list($validi,$nulli,$bianchi,$contestati,$votinulli) = $result->fetch(PDO::FETCH_NUM);405 echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>";406 $sql="SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista";407 $res_lis = $dbi->prepare("$sql");408 $res_lis->execute();409 410 411 $num_liste = $res_lis->rowCount();412 $ele_lista='';413 if (($genere==4 or $genere==5) and !$votoc) { //liste a piu' candidati414 if(($genere==5 and $id_conf and $fascia<=$limite and !$disgiunto) and !$id_lista) { //esclude il voto di lista per le comunali nei comuni sotto fascia limite415 $sql="SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo limit 0,1";416 $result = $dbi->prepare("$sql");417 $result->execute();418 419 420 list($id_lista)=$result->fetch(PDO::FETCH_NUM);421 }422 echo "<td colspan=\"2\">";423 echo "<form name=\"liste\" data-ajax=\"false\" action=\"admin.php\">"; # data-ajax=\"false\"424 echo "<input type=\"hidden\" id=\"pag\" name=\"pag\" value=\"admin.php?id_cons_gen=$id_cons_gen&id_sez=$id_sez&id_circ=$id_circ&id_sede=$id_sede&do=spoglio&ops=3&id_lista=\">";425 echo "<select id=\"id_lista\" name=\"id_lista\" onChange=\"vai_lista();\">";426 if ($id_lista){427 echo "<option value=\"0\">"._VOTI_LISTA;428 $ele_lista=" and t1.id_lista='$id_lista' ";429 }else{430 echo "<option value=\"0\" selected>"._VOTI_LISTA;431 $ele_lista=" group by t1.id_lista ";432 if(!isset($votolista)) $votolista=0;433 434 }435 while(list($id_rif,$descrizione,$num_lis) = $res_lis->fetch(PDO::FETCH_NUM)) {436 $segna='';437 $sql="SELECT count(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";438 $result = $dbi->prepare("$sql");439 $result->execute();440 441 442 list($ctrvoticand)=$result->fetch(PDO::FETCH_NUM);443 $sql="SELECT sum(t1.voti),0,0 from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista=$id_rif";444 $result = $dbi->prepare("$sql");445 $result->execute();446 447 448 list($votisezcand)=$result->fetch(PDO::FETCH_NUM);449 if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4){450 $sql="SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'";451 $result = $dbi->prepare("$sql");452 $result->execute();453 }else{454 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'";455 $result = $dbi->prepare("$sql");456 $result->execute();457 list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);458 $sql="SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";459 $result = $dbi->prepare("$sql");460 $result->execute();461 }462 list($votisezlis,$sgpl)=$result->fetch(PDO::FETCH_NUM);463 if($votisezcand>($votisezlis*$numprefs))464 {$segna="style=\"background-color: #dd0000;\"";}465 elseif($ctrvoticand)466 $segna="style=\"background-color: #99CC33;\"";467 $sql="SELECT t1.voti,t2.num_cand FROM ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$id_rif'";468 $res4 = $dbi->prepare("$sql");469 $res4->execute();470 471 472 $errcand[$id_rif]=array();473 while(list($testvotic,$numcand)=$res4->fetch(PDO::FETCH_NUM))474 if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;}475 476 $sel = ($id_rif == $id_lista) ? "selected" : "";477 echo "<option $segna value=\"$id_rif\" $sel>";478 for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}479 echo $num_lis.") ".substr($descrizione,0,30);480 }481 echo "</select></form></td></tr><tr><td style=\"vertical-align: top;\"> </td>\n";482 }else {483 $id_lista=0;484 }485 echo "<td style=\"vertical-align: top;\">";486 487 if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";}488 if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) {489 $sql="SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,t2.contestati,0,0 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez=$id_sez group by t1.id_sez";490 $result = $dbi->prepare("$sql");491 $result->execute();492 493 494 }else{495 $sql="SELECT sum(t1.voti),t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo,t1.id_sez from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez='$id_sez' group by t1.id_sez,t2.validi_lista, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli_lista,t2.bianchi,t2.nulli,t2.contestati,t2.voti_nulli,t2.solo_gruppo";496 $result = $dbi->prepare("$sql");497 $result->execute();498 }499 500 // aggiunte le variabili $sgpl e $vnulli2 per la gestione dei voti 1) al solo presidente per singola lista - 2) al solo presidente per singola lista perché nullo o contestato quello di lista501 $isscr= $result->rowCount();502 list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2,$sgpl) = $result->fetch(PDO::FETCH_NUM);503 if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){504 $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";505 $resg = $dbi->prepare("$sql");506 $resg->execute();507 508 509 list($sgpl)=$resg->fetch(PDO::FETCH_NUM);510 if ($sg != $sgpl) echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></table>";511 }512 $valista=$validi2;513 if(!$id_lista or $genere==3){ //controllo di congruenza514 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";515 $res2 = $dbi->prepare("$sql");516 $res2->execute();517 518 519 list($tot) = $res2->fetch(PDO::FETCH_NUM);520 ####### controlli521 $sql="select * from ".$prefix."_ele_controlli where id_cons='$id_cons' and id_sez='$id_sez' ";522 $resc = $dbi->prepare("$sql");523 $resc->execute();524 if($resc->rowCount()){ if ($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2!=$tot and $validi+$sg>0){525 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2)."</b><br></td></table>";526 }527 528 if((($voti_sez)!=$validi2) and ($voti_sez>0)){529 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".($voti_sez)." "._NO_VAL_VOTI." ".$validi2."</b><br></td></tr></table>";530 }531 }elseif($genere==5){532 $sql="SELECT sum(t1.voti) from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on (t1.id_cand=t2.id_cand) where t1.id_sez=$id_sez and t2.id_lista='$id_lista'";533 $result = $dbi->prepare("$sql");534 $result->execute();535 536 537 list($votisezcand)=$result->fetch(PDO::FETCH_NUM);538 if(($fascia>$limite or $disgiunto) or !$id_conf){539 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'";540 $result = $dbi->prepare("$sql");541 $result->execute();542 543 544 }else{545 546 $sql="SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'";547 $result = $dbi->prepare("$sql");548 $result->execute();549 550 551 list($id_gruppo)=$result->fetch(PDO::FETCH_NUM);552 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";553 $result = $dbi->prepare("$sql");554 $result->execute();555 556 557 }558 list($votisezlis)=$result->fetch(PDO::FETCH_NUM);559 if($votisezcand>($votisezlis*$numprefs))560 {561 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza $votisezcand <br/>superano i voti di lista $votisezlis</b><br></td></tr></table>";562 }563 }564 #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto565 $errgrulis=array();566 if($genere==5 and !$disgiunto and ($tipo_cons==18 or $tipo_cons==19)){567 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";568 $resref = $dbi->prepare("$sql");569 $resref->execute();570 571 572 $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";573 $res4 = $dbi->prepare("$sql");574 $res4->execute();575 576 577 list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);578 if ($sezscrl)579 580 while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))581 {582 $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";583 $res3 = $dbi->prepare("$sql");584 $res3->execute();585 586 587 $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";588 $res4 = $dbi->prepare("$sql");589 $res4->execute();590 591 592 list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);593 list($vliste)=$res4->fetch(PDO::FETCH_NUM);594 if($vliste>$vgruppo)595 {596 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";597 $result = $dbi->prepare("$sql");598 $result->execute();599 600 601 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);602 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr></table>";603 $errgrulis[$id_gruppo]=1;604 }605 elseif($vliste<$vgruppo)606 {607 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";608 $result = $dbi->prepare("$sql");609 $result->execute();610 611 612 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);613 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";614 $errgrulis[$id_gruppo]=1;615 }616 }617 }618 }619 620 621 echo "\n<form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_liste.php\">"622 ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">"623 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"624 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"625 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"626 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"627 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"628 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"629 ."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"630 ."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"631 ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";632 echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";633 echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";634 if ($genere<4){635 // echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._LISTA."</b></td>";636 }637 echo "<b>"._NUM."</b></td>";638 if($id_lista){639 echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._CANDIDATO."</b></td>"640 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";641 }else{642 echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._DESCR."</b></td>"643 ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";644 #funzione di inserimento del dettaglio di voti nulli sospesa, non ritenuta utile645 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)646 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NULLI_LISTE."</b></td>";647 if($disgiunto){648 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLOLIS."</b></td>";649 }650 }651 echo "</tr>\n";652 653 654 if($id_lista) $sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista,t1.num_cand";655 else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista";656 $result = $dbi->prepare("$sql");657 $result->execute();658 659 660 $max = $result->rowCount();661 $tot_pref=0;662 $i=1;663 664 if($id_lista) {665 while(list($id_cand,$id_cons2,$id_lista2,$nl, $cognome, $nome, $note, $simbolo, $num_cand) = $result->fetch(PDO::FETCH_NUM)){666 // dati lista667 $sql="select id_lista, descrizione,simbolo,num_lista from ".$prefix."_ele_lista where id_lista='$id_lista2'";668 $result1 = $dbi->prepare("$sql");669 $result1->execute();670 671 672 list($id_lista3,$descr_lista,$simb_lista,$num_lista)=$result1->fetch(PDO::FETCH_NUM);673 // dati gruppo674 $sql="select descrizione,simbolo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";675 $result2 = $dbi->prepare("$sql");676 $result2->execute();677 678 679 list($descr_gruppo,$simb_gruppo)=$result2->fetch(PDO::FETCH_NUM);680 681 echo "<tr bgcolor=\"$bgcolor2\">";682 if ($genere<4){683 echo "<td align=\"left\"><b><img src=\"images/lista/$simb_lista \" width=\"32\" heigth=\"32\" align=\"center\" ALT=\"$descr_lista\" > </b></td>";684 }685 echo "<td align=\"center\"><b> $num_cand </b></td>"686 ."<td align=\"left\"><b>$cognome $nome</b></td>";687 $cond_sele="and id_cand=$id_cand";688 $sql="SELECT voti FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele";689 $res = $dbi->prepare("$sql");690 $res->execute();691 692 693 list($voti)= $res->fetch(PDO::FETCH_NUM);694 if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor='';695 echo "<td align=\"right\" $errcolor><input name=\"voti$num_cand\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";696 echo "<input type=\"hidden\" name=\"id_cand$num_cand\" value=\"$id_cand\"></td></tr>\n";697 $i++;698 $tot_pref+=$voti;699 }700 }else {701 if($circo) $circot1=" and t1.id_circ=$id_circ"; else $circot1='';702 $sql="select t2.voti,t1.id_lista, descrizione,simbolo,t1.num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo703 from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2704 where t1.id_cons='$id_cons'705 and t1.id_lista=t2.id_lista706 and t2.id_sez=$id_sez707 $circot1708 order by t1.num_lista";709 710 try {711 $result1 = $dbi->prepare("$sql");712 $result1->execute();713 714 }715 catch(PDOException $e)716 {717 echo $sql . "<br>" . $e->getMessage();718 }719 720 $num_lista=$result1->rowCount();721 if (!$num_lista){722 $sql="select '0',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo723 from ".$prefix."_ele_lista where id_cons='$id_cons' $circo724 order by num_lista";725 $result1 = $dbi->prepare("$sql");726 $result1->execute();727 }728 $tvnpl=0;729 $tslpl=0;730 while (list($voti,$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=$result1->fetch(PDO::FETCH_NUM)){731 echo "<tr bgcolor=\"$bgcolor2\">";732 // if ($genere<4 or $votoc){733 // }734 $sql="select t1.* from ".$prefix."_ele_voti_candidati as t1, ".$prefix."_ele_candidati as t2 where t1.id_cand=t2.id_cand and t1.id_sez='$id_sez' and t2.id_lista='$id_lista3' limit 0,1";735 $rese = $dbi->prepare("$sql");736 $rese->execute();737 if($rese->rowCount()) $segna="style=\"background-color: #99CC33;\""; else $segna='';738 $sql="select * from ".$prefix."_ele_controlli where tipo='lista' and id_sez='$id_sez' and id='$id_lista3'";739 $rese = $dbi->prepare("$sql");740 $rese->execute();741 if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\"";742 list($sezcol)=$rese->fetch(PDO::FETCH_NUM);743 $errcolor='';744 if(isset($errgrulis[$rifgruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";745 echo "<td align=\"center\" $segna><b> $num_lista </b></td>"746 ."<td align=\"left\"><b> $descr_lista</b></td>";747 $cond_sele="and id_lista=$id_lista3";748 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$voti."\" size=\"7\" style=\"text-align:right\">";749 #funzione non ritenuta utile750 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19) { echo "</td><td align=\"right\"><input name=\"vnpl$i\" value=\"".$vnpl."\" size=\"7\" style=\"text-align:right\">"; $tvnpl+=$vnpl;}751 if($disgiunto) {echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\">"; $tslpl+=intval($slpl);}752 echo "<input type=\"hidden\" name=\"id_lista$i\" value=\"$id_lista3\"></td>";753 // echo "<td align=\"right\">$sgpl";754 echo "</tr>\n";755 $i++;756 $tot_pref+=$voti;757 }758 }759 if(!$id_lista) {760 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><font size=\"3\">"._TOT._VOTI_LISTA."</font></td><td align=\"center\"><font size=\"3\">$tot_pref</font></td>";761 # if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)762 # echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tvnpl."</font></td>";763 if($disgiunto)764 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font size=\"3\">".$tslpl."</font></td>";765 echo "</tr>";766 }767 else echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOTPREF."</td><td align=\"center\">$tot_pref</td></tr>";768 // toglie ai candidati la visual... del solo_gruppo769 if(!$votog) {770 if (($genere==3 OR $genere==5) and (!$id_lista) and (($disgiunto or $fascia>$limite) or !$id_conf)) { //gruppo e liste771 echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._VALIDI_LISTA."</b></td><td align=\"center\"><input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\"><input name=\"valista\" value=\"$valista\" size=\"5\" style=\"text-align:right\"></td></tr>";772 echo "<tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\"><input name=\"sg\" value=\"$sg\" size=\"5\" style=\"text-align:right\">";773 if(defined('_NULLISTA'))774 echo "<input type=\"hidden\" name=\"votinulli\" value=\"$votinulli\"><input type=\"hidden\" name=\"contestati\" value=\"$contestati\"></td></tr>";775 else776 echo "</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._NULLI_LISTE."</b></td><td align=\"center\"><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"777 ."</td></tr><tr bgcolor=\"$bgcolor2\"><td></td><td><b>"._CONTESTATI_LISTE."</b></td><td align=\"center\"><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\"></td></tr>";778 779 }elseif (($genere==3 OR $genere==5) and !$votoc and (($disgiunto or $fascia>$limite) or !$id_conf)){ //}elseif ($tipo_cons!=10 and $tipo_cons!=11){780 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">$sg</td></tr>";781 }782 ######modifica del 16-04-2009 per visualizzare i voti al solo sindaco nei comuni con meno di 15000 abitanti783 elseif(($genere==3 OR $genere==5) and ($id_lista) and ($fascia<=$limite or !$id_conf) and $numprefs==1) {784 $sql="SELECT id_gruppo FROM ".$prefix."_ele_lista where id_lista='$id_lista'";785 $resvg = $dbi->prepare("$sql");786 $resvg->execute();787 788 789 list($id_gruppo) = $resvg->fetch(PDO::FETCH_NUM);790 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo' and id_sez='$id_sez'";791 $resvg = $dbi->prepare("$sql");792 $resvg->execute();793 794 795 list($voti_sind) = $resvg->fetch(PDO::FETCH_NUM);796 797 echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">".($voti_sind - $tot_pref)."</td></tr>";798 }799 ###### fine modifica del 16-04-2009800 801 }802 echo "<tr>";803 echo "<td></td><td></td>";804 echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";805 echo "</tr></table>";806 if(chisei($id_cons_gen)>=64){807 echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"1\">"._DELETE."</td>";808 } # onclick=\"javascript:del_dati()\"809 echo "</form></tr></table>";810 811 812 813 }814 #if (!((!$votog) and ($genere==3 OR $genere==5) and ($fascia>$limite)))815 finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);816 }817 818 819 function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){820 global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;821 ////////////////////////////////////////////822 // da qua va la sezione per i voti finali823 ///////////////////////////////////////////824 $bgcolor1="#7777ff";825 $bgcolor2=$_SESSION['bgcolor2'];826 827 828 829 echo "<form name=\"spogliovoti\" data-ajax=\"false\" action=\"modules/Elezioni/salva_voti.php\">"830 ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";831 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"832 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"833 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"834 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"835 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";836 837 echo "<table border=\"0\" width=\"100%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";838 /* if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )839 echo "<td width=\"32\"><b>"._VOTI_LISTA."</b></td>";840 else */841 echo "<td width=\"15%\"><b>"._VALIDI."</b></td>";842 echo "<td width=\"82\"><b>"._NULLI."</b></td>"843 ."<td><b>"._BIANCHI."</b></td>"844 ."<td width=\"82\"><b>"._VOTINULLI."</b></td>"845 ."<td><b>"._CONTESTATI."</b></td>"846 ."<td><b>"._TOTNON."</b></td>"847 ."<td><b>"._TOTALEVOTI."</b></td>"848 ."<td bgcolor=\"#ffffff\"></td> </tr>";849 /*if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )850 $result = mysql_query("select id_cons,id_sez,validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista,solo_gruppo,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";851 $res = $dbi->prepare("$sql");852 $res->execute();853 854 855 else */856 $sql = "select id_cons,id_sez,validi,nulli,bianchi,contestati,voti_nulli,'0','0','0',solo_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ";857 $result = $dbi->prepare("$sql");858 $result->execute();859 860 861 list($id_cons2,$id_sez2,$validi, $nulli, $bianchi, $contestati,$votinulli,$sg,$conts,$nullis,$sololista) = $result->fetch(PDO::FETCH_NUM);862 $tot_nulli=$nulli+$bianchi+$contestati+$votinulli;863 $tot_voti=$validi+$tot_nulli+$conts+$nullis;864 // ."</td><td><input name=\"sololista\" value=\"$sololista\" size=\"5\" style=\"text-align:right\">" --- ."<td><b>"._SOLOLIS."</b></td>"865 866 867 echo "<tr bgcolor=\"$bgcolor2\" align=\"center\"><td align=\"left\"><input name=\"validi\" value=\"$validi\" size=\"7\" style=\"text-align:right\">";868 /* if(($genere==3 or $genere==5) and !$votog and $ops==3){869 echo "</td><td>$nulli"870 ."</td><td>$bianchi";871 echo "<input type=\"hidden\" name=\"nulli\" value=\"$nulli\"><input type=\"hidden\" name=\"bianchi\" value=\"$bianchi\">";872 }else{ */873 echo "</td><td><input name=\"nulli\" value=\"$nulli\" size=\"5\" style=\"text-align:right\">"874 ."</td><td><input name=\"bianchi\" value=\"$bianchi\" size=\"5\" style=\"text-align:right\">";875 // }876 echo "</td><td><input name=\"votinulli\" value=\"$votinulli\" style=\"text-align:right;\">"877 ."</td><td><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\">"878 ."</td><td>$tot_nulli"879 ."</td><td>$tot_voti</td><td>"880 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"881 ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">"882 ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"883 ."</td></tr></table></form>"; //</td></tr>";884 885 886 // echo "</table>";887 /* echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";888 if (!$validi) {889 echo "document.spogliovoti.validi.focus()\n";890 echo "document.spogliovoti.validi.select()\n";891 }892 echo "//-->\n"893 ."</script>\n"; */894 895 896 }897 898 899 function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){900 global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;901 ////////////////////////////////////////////902 // da qua va la sezione per le preferenze ai gruppi903 ///////////////////////////////////////////904 // Controllo immmissioni905 906 $bgcolor1="#7777ff";907 $bgcolor2=$_SESSION['bgcolor2'];908 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ";909 $res = $dbi->prepare("$sql");910 $res->execute();911 912 913 $max = $res->rowCount();914 $max = $max-1;915 /* echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";916 if ($genere==0) {917 echo "document.sezioni.si1.focus()\n";918 echo "document.sezioni.si1.select()\n";919 } else {920 echo "document.sezioni.voti1.focus()\n"921 ."document.sezioni.voti1.select()\n";922 }923 echo "//-->\n"924 ."</script>\n"; */925 // tabella votanti926 echo "<center>";927 if ($genere!=0){928 $sql="SELECT voti_uomini,voti_donne, voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_cons='$id_cons' order by data desc,orario desc limit 0,1";929 $result = $dbi->prepare("$sql");930 $result->execute();931 932 933 list( $voti_u, $voti_d, $voti_t) = $result->fetch(PDO::FETCH_NUM);934 echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"935 ."<tr><td></td><td align=\"center\"></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIU."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTID."</td><td bgcolor=\"$bgcolor1\" align=\"center\">"._VOTIT."</td></tr>"936 ."<tr><td></td><td bgcolor=\"$bgcolor1\" align=\"center\">"._TOT_ULT."</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_u</td><td align=\"center\" bgcolor=\"$bgcolor2\">$voti_d</td><td bgcolor=\"$bgcolor2\" align=\"center\">$voti_t</td></tr>";937 echo "</table>";938 }939 echo "<table class=\"table-menu\" style=\"width: 50%; color: black\">";940 if ($genere==0){941 $sql="SELECT id_gruppo,si+no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' ";942 $res = $dbi->prepare("$sql");943 $res->execute();944 945 946 while (list($id_gruppo,$voti_parz,$validi,$nulli,$bianchi,$contestati) = $res->fetch(PDO::FETCH_NUM)){947 if ($voti_parz!=$validi){948 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo' ";949 $res2 = $dbi->prepare("$sql");950 $res2->execute();951 952 953 list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);954 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI_REF." $num_gruppo: ".$voti_parz." "._NO_VAL_VOTI.": ".$validi."</b><br></td></tr>";955 }956 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";957 $res2 = $dbi->prepare("$sql");958 $res2->execute();959 960 961 list($tot) = $res2->fetch(PDO::FETCH_NUM);962 if (($validi+$nulli+$bianchi+$contestati)!= $tot ){963 $sql="SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'";964 $res2 = $dbi->prepare("$sql");965 $res2->execute();966 967 968 list($num_gruppo) = $res2->fetch(PDO::FETCH_NUM);969 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI_REF." $num_gruppo: ".$tot." "._NO_SOMMA." ".($validi+$nulli+$bianchi+$contestati)."</b><br></td></tr>";970 }971 }972 }else{973 $sql="select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";974 $result = $dbi->prepare("$sql");975 $result->execute();976 list($flagsg,$disgiunto)=$result->fetch(PDO::FETCH_NUM);977 $dettnulli=$flagsg;978 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'";979 $res = $dbi->prepare("$sql");980 $res->execute();981 list($voti_parz) = $res->fetch(PDO::FETCH_NUM);982 $sql="SELECT validi,nulli,bianchi,contestati,solo_lista,voti_nulli FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'";983 $res = $dbi->prepare("$sql");984 $res->execute();985 list($validi,$nulli,$bianchi,$contestati,$solo_lista,$votinulli) = $res->fetch(PDO::FETCH_NUM);986 if ($voti_parz!=($validi-$solo_lista) and $voti_parz>0){987 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTI." ".$voti_parz." "._NO_VAL_VOTI." ".($validi-$solo_lista)."</b><br></td><tr>";988 }989 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'";990 $res2 = $dbi->prepare("$sql");991 $res2->execute();992 993 994 list($tot) = $res2->fetch(PDO::FETCH_NUM);995 if ($validi+$nulli+$bianchi+$contestati+$votinulli!=$tot and $validi+$nulli+$bianchi+$contestati+$votinulli>0){996 echo "<tr><td style=\"background-color: rgb(255, 0, 0); text-align:center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_VOTANTI." ".$tot." "._NO_TOT_VOTI." ".($validi+$nulli+$bianchi+$contestati+$votinulli)."</b><br></td></tr>";997 }998 $sql="SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez";999 $resg = $dbi->prepare("$sql");1000 $resg->execute();1001 1002 1003 list($voti_sez)=$resg->fetch(PDO::FETCH_NUM);1004 if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){1005 1006 $sql="SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez";1007 $resg = $dbi->prepare("$sql");1008 $resg->execute();1009 1010 1011 list($sgpl)=$resg->fetch(PDO::FETCH_NUM);1012 $sql="SELECT solo_gruppo from ".$prefix."_ele_sezioni where id_cons=$id_cons and id_sez=$id_sez";1013 $resg = $dbi->prepare("$sql");1014 $resg->execute();1015 1016 1017 list($sg)=$resg->fetch(PDO::FETCH_NUM);1018 if ($sg != $sgpl) echo "<tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br><b> "._ATT_UNI." ".$sgpl." "._ATT_TOT_UNI." ".$sg."</b><br></td></tr>";1019 }1020 #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto1021 if($genere==5 and !$disgiunto and $flagsg and ($tipo_cons==18 or $tipo_cons==19)){1022 $sql="SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo";1023 $resref = $dbi->prepare("$sql");1024 $resref->execute();1025 1026 1027 $errgrulis=array();1028 $sql="SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'";1029 $res4 = $dbi->prepare("$sql");1030 $res4->execute();1031 1032 1033 list($sezscrl)=$res4->fetch(PDO::FETCH_NUM);1034 if ($sezscrl)1035 while ( list($id_gruppo)=$resref->fetch(PDO::FETCH_NUM))1036 {1037 if($disgiunto || $flagsg){1038 $sql="SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";1039 $res3 = $dbi->prepare("$sql");1040 $res3->execute();1041 if($flagsg){1042 $sql="SELECT sum(voti+nulli_lista) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1043 $res4 = $dbi->prepare("$sql");1044 $res4->execute();1045 }else{1046 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1047 $res4 = $dbi->prepare("$sql");1048 $res4->execute();1049 }1050 }else{1051 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'";1052 $res3 = $dbi->prepare("$sql");1053 $res3->execute();1054 $sql="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista in (select id_lista from ".$prefix."_ele_lista where id_gruppo='$id_gruppo')";1055 $res4 = $dbi->prepare("$sql");1056 $res4->execute();1057 }1058 list($vgruppo)=$res3->fetch(PDO::FETCH_NUM);1059 list($vliste)=$res4->fetch(PDO::FETCH_NUM);1060 if($vliste>$vgruppo and !$disgiunto )1061 {1062 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";1063 $result = $dbi->prepare("$sql");1064 $result->execute();1065 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);1066 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti delle liste collegate $vliste<br/> superano i voti assegnati al gruppo $dgruppo $vgruppo</b><br></td></tr></table>";1067 $errgrulis[$id_gruppo]=1;1068 }1069 elseif($vliste<$vgruppo and $disgiunto )1070 {1071 $sql="SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";1072 $result = $dbi->prepare("$sql");1073 $result->execute();1074 list($dgruppo)=$result->fetch(PDO::FETCH_NUM);1075 echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo<br/> superano i voti delle liste collegate </b><br></td></tr></table>";1076 $errgrulis[$id_gruppo]=1;1077 }1078 }1079 }1080 1081 }1082 if(!isset($votinulli)) $votinulli=0;1083 echo "<tr><td></td></tr></table>";1084 if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {1085 if($genere==0) echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_ref.php\">";1086 else echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" data-ajax=\"false\" action=\"modules/Elezioni/salva_gruppi.php\">";1087 echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppiq\">"1088 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"1089 ."<input type=\"hidden\" name=\"id_cons\" value=\"$id_cons\">"1090 ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"1091 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"1092 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"1093 ."<input type=\"hidden\" name=\"circo\" value=\"$circo\">"1094 ."<input type=\"hidden\" name=\"genere\" value=\"$genere\">"1095 ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";1096 1097 if ($genere==0){1098 echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"1099 ."<td colspan=\"6\"><b>"._GRUPPO."</b></td></tr>";1100 $campitesta= "<tr align=\"center\" bgcolor=\"$bgcolor1\"><td><b>Votanti "._SI."</b></td>"1101 ."<td><b>Votanti "._NO."</b></td>"1102 ."<td><b>"._VALIDI."</b></td>"1103 ."<td><b>"._BIANCHI."</b></td>"1104 ."<td><b>"._CONTESTATI."</b></td>"1105 ."<td><b>"._NULLI."</b></td></tr>";1106 1107 $campiriep="<tr style=\"background-color: $bgcolor1; text-align:center\"><td colspan=\"2\"><b>"._TOTNON."</b></td>"1108 ."<td colspan=\"2\"><b>"._TOTALEVOTI."</b></td>"1109 ."<td colspan=\"2\"><b>"._VOTANTI."</b></td></tr>";1110 }else{1111 echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"1112 ."<td width=\"3%\"><b>"._NUM."</b></td>"1113 ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";1114 echo "<td width=\"5%\"><b>"._VOTI."</b></td>";1115 if($dettnulli) echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLO_GRUPPO."</b></td>";1116 echo "</tr>";1117 }1118 $sql="SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";1119 $res = $dbi->prepare("$sql");1120 $res->execute();1121 1122 1123 $max = $res->rowCount();1124 //echo "Massimo:$max - id=$id_cons - circo: $circo";1125 $sql="select * from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ";1126 $result = $dbi->prepare("$sql");1127 $result->execute();1128 1129 1130 $i=1;1131 $tot_pref=0;1132 $totsg=0;1133 while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = $result->fetch(PDO::FETCH_NUM)){1134 1135 //echo "test: $id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo";1136 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"1137 1138 ."//-->\n";1139 echo "function controlloref$i() {\n";1140 echo "var a=Number(window.document.sezioni.si$i.value); var b=Number(window.document.sezioni.no$i.value); if(a=='NaN') {a=0} if(b=='NaN') {b=0} var c=a + b; window.document.sezioni.val$i.value=c\n";1141 echo "}\n";1142 echo "</script>\n";1143 1144 if ($num_gruppo != ''){1145 if ($genere==0){1146 $sql="SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1147 $res = $dbi->prepare("$sql");1148 $res->execute();1149 1150 1151 list($tot) = $res->fetch(PDO::FETCH_NUM);1152 $sql="SELECT * FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1153 $res = $dbi->prepare("$sql");1154 $res->execute();1155 1156 1157 $pro= $res->fetch(PDO::FETCH_BOTH);1158 if ($pro['si']+$pro['no']!=$pro['validi'] or ($pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=$tot and $pro['validi']+$pro['nulli']+$pro['bianchi']+$pro['contestati']!=0)){1159 echo "<tr style=\"background-color: rgb(255, 0, 0); text-align:center\">";1160 }else{1161 echo "<tr style=\"background-color: $bgcolor2; text-align:center\">";1162 }1163 $descr = explode('.',$descr_gruppo, 100);1164 echo "<td colspan=\"6\" align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo) </b>"1165 ."<b> $descr[0] </b></td></tr>";1166 $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'';1167 $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'';1168 $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'';1169 $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'';1170 $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'';1171 $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'';1172 $tot_nulli=intval($pro['nulli'])+intval($pro['bianchi'])+intval($pro['contestati']);1173 $tot_voti=intval($pro['validi'])+$tot_nulli;1174 echo $campiriep; # style=\"text-align: center; border: 1px; border-color: black; border-collaps:collaps;\"1175 echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td colspan=\"2\" >$tot_nulli</td>";1176 echo "<td colspan=\"2\">$tot_voti</td>";1177 echo "<td colspan=\"2\">$tot</td></tr>";1178 echo $campitesta;1179 echo "<tr><td align=\"right\" width=\"3%\"><input name=\"si$i\" value=\"".$pro['si']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i()></td>";1180 echo "</td><td align=\"right\" width=\"3%\"><input name=\"no$i\" value=\"".$pro['no']."\" size=\"7\" style=\"text-align:right\" onchange=controlloref$i()></td>";1181 echo "</td><td align=\"right\" width=\"3%\"><input name=\"val$i\" value=\"".$pro['validi']."\" size=\"7\" style=\"text-align:right\" ></td>";1182 echo "</td><td align=\"right\"><input name=\"bia$i\" value=\"".$pro['bianchi']."\" size=\"7\" style=\"text-align:right\"></td>";1183 echo "</td><td align=\"right\"><input name=\"con$i\" value=\"".$pro['contestati']."\" size=\"7\" style=\"text-align:right\"></td>";1184 echo "</td><td align=\"right\"><input name=\"nul$i\" value=\"".$pro['nulli']."\" size=\"7\" style=\"text-align:right\"></td>";1185 1186 1187 }else{1188 echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"num_gruppo$i\" value=\"$num_gruppo\"><b>$num_gruppo</b>"1189 ."</td><td align=\"left\"><b> $descr_gruppo </b>";1190 $sql="SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ";1191 $res = $dbi->prepare("$sql");1192 $res->execute();1193 1194 $pro= $res->fetch(PDO::FETCH_BOTH);1195 if(!$res->rowCount()) {$pro['voti']=''; $pro['solo_gruppo']='';}1196 $errcolor='';1197 if(isset($errgrulis[$id_gruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";1198 echo "</td><td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\"></td>";1199 1200 if($dettnulli) {echo "<td align=\"right\"><input name=\"solog$i\" value=\"".$pro['solo_gruppo']."\" size=\"7\" style=\"text-align:right\"></td>"; $totsg+=intval($pro['solo_gruppo']);}1201 $tot_pref += intval($pro['voti']);1202 echo "</tr>";1203 }1204 1205 $i++;1206 }1207 1208 }1209 if ($genere!=0) {1210 $sql="SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ";1211 $res = $dbi->prepare("$sql");1212 $res->execute();1213 1214 1215 list($disgiunto)=$res->fetch(PDO::FETCH_NUM);1216 $sql="SELECT solo_lista FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' ";1217 $res = $dbi->prepare("$sql");1218 $res->execute();1219 1220 1221 list($sololis)=$res->fetch(PDO::FETCH_NUM);1222 echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._TOTPREF."</td><td>$tot_pref</td>";1223 if($dettnulli) echo "<td>$totsg</td>";1224 echo "</tr>";1225 if($disgiunto)1226 echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._SOLOLIS."</td><td><input name=\"sololista\" value=\"".$sololis."\" size=\"7\" style=\"text-align:right\"></td></tr>";1227 }1228 1229 echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";1230 1231 echo "</tr></table></form></td></tr>";1232 if(chisei($id_cons_gen)>=64){1233 echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";1234 }1235 1236 echo "</td></tr></table></center>";1237 }1238 if ($genere!=0){1239 finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);1240 }1241 }1242 1243 1244 1245 1246 176 ?> -
trunk/admin/versione.php
r359 r360 1 1 <?php 2 2 3 $versione = "3.0 rev 3 59";3 $versione = "3.0 rev 360"; 4 4 $version_number = $versione; 5 $datarel = " 24 febbraio 2022";5 $datarel = "14 marzo 2022"; 6 6 $version = "Eleonline $version_number (<i>Data Release: $datarel</i>)"; 7 7 -
trunk/client/file.php
r265 r360 3 3 include("config.php"); 4 4 try{ 5 $dbi = new PDO("mysql:host=$dbhost;charset= latin1", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));5 $dbi = new PDO("mysql:host=$dbhost;charset=utf8", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION)); 6 6 $sql = "use $dbname"; 7 7 $dbi->exec($sql); … … 11 11 echo $sql . "<br>" . $e->getMessage(); 12 12 } 13 $sth = $dbi->prepare("SET NAMES 'utf8'"); 14 $sth->execute(); 15 16 13 17 $fase=intval($_GET['fase']); 14 18 … … 19 23 $res->execute(); 20 24 21 Header("content-type: application/x-javascript ");25 Header("content-type: application/x-javascript; charset=utf-8"); 22 26 echo "document.write(\"<b><select name=\'id_cons_gen2\'>"; 23 27 24 28 while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) { 25 echo "<option value=\'$id_cons_gen2\'>$descr ";29 echo "<option value=\'$id_cons_gen2\'>$descr</option>"; 26 30 } 27 31 echo "</select>"; … … 44 48 $res->execute(); 45 49 46 Header("content-type: application/x-javascript ");50 Header("content-type: application/x-javascript; charset=utf-8"); 47 51 echo "document.write(\"<b><input type=\'hidden\' name=\'id_cons_gen2\' value=\'$id_cons_gen2\'><select name=\'id_comune2\'>"; 48 52 49 53 while(list($id_comune2,$descr) = $res->fetch(PDO::FETCH_NUM)) { 50 echo "<option value=\'$id_comune2\'>$descr ";54 echo "<option value=\'$id_comune2\'>$descr</option>"; 51 55 } 52 56 echo "</select>"; -
trunk/client/modules/Elezioni/backup.php
r322 r360 12 12 list($nomeFile) = $result->fetch(PDO::FETCH_NUM); 13 13 #$nomeFile="backup"; 14 header( 'Content-Type: application/octet-stream ' );14 header( 'Content-Type: application/octet-stream; charset=utf-8' ); 15 15 header( 'Content-Disposition: attachment; filename="'.$nomeFile.'"' ); 16 16 #header( 'Content-Length:'.strlen( $content ) ); -
trunk/client/versione.php
r359 r360 1 1 <?php 2 2 3 $versione = "3.0 rev 3 59";3 $versione = "3.0 rev 360"; 4 4 $version_number = $versione; 5 $datarel = " 24 febbraio 2022";5 $datarel = "14 marzo 2022"; 6 6 $version = "Eleonline $version_number (<i>Data Release: $datarel</i>)"; 7 7 -
trunk/install/sql/eleonline.sql
r359 r360 1 1 -- phpMyAdmin SQL Dump 2 -- version 4.7.72 -- version 5.1.0 3 3 -- https://www.phpmyadmin.net/ 4 4 -- 5 -- Host: 127.0.0.16 -- Creato il: Apr 16, 2019 alle 21:107 -- Versione del server: 10. 1.30-MariaDB8 -- Versione PHP: 7. 2.25 -- Host: localhost 6 -- Creato il: Mar 11, 2022 alle 17:08 7 -- Versione del server: 10.3.27-MariaDB-0+deb10u1 8 -- Versione PHP: 7.3.31-1~deb10u1 9 9 10 10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 SET AUTOCOMMIT = 0;12 11 START TRANSACTION; 13 12 SET time_zone = "+00:00"; … … 20 19 21 20 -- 22 -- Database: `ele 3`21 -- Database: `eleonline3` 23 22 -- 24 23 … … 32 31 `access_id` int(10) NOT NULL, 33 32 `access_title` varchar(20) DEFAULT NULL 34 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;33 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 35 34 36 35 -- … … 54 53 `aid` varchar(25) NOT NULL DEFAULT '', 55 54 `name` varchar(50) DEFAULT NULL, 56 `id_comune` int(11) NOT NULL DEFAULT '0',55 `id_comune` int(11) NOT NULL DEFAULT 0, 57 56 `email` varchar(255) DEFAULT NULL, 58 57 `pwd` varchar(40) DEFAULT NULL, 59 `counter` int(11) NOT NULL DEFAULT '0',60 `adminop` tinyint(2) NOT NULL DEFAULT '0',61 `admincomune` tinyint(2) NOT NULL DEFAULT '0',62 `adminsuper` tinyint(2) NOT NULL DEFAULT '0',58 `counter` int(11) NOT NULL DEFAULT 0, 59 `adminop` tinyint(2) NOT NULL DEFAULT 0, 60 `admincomune` tinyint(2) NOT NULL DEFAULT 0, 61 `adminsuper` tinyint(2) NOT NULL DEFAULT 0, 63 62 `admlanguage` varchar(30) NOT NULL DEFAULT '' 64 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;63 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 65 64 66 65 -- … … 84 83 `startdate` varchar(50) NOT NULL DEFAULT '', 85 84 `adminmail` varchar(255) NOT NULL DEFAULT '', 86 `tema` varchar(25) NOT NULL ,87 `foot` text NOT NULL,88 `language` varchar(3) NOT NULL,89 `blocco` enum('0','1') NOT NULL ,90 `testata` blob ,91 `nome_testata` varchar(50) NOT NULL ,92 `fileout` varchar(255) NOT NULL ,93 `copyright` text NOT NULL,94 `versione` int(3) NOT NULL,95 `patch` int(3) NOT NULL ,96 `siteistat` int(11) NOT NULL ,97 `multicomune` enum('0','1') NOT NULL ,98 `flash` enum('0','1') NOT NULL ,99 `displayerrors` enum('0','1') NOT NULL ,100 `gkey` varchar(100) NOT NULL ,101 `googlemaps` enum('0','1') NOT NULL ,85 `tema` varchar(25) NOT NULL DEFAULT '', 86 `foot` mediumtext NOT NULL, 87 `language` char(3) NOT NULL DEFAULT '', 88 `blocco` enum('0','1') NOT NULL DEFAULT '0', 89 `testata` blob DEFAULT NULL, 90 `nome_testata` varchar(50) NOT NULL DEFAULT '', 91 `fileout` varchar(255) NOT NULL DEFAULT '', 92 `copyright` mediumtext NOT NULL, 93 `versione` int(3) DEFAULT NULL, 94 `patch` int(3) NOT NULL DEFAULT 0, 95 `siteistat` int(11) NOT NULL DEFAULT 0, 96 `multicomune` enum('0','1') NOT NULL DEFAULT '0', 97 `flash` enum('0','1') NOT NULL DEFAULT '0', 98 `displayerrors` enum('0','1') NOT NULL DEFAULT '0', 99 `gkey` varchar(100) NOT NULL DEFAULT '', 100 `googlemaps` enum('0','1') NOT NULL DEFAULT '0', 102 101 `editor` enum('0','1') NOT NULL DEFAULT '1', 103 102 `tema_on` enum('0','1') NOT NULL DEFAULT '1', 104 `ed_user` varchar(25) NOT NULL 105 ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 103 `ed_user` varchar(25) NOT NULL DEFAULT '', 104 `secret` varchar(30) DEFAULT NULL 105 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 106 106 107 107 -- … … 110 110 111 111 INSERT INTO `soraldo_config` (`sitename`, `siteurl`, `site_logo`, `slogan`, `startdate`, `adminmail`, `tema`, `foot`, `language`, `blocco`, `testata`, `nome_testata`, `fileout`, `copyright`, `Versione`, `patch`, `siteistat`, `multicomune`, `flash`, `displayerrors`, `gkey`, `googlemaps`, `editor`, `tema_on`, `ed_user`) VALUES 112 ('', 'http ://www.fonte-nuova.it', '', 'Sito istituzionale', 'Maggio 2009', 'admin@localhost', 'facebook', '<b>Comune di Menfi</b><br>\r\nvia - 84023 Menfi (Ag)\r\nTel: Fax: \r\n<hr>', 'it', '1', '', '', '', 'Gpl v3', 2, 0, 84023, '1', '1', '0', '', '0', '1', '1', 'Admin');112 ('', 'https://www.eleonline.it', '', 'Sito istituzionale', 'Maggio 2022', 'admin@localhost', 'facebook', '<b>Comune di Test</b><br>\r\nvia - \r\nTel: Fax: \r\n<hr>', 'it', '1', '', '', '', 'Gpl v3', 2, 0, 84023, '1', '1', '0', '', '0', '1', '1', 'Admin'); 113 113 114 114 -- -------------------------------------------------------- … … 119 119 120 120 CREATE TABLE `soraldo_doc_cons` ( 121 `id_cons` int(11) NOT NULL ,122 `id_doc` int(11) NOT NULL ,123 `tabella` varchar(25) NOT NULL 124 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;121 `id_cons` int(11) NOT NULL DEFAULT 0, 122 `id_doc` int(11) NOT NULL DEFAULT 0, 123 `tabella` varchar(25) NOT NULL DEFAULT '' 124 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 125 125 126 126 -- -------------------------------------------------------- … … 132 132 CREATE TABLE `soraldo_ele_candidati` ( 133 133 `id_cand` int(11) NOT NULL, 134 `id_cons` int(11) NOT NULL DEFAULT '0',135 `id_lista` int(11) NOT NULL DEFAULT '0',136 `num_lista` int(2) UNSIGNED NOT NULL DEFAULT '0',134 `id_cons` int(11) NOT NULL DEFAULT 0, 135 `id_lista` int(11) NOT NULL DEFAULT 0, 136 `num_lista` int(2) UNSIGNED NOT NULL, 137 137 `cognome` varchar(50) DEFAULT NULL, 138 138 `nome` varchar(50) DEFAULT NULL, 139 `note` t inytext NOT NULL,139 `note` text NOT NULL, 140 140 `simbolo` varchar(30) NOT NULL DEFAULT '', 141 `num_cand` int(7) NOT NULL DEFAULT '0'142 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;141 `num_cand` int(7) NOT NULL DEFAULT 0 142 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 143 143 144 144 -- -------------------------------------------------------- … … 149 149 150 150 CREATE TABLE `soraldo_ele_circoscrizione` ( 151 `id_cons` int(11) NOT NULL DEFAULT '0',151 `id_cons` int(11) NOT NULL DEFAULT 0, 152 152 `id_circ` int(11) NOT NULL, 153 `num_circ` int(7) NOT NULL DEFAULT '0',154 `descrizione` text155 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;153 `num_circ` int(7) NOT NULL DEFAULT 0, 154 `descrizione` mediumtext DEFAULT NULL 155 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 156 156 157 157 -- -------------------------------------------------------- … … 163 163 CREATE TABLE `soraldo_ele_collegi` ( 164 164 `id_collegio` int(11) NOT NULL, 165 `id_cons_gen` int(11) NOT NULL DEFAULT '0',166 `descrizione` text167 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;165 `id_cons_gen` int(11) NOT NULL DEFAULT 0, 166 `descrizione` mediumtext DEFAULT NULL 167 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 168 168 169 169 -- -------------------------------------------------------- … … 174 174 175 175 CREATE TABLE `soraldo_ele_come` ( 176 `id_cons` int(11) NOT NULL DEFAULT '0',176 `id_cons` int(11) NOT NULL DEFAULT 0, 177 177 `mid` int(7) NOT NULL, 178 178 `title` varchar(150) NOT NULL DEFAULT '', 179 `preamble` text NOT NULL,180 `content` text NOT NULL,179 `preamble` mediumtext NOT NULL, 180 `content` mediumtext NOT NULL, 181 181 `editimage` varchar(100) NOT NULL DEFAULT '' 182 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;182 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 183 183 184 184 -- -------------------------------------------------------- … … 189 189 190 190 CREATE TABLE `soraldo_ele_comuni` ( 191 `id_comune` int(11) NOT NULL DEFAULT '0',191 `id_comune` int(11) NOT NULL DEFAULT 0, 192 192 `descrizione` varchar(50) DEFAULT NULL, 193 193 `indirizzo` varchar(50) DEFAULT NULL, … … 195 195 `fax` varchar(15) DEFAULT NULL, 196 196 `email` varchar(50) DEFAULT NULL, 197 `fascia` tinyint(4) NOT NULL DEFAULT '0',197 `fascia` tinyint(4) NOT NULL DEFAULT 0, 198 198 `capoluogo` enum('0','1') NOT NULL DEFAULT '0', 199 `simbolo` text,200 `stemma` blob ,201 `id_cons` int(11) DEFAULT '0',202 `cap` text203 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;199 `simbolo` mediumtext DEFAULT NULL, 200 `stemma` blob DEFAULT NULL, 201 `id_cons` int(11) DEFAULT 0, 202 `cap` mediumtext DEFAULT NULL 203 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 204 204 205 205 -- -------------------------------------------------------- … … 210 210 211 211 CREATE TABLE `soraldo_ele_comu_collegi` ( 212 `id_collegio` int(11) NOT NULL DEFAULT '0',213 `id_cons` int(11) NOT NULL DEFAULT '0',214 `id_comune` int(11) NOT NULL DEFAULT '0',215 `id_cons_gen` int(11) NOT NULL DEFAULT '0'216 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;212 `id_collegio` int(11) NOT NULL DEFAULT 0, 213 `id_cons` int(11) NOT NULL DEFAULT 0, 214 `id_comune` int(11) NOT NULL DEFAULT 0, 215 `id_cons_gen` int(11) NOT NULL DEFAULT 0 216 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 217 217 218 218 -- -------------------------------------------------------- … … 230 230 `supsbarramento` int(3) NOT NULL, 231 231 `suppremio` int(3) NOT NULL, 232 `listinfsbar` int(3) NOT NULL DEFAULT '1',232 `listinfsbar` int(3) NOT NULL DEFAULT 1, 233 233 `listinfconta` enum('0','1') NOT NULL DEFAULT '1', 234 234 `listsupconta` enum('0','1') NOT NULL DEFAULT '1', … … 240 240 `inffisso` enum('0','1') NOT NULL DEFAULT '0', 241 241 `supfisso` enum('0','1') NOT NULL DEFAULT '0', 242 `fascia_capoluogo` int(2) NOT NULL DEFAULT '0'243 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;242 `fascia_capoluogo` int(2) NOT NULL DEFAULT 0 243 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 244 244 245 245 -- … … 264 264 CREATE TABLE `soraldo_ele_consultazione` ( 265 265 `id_cons_gen` int(11) NOT NULL, 266 `descrizione` text,266 `descrizione` mediumtext DEFAULT NULL, 267 267 `data_inizio` date DEFAULT NULL, 268 268 `data_fine` date DEFAULT NULL, 269 `tipo_cons` int(7) NOT NULL DEFAULT '0'270 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;269 `tipo_cons` int(7) NOT NULL DEFAULT 0 270 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 271 271 272 272 -- -------------------------------------------------------- … … 279 279 `id_cons` int(11) NOT NULL, 280 280 `chiusa` set('0','1','2') NOT NULL DEFAULT '0', 281 `id_comune` int(11) NOT NULL DEFAULT '0',282 `id_cons_gen` int(11) NOT NULL DEFAULT '0',283 `id_conf` int(11) NOT NULL DEFAULT '0',281 `id_comune` int(11) NOT NULL DEFAULT 0, 282 `id_cons_gen` int(11) NOT NULL DEFAULT 0, 283 `id_conf` int(11) NOT NULL DEFAULT 0, 284 284 `preferita` enum('0','1') NOT NULL DEFAULT '0', 285 `preferenze` tinyint(1) NOT NULL DEFAULT '1',286 `id_fascia` int(2) NOT NULL DEFAULT '1',285 `preferenze` tinyint(1) NOT NULL DEFAULT 1, 286 `id_fascia` int(2) NOT NULL DEFAULT 1, 287 287 `vismf` enum('0','1') NOT NULL DEFAULT '0', 288 `solo_gruppo` enum('0','1') NOT NULLDEFAULT '0',288 `solo_gruppo` enum('0','1') DEFAULT '0', 289 289 `disgiunto` enum('0','1') NOT NULL DEFAULT '0' 290 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;290 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 291 291 292 292 -- -------------------------------------------------------- … … 301 301 `tipo` varchar(10) NOT NULL, 302 302 `id` int(11) NOT NULL 303 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;303 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 304 304 305 305 -- -------------------------------------------------------- … … 311 311 CREATE TABLE `soraldo_ele_documenti` ( 312 312 `id_doc` int(11) NOT NULL, 313 `descrizione` varchar(50) NOT NULL ,314 `nomedoc` varchar(25) NOT NULL ,313 `descrizione` varchar(50) NOT NULL DEFAULT '', 314 `nomedoc` varchar(25) NOT NULL DEFAULT '', 315 315 `filedoc` blob NOT NULL 316 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;316 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 317 317 318 318 -- -------------------------------------------------------- … … 326 326 `abitanti` int(11) NOT NULL, 327 327 `seggi` int(4) NOT NULL, 328 `id_conf` int(11) DEFAULT '1'329 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;328 `id_conf` int(11) DEFAULT 1 329 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 330 330 331 331 -- … … 409 409 410 410 CREATE TABLE `soraldo_ele_gruppo` ( 411 `id_cons` int(11) NOT NULL DEFAULT '0',411 `id_cons` int(11) NOT NULL DEFAULT 0, 412 412 `id_gruppo` int(11) NOT NULL, 413 `num_gruppo` int(7) NOT NULL DEFAULT '0',414 `descrizione` text,415 `simbolo` text,416 `stemma` blob ,417 `id_circ` int(11) NOT NULL DEFAULT '0',418 `num_circ` int(2) UNSIGNED NOT NULL DEFAULT '1',419 `prognome` text,420 `programma` mediumblob 421 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;413 `num_gruppo` int(7) NOT NULL DEFAULT 0, 414 `descrizione` mediumtext DEFAULT NULL, 415 `simbolo` mediumtext DEFAULT NULL, 416 `stemma` blob DEFAULT NULL, 417 `id_circ` int(11) NOT NULL DEFAULT 0, 418 `num_circ` int(2) UNSIGNED NOT NULL DEFAULT 1, 419 `prognome` mediumtext DEFAULT NULL, 420 `programma` mediumblob DEFAULT NULL 421 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 422 422 423 423 -- -------------------------------------------------------- … … 428 428 429 429 CREATE TABLE `soraldo_ele_link` ( 430 `id_cons` int(11) NOT NULL DEFAULT '0',430 `id_cons` int(11) NOT NULL DEFAULT 0, 431 431 `mid` int(7) NOT NULL, 432 432 `title` varchar(150) NOT NULL DEFAULT '', 433 `preamble` text NOT NULL,434 `content` text NOT NULL,433 `preamble` mediumtext NOT NULL, 434 `content` mediumtext NOT NULL, 435 435 `editimage` varchar(100) NOT NULL DEFAULT '' 436 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;436 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 437 437 438 438 -- -------------------------------------------------------- … … 443 443 444 444 CREATE TABLE `soraldo_ele_lista` ( 445 `id_cons` int(11) NOT NULL DEFAULT '0',445 `id_cons` int(11) NOT NULL DEFAULT 0, 446 446 `id_lista` int(11) NOT NULL, 447 `num_lista` int(7) NOT NULL DEFAULT '0',448 `id_gruppo` int(11) NOT NULL DEFAULT '0',449 `num_gruppo` int(2) UNSIGNED NOT NULL DEFAULT '0',450 `id_circ` int(11) NOT NULL DEFAULT '0',451 `num_circ` int(2) UNSIGNED NOT NULL DEFAULT '1',452 `descrizione` text ,453 `simbolo` text,454 `stemma` blob 455 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;447 `num_lista` int(7) NOT NULL DEFAULT 0, 448 `id_gruppo` int(11) NOT NULL DEFAULT 0, 449 `num_gruppo` int(2) UNSIGNED NOT NULL DEFAULT 0, 450 `id_circ` int(11) NOT NULL DEFAULT 0, 451 `num_circ` int(2) UNSIGNED NOT NULL DEFAULT 1, 452 `descrizione` text DEFAULT NULL, 453 `simbolo` mediumtext DEFAULT NULL, 454 `stemma` blob DEFAULT NULL 455 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 456 456 457 457 -- -------------------------------------------------------- … … 467 467 `data` date DEFAULT NULL, 468 468 `ora` time DEFAULT NULL, 469 `log_da` text,470 `log_a` text,469 `log_da` mediumtext DEFAULT NULL, 470 `log_a` mediumtext DEFAULT NULL, 471 471 `tabella` varchar(30) DEFAULT NULL 472 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;472 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 473 473 474 474 -- -------------------------------------------------------- … … 479 479 480 480 CREATE TABLE `soraldo_ele_modelli` ( 481 `id_cons` int(11) NOT NULL DEFAULT '0',481 `id_cons` int(11) NOT NULL DEFAULT 0, 482 482 `categoria` varchar(20) NOT NULL DEFAULT '', 483 483 `modello` blob NOT NULL 484 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;484 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 485 485 486 486 -- -------------------------------------------------------- … … 491 491 492 492 CREATE TABLE `soraldo_ele_numeri` ( 493 `id_cons` int(11) NOT NULL DEFAULT '0',493 `id_cons` int(11) NOT NULL DEFAULT 0, 494 494 `mid` int(7) NOT NULL, 495 495 `title` varchar(150) NOT NULL DEFAULT '', 496 `preamble` text NOT NULL,497 `content` text NOT NULL,496 `preamble` mediumtext NOT NULL, 497 `content` mediumtext NOT NULL, 498 498 `editimage` varchar(100) NOT NULL DEFAULT '' 499 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;499 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 500 500 501 501 -- -------------------------------------------------------- … … 506 506 507 507 CREATE TABLE `soraldo_ele_operatori` ( 508 `id_cons` int(11) NOT NULL DEFAULT '0',509 `id_sede` int(11) NOT NULL DEFAULT '0',510 `id_comune` int(11) NOT NULL DEFAULT '0',508 `id_cons` int(11) NOT NULL DEFAULT 0, 509 `id_sede` int(11) NOT NULL DEFAULT 0, 510 `id_comune` int(11) NOT NULL DEFAULT 0, 511 511 `permessi` int(3) DEFAULT NULL, 512 `aid` varchar(25) NOT NULL DEFAULT '' 513 ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 512 `aid` varchar(25) NOT NULL DEFAULT '', 513 `id_circ` int(11) NOT NULL DEFAULT 0, 514 `id_sez` int(11) NOT NULL DEFAULT 0 515 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 514 516 515 517 -- -------------------------------------------------------- … … 520 522 521 523 CREATE TABLE `soraldo_ele_province` ( 522 `id` tinyint(11) NOT NULL ,523 `descrizione` varchar(30) NOT NULL 524 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;524 `id` tinyint(11) NOT NULL DEFAULT 0, 525 `descrizione` varchar(30) NOT NULL DEFAULT '' 526 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 525 527 526 528 -- -------------------------------------------------------- … … 531 533 532 534 CREATE TABLE `soraldo_ele_regioni` ( 533 `id` int(11) NOT NULL ,534 `descrizione` varchar(25) NOT NULL 535 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;535 `id` int(11) NOT NULL DEFAULT 0, 536 `descrizione` varchar(25) NOT NULL DEFAULT '' 537 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 536 538 537 539 -- -------------------------------------------------------- … … 542 544 543 545 CREATE TABLE `soraldo_ele_rilaff` ( 544 `id_cons_gen` int(11) NOT NULL DEFAULT '0',546 `id_cons_gen` int(11) NOT NULL DEFAULT 0, 545 547 `orario` time NOT NULL DEFAULT '00:00:00', 546 `data` date NOT NULL DEFAULT ' 1970-01-01'547 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;548 `data` date NOT NULL DEFAULT '0000-00-00' 549 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 548 550 549 551 -- -------------------------------------------------------- … … 554 556 555 557 CREATE TABLE `soraldo_ele_sede` ( 556 `id_cons` int(11) NOT NULL DEFAULT '0',558 `id_cons` int(11) NOT NULL DEFAULT 0, 557 559 `id_sede` int(11) NOT NULL, 558 `id_circ` int(11) NOT NULL DEFAULT '0',560 `id_circ` int(11) NOT NULL DEFAULT 0, 559 561 `indirizzo` varchar(60) DEFAULT NULL, 560 562 `telefono1` varchar(12) DEFAULT NULL, … … 564 566 `mappa` mediumblob NOT NULL, 565 567 `filemappa` varchar(100) NOT NULL DEFAULT '' 566 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;568 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 567 569 568 570 -- -------------------------------------------------------- … … 573 575 574 576 CREATE TABLE `soraldo_ele_servizi` ( 575 `id_cons` int(11) NOT NULL DEFAULT '0',577 `id_cons` int(11) NOT NULL DEFAULT 0, 576 578 `mid` int(7) NOT NULL, 577 579 `title` varchar(150) NOT NULL DEFAULT '', 578 `preamble` text NOT NULL,579 `content` text NOT NULL,580 `preamble` mediumtext NOT NULL, 581 `content` mediumtext NOT NULL, 580 582 `editimage` varchar(100) NOT NULL DEFAULT '' 581 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;583 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 582 584 583 585 -- -------------------------------------------------------- … … 588 590 589 591 CREATE TABLE `soraldo_ele_sezioni` ( 590 `id_cons` int(11) NOT NULL DEFAULT '0',592 `id_cons` int(11) NOT NULL DEFAULT 0, 591 593 `id_sez` int(11) NOT NULL, 592 `id_sede` int(11) NOT NULL DEFAULT '0',593 `num_sez` int(7) NOT NULL DEFAULT '0',594 `id_sede` int(11) NOT NULL DEFAULT 0, 595 `num_sez` int(7) NOT NULL DEFAULT 0, 594 596 `maschi` int(4) DEFAULT NULL, 595 597 `femmine` int(4) DEFAULT NULL, 596 `validi` int(7) NOT NULL DEFAULT '0',597 `nulli` int(7) NOT NULL DEFAULT '0',598 `bianchi` int(7) NOT NULL DEFAULT '0',599 `contestati` int(7) NOT NULL DEFAULT '0',600 `solo_gruppo` int(7) NOT NULL DEFAULT '0',601 `autorizzati_m` int(4) NOT NULL DEFAULT '0',602 `autorizzati_f` int(4) NOT NULL DEFAULT '0',603 `voti_nulli` int(7) NOT NULL DEFAULT '0',604 `validi_lista` int(7) NOT NULL DEFAULT '0',605 `contestati_lista` int(7) NOT NULL DEFAULT '0',606 `voti_nulli_lista` int(7) NOT NULL DEFAULT '0',607 `solo_lista` int(7) NOT NULL DEFAULT '0',598 `validi` int(7) NOT NULL DEFAULT 0, 599 `nulli` int(7) NOT NULL DEFAULT 0, 600 `bianchi` int(7) NOT NULL DEFAULT 0, 601 `contestati` int(7) NOT NULL DEFAULT 0, 602 `solo_gruppo` int(7) NOT NULL DEFAULT 0, 603 `autorizzati_m` int(4) NOT NULL DEFAULT 0, 604 `autorizzati_f` int(4) NOT NULL DEFAULT 0, 605 `voti_nulli` int(7) NOT NULL DEFAULT 0, 606 `validi_lista` int(7) NOT NULL DEFAULT 0, 607 `contestati_lista` int(7) NOT NULL DEFAULT 0, 608 `voti_nulli_lista` int(7) NOT NULL DEFAULT 0, 609 `solo_lista` int(7) NOT NULL DEFAULT 0, 608 610 `colore` varchar(50) DEFAULT NULL 609 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;611 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 610 612 611 613 -- -------------------------------------------------------- … … 618 620 `id` int(11) NOT NULL, 619 621 `tema` varchar(20) NOT NULL DEFAULT '' 620 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;622 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 621 623 622 624 -- -------------------------------------------------------- … … 627 629 628 630 CREATE TABLE `soraldo_ele_tipo` ( 629 `tipo_cons` int(11) NOT NULL DEFAULT '0',631 `tipo_cons` int(11) NOT NULL DEFAULT 0, 630 632 `descrizione` varchar(30) DEFAULT NULL, 631 633 `lingua` varchar(2) NOT NULL DEFAULT '0', 632 `genere` tinyint(4) NOT NULL DEFAULT '0',634 `genere` tinyint(4) NOT NULL DEFAULT 0, 633 635 `voto_g` enum('0','1') NOT NULL DEFAULT '0', 634 636 `voto_l` enum('0','1') NOT NULL DEFAULT '0', 635 637 `voto_c` enum('0','1') NOT NULL DEFAULT '0', 636 638 `circo` enum('0','1') NOT NULL DEFAULT '0' 637 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;639 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 638 640 639 641 -- … … 669 671 670 672 CREATE TABLE `soraldo_ele_voti_candidati` ( 671 `id_cons` int(11) NOT NULL DEFAULT '0',672 `id_cand` int(11) NOT NULL DEFAULT '0',673 `id_sez` int(11) NOT NULL DEFAULT '0',673 `id_cons` int(11) NOT NULL DEFAULT 0, 674 `id_cand` int(11) NOT NULL DEFAULT 0, 675 `id_sez` int(11) NOT NULL DEFAULT 0, 674 676 `num_cand` int(2) UNSIGNED NOT NULL, 675 `voti` int(7) NOT NULL DEFAULT '0'676 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;677 `voti` int(7) NOT NULL DEFAULT 0 678 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 677 679 678 680 -- -------------------------------------------------------- … … 683 685 684 686 CREATE TABLE `soraldo_ele_voti_gruppo` ( 685 `id_cons` int(11) NOT NULL DEFAULT '0',686 `id_gruppo` int(11) NOT NULL DEFAULT '0',687 `id_sez` int(11) NOT NULL DEFAULT '0',687 `id_cons` int(11) NOT NULL DEFAULT 0, 688 `id_gruppo` int(11) NOT NULL DEFAULT 0, 689 `id_sez` int(11) NOT NULL DEFAULT 0, 688 690 `num_gruppo` int(2) UNSIGNED NOT NULL, 689 `voti` int(7) NOT NULL DEFAULT '0',690 `solo_gruppo` int(7) NOT NULL DEFAULT '0'691 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;691 `voti` int(7) NOT NULL DEFAULT 0, 692 `solo_gruppo` int(7) NOT NULL DEFAULT 0 693 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 692 694 693 695 -- -------------------------------------------------------- … … 698 700 699 701 CREATE TABLE `soraldo_ele_voti_lista` ( 700 `id_cons` int(11) NOT NULL DEFAULT '0',701 `id_lista` int(11) NOT NULL DEFAULT '0',702 `id_sez` int(11) NOT NULL DEFAULT '0',703 `num_lista` int(2) UNSIGNED NOT NULL,704 `voti` int(7) NOT NULL DEFAULT '0',705 `nulli_lista` int(7) NOT NULL DEFAULT '0',706 `solo_lista` int(7) NOT NULL DEFAULT '0'707 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;702 `id_cons` int(11) NOT NULL DEFAULT 0, 703 `id_lista` int(11) NOT NULL DEFAULT 0, 704 `id_sez` int(11) NOT NULL DEFAULT 0, 705 `num_lista` int(2) UNSIGNED DEFAULT 0, 706 `voti` int(7) NOT NULL DEFAULT 0, 707 `nulli_lista` int(7) NOT NULL DEFAULT 0, 708 `solo_lista` int(7) DEFAULT 0 709 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 708 710 709 711 -- -------------------------------------------------------- … … 714 716 715 717 CREATE TABLE `soraldo_ele_voti_parziale` ( 716 `id_cons` int(11) NOT NULL DEFAULT '0',717 `id_sez` int(11) NOT NULL DEFAULT '0',718 `id_cons` int(11) NOT NULL DEFAULT 0, 719 `id_sez` int(11) NOT NULL DEFAULT 0, 718 720 `id_parz` int(11) NOT NULL, 719 721 `orario` time NOT NULL DEFAULT '00:00:00', 720 `data` date NOT NULL DEFAULT ' 1970-01-01',721 `voti_uomini` int(7) NOT NULL DEFAULT '0',722 `voti_donne` int(7) NOT NULL DEFAULT '0',723 `voti_complessivi` int(7) NOT NULL DEFAULT '0',724 `id_gruppo` int(11) NOT NULL DEFAULT '0'725 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;722 `data` date NOT NULL DEFAULT '0000-00-00', 723 `voti_uomini` int(7) NOT NULL DEFAULT 0, 724 `voti_donne` int(7) NOT NULL DEFAULT 0, 725 `voti_complessivi` int(7) NOT NULL DEFAULT 0, 726 `id_gruppo` int(11) NOT NULL DEFAULT 0 727 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 726 728 727 729 -- -------------------------------------------------------- … … 732 734 733 735 CREATE TABLE `soraldo_ele_voti_ref` ( 734 `id_cons` int(11) NOT NULL DEFAULT '0',735 `id_gruppo` int(11) NOT NULL DEFAULT '0',736 `id_sez` int(11) NOT NULL DEFAULT '0',736 `id_cons` int(11) NOT NULL DEFAULT 0, 737 `id_gruppo` int(11) NOT NULL DEFAULT 0, 738 `id_sez` int(11) NOT NULL DEFAULT 0, 737 739 `num_gruppo` int(2) UNSIGNED NOT NULL, 738 `si` int(7) DEFAULT '0',739 `no` int(7) DEFAULT '0',740 `validi` int(7) DEFAULT '0',741 `nulli` int(7) DEFAULT '0',742 `bianchi` int(7) DEFAULT '0',743 `contestati` int(7) DEFAULT '0'744 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;740 `si` int(7) DEFAULT 0, 741 `no` int(7) DEFAULT 0, 742 `validi` int(7) DEFAULT 0, 743 `nulli` int(7) DEFAULT 0, 744 `bianchi` int(7) DEFAULT 0, 745 `contestati` int(7) DEFAULT 0 746 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 745 747 746 748 -- -------------------------------------------------------- … … 754 756 `nome_file` varchar(255) NOT NULL DEFAULT '', 755 757 `titolo` varchar(255) NOT NULL DEFAULT '', 756 `pos_or` int(1) NOT NULL DEFAULT '1',757 `pos_ver` int(3) NOT NULL DEFAULT '0',758 `attivo` int(1) NOT NULL DEFAULT '0'759 ) ENGINE=MyISAM DEFAULT CHARSET= latin1;758 `pos_or` int(1) NOT NULL DEFAULT 1, 759 `pos_ver` int(3) NOT NULL DEFAULT 0, 760 `attivo` int(1) NOT NULL DEFAULT 0 761 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 760 762 761 763 -- … … 804 806 -- 805 807 ALTER TABLE `soraldo_ele_candidati` 806 ADD UNIQUE KEY `id_cand` (`id_cand`),808 ADD PRIMARY KEY (`id_cand`) USING BTREE, 807 809 ADD KEY `id_lista` (`id_lista`), 808 ADD KEY `id_cons` (`id_cons`,` num_lista`) USING BTREE;810 ADD KEY `id_cons` (`id_cons`,`id_lista`) USING BTREE; 809 811 810 812 -- … … 853 855 -- 854 856 ALTER TABLE `soraldo_ele_consultazione` 855 ADD PRIMARY KEY (`id_cons_gen`); 857 ADD PRIMARY KEY (`id_cons_gen`), 858 ADD UNIQUE KEY `descrizione` (`descrizione`(100)); 856 859 857 860 -- … … 885 888 -- 886 889 ALTER TABLE `soraldo_ele_gruppo` 887 ADD UNIQUE KEY `id_gruppo` (`id_gruppo`),888 ADD UNIQUE KEY `id_cons` (`id_cons`,`num_gruppo`,`num_circ`) USING BTREE;890 ADD PRIMARY KEY (`id_gruppo`) USING BTREE, 891 ADD KEY `id_cons` (`id_cons`,`id_circ`) USING BTREE; 889 892 890 893 -- … … 898 901 -- 899 902 ALTER TABLE `soraldo_ele_lista` 900 ADD PRIMARY KEY (`id_cons`,`num_lista`,`num_circ`) USING BTREE, 901 ADD UNIQUE KEY `id_lista` (`id_lista`), 902 ADD KEY `id_gruppo` (`id_gruppo`); 903 904 -- 905 -- Indici per le tabelle `soraldo_ele_log` 906 -- 907 ALTER TABLE `soraldo_ele_log` 908 ADD KEY `id_cons` (`id_cons`); 903 ADD PRIMARY KEY (`id_lista`) USING BTREE, 904 ADD KEY `id_gruppo` (`id_gruppo`), 905 ADD KEY `id_cons` (`id_cons`,`id_gruppo`) USING BTREE; 909 906 910 907 -- … … 983 980 ADD KEY `id_sez` (`id_sez`), 984 981 ADD KEY `id_cand` (`id_cand`), 985 ADD KEY `id_cons` (`id_cons`,` num_cand`) USING BTREE;982 ADD KEY `id_cons` (`id_cons`,`id_sez`,`id_cand`) USING BTREE; 986 983 987 984 -- … … 991 988 ADD KEY `id_gruppo` (`id_gruppo`), 992 989 ADD KEY `id_sez` (`id_sez`), 993 ADD KEY `id_cons` (`id_cons`,` num_gruppo`) USING BTREE;990 ADD KEY `id_cons` (`id_cons`,`id_sez`,`id_gruppo`) USING BTREE; 994 991 995 992 -- … … 999 996 ADD KEY `id_lista` (`id_lista`), 1000 997 ADD KEY `id_sez` (`id_sez`), 1001 ADD KEY ` cons` (`id_cons`,`num_lista`) USING BTREE;998 ADD KEY `id_cons` (`id_cons`,`id_sez`,`id_lista`) USING BTREE; 1002 999 1003 1000 -- … … 1016 1013 ADD KEY `id_gruppo` (`id_gruppo`), 1017 1014 ADD KEY `id_sez` (`id_sez`), 1018 ADD KEY `id_cons` (`id_cons`,` num_gruppo`) USING BTREE;1015 ADD KEY `id_cons` (`id_cons`,`id_gruppo`) USING BTREE; 1019 1016 1020 1017 -- … … 1140 1137 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 1141 1138 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 1142
Note:
See TracChangeset
for help on using the changeset viewer.