source: trunk/admin/temi/Futura2/index.php@ 364

Last change on this file since 364 was 363, checked in by roby, 3 years ago

Rivista la funzione aggiornadb

File size: 9.3 KB
RevLine 
[358]1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Luciano Apolito & Roberto Gigli */
5/* http://www.eleonline.it */
6/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
7/************************************************************************/
8
9if (!defined('ADMIN_FILE')) {
10 die ("You can't access this file directly...");
11}
12$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
13foreach($param as $key=>$val) {
[363]14 if($key=='ops') $ops=intval($val);
15 if($key=='id_lista') $id_lista=intval($val);
[358]16}
[359]17
[360]18
19
20include_once("header.php");
[363]21#$nometema=$tema;
[358]22#require_once("class/db/db.php"); //classe db
[360]23global $tema,$id_comune,$descr_cons,$multicomune,$dbi,$prefix,$currentlang,$ops,$id_sez,$id_cons,$id_cons_gen;
[358]24include_once("modules/Elezioni/query.sql");
[360]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");
27include_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();
[358]32
[360]33list($id_sez) = $res->fetch(PDO::FETCH_NUM);#include("TEST:$id_sez:$sql:");
[361]34if (!$id_sez) {
35 $BASE=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-18);
36 Header("Location: ".$BASE."admin.php?op=logout&msglogout=4");
[360]37
[361]38}
[358]39if(isset($row[0])) {
40 $tipo_cons=$row[0]; $descr_cons=$row[1]; $id_cons_gen=$row[2];
41} else {
42 $tipo_cons=0; $descr_cons=''; $id_cons_gen=0;
43}
44$row=tipocons();
45if(isset($row[0])) {
46 $genere=$row[0];$votog=$row[1];$votol=$row[2];$votoc=$row[3];$conscirc=$row[4];
47} else {
48 $genere=0;$votog=0;$votol=0;$votoc=0;$conscirc=0;
49}
50
51include("temi/$tema/config.php");
52
53#if($colortheme=='')$colortheme="c";
54# descrizione comune
55if(!$id_comune or $id_comune=='') $id_comune=$siteistat;
56$sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
57 $res = $dbi->prepare("$sql");
58 $res->execute();
59
60list($descr_com) = $res->fetch(PDO::FETCH_NUM);
[360]61#include_once("header.php");
[359]62testata();
[358]63
64####################################
65function testata(){
66####################################
67
[363]68global $op,$tema,$dbi,$file,$bgcolor,$sitename,$prefix,$blocco,$lang,$siteistat,$id_cons_gen,$descr_cons,$minsez,$offsetsez,$multicomune,$id_comune,$multicomune,$rss,$colortheme,$descr_com;
[359]69global $id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av,$votog,$genere,$aid,$bgcolor1,$language;
[360]70
[358]71include("temi/$tema/function_theme.php");
72$logo='';
[360]73
74echo "<SCRIPT type=\"text/javascript\">\n";
75echo "function vai_cong(idrif){\n";
76echo "document.getElementById('frm').submit()\n";
77echo "}\n";
78echo "function vai_scelta(idrif){\n";
79echo "window.document.location.href=idrif\n";
80echo "}\n";
81echo "</script>\n";
82
83#
84if(!$ops) $ops=1;
[358]85$sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
[360]86$res = $dbi->prepare("$sql");
87$res->execute();
88list($descr_com) = $res->fetch(PDO::FETCH_NUM);
89$descr_com =stripslashes($descr_com);
[358]90
91echo '
92<div data-role="page" data-theme="a">
[360]93<div data-role="header" data-position="inline">';
94echo '<h2 style="color: white;">Elezioni on line</h2>';
95$oggi=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
96$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)";
97$rese = $dbi->prepare("$sql");
98$rese->execute();
99if ($rese->rowCount()>1){
100 echo "<form id=\"frm\" name=\"sceltacons\" data-ajax=\"false\" action=\"admin.php\">";
101 echo "<input type=\"hidden\" name=\"id_comune=\" value=\"$id_comune\">";
102 echo "<input type=\"hidden\" name=\"ops=\" value=\"$ops\">";
103 echo "<select id=\"id_cong\" name=\"id_cons_gen\" onChange=\"vai_cong('id_cong');\">";
104 while (list($id_cons_gen2,$desc2)=$rese->fetch(PDO::FETCH_NUM)) {
105 $sel = ($id_cons_gen == $id_cons_gen2) ? "selected" : "";
106 echo "<option value=\"$id_cons_gen2\" $sel>";
107 echo $desc2;
108 echo "</option>";
109 }
110 echo "</select></form>";
111}
112$sql="select tipo from ".$prefix."_ele_controlli where id_sez='$id_sez' group by tipo";
113$rese = $dbi->prepare("$sql");
114$rese->execute();
[361]115$bordoini="style='cursor: pointer;";
116$errbordoa='';
117$errbordog='';
118$errbordol='';
[360]119while (list($tipo)=$rese->fetch(PDO::FETCH_NUM)) {
[361]120 if ($tipo=='affluenze') $errbordoa="border: 6px solid; border-color: rgb(255, 0, 0);";
121 if ($tipo=='gruppo' or $tipo=='referendum') $errbordog="border: 6px solid; border-color: rgb(255, 0, 0);";
122 if ($tipo=='lista') $errbordol="border: 6px solid; border-color: rgb(255, 0, 0);";
[360]123}
[361]124$bordoa=$bordoini.$errbordoa."'";
125$bordog=$bordoini.$errbordog."'";
126$bordol=$bordoini.$errbordol."'";
[360]127if($rese->rowCount()) $segna="style=\"background-color: #dd0000;\""; else $segna='';
[358]128if($ops=="4" ) {$bgcolorg="yellow"; $tcolorg='blue';} else {$bgcolorg="grey"; $tcolorg='white';} #$active_gruppo=" class=\"ui-btn-active\""; else $active_gruppo='';
129if($ops=="3") {$bgcolorl="yellow"; $tcolorl='blue';} else {$bgcolorl="grey"; $tcolorl='white';} # $active_lista=" class=\"ui-btn-active\""; else $active_lista='';
130if($ops=="1") {$bgcolora="yellow"; $tcolora='blue';} else {$bgcolora="grey"; $tcolora='white';} # $active_aff=" class=\"ui-btn-active\""; else $active_aff='';
131echo "</div>";
[360]132echo'<div data-role="fieldcontain" style="text-align:center;">
133<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>';
[358]134###############
135 //************************************
136 // Menu spoglio
137 //************************************
[360]138$sql="select id_sez from ".$prefix."_ele_operatori where id_cons='$id_cons' and aid='$aid' and id_comune='$id_comune'";
139$sth = $dbi->prepare("$sql"); #echo $sql;
140$sth->execute();
141list($id_sez)=$sth->fetch(PDO::FETCH_NUM);
142$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'";
143$result = $dbi->prepare("$sql");#echo $sql;
144$result->execute();
145list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine, $colore) = $result->fetch(PDO::FETCH_NUM);
146echo "<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>";
147#<a href=\"admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=1\"></a>
148echo "\n<td bgcolor=\"$bgcolora\" align=\"center\" $bordoa onClick=\"vai_scelta('admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=1');\"><p style=\"margin-left:10px;margin-right:10px;\"><font color=\"$tcolora\"><b>"._AFFLUENZE."</font></b></p></td>\n";
149if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){
150 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n";
151}
152if($genere==2 and $votog)
153 echo "<td bgcolor=\"$bgcolorg\" align=\"center\" $bordog onClick=\"vai_scelta('admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=4');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorg\">"._GRUPPO."</font></b></p></td>\n";
[363]154elseif($genere>=4 and !$votoc)
155 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTAPREF."</font></b></p></td>\n";
[360]156elseif(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){
157 echo "<td bgcolor=\"$bgcolorl\" align=\"center\"$bordol onClick=\"vai_scelta('admin.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen&amp;ops=3');\"><p style=\"margin-left:10px;margin-right:10px;\"><b><font color=\"$tcolorl\">"._LISTA."</font></b></p></td>\n";
158}
159echo "</tr></table></td></tr></table><hr></div>\n";
[358]160if($ops=="1")votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av);
161elseif($ops=="3")preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
162elseif($ops=="4")preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
163footer_mon();
164die();
165}
166
167
168########################################
169function footer_mon(){
170global $id_comune,$id_cons_gen,$tema,$colortheme,$rss;
171
172echo '
173<div data-role="footer" data-theme="a" style="margin:0 auto; text-align:center;">
174 <div data-role="footer" data-position="inline" data-icon="cogs">';
175
176 echo ' <h5><a href="http://www.eleonline.it" target="_blank">Eleonline</a> <span style="font-size:12px;"> di luciano apolito & roberto gigli</span></h5></div>';
177
178
179 echo "<a href=\"admin.php?op=logout&id_comune=$id_comune\" data-ajax=\"false\">"._ESCI."</a>";
180# echo '&nbsp;<a href="admin.php?name=Elezioni&tema=facebook&nocell=1" data-rel="external" data-ajax="false" >Versione Desktop</a>';
181
182}
183
184
185
186?>
Note: See TracBrowser for help on using the repository browser.