[254] | 1 | <?php
|
---|
| 2 | /************************************************************************/
|
---|
| 3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 4 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 5 | /* http://www.eleonline.it */
|
---|
| 6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 7 | /************************************************************************/
|
---|
| 8 | /* Modulo Inserimento dati */
|
---|
| 9 | /* Amministrazione */
|
---|
| 10 | /************************************************************************/
|
---|
| 11 |
|
---|
| 12 | if (!defined('ADMIN_FILE')) {
|
---|
| 13 | die ("You can't access this file directly...");
|
---|
| 14 | }
|
---|
| 15 | $aid=$_SESSION['aid'];
|
---|
| 16 | $dbi=$_SESSION['dbi'];
|
---|
| 17 | $prefix=$_SESSION['prefix'];
|
---|
| 18 | $currentlang=$_SESSION['lang'];
|
---|
| 19 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
|
---|
| 20 | $vari= implode(',',$_GET);//param);
|
---|
| 21 | $id_comune=$_SESSION['id_comune'];
|
---|
| 22 | $id_cons_gen=intval($_GET['id_cons_gen']);
|
---|
| 23 | $perms=ChiSei($id_cons_gen);
|
---|
| 24 | if ($perms<16 or !$id_cons_gen) die("Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
| 25 | if (isset($_GET['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do='';
|
---|
| 26 | //if (isset($param['id_cons'])) $id_cons=intval($param['id_cons']); else $id_cons='';
|
---|
| 27 | if (isset($param['ops'])) $ops=intval($param['ops']); else $ops='';
|
---|
| 28 | if (isset($param['min'])) $min=intval($param['min']); else $min=0;
|
---|
| 29 | if (isset($param['ok'])) $ok=intval($param['ok']); else $ok='';
|
---|
| 30 | if (isset($param['ov'])) $ov=intval($param['ov']); else $ov='';
|
---|
| 31 | if (isset($param['mv'])) $mv=intval($param['mv']); else $mv='';
|
---|
| 32 | if (isset($param['gv'])) $gv=intval($param['gv']); else $gv='';
|
---|
| 33 | if (isset($param['msv'])) $msv=intval($param['msv']); else $msv='';
|
---|
| 34 | if (isset($param['av'])) $av=intval($param['av']); else $av='';
|
---|
| 35 | if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else
|
---|
| 36 | if (isset($_SESSION['id_circ'])) $id_circ=intval($_SESSION['id_circ']); else $id_circ='0';
|
---|
| 37 | if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede='0';
|
---|
| 38 | if (isset($param['id_sez'])) $id_sez=intval($param['id_sez']); else $id_sez='';
|
---|
| 39 | if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='0';
|
---|
| 40 | if (isset($param['prev_sez'])) $prev_sez=intval($param['prev_sez']); else $prev_sez='0';
|
---|
| 41 | if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='0';
|
---|
| 42 | if (isset($param['update'])) $update=intval($param['update']); else $update='';
|
---|
| 43 | include("modules/Elezioni/funzionidata.php");
|
---|
| 44 | include("modules/Elezioni/ele.php");
|
---|
| 45 | global $votolista, $limite, $dettnulli,$disgiunto;
|
---|
| 46 | if(!isset($votolista)) $votolista=0;
|
---|
| 47 | $res = mysql_query("SELECT tipo_cons FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'" , $dbi);
|
---|
| 48 | list($tipo_cons) = mysql_fetch_row($res);
|
---|
| 49 | if ($tipo_cons!=3 or $votolista==1) $limite=0; #die ("limite: $limite");}
|
---|
| 50 | $res = mysql_query("SELECT count(id_circ) FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' ", $dbi);
|
---|
| 51 | list($num_circ)=mysql_fetch_row($res);
|
---|
| 52 | $res = mysql_query("SELECT solo_gruppo,disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ", $dbi);
|
---|
| 53 | list($dettnulli,$disgiunto)=mysql_fetch_row($res);
|
---|
| 54 | if ($conscirc){ // or $num_circ==1
|
---|
| 55 | if (!$id_circ){
|
---|
| 56 | if (!$id_sez){
|
---|
| 57 | $res = mysql_query("SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez='1'", $dbi);
|
---|
| 58 | list($id_sez)=mysql_fetch_row($res);
|
---|
| 59 | }
|
---|
| 60 | $res = mysql_query("SELECT t1.id_circ FROM ".$prefix."_ele_sede as t1 left join ".$prefix."_ele_sezioni as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and t2.id_sez='$id_sez'", $dbi);
|
---|
| 61 | #$res = mysql_query("SELECT id_circ FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ limit 0,1", $dbi);
|
---|
| 62 | if (!$res) die("Errore, non trovo circoscrizioni inserite! Consultare l'amministratore");
|
---|
| 63 | list($id_circ)=mysql_fetch_row($res);
|
---|
| 64 | $_SESSION['id_circ']=$id_circ;
|
---|
| 65 | }
|
---|
| 66 | $result = mysql_query("select id_sede from ".$prefix."_ele_sede where id_circ='$id_circ'", $dbi);
|
---|
| 67 | $i=0;
|
---|
| 68 | while(list($tmp) = mysql_fetch_row($result)) $idsedi[$i++]=$tmp;$tmp=implode (",",$idsedi);
|
---|
| 69 | unset($idsedi);$i=0;$idsezi=array();unset($result);
|
---|
| 70 | $result = mysql_query("SELECT id_sez FROM ".$prefix."_ele_sezioni where id_sede in ($tmp)", $dbi);
|
---|
| 71 | unset($tmp);
|
---|
| 72 | while(list($tmp) = mysql_fetch_row($result)) $idsezi[$i++]=$tmp;
|
---|
| 73 | $tmp=implode (",",$idsezi);
|
---|
| 74 | $sezi = "and id_sez in ($tmp)";
|
---|
| 75 | $circo = "and id_circ='$id_circ'";
|
---|
| 76 | }else{
|
---|
| 77 | $sezi='';
|
---|
| 78 | $circo='';
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | function stato_rilevazione($id_sez,$solosede){
|
---|
| 82 | global $id_cons, $prefix, $dbi, $id_cons_gen,$status,$genere,$votol, $votog, $votoc,$idrefgruppo,$num_ril,$circo,$dettnulli,$tipo_cons;
|
---|
| 83 |
|
---|
| 84 | if($idrefgruppo and $genere==0) $perref= "and id_gruppo='$idrefgruppo'";
|
---|
| 85 | else $perref="";
|
---|
| 86 | $ops=0;
|
---|
| 87 | $status=0;
|
---|
| 88 | $stret=0; $contains=0;
|
---|
| 89 | ###########
|
---|
| 90 | $res = mysql_query("SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data asc,orario asc", $dbi);
|
---|
| 91 | $num_ril=mysql_num_rows($res);
|
---|
| 92 | $res3 = mysql_query("SELECT stato_aff, stato_val,stato_gru,stato_lis,stato_can,status FROM ".$prefix."_ele_controllosez where id_sez='$id_sez' and id_cons='$id_cons'", $dbi);
|
---|
| 93 |
|
---|
| 94 | if(mysql_num_rows($res3)){
|
---|
| 95 | list($aff,$val,$gru,$lis,$can,$status)=mysql_fetch_row($res3);
|
---|
| 96 | if ($can) {$ops=-5;}
|
---|
| 97 | elseif ($lis) {$ops=-3;}
|
---|
| 98 | elseif($gru) {$ops=-4;}
|
---|
| 99 | elseif ($val) {$ops=-2;}
|
---|
| 100 | elseif($aff) {$ops=-1;}
|
---|
| 101 | # if($can==1) $status=1;
|
---|
| 102 | }else{
|
---|
| 103 | $aff=0;$lis=0;$val=0;$gru=0;$can=0;$stret=0;$status=0;
|
---|
| 104 | ##########################
|
---|
| 105 | if($ops==0){
|
---|
| 106 | #controllo congruenza affluenze
|
---|
| 107 | $res3= mysql_query("SELECT count(num_sez) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi);
|
---|
| 108 | list($numtot) = mysql_fetch_row($res3);
|
---|
| 109 | $test_ril=0;$pre_rilc=0;$pre_rilm=0;$pre_rilf=0;
|
---|
| 110 | if($res)
|
---|
| 111 | while (list($giorno,$ora) = mysql_fetch_row($res)){
|
---|
| 112 | $test_ril++;
|
---|
| 113 | $query="SELECT voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' $perref and orario='$ora' and data='$giorno'";
|
---|
| 114 | $res2 = mysql_query("$query", $dbi);
|
---|
| 115 | $numscru=mysql_num_rows($res2);
|
---|
| 116 | $query="SELECT sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' $perref and orario='$ora' and data='$giorno'";
|
---|
| 117 | $res2 = mysql_query("$query", $dbi);
|
---|
| 118 | list($voti)=mysql_fetch_row($res2);
|
---|
| 119 | if($numscru) {
|
---|
| 120 | if(isset($ora)){
|
---|
| 121 | $query="SELECT count(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' $perref and orario='$ora' and data='$giorno'";
|
---|
| 122 | # $res3 = mysql_query("$query", $dbi);
|
---|
| 123 | # list($numscru)=mysql_fetch_row($res3);
|
---|
| 124 | $res3= mysql_query("SELECT maschi+autorizzati_m,femmine+autorizzati_f FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi);
|
---|
| 125 | list($iscrittim,$iscrittif) = mysql_fetch_row($res3);
|
---|
| 126 | $iscritti=$iscrittim+$iscrittif;
|
---|
| 127 |
|
---|
| 128 | $query="SELECT voti_complessivi, voti_uomini, voti_donne FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' $perref and orario='$ora' and data='$giorno'";
|
---|
| 129 | $res3 = mysql_query("$query", $dbi);
|
---|
| 130 | list($voti, $uomini, $donne)=mysql_fetch_row($res3);
|
---|
| 131 | if (((($uomini+$donne)==0 and ($voti<=$iscritti) and $voti>=$pre_rilc) or ((($uomini+$donne)==$voti) and ($uomini<=$iscrittim) and ($donne<=$iscrittif) )) and $uomini>=$pre_rilm and $donne>=$pre_rilf and $voti>=$pre_rilc)
|
---|
| 132 | {
|
---|
| 133 | $ops=-1;$aff=1; $status=$test_ril;
|
---|
| 134 | }elseif($numscru) {$aff=-1;$stret=1;break;}
|
---|
| 135 | else {$status=0;$ops=-1;break;}
|
---|
| 136 | }
|
---|
| 137 | } else {$stret=-1;$aff=0;}
|
---|
| 138 | $pre_rilc=$voti; $pre_rilm=$uomini;$pre_rilf=$donne;
|
---|
| 139 | }
|
---|
| 140 | #if(isset($num_ril) and $num_ril==$test_ril) $status=1;
|
---|
| 141 |
|
---|
| 142 | #controllo congruenza voti espressi
|
---|
| 143 | #per referendum
|
---|
| 144 | $resref = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi);
|
---|
| 145 | if($genere==0){
|
---|
| 146 | $numscru=mysql_num_rows($resref); $rifscru=0;
|
---|
| 147 | while(list($idrefgruppo)=mysql_fetch_row($resref)) {
|
---|
| 148 | $res2= mysql_query("SELECT si,no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_sez='$id_sez' and id_gruppo='$idrefgruppo'", $dbi);
|
---|
| 149 | $refscru=mysql_num_rows($res2);
|
---|
| 150 | if($refscru){
|
---|
| 151 | $query="SELECT voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$idrefgruppo' order by data desc, orario desc";
|
---|
| 152 | $res3 = mysql_query("$query", $dbi);
|
---|
| 153 | list($voti)=mysql_fetch_row($res3);
|
---|
| 154 |
|
---|
| 155 | $rifscru++;
|
---|
| 156 | list($si,$no,$validi,$nulli,$bianchi,$contestati)=mysql_fetch_row($res2);
|
---|
| 157 | if(($si+$no==$validi) and ($validi+$nulli+$bianchi+$contestati==$voti)) { if($rifscru==$numscru) $status=5; else $status=4; $ops=-4;$val=1;} #{$status=1;return (-4);}
|
---|
| 158 | else {$val=-1;$stret=4;break;} #return (4);
|
---|
| 159 | } else { $stret=4;break;}
|
---|
| 160 | }
|
---|
| 161 | }else{
|
---|
| 162 | #per le altre consultazione
|
---|
| 163 | $res2= mysql_query("SELECT validi FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' and id_cons='$id_cons' ", $dbi);
|
---|
| 164 | if($res2){
|
---|
| 165 | list($validi) = mysql_fetch_row($res2);
|
---|
| 166 | if($validi) {
|
---|
| 167 | $status=0;
|
---|
| 168 | $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'";
|
---|
| 169 | $res4 = mysql_query("$query", $dbi);
|
---|
| 170 | list($validi, $nulli, $bianchi,$contestati,$votinulli,$sologruppo,$validilista,$contestatilista,$votinullilista,$sololista)=mysql_fetch_row($res4);
|
---|
| 171 | if($validi>0) {
|
---|
| 172 | if (($validi+$nulli+$bianchi+$contestati+$votinulli)==$voti)
|
---|
| 173 | {$status=2;$ops=(-4+$votog);$val=1;}
|
---|
| 174 | else {$val=-1;$stret=(4-$votog);}
|
---|
| 175 | } #else return 0;
|
---|
| 176 | }
|
---|
| 177 | }
|
---|
| 178 | #controllo congruenza voti di gruppo
|
---|
| 179 | if($genere!=4){
|
---|
| 180 | $res3= mysql_query("SELECT sum(voti),sum(solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_cons='$id_cons'", $dbi);
|
---|
| 181 | if($res3 and !$votog){#$status=0;$ops=-4;
|
---|
| 182 | list($votigs,$votisolog) = mysql_fetch_row($res3);
|
---|
| 183 | if($votigs and $genere!=2) {
|
---|
| 184 | # $status=0;
|
---|
| 185 | # $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'";
|
---|
| 186 | # $res4 = mysql_query("$query", $dbi);
|
---|
| 187 | # list($votigs)=mysql_fetch_row($res4);
|
---|
| 188 | if($votigs>0||$sololista==$validi) {
|
---|
| 189 | if (($votigs+$sololista)==$validi && (!$sologruppo || $votisolog==($sologruppo*$dettnulli) || ($sologruppo<$validi and $validilista+$contestatilista+$votinullilista==0)))
|
---|
| 190 | {$status=3;$ops=-3;$gru=1;}
|
---|
| 191 | else {$gru=-1; $stret=4;}
|
---|
| 192 | } #else return 0;
|
---|
| 193 | }
|
---|
| 194 | }
|
---|
| 195 | }#else {$gru=1;echo "--$votigs -- $votog";}
|
---|
| 196 | if(($genere>1 and !$votol)){#$status=0;
|
---|
| 197 | $res4= mysql_query("SELECT t1.preferenze,t1.id_fascia,t2.limite,t1.disgiunto FROM ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_conf as t2 on t1.id_conf=t2.id_conf where t1.id_cons='$id_cons'", $dbi);
|
---|
| 198 | if($res4) list($testpref,$fascia,$limite,$disgiunto)=mysql_fetch_row($res4); else {$testpref=0;$fascia=0;$limite=0;}
|
---|
| 199 |
|
---|
| 200 | #controllo congruenza voti di lista
|
---|
| 201 | # $res3= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons'", $dbi);
|
---|
| 202 | # list($votil) = mysql_fetch_row($res3);
|
---|
| 203 | $tablg=($fascia<=$limite && !$disgiunto) ? "gruppo":"lista";
|
---|
| 204 | $query="SELECT sum(voti),sum(solo_".$tablg.") FROM ".$prefix."_ele_voti_$tablg where id_sez='$id_sez' and id_cons='$id_cons'";
|
---|
| 205 | $res4 = mysql_query($query, $dbi);
|
---|
| 206 | list($votils,$votisolols)=mysql_fetch_row($res4);
|
---|
| 207 | $query="SELECT voti FROM ".$prefix."_ele_voti_$tablg where id_sez='$id_sez' and id_cons='$id_cons'";
|
---|
| 208 | $res4 = mysql_query($query, $dbi);
|
---|
| 209 | $sezscru=mysql_num_rows($res4);
|
---|
| 210 | if($sezscru) {
|
---|
| 211 | if($genere==4 or $votog) {$contrlis= ($votisolols==$sololista || $votisolols==0) ? 1:0; }
|
---|
| 212 | #################
|
---|
| 213 | else {
|
---|
| 214 | $contrlis=($sologruppo+$validilista+$contestatilista+$votinullilista)==$validi ? 1:0;
|
---|
| 215 | if($contrlis and $disgiunto and ($sologruppo+$validilista+$contestatilista+$votinullilista)==0)
|
---|
| 216 | $contrlis=($votisolols==$sololista || $votisolols==0) ? 1:0;
|
---|
| 217 | if($contrlis and $tipo_cons==18 or $tipo_cons==19)
|
---|
| 218 | while ( list($id_gruppo)=mysql_fetch_row($resref))
|
---|
| 219 | {
|
---|
| 220 | $res3= mysql_query("SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 221 | $res4= mysql_query("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')", $dbi);
|
---|
| 222 | list($vgruppo)=mysql_fetch_row($res3);
|
---|
| 223 | list($vliste)=mysql_fetch_row($res4);
|
---|
| 224 | if($vliste>$vgruppo) {$contrlis=0 ;}
|
---|
| 225 | if($vliste<$vgruppo) {$contrlis=0 ;}
|
---|
| 226 | }
|
---|
| 227 | }
|
---|
| 228 | #################
|
---|
| 229 |
|
---|
| 230 | if((($contrlis) and $validilista==$votils) or ($fascia<=$limite and $fascia)) {$status=4;$lis=1;$ops=-4;}
|
---|
| 231 | elseif($sezscru) {$stret=3;$lis=-1;}
|
---|
| 232 |
|
---|
| 233 | # if($votils>0) {
|
---|
| 234 | if(mysql_num_rows($res4)>0) {
|
---|
| 235 | # $res4= mysql_query("SELECT count(0) FROM ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 236 | # list($contains)=mysql_fetch_row($res4);
|
---|
| 237 | # if($contains==0) $tutte=1; else $tutte=0;
|
---|
| 238 |
|
---|
| 239 | $query="SELECT id_lista FROM ".$prefix."_ele_lista where id_cons='$id_cons' $circo";
|
---|
| 240 | $res3 = mysql_query("$query", $dbi);
|
---|
| 241 | $contaliste=mysql_num_rows($res3);
|
---|
| 242 | $res4= mysql_query("SELECT preferenze FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi);
|
---|
| 243 | if($res4) list($testpref)=mysql_fetch_row($res4); else $testpref=0;
|
---|
| 244 | while(list($testlista)=mysql_fetch_row($res3)){
|
---|
| 245 | if($fascia<=$limite and !$disgiunto and !$dettnulli)
|
---|
| 246 | {
|
---|
| 247 | $res4= mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_lista where id_cons='$id_cons' and id_lista='$testlista'", $dbi);
|
---|
| 248 | list($idgruppo)=mysql_fetch_row($res4);
|
---|
| 249 | $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$idgruppo'", $dbi);
|
---|
| 250 |
|
---|
| 251 | }else{
|
---|
| 252 | $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez' and id_lista='$testlista'", $dbi);
|
---|
| 253 | }
|
---|
| 254 | if($res4) list($testvotil)=mysql_fetch_row($res4); else $testvotil=0;
|
---|
| 255 | $res4= mysql_query("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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi);
|
---|
| 256 | if($res4) list($testvotic)=mysql_fetch_row($res4); else $testvotic=0;
|
---|
| 257 | $res4= mysql_query("SELECT 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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi);
|
---|
| 258 | if(mysql_num_rows($res4)) $contains++;
|
---|
| 259 | $totvotic=0;
|
---|
| 260 | while(list($testvotic)=mysql_fetch_row($res4))
|
---|
| 261 | {
|
---|
| 262 | $totvotic+=$testvotic;
|
---|
| 263 | if($testvotil<$testvotic) { $can=-1;break;}
|
---|
| 264 | }
|
---|
| 265 | if(($testvotil*$testpref)<$totvotic) { $can=-1;break;}
|
---|
| 266 | }
|
---|
| 267 | if($contains==$contaliste and $can==0) {$status=5;$can=1;$ops=-3;}
|
---|
| 268 | elseif($can==-1) {$stret=3;}
|
---|
| 269 | }
|
---|
| 270 | }
|
---|
| 271 | }elseif($ops==-3){ $ops=-4;}
|
---|
| 272 | }
|
---|
| 273 | if(isset($can)){
|
---|
| 274 | $res4=mysql_query("insert into ".$prefix."_ele_controllosez values('$id_sez','$id_cons','$aff','$val','$gru','$lis','$can','$status')",$dbi);
|
---|
| 275 | }
|
---|
| 276 | }
|
---|
| 277 | }
|
---|
| 278 | if($aff==-1) {$stret=1;}
|
---|
| 279 | elseif($val==-1) {$stret=(4-$votog);}
|
---|
| 280 | elseif($gru==-1) {$stret=4;}
|
---|
| 281 | elseif($lis==-1) {$stret=3;}
|
---|
| 282 | elseif($can==-1) {$stret=3;}
|
---|
| 283 | elseif($can==1) {$stret=-3;}
|
---|
| 284 | elseif($lis==1) {$stret=-3;}
|
---|
| 285 | elseif($gru==1) {$stret=-4;}
|
---|
| 286 | elseif($val==1) {$stret=-(4-$votog);}
|
---|
| 287 | else ($stret=-1);
|
---|
| 288 | if($stret) return($stret);
|
---|
| 289 | return ($ops);
|
---|
| 290 |
|
---|
| 291 |
|
---|
| 292 | }
|
---|
| 293 |
|
---|
| 294 | // Offset - visualizza il numero di elementi per pagina
|
---|
| 295 | $offset=2;
|
---|
| 296 | if (!isset($min)) $min=0;
|
---|
| 297 | $hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
|
---|
| 298 |
|
---|
| 299 | function numeri_sezione($nums) {
|
---|
| 300 | // tabella visualizzazione sezioni per numero
|
---|
| 301 | global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$id_cons,$id_lista,$ops, $perms,$id_sez,$num_ril,$status,$idrefgruppo,$votog,$votol,$votoc;
|
---|
| 302 | $idrefgruppo='';
|
---|
| 303 | $solosede='';
|
---|
| 304 | if ($perms<32) {
|
---|
| 305 | $res = mysql_query("SELECT id_sede FROM ".$prefix."_ele_operatori where aid='$aid' and id_cons=$id_cons", $dbi);
|
---|
| 306 | if ($res) {
|
---|
| 307 | list($solouna)=mysql_fetch_row($res);
|
---|
| 308 | if ($solouna>0) $solosede="and id_sede='$solouna'";
|
---|
| 309 | }
|
---|
| 310 | }
|
---|
| 311 | $res = mysql_query("SELECT num_sez, id_sez ,id_sede FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $solosede order by num_sez", $dbi);
|
---|
| 312 | $max = mysql_num_rows($res);
|
---|
| 313 | //if ($max>=64){
|
---|
| 314 | $i=0;
|
---|
| 315 | echo "\n<table align=\"left\" width=\"100%\" border=\"3\"><tr bgcolor=\"$bgcolor1\"><td>";
|
---|
| 316 |
|
---|
| 317 |
|
---|
| 318 | echo "<div id=\"navmenu\"> <ul>";
|
---|
| 319 | while(list($sez_num, $sez_id ,$sede_id) = mysql_fetch_row($res)) {
|
---|
| 320 | $ops='';
|
---|
| 321 | if(!$id_sez) {$id_sez=$sez_id; $id_sede=$sede_id;}
|
---|
| 322 | $i++;
|
---|
| 323 | $result = mysql_query("SELECT id_circ FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_sede='$sede_id' ", $dbi);
|
---|
| 324 | list($circ_id) = mysql_fetch_row($result);
|
---|
| 325 | //colora la sezione
|
---|
| 326 | $sezstat=0; #die($ops);
|
---|
| 327 | $sezstat=stato_rilevazione($sez_id,$solosede);
|
---|
| 328 | $cursez="style=\" background: #bbbbbb;";
|
---|
| 329 | $bgsez="";
|
---|
| 330 | if ($sezstat>0) {
|
---|
| 331 | $cursez="style=\" background: #FF3300;";#rosso;
|
---|
| 332 | }else{
|
---|
| 333 | if($sezstat==-5 or ($sezstat==-3 and $votoc))
|
---|
| 334 | if($status<$num_ril or ($votoc and $status==0) or ($genere==5 and $status==2)) {$cursez="style=\" background: #ADFF2F;";}#verde-giallo
|
---|
| 335 | else $cursez="style=\" background: #99CC33;"; #verde
|
---|
| 336 | elseif($sezstat==-3){
|
---|
| 337 | if($status==0) {$cursez="style=\" background: #B0E0E6;";}#powder-blue
|
---|
| 338 | elseif(($genere==4 and $status==5) or $votoc or $status==5 or ($genere==3 and $status==4)) $cursez="style=\" background: #99CC33;"; #verde
|
---|
| 339 | else $cursez="style=\" background: #00BFFF;"; #deepsky-blue
|
---|
| 340 | }
|
---|
| 341 | elseif($sezstat==-4){
|
---|
| 342 | if($status==2) {$cursez="style=\" background: #F5F5F5;";}#whitesmoke
|
---|
| 343 | elseif ($genere>1 or ($genere==0 and $status<5)) $cursez="style=\" background: #98FB98;"; #palegreen
|
---|
| 344 | elseif ($genere==0 and $status==0) {$cursez="style=\" background: #DAA520;";} #gold
|
---|
| 345 | else $cursez="style=\" background: #99CC33;"; #verde
|
---|
| 346 | }
|
---|
| 347 | elseif($sezstat==-2){
|
---|
| 348 | if($status==0) {$cursez="style=\" background: #B0E0E6;";}#powder-blue
|
---|
| 349 | else $cursez="style=\" background: #00BFFF;"; #deepsky-blue
|
---|
| 350 | }
|
---|
| 351 | elseif($sezstat==-1){
|
---|
| 352 | if($status==0 and $status<$num_ril) {$cursez="style=\" background: #F5F5DC;";}#beige
|
---|
| 353 | elseif($status==1 and $status<$num_ril) {$cursez="style=\" background: #D3D3D3;";}#lightgray
|
---|
| 354 | elseif($status==2 and $status<$num_ril) {$cursez="style=\" background: #E0FFFF;";}#lightcyan
|
---|
| 355 | elseif($status==3 and $status<$num_ril) {$cursez="style=\" background: #F0E68C;";}#kaki
|
---|
| 356 | else {$sezstat=-4;$cursez="style=\" background: #DAA520;";} #gold
|
---|
| 357 | }
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | if ($sezstat) $ops=abs($sezstat); else $ops=1;
|
---|
| 361 |
|
---|
| 362 | if(!$ops) $ops=1;
|
---|
| 363 | $res2= mysql_query("SELECT num_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi);
|
---|
| 364 | list($numero_sez) = mysql_fetch_row($res2);
|
---|
| 365 | if ($sez_num==$numero_sez) {$cursez.= " border: solid; border-color: YELLOW; border-width: 4px; border-left: solid gray 4px; border-top: solid gray 4px;\"";} else $cursez.="\"";
|
---|
| 366 | echo "\n<li $cursez><b><a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$circ_id&id_sede=$sede_id&id_sez=$sez_id&ops=$ops&do=spoglio&id_lista=$id_lista\">$sez_num</a></b></li>\n";
|
---|
| 367 | }
|
---|
| 368 | //}
|
---|
| 369 | echo "</ul></div></td></tr></table>\n";
|
---|
| 370 | //}// fine tabella per numero sezioni
|
---|
| 371 | }
|
---|
| 372 | ///////////////////////////////////////////////////////////////////////////////////
|
---|
| 373 |
|
---|
| 374 |
|
---|
| 375 | function voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista) {
|
---|
| 376 | global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$prev_sez,$votog,$votol,$votoc,$conscirc,$id_sez;
|
---|
| 377 |
|
---|
| 378 | echo "<table border=\"0\" width=\"760\" align=\"left\"><tr>";
|
---|
| 379 | echo "\n<td bgcolor=\"$bgcolor1\" align=\"left\">";
|
---|
| 380 | numeri_sezione(22);
|
---|
| 381 | echo "\n</td></tr><tr><td>\n";
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | ///////////////////////
|
---|
| 385 | // Circoscrizione : scelta
|
---|
| 386 | ///////////////////////
|
---|
| 387 |
|
---|
| 388 | $resoper=mysql_query("SELECT t1.id_sede,t2.id_circ FROM ".$prefix."_ele_operatori as t1,
|
---|
| 389 | ".$prefix."_ele_sede as t2
|
---|
| 390 | where t1.id_cons='$id_cons' AND t1.id_sede=t2.id_sede and t1.aid='$aid'", $dbi);
|
---|
| 391 | list($id_sede2,$id_circ2) = mysql_fetch_row($resoper);
|
---|
| 392 | if ($id_sede2 and !($id_sede==$id_sede2)) {
|
---|
| 393 | $id_sede=$id_sede2;
|
---|
| 394 | $id_circ=$id_circ2;
|
---|
| 395 | $do="spoglio";
|
---|
| 396 | $res= mysql_query("SELECT id_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sede=$id_sede order by num_sez limit 0,1", $dbi);
|
---|
| 397 | list($id_sez) = mysql_fetch_row($res);
|
---|
| 398 | }
|
---|
| 399 | if ($do == "circo") {
|
---|
| 400 | OpenTable();
|
---|
| 401 | echo "<tr><td><form name=\"voti\" action=\"admin.php\">"
|
---|
| 402 | ."<input type=\"hidden\" name=\"op\" value=\"voti\">"
|
---|
| 403 | ."<input type=\"hidden\" name=\"do\" value=\"sede\">"
|
---|
| 404 | // Circoscrizione: lista
|
---|
| 405 | //**************************************
|
---|
| 406 | .""._CIRCO.": "
|
---|
| 407 | ."<select name=\"id_circ\">";
|
---|
| 408 | $res= mysql_query("SELECT id_circ,descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' order by num_circ", $dbi);
|
---|
| 409 | while(list($id,$descr) = mysql_fetch_row($res)) {
|
---|
| 410 | if ($descr!="Tutte"){
|
---|
| 411 | if ($id == $id_circ) {
|
---|
| 412 | $sel = "selected";
|
---|
| 413 | } else {
|
---|
| 414 | $sel = "";
|
---|
| 415 | }
|
---|
| 416 | echo "<option value=\"$id\" $sel>$descr";
|
---|
| 417 | }
|
---|
| 418 | }
|
---|
| 419 | echo "</select>"
|
---|
| 420 | //***********************************
|
---|
| 421 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 422 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
| 423 | ."</form></td></tr>";
|
---|
| 424 | CloseTable();
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | ///////////////////////
|
---|
| 428 | // sede : scelta
|
---|
| 429 | ///////////////////////
|
---|
| 430 |
|
---|
| 431 |
|
---|
| 432 | if ($do == "sede") {
|
---|
| 433 | OpenTable();
|
---|
| 434 | echo "\n<tr><td><form name=\"sede\" action=\"admin.php\">";
|
---|
| 435 | $res= mysql_query("SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' AND id_circ='$id_circ' order by num_circ", $dbi);
|
---|
| 436 | list( $descr_circ) = mysql_fetch_row($res);
|
---|
| 437 | echo "<a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=circo\">"._CIRCO."</a> $descr_circ ->";
|
---|
| 438 | echo "<input type=\"hidden\" name=\"op\" value=\"voti\">"
|
---|
| 439 | ."<input type=\"hidden\" name=\"do\" value=\"spoglio\">"
|
---|
| 440 |
|
---|
| 441 | // Indirizzo: lista
|
---|
| 442 | //**************************************
|
---|
| 443 | .""._INDIRIZZO.": "
|
---|
| 444 | ."<select name=\"id_sede\">";
|
---|
| 445 | $res= mysql_query("SELECT id_sede,indirizzo FROM ".$prefix."_ele_sede where id_cons='$id_cons' and id_circ='$id_circ' order by indirizzo", $dbi);
|
---|
| 446 | // echo "$id_circ - $id_cons";
|
---|
| 447 | while(list($id,$indir) = mysql_fetch_row($res)) {
|
---|
| 448 | if ($id == $id_sede) {
|
---|
| 449 | $sel = "selected";
|
---|
| 450 | } else {
|
---|
| 451 | $sel = "";
|
---|
| 452 | }
|
---|
| 453 | echo "<option value=\"$id\" $sel>$indir";
|
---|
| 454 | }
|
---|
| 455 | echo "</select>"
|
---|
| 456 | //*************************************
|
---|
| 457 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 458 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
| 459 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
| 460 | ."</form></td></tr>\n";
|
---|
| 461 | CloseTable();
|
---|
| 462 | }
|
---|
| 463 |
|
---|
| 464 | ///////////////////////
|
---|
| 465 | // sezione : scelta
|
---|
| 466 | ///////////////////////
|
---|
| 467 | if ($do == "spoglio") {
|
---|
| 468 |
|
---|
| 469 |
|
---|
| 470 | //************************************
|
---|
| 471 | // Menu spoglio
|
---|
| 472 | //************************************
|
---|
| 473 | $result = mysql_query("select id_cons,id_sez,id_sede,num_sez, maschi, femmine from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 474 | list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = mysql_fetch_row($result);
|
---|
| 475 |
|
---|
| 476 | echo "<hr><table><tr><td width=\"200\"><font size =\"4\" color=\"black\" align=\"left\"><b>Sezione N. $num_sez</b></font size></td><td><table><tr>";
|
---|
| 477 | 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";
|
---|
| 478 | if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){
|
---|
| 479 | echo "<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=4\">"._GRUPPO."</a></b></p></td>\n";
|
---|
| 480 | }
|
---|
| 481 | if(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){
|
---|
| 482 | echo "<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=3\">"._LISTA."</a></b></p></td>\n";
|
---|
| 483 | }
|
---|
| 484 | echo "</tr></table></td></tr></table><hr>\n";
|
---|
| 485 |
|
---|
| 486 | #############
|
---|
| 487 | # posizionamento in mancanza di scelta
|
---|
| 488 | #############
|
---|
| 489 | if (!$ops){
|
---|
| 490 | if (!$id_sez) { echo"";#import( pagina di help );
|
---|
| 491 | } else{
|
---|
| 492 | $res= mysql_query("SELECT data, orario from ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1", $dbi);
|
---|
| 493 | list($data,$orario)=mysql_fetch_row($res);
|
---|
| 494 | $res= mysql_query("SELECT voti_complessivi from ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and orario='$orario' and data='$data'", $dbi);
|
---|
| 495 | list($voti) = mysql_fetch_row($res);
|
---|
| 496 | if (!$voti) $ops=1;
|
---|
| 497 | else {
|
---|
| 498 | if($genere<4){
|
---|
| 499 | $res= mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'", $dbi);
|
---|
| 500 | list($voti) = mysql_fetch_row($res);
|
---|
| 501 | if ($voti==0 or $genere<3) $ops=4;
|
---|
| 502 | }
|
---|
| 503 | if(!$ops) $ops=3;
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 | }
|
---|
| 507 | }
|
---|
| 508 | ############ fine posizionamento
|
---|
| 509 |
|
---|
| 510 | ///////////////////////////////////////////
|
---|
| 511 | // opzioni per le funzioni di immissione
|
---|
| 512 |
|
---|
| 513 | if ($ops == 1) {
|
---|
| 514 | votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av);
|
---|
| 515 | }else{
|
---|
| 516 | ############# Controllo flag per cancellazione consultazione
|
---|
| 517 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
| 518 | ."//-->\n";
|
---|
| 519 | echo "function del_dati() {\n";
|
---|
| 520 | echo "if (document.getElementById('pwd3').checked==false) {\n";
|
---|
| 521 | echo "document.getElementById('update').value=\""._OK."\" \n";
|
---|
| 522 | echo "document.getElementById('do').value=\"0\" \n";
|
---|
| 523 | echo "}else{\n";
|
---|
| 524 | echo "document.getElementById('update').value=\""._DELETE."\" \n";
|
---|
| 525 | echo "document.getElementById('do').value=\"1\" \n";
|
---|
| 526 | echo "} \n";
|
---|
| 527 | echo "} \n";
|
---|
| 528 | echo "</script>\n";
|
---|
| 529 | }
|
---|
| 530 | if ($ops == 3) {
|
---|
| 531 | preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
| 532 | }
|
---|
| 533 | if ($ops == 4) {
|
---|
| 534 | preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
| 535 |
|
---|
| 536 | }
|
---|
| 537 |
|
---|
| 538 | }
|
---|
| 539 | CloseTable();
|
---|
| 540 |
|
---|
| 541 | }
|
---|
| 542 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 543 | // FUNZIONI DI IMMISSIONE
|
---|
| 544 | // - preferenze (candidati consiglieri)
|
---|
| 545 | // - preferenze_gruppi
|
---|
| 546 | // - votanti
|
---|
| 547 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 548 |
|
---|
| 549 | //////////////////////////////////////////////////////////////////////
|
---|
| 550 | // da qui va la sezione per le preferenze candidati consiglieri
|
---|
| 551 | //////////////////////////////////////////////////////////////////////
|
---|
| 552 | function preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
| 553 | global $aid, $prefix, $dbi, $id_lista,$genere,$id_cons_gen,$id_gruppo,$sezi,$circo,$votog,$votol,$votoc,$conscirc;
|
---|
| 554 | global $tipo_cons,$limite,$dettnulli,$disgiunto;
|
---|
| 555 |
|
---|
| 556 | $bgcolor1="#7777ff";
|
---|
| 557 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 558 | //controlla se sono stati inseriti i votanti
|
---|
| 559 | $result = mysql_query("SELECT preferenze, id_fascia, id_conf,solo_gruppo, disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons'",$dbi);
|
---|
| 560 | list($numprefs,$fascia,$id_conf,$flagsg,$disgiunto)=mysql_fetch_row($result);
|
---|
| 561 |
|
---|
| 562 | ####### 06-11-2014 - circoscrizionali - nello spostamento ad altra sezione resta sullo stesso numero di lista anche se sono sezioni di diverse circoscrizioni
|
---|
| 563 | if ($circo and $id_lista){
|
---|
| 564 | $res_lis = mysql_query("SELECT num_lista from ".$prefix."_ele_lista where id_lista=$id_lista",$dbi);
|
---|
| 565 | list($num_lista)=mysql_fetch_row($res_lis);
|
---|
| 566 | $res_lis = mysql_query("SELECT id_lista from ".$prefix."_ele_lista where num_lista=$num_lista and id_cons='$id_cons' $circo",$dbi);
|
---|
| 567 | list($id_lista)=mysql_fetch_row($res_lis);
|
---|
| 568 | }
|
---|
| 569 | #######
|
---|
| 570 | if(!$votog and ($genere==3 or $genere==5))
|
---|
| 571 | $result = mysql_query("select validi_lista,nulli,bianchi,contestati_lista,voti_nulli_lista from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 572 | else
|
---|
| 573 | $result = mysql_query("select validi,nulli,bianchi,contestati,voti_nulli from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 574 | list($validi,$nulli,$bianchi,$contestati,$votinulli) = mysql_fetch_row($result);
|
---|
| 575 | echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>";
|
---|
| 576 | $res_lis = mysql_query("SELECT id_lista, descrizione,num_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo order by num_lista",$dbi);
|
---|
| 577 | $num_liste = mysql_num_rows($res_lis);
|
---|
| 578 | $ele_lista='';
|
---|
| 579 | if (($genere==4 or $genere==5) and !$votoc) { //liste a piu' candidati
|
---|
| 580 | 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 limite
|
---|
| 581 | $result = mysql_query("SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons limit 0,1",$dbi);
|
---|
| 582 | list($id_lista)=mysql_fetch_row($result);
|
---|
| 583 | }
|
---|
| 584 | echo "<td> </td></tr><tr><td style=\"vertical-align: top;\">";
|
---|
| 585 | echo "<form name=\"liste\" action=\"admin.php\">";
|
---|
| 586 | 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=\">";
|
---|
| 587 | echo "<select name=\"id_lista\" size=\"".($num_liste+1)."\" onChange=\"vai_lista()\">";
|
---|
| 588 | if ($id_lista){
|
---|
| 589 | echo "<option value=\"0\">"._VOTI_LISTA;
|
---|
| 590 | $ele_lista=" and t1.id_lista='$id_lista' ";
|
---|
| 591 | }else{
|
---|
| 592 | echo "<option value=\"0\" selected>"._VOTI_LISTA;
|
---|
| 593 | $ele_lista=" group by t1.id_lista ";
|
---|
| 594 | if(!isset($votolista)) $votolista=0;
|
---|
| 595 |
|
---|
| 596 | }
|
---|
| 597 | while(list($id_rif,$descrizione,$num_lis) = mysql_fetch_row($res_lis)) {
|
---|
| 598 | $segna='';
|
---|
| 599 | $result = mysql_query("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",$dbi);
|
---|
| 600 | list($ctrvoticand)=mysql_fetch_row($result);
|
---|
| 601 | $result = mysql_query("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",$dbi);
|
---|
| 602 | list($votisezcand)=mysql_fetch_row($result);
|
---|
| 603 | if((($fascia>$limite or $disgiunto) or !$id_conf) or $genere==4)
|
---|
| 604 | $result = mysql_query("SELECT voti,solo_lista from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'", $dbi);
|
---|
| 605 | else{
|
---|
| 606 |
|
---|
| 607 | $result = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'", $dbi);
|
---|
| 608 | list($id_gruppo)=mysql_fetch_row($result);
|
---|
| 609 | $result = mysql_query("SELECT sum(voti),0 from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 610 | }
|
---|
| 611 | list($votisezlis,$sgpl)=mysql_fetch_row($result);
|
---|
| 612 | if($votisezcand>($votisezlis*$numprefs))
|
---|
| 613 | {$segna="style=\"background-color: #dd0000;\"";}
|
---|
| 614 | elseif($ctrvoticand)
|
---|
| 615 | $segna="style=\"background-color: #99CC33;\"";
|
---|
| 616 | $res4= mysql_query("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'", $dbi);
|
---|
| 617 | $errcand[$id_rif]=array();
|
---|
| 618 | while(list($testvotic,$numcand)=mysql_fetch_row($res4))
|
---|
| 619 | if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;}
|
---|
| 620 |
|
---|
| 621 | $sel = ($id_rif == $id_lista) ? "selected" : "";
|
---|
| 622 | echo "<option $segna value=\"$id_rif\" $sel>";
|
---|
| 623 | for ($j=strlen($num_lis);$j<2;$j++) { echo " ";}
|
---|
| 624 | echo $num_lis.") ".substr($descrizione,0,30);
|
---|
| 625 | }
|
---|
| 626 | echo "</select></form></td>\n";
|
---|
| 627 | }else {
|
---|
| 628 | $id_lista=0;
|
---|
| 629 | }
|
---|
| 630 | echo "<td style=\"vertical-align: top;\">";
|
---|
| 631 |
|
---|
| 632 | if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";}
|
---|
| 633 | if(($genere==4 or ($genere==5 and $votog)) and !$id_lista)
|
---|
| 634 | $result = mysql_query("SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,0,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",$dbi);
|
---|
| 635 | else
|
---|
| 636 | $result = mysql_query("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 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",$dbi);
|
---|
| 637 | // 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 lista
|
---|
| 638 | $isscr= mysql_num_rows($result);
|
---|
| 639 | list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2,$sgpl) = mysql_fetch_row($result);
|
---|
| 640 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
| 641 | $resg = mysql_query("SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez",$dbi);
|
---|
| 642 | list($sgpl)=mysql_fetch_row($resg);
|
---|
| 643 | 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>";
|
---|
| 644 | }
|
---|
| 645 | $valista=$validi2;
|
---|
| 646 | if(!$id_lista or $genere==3){ //controllo di congruenza
|
---|
| 647 | $res2 = mysql_query("SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 648 | list($tot) = mysql_fetch_row($res2);
|
---|
| 649 | if ($validi2+$vnulli2+$cont2+$sg+$bia2+$nul2+$con2+$vnul2!=$tot and $validi+$sg>0){
|
---|
| 650 | 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>";
|
---|
| 651 | }
|
---|
| 652 |
|
---|
| 653 | if((($voti_sez)!=$validi2) and ($voti_sez>0)){
|
---|
| 654 | 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>";
|
---|
| 655 | }
|
---|
| 656 | }elseif($genere==5){
|
---|
| 657 | $result = mysql_query("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",$dbi);
|
---|
| 658 | list($votisezcand)=mysql_fetch_row($result);
|
---|
| 659 | if(($fascia>$limite or $disgiunto) or !$id_conf)
|
---|
| 660 | $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'", $dbi);
|
---|
| 661 | else{
|
---|
| 662 |
|
---|
| 663 | $result = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'", $dbi);
|
---|
| 664 | list($id_gruppo)=mysql_fetch_row($result);
|
---|
| 665 | $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 666 | }
|
---|
| 667 | list($votisezlis)=mysql_fetch_row($result);
|
---|
| 668 | if($votisezcand>($votisezlis*$numprefs))
|
---|
| 669 | {
|
---|
| 670 | 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>";
|
---|
| 671 | }
|
---|
| 672 | }
|
---|
| 673 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
| 674 | $errgrulis=array();
|
---|
| 675 | if($genere==5 and !$disgiunto and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
| 676 | $resref = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi);
|
---|
| 677 | $res4= mysql_query("SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'", $dbi);
|
---|
| 678 | list($sezscrl)=mysql_fetch_row($res4);
|
---|
| 679 | if ($sezscrl)
|
---|
| 680 |
|
---|
| 681 | while ( list($id_gruppo)=mysql_fetch_row($resref))
|
---|
| 682 | {
|
---|
| 683 | $res3= mysql_query("SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 684 | $res4= mysql_query("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')", $dbi);
|
---|
| 685 | list($vgruppo)=mysql_fetch_row($res3);
|
---|
| 686 | list($vliste)=mysql_fetch_row($res4);
|
---|
| 687 | if($vliste>$vgruppo)
|
---|
| 688 | {
|
---|
| 689 | $result = mysql_query("SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 690 | list($dgruppo)=mysql_fetch_row($result);
|
---|
| 691 | 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>";
|
---|
| 692 | $errgrulis[$id_gruppo]=1;
|
---|
| 693 | }
|
---|
| 694 | elseif($vliste<$vgruppo)
|
---|
| 695 | {
|
---|
| 696 | $result = mysql_query("SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 697 | list($dgruppo)=mysql_fetch_row($result);
|
---|
| 698 | 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>";
|
---|
| 699 | $errgrulis[$id_gruppo]=1;
|
---|
| 700 | }
|
---|
| 701 | }
|
---|
| 702 | }
|
---|
| 703 |
|
---|
| 704 |
|
---|
| 705 |
|
---|
| 706 | echo "\n<form name=\"sezioni\" action=\"admin.php\">"
|
---|
| 707 | ."<input type=\"hidden\" name=\"op\" value=\"rec_voti\">"
|
---|
| 708 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 709 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
| 710 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
| 711 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
| 712 | ."<input type=\"hidden\" name=\"tabella\" value=\"$tab\">"
|
---|
| 713 | ."<input type=\"hidden\" name=\"id_lista\" value=\"$id_lista\">\n"
|
---|
| 714 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">\n";
|
---|
| 715 | echo "<table class=\"table-menu\" style=\"width: 90%; color: black\">";
|
---|
| 716 | echo "<tr><td bgcolor=\"$bgcolor1\" align=\"left\" width=\"32\">";
|
---|
| 717 | if ($genere<4){
|
---|
| 718 | // echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._LISTA."</b></td>";
|
---|
| 719 | }
|
---|
| 720 | echo "<b>"._NUM."</b></td>";
|
---|
| 721 | if($id_lista){
|
---|
| 722 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._CANDIDATO."</b></td>"
|
---|
| 723 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";
|
---|
| 724 | }else{
|
---|
| 725 | echo "<td bgcolor=\"$bgcolor1\" align=\"left\"><b>"._DESCR."</b></td>"
|
---|
| 726 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTI."</b></td>";
|
---|
| 727 | if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19)
|
---|
| 728 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NULLI_LISTE."</b></td>";
|
---|
| 729 | if($disgiunto){
|
---|
| 730 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLOLIS."</b></td>";
|
---|
| 731 | }
|
---|
| 732 | }
|
---|
| 733 | echo "</tr>\n";
|
---|
| 734 |
|
---|
| 735 |
|
---|
| 736 |
|
---|
| 737 |
|
---|
| 738 |
|
---|
| 739 | $result = mysql_query("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", $dbi);
|
---|
| 740 | $max = mysql_num_rows($result);
|
---|
| 741 | $tot_pref=0;
|
---|
| 742 | $i=1;
|
---|
| 743 |
|
---|
| 744 | if($id_lista) {
|
---|
| 745 | while(list($id_cand,$id_cons2,$id_lista2, $cognome, $nome, $note, $simbolo, $num_cand) = mysql_fetch_row($result)){
|
---|
| 746 | // dati lista
|
---|
| 747 | $result1 = mysql_query("select id_lista, descrizione,simbolo,num_lista from ".$prefix."_ele_lista where id_lista='$id_lista2'", $dbi);
|
---|
| 748 | list($id_lista3,$descr_lista,$simb_lista,$num_lista)=mysql_fetch_row($result1);
|
---|
| 749 | // dati gruppo
|
---|
| 750 | $result2 = mysql_query("select descrizione,simbolo from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 751 | list($descr_gruppo,$simb_gruppo)=mysql_fetch_row($result2);
|
---|
| 752 |
|
---|
| 753 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
| 754 | if ($genere<4){
|
---|
| 755 | echo "<td align=\"left\"><b><img src=\"images/lista/$simb_lista \" width=\"32\" heigth=\"32\" align=\"center\" ALT=\"$descr_lista\" > </b></td>";
|
---|
| 756 | }
|
---|
| 757 | echo "<td align=\"center\"><b> $num_cand </b></td>"
|
---|
| 758 | ."<td align=\"left\"><b>$cognome $nome</b></td>";
|
---|
| 759 | $cond_sele="and id_cand=$id_cand";
|
---|
| 760 | $res = mysql_query("SELECT * FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele", $dbi);
|
---|
| 761 | $pro= mysql_fetch_array($res, 3);
|
---|
| 762 | if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor='';
|
---|
| 763 | echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\">";
|
---|
| 764 | echo "<input type=\"hidden\" name=\"id_cand$i\" value=\"$id_cand\"></td></tr>\n";
|
---|
| 765 | $i++;
|
---|
| 766 | $tot_pref+=$pro['voti'];
|
---|
| 767 | }
|
---|
| 768 | }else {
|
---|
| 769 | $result1 = mysql_query("select t2.voti,t1.id_lista, descrizione,simbolo,num_lista,t2.nulli_lista,t2.solo_lista,t1.id_gruppo
|
---|
| 770 | from ".$prefix."_ele_lista as t1, ".$prefix."_ele_voti_lista as t2
|
---|
| 771 | where t1.id_cons='$id_cons'
|
---|
| 772 | and t1.id_lista=t2.id_lista
|
---|
| 773 | and t2.id_sez=$id_sez
|
---|
| 774 | order by t1.num_lista", $dbi);
|
---|
| 775 | $num_lista=mysql_num_rows($result1);
|
---|
| 776 | if (!$num_lista){
|
---|
| 777 | $result1 = mysql_query("select '',id_lista, descrizione,simbolo,num_lista,'','',id_gruppo
|
---|
| 778 | from ".$prefix."_ele_lista where id_cons='$id_cons' $circo
|
---|
| 779 | order by num_lista", $dbi);
|
---|
| 780 | }
|
---|
| 781 | while (list($pro['voti'],$id_lista3,$descr_lista,$simb_lista,$num_lista,$vnpl,$slpl,$rifgruppo)=mysql_fetch_row($result1)){
|
---|
| 782 | echo "<tr bgcolor=\"$bgcolor2\">";
|
---|
| 783 | // if ($genere<4 or $votoc){
|
---|
| 784 | // }
|
---|
| 785 | $errcolor='';
|
---|
| 786 | if(isset($errgrulis[$rifgruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";
|
---|
| 787 | echo "<td align=\"center\"><b> $num_lista </b></td>"
|
---|
| 788 | ."<td align=\"left\"><b> $descr_lista</b></td>";
|
---|
| 789 | $cond_sele="and id_lista=$id_lista3";
|
---|
| 790 | echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\">";
|
---|
| 791 | 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\">";
|
---|
| 792 | if($disgiunto) echo "</td><td align=\"right\"><input name=\"slpl$i\" value=\"".$slpl."\" size=\"7\" style=\"text-align:right\">";
|
---|
| 793 | echo "<input type=\"hidden\" name=\"id_lista$i\" value=\"$id_lista3\"></td>";
|
---|
| 794 | // echo "<td align=\"right\">$sgpl";
|
---|
| 795 | echo "</tr>\n";
|
---|
| 796 | $i++;
|
---|
| 797 | $tot_pref+=$pro['voti'];
|
---|
| 798 | }
|
---|
| 799 | }
|
---|
| 800 | if(!$id_lista) echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOT._VOTI_LISTA."</td><td align=\"center\">$tot_pref</td></tr>";
|
---|
| 801 | else echo "<tr bgcolor=\"$bgcolor1\"><td></td><td>"._TOTPREF."</td><td align=\"center\">$tot_pref</td></tr>";
|
---|
| 802 | // toglie ai candidati la visual... del solo_gruppo
|
---|
| 803 | if(!$votog) {
|
---|
| 804 | if (($genere==3 OR $genere==5) and (!$id_lista) and (($disgiunto or $fascia>$limite) or !$id_conf)) { //gruppo e liste
|
---|
| 805 | 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>";
|
---|
| 806 | 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\"></td></tr>";
|
---|
| 807 | echo "<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\">"
|
---|
| 808 | ."</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>";
|
---|
| 809 |
|
---|
| 810 | }elseif (($genere==3 OR $genere==5) and !$votoc and (($disgiunto or $fascia>$limite) or !$id_conf)){ //}elseif ($tipo_cons!=10 and $tipo_cons!=11){
|
---|
| 811 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">$sg</td></tr>";
|
---|
| 812 | }
|
---|
| 813 | ######modifica del 16-04-2009 per visualizzare i voti al solo sindaco nei comuni con meno di 15000 abitanti
|
---|
| 814 | elseif(($genere==3 OR $genere==5) and ($id_lista) and ($fascia<=$limite or !$id_conf) and $numprefs==1) {
|
---|
| 815 | $resvg = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_lista where id_lista='$id_lista'", $dbi);
|
---|
| 816 | list($id_gruppo) = mysql_fetch_row($resvg);
|
---|
| 817 | $resvg = mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_gruppo='$id_gruppo' and id_sez='$id_sez'", $dbi);
|
---|
| 818 | list($voti_sind) = mysql_fetch_row($resvg);
|
---|
| 819 |
|
---|
| 820 | echo "<tr bgcolor=\"$bgcolor1\"><td></td><td><b>"._SOLO_GRUPPO."</b></td><td align=\"center\">".($voti_sind - $tot_pref)."</td></tr>";
|
---|
| 821 | }
|
---|
| 822 | ###### fine modifica del 16-04-2009
|
---|
| 823 |
|
---|
| 824 | }
|
---|
| 825 | echo "<tr>";
|
---|
| 826 | echo "<td></td><td></td>";
|
---|
| 827 | echo "<td align=\"center\"><input type=\"submit\" id=\"update\" name=\"update\" value=\""._OK."\"></td>";
|
---|
| 828 | echo "</tr></table></form></tr>";
|
---|
| 829 | if(chisei($id_cons_gen)>=64){
|
---|
| 830 | echo "<td></td><td> <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."</td>";
|
---|
| 831 | }
|
---|
| 832 | echo "</table>";
|
---|
| 833 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
| 834 | ."document.sezioni.voti1.focus()\n"
|
---|
| 835 | ."document.sezioni.voti1.select()\n"
|
---|
| 836 | ."//-->\n";
|
---|
| 837 | echo "function vai_lista() {\n";
|
---|
| 838 | echo "window.document.location.href=document.liste.pag.value+document.liste.id_lista.value\n";
|
---|
| 839 | echo "}\n";
|
---|
| 840 | echo "</script>\n";
|
---|
| 841 | # }
|
---|
| 842 | #if (!((!$votog) and ($genere==3 OR $genere==5) and ($fascia>$limite)))
|
---|
| 843 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
| 844 | }
|
---|
| 845 |
|
---|
| 846 | /////////////////////////////////////////////
|
---|
| 847 | // registra le preferenze ai candidati
|
---|
| 848 | /////////////////////////////////////////////
|
---|
| 849 |
|
---|
| 850 | function rec_voti() {
|
---|
| 851 | global $prefix, $dbi,$aid,$id_cons,$ops,$genere,$votog,$fileout,$id_comune,$limite,$update,$dettnulli,$disgiunto,$tipo_cons;
|
---|
| 852 |
|
---|
| 853 | $sqlcomu="select id_fascia,id_conf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
|
---|
| 854 | $res = mysql_query($sqlcomu);
|
---|
| 855 | if($res)
|
---|
| 856 | list($fascia,$id_conf)=mysql_fetch_row($res);
|
---|
| 857 | else {$fascia=0; $id_conf=0;}
|
---|
| 858 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 859 | $username=$aid;
|
---|
| 860 | $log_data= date("Y/m/d");
|
---|
| 861 | $log_ora=getdate(time());
|
---|
| 862 | $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']);
|
---|
| 863 | $arg2 = func_get_args();
|
---|
| 864 | $arg = split(",",$arg2[0]);
|
---|
| 865 | $id_cons_gen=intval($arg[1]);
|
---|
| 866 | $id_sez = intval($arg[2]);
|
---|
| 867 | $id_circ = intval($arg[3]);
|
---|
| 868 | $id_sede = intval($arg[4]);
|
---|
| 869 | $tab = $arg[5];
|
---|
| 870 | $id_lista = intval($arg[6]);
|
---|
| 871 | $do= intval($arg[7]);
|
---|
| 872 | if ($tab=="_ele_voti_candidati") {
|
---|
| 873 | $condizione="id_cand";
|
---|
| 874 | }else{
|
---|
| 875 | $condizione="id_lista";
|
---|
| 876 | }
|
---|
| 877 | if ((($genere==3) OR ($genere==5)) and !$id_lista and !$votog and (($disgiunto or $fascia>$limite) or !$id_conf)) $y = (count($arg)-4);
|
---|
| 878 | else $y=count($arg);#die ("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'");
|
---|
| 879 | mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 880 | if($do==1) {
|
---|
| 881 | mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 882 | mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 883 | if($genere!=4)
|
---|
| 884 | mysql_query("update ".$prefix."_ele_sezioni set validi_lista='0',contestati_lista='0',voti_nulli_lista='0',solo_gruppo='0' where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 885 |
|
---|
| 886 | }else{
|
---|
| 887 | for($i=8,$y--;$i< $y;$i++) {
|
---|
| 888 | $voti = intval($arg[$i++]);
|
---|
| 889 | $vnrigains=",'0'";
|
---|
| 890 | $vnriga='';
|
---|
| 891 | if($dettnulli && !$disgiunto && $tipo_cons!=18 && $tipo_cons!=19 and $condizione!="id_cand") {$vnpl = intval($arg[$i++]); $vnriga=",nulli_lista='$vnpl'"; $vnrigains=",'".$vnpl."'";} else {if (!($condizione=="id_lista")) $vnrigains="";}
|
---|
| 892 | if($disgiunto and $condizione!="id_cand") {$slpl = intval($arg[$i++]); $vnriga.=",solo_lista='$slpl'"; $vnrigains.=",'".$slpl."'";} else {$vnriga.=''; if ($condizione=="id_lista") $vnrigains.=",'0'"; else $vnrigains="";}
|
---|
| 893 | $id_cand = intval($arg[$i]);
|
---|
| 894 | $result = mysql_query("select * from ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' and $condizione='$id_cand'", $dbi);
|
---|
| 895 | $ar=mysql_fetch_array($result);
|
---|
| 896 |
|
---|
| 897 | if ($ar){
|
---|
| 898 | #die("T1:$dettnulli -- T2:$disgiunto -- update ".$prefix."$tab set voti='$voti'$vnriga where id_cons='$id_cons' and id_sez='$id_sez' and $condizione='$id_cand'");
|
---|
| 899 | if ($ar['voti']!=$voti or (isset($vnpl) and $ar['nulli_lista']!=$vnpl) or (isset($slpl) and $ar['solo_lista']!=$slpl)) {
|
---|
| 900 | mysql_query("update ".$prefix."$tab set voti='$voti'$vnriga where id_cons='$id_cons' and id_sez='$id_sez' and $condizione='$id_cand'", $dbi);
|
---|
| 901 | if ($fileout) fwrite($fp,"update ".$prefix."$tab set voti='$voti' where id_cons='$id_cons' and id_sez='$id_sez' and $condizione='$id_cand';\n");
|
---|
| 902 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','$orario','voti=".$ar['voti']."','$condizione:$id_cand voti: $voti','$tab')", $dbi);
|
---|
| 903 | }
|
---|
| 904 | } else {//die ("insert into ".$prefix."$tab values ('$id_cons', '$id_cand','$id_sez','$voti'$vnrigains)");
|
---|
| 905 | if ($voti)
|
---|
| 906 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','$orario',' ','$condizione:$id_cand voti: $voti','$tab')", $dbi);
|
---|
| 907 | mysql_query("insert into ".$prefix."$tab values ('$id_cons', '$id_cand','$id_sez','$voti'$vnrigains)", $dbi);
|
---|
| 908 | if ($fileout) fwrite($fp,"insert into ".$prefix."$tab values ('$id_cons', '$id_cand','$id_sez','$voti');\n");
|
---|
| 909 | }
|
---|
| 910 | }
|
---|
| 911 | // foreach ($arg as $vval) echo $vval." - ";
|
---|
| 912 | // solo gruppo e preferenze alle liste
|
---|
| 913 |
|
---|
| 914 | if(!$votog) {
|
---|
| 915 | if ((($genere==3) OR ($genere==5)) and !$id_lista and (($disgiunto or $fascia>$limite) or !$id_conf)) {
|
---|
| 916 | $valista=$arg[$i++];
|
---|
| 917 | $result = mysql_query("update ".$prefix."_ele_sezioni set solo_gruppo='".$arg[$i]."' where id_sez='$id_sez'",$dbi);
|
---|
| 918 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set solo_gruppo='".$arg[$i]."' where id_sez='$id_sez';\n");
|
---|
| 919 | if ($condizione=="id_lista"){
|
---|
| 920 | $result = mysql_query("select * from ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi);
|
---|
| 921 | $ar=mysql_fetch_array($result);
|
---|
| 922 | ++$i;
|
---|
| 923 | mysql_query("update ".$prefix."_ele_sezioni set voti_nulli_lista='".$arg[$i++]."', contestati_lista='".$arg[$i++]."' where id_sez='$id_sez'", $dbi);
|
---|
| 924 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set voti_nulli_lista='".$arg[$i++]."', contestati_lista='".$arg[$i++]."' where id_sez='$id_sez';\n");
|
---|
| 925 | # if ($ar['validi'] and !$ar['validi_lista']){
|
---|
| 926 | if ($ar['validi']){
|
---|
| 927 | # $result = mysql_query("select sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez'", $dbi);
|
---|
| 928 | # list($val)=mysql_fetch_row($result);
|
---|
| 929 | # mysql_query("update ".$prefix."_ele_sezioni set validi_lista='$val' where id_sez='$id_sez'", $dbi);
|
---|
| 930 | if($valista)
|
---|
| 931 | mysql_query("update ".$prefix."_ele_sezioni set validi_lista='$valista' where id_sez='$id_sez'", $dbi);
|
---|
| 932 | else
|
---|
| 933 | mysql_query("update ".$prefix."_ele_sezioni set validi_lista=(`validi`-`solo_gruppo`-`voti_nulli_lista`-`contestati_lista`) where id_sez='$id_sez'", $dbi);
|
---|
| 934 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set validi_lista=(`validi`+`contestati`+`voti_nulli`-`solo_gruppo`-`voti_nulli_lista`-`contestati_lista`) where id_sez='$id_sez';\n");
|
---|
| 935 | }
|
---|
| 936 | }
|
---|
| 937 | }
|
---|
| 938 | }
|
---|
| 939 | }
|
---|
| 940 |
|
---|
| 941 | // $ops = $arg[$argc];
|
---|
| 942 | if ($fileout)fclose($fp);
|
---|
| 943 | Header("Location: admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&do=spoglio&ops=3&id_lista=$id_lista");
|
---|
| 944 | }
|
---|
| 945 |
|
---|
| 946 |
|
---|
| 947 | ////////////////////////////////////////////
|
---|
| 948 | // da qua va la sezione per i votanti
|
---|
| 949 | ///////////////////////////////////////////
|
---|
| 950 |
|
---|
| 951 | function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
|
---|
| 952 | //function votanti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av){
|
---|
| 953 | global $aid, $prefix, $dbi,$tipo_cons,$genere,$id_cons_gen;
|
---|
| 954 | $bgcolor1=$_SESSION['bgcolor2'];
|
---|
| 955 | OpenTable();
|
---|
| 956 | $res = mysql_query("SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi);
|
---|
| 957 | if($res) list($vismf)= mysql_fetch_row($res); else $vismf=0;
|
---|
| 958 | $res = mysql_query("SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario ", $dbi);
|
---|
| 959 | $num = mysql_num_rows($res);
|
---|
| 960 | $ressez = mysql_query("SELECT maschi,femmine FROM ".$prefix."_ele_sezioni where id_sez=$id_sez", $dbi);
|
---|
| 961 | list($maschi,$femmine)=mysql_fetch_row($ressez);
|
---|
| 962 | $y=0;
|
---|
| 963 | echo "<tr><td> </td></tr>";
|
---|
| 964 | while (list($ora,$giorno)= mysql_fetch_row($res)){
|
---|
| 965 | $y++;
|
---|
| 966 | echo "\n<tr><td>";
|
---|
| 967 | echo "<form name=\"votanti$y\" action=\"admin.php\">";
|
---|
| 968 | echo "<table class=\"table-menu\" style=\"width: 100%; color: black;\"><tr>";
|
---|
| 969 | if ($genere==0){ //e' un referendum
|
---|
| 970 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._NUM."</b></td>";
|
---|
| 971 | }
|
---|
| 972 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"32\"><b>"._ORA."</b></td>"
|
---|
| 973 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"width=\"32\"><b>"._DATA."</b></td>";
|
---|
| 974 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIU."</b></td>";
|
---|
| 975 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTID."</b></td>"
|
---|
| 976 | ."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VOTIT."</b>";
|
---|
| 977 | if ($genere==0){
|
---|
| 978 | $res2 = mysql_query("SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ", $dbi);
|
---|
| 979 | $max = mysql_num_rows($res2);
|
---|
| 980 | }else{ $max=1;}
|
---|
| 981 | echo "<input type=\"hidden\" name=\"op\" value=\"rec_add_votanti\">";
|
---|
| 982 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 983 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
| 984 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
| 985 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
|
---|
| 986 | echo "</td>"; //la riga viene chiusa nel ciclo for
|
---|
| 987 | for ($i=1;$i<=$max;$i++){
|
---|
| 988 | $query="SELECT * FROM ".$prefix."_ele_voti_parziale as t1 left join ".$prefix."_ele_gruppo as t2
|
---|
| 989 | on (t1.id_gruppo=t2.id_gruppo) where t1.id_sez='$id_sez'
|
---|
| 990 | and t1.id_cons='$id_cons' and t1.orario='$ora' and t1.data='$giorno'";
|
---|
| 991 | if ($genere==0){
|
---|
| 992 | $query.=" and t2.num_gruppo=$i";
|
---|
| 993 | }
|
---|
| 994 | $result = mysql_query($query, $dbi);
|
---|
| 995 | list($id_cons2,$id_sez2,$id_parz,$orario,$data, $voti_u, $voti_d, $voti_t,$id_gruppo) = mysql_fetch_row($result);
|
---|
| 996 | $res2 = mysql_query("SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_gruppo=$id_gruppo ", $dbi);
|
---|
| 997 | $resril = mysql_query("select count(0) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 998 | list($numril)=mysql_fetch_row($resril);
|
---|
| 999 | if ($res2)
|
---|
| 1000 | list($gruppo)= mysql_fetch_row($res2);
|
---|
| 1001 | else
|
---|
| 1002 | $gruppo=0;
|
---|
| 1003 | if (!$gruppo>0) {
|
---|
| 1004 | $gruppo=$i;
|
---|
| 1005 | $res3 = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where num_gruppo=$gruppo and id_cons=$id_cons", $dbi);
|
---|
| 1006 | if ($res3)
|
---|
| 1007 | list($id_gruppo)=mysql_fetch_row($res3);
|
---|
| 1008 | }
|
---|
| 1009 | if(!isset($precede[$id_gruppo])) $precede[$id_gruppo]=0; if(!isset($error)) $error=0;
|
---|
| 1010 | if($precede[$id_gruppo]>($voti_t) and $voti_t!='') $error=1;
|
---|
| 1011 | $precede[$id_gruppo]=$voti_t;
|
---|
| 1012 | if (($voti_u+$voti_d and $voti_u+$voti_d!=$voti_t) or $error){
|
---|
| 1013 | echo "</tr><tr style=\"background-color: rgb(255, 0, 0); text-align: center\">"; $error=0;
|
---|
| 1014 | }else{
|
---|
| 1015 | echo "</tr><tr class=\"tr-dx\">";
|
---|
| 1016 | }
|
---|
| 1017 | if ($genere==0){ // e' un referendum
|
---|
| 1018 | echo "<td align=\"center\">$gruppo</td>";
|
---|
| 1019 | }
|
---|
| 1020 |
|
---|
| 1021 | list ($anno,$mese,$di)=explode('-',$giorno);
|
---|
| 1022 | echo "<td align=\"center\">$ora</td><td align=\"center\">$di-$mese-$anno</td>";
|
---|
| 1023 | if ($voti_u > $maschi) echo "<td align=\"center\" bgcolor=\"red\">";
|
---|
| 1024 | else echo "<td align=\"center\">";
|
---|
| 1025 | if ($y<$num and $vismf==0 and $voti_u==0) { echo "<input type=\"hidden\"";}else echo "<input type=\"text\" style=\"text-align:right\"";
|
---|
| 1026 | echo " name=\"voti_u$i\" value=\"$voti_u\" size=\"5\"></td>";
|
---|
| 1027 | if ($voti_d > $femmine) echo "<td align=\"center\" bgcolor=\"red\">";
|
---|
| 1028 | else echo "<td align=\"center\">";
|
---|
| 1029 | if ($y<$num and $vismf==0 and $voti_d==0) { echo "<input type=\"hidden\"";}else echo "<input type=\"text\" style=\"text-align:right\"";
|
---|
| 1030 | echo " name=\"voti_d$i\" value=\"$voti_d\" size=\"5\"></td>";
|
---|
| 1031 | if ($voti_t > ($maschi+$femmine)) echo "<td align=\"center\" bgcolor=\"red\"><input type=\"text\" name=\"voti_t$i\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\">";
|
---|
| 1032 | else echo "<td align=\"center\"><input name=\"voti_t$i\" value=\"$voti_t\" size=\"5\" style=\"text-align:right\">";
|
---|
| 1033 | echo "<input type=\"hidden\" name=\"id_parz$i\" value=\"$id_parz\">"
|
---|
| 1034 | ."<input type=\"hidden\" name=\"data$i\" value=\"$giorno\">"
|
---|
| 1035 | ."<input type=\"hidden\" name=\"orario$i\" value=\"$ora\">"
|
---|
| 1036 | ."<input type=\"hidden\" name=\"gruppo$i\" value=\"$id_gruppo\">";
|
---|
| 1037 | echo "</td>";
|
---|
| 1038 | }
|
---|
| 1039 | if (chisei($id_cons_gen)>=64 and $y==$numril) echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"></td>";
|
---|
| 1040 | else echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"></td>";
|
---|
| 1041 | echo "<td style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"></td>";
|
---|
| 1042 | echo "</tr>";
|
---|
| 1043 |
|
---|
| 1044 |
|
---|
| 1045 |
|
---|
| 1046 | # echo "</table></form></td></tr>";
|
---|
| 1047 | echo "</table></form>";
|
---|
| 1048 | $compl= mysql_query("select count(voti_complessivi) from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez=$id_sez", $dbi);
|
---|
| 1049 | list ($complessivi)= mysql_fetch_row($compl);
|
---|
| 1050 | if (!$complessivi)
|
---|
| 1051 | {
|
---|
| 1052 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
| 1053 | if ($y==$num) {
|
---|
| 1054 | echo "document.votanti$y.voti_u1.focus()\n";
|
---|
| 1055 | echo "document.votanti$y.voti_u1.select()\n";
|
---|
| 1056 | }else{
|
---|
| 1057 | echo "document.votanti$y.voti_t1.focus()\n";
|
---|
| 1058 | echo "document.votanti$y.voti_t1.select()\n";
|
---|
| 1059 | }
|
---|
| 1060 | echo "//-->\n"
|
---|
| 1061 | ."</script>\n";
|
---|
| 1062 | break;
|
---|
| 1063 | }
|
---|
| 1064 | echo "</td></tr>";
|
---|
| 1065 | }
|
---|
| 1066 | CloseTable();
|
---|
| 1067 | }
|
---|
| 1068 |
|
---|
| 1069 |
|
---|
| 1070 | ///////////////////////////
|
---|
| 1071 | // registra i votanti
|
---|
| 1072 | ///////////////////////////
|
---|
| 1073 |
|
---|
| 1074 | function rec_add_votanti() {
|
---|
| 1075 | global $prefix, $dbi,$aid,$tipo_cons,$genere,$id_cons,$fileout;
|
---|
| 1076 | //ordine dei parametri: 0)op 1)voti_u 2) voti_d 3)voti_t 4)id_cons 5)id_sez 6)id_circ 7)id_sede
|
---|
| 1077 | // 8)id_parz 9)ops 10)data 11)orario 12)tipo 13)id_gruppo 14) update
|
---|
| 1078 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 1079 |
|
---|
| 1080 | $username="$aid";
|
---|
| 1081 | $arg2 = func_get_args();
|
---|
| 1082 | $arg = split(",",$arg2[0]);
|
---|
| 1083 | $id_cons_gen=intval($arg[1]);
|
---|
| 1084 | $id_sez=intval($arg[2]);
|
---|
| 1085 | $id_circ=intval($arg[3]);
|
---|
| 1086 | $id_sede=intval($arg[4]);
|
---|
| 1087 | $op=$arg[count($arg)-2];
|
---|
| 1088 | for($i=5;$i< count($arg)-2;) {
|
---|
| 1089 | $voti_u = intval($arg[$i++]);
|
---|
| 1090 | $voti_d = intval($arg[$i++]);
|
---|
| 1091 | $voti_t = intval($arg[$i++]);
|
---|
| 1092 | if($voti_t==0) $voti_t=$voti_d+$voti_u;
|
---|
| 1093 | $id_parz = intval($arg[$i++]);
|
---|
| 1094 | $giorno = $arg[$i++];
|
---|
| 1095 | $ora = $arg[$i++];
|
---|
| 1096 | $id_gruppo = intval($arg[$i++]);
|
---|
| 1097 | $data=date("Y/m/d");
|
---|
| 1098 | $tempo=date("H:i:s");
|
---|
| 1099 | mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1100 | $query="select * from ".$prefix."_ele_voti_parziale where data='$giorno' and orario='$ora' and id_sez='$id_sez'";
|
---|
| 1101 | if ($genere==0){
|
---|
| 1102 | $query.=" and id_gruppo=$id_gruppo";
|
---|
| 1103 | }
|
---|
| 1104 | $res=mysql_query("$query",$dbi);
|
---|
| 1105 | $righe=mysql_num_rows($res);
|
---|
| 1106 | if (!$righe){
|
---|
| 1107 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$data','$tempo','','id_parz:$id_parz ora: $ora data:$giorno voti uomini:$voti_u donne:$voti_d totali:$voti_t id_gruppo:$id_gruppo','".$prefix."_ele_voti_parziale')", $dbi);
|
---|
| 1108 | mysql_query("insert into ".$prefix."_ele_voti_parziale values ('$id_cons', '$id_sez','$id_parz','$ora','$giorno','$voti_u','$voti_d','$voti_t','$id_gruppo')", $dbi);
|
---|
| 1109 | if ($fileout) fwrite($fp,"insert into ".$prefix."_ele_voti_parziale values ('$id_cons', '$id_sez','$id_parz','$ora','$giorno','$voti_u','$voti_d','$voti_t','$id_gruppo');\n");
|
---|
| 1110 | } elseif($op=="true"){
|
---|
| 1111 | $result = mysql_query("delete from ".$prefix."_ele_voti_parziale where id_parz='$id_parz'", $dbi);
|
---|
| 1112 | if ($fileout) fwrite($fp,"delete from ".$prefix."_ele_voti_parziale where id_parz='$id_parz';\n");
|
---|
| 1113 | } else {
|
---|
| 1114 | $res=mysql_query("select * from ".$prefix."_ele_voti_parziale where id_parz=$id_parz",$dbi);
|
---|
| 1115 | $ar=mysql_fetch_array($res);
|
---|
| 1116 |
|
---|
| 1117 | if ($ar['voti_uomini']!=$voti_u or $ar['voti_donne']!=$voti_d or $ar['voti_complessivi']!=$voti_t){
|
---|
| 1118 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$data','$tempo','ora:$ar[3] data:$ar[4] voti uomini:$ar[5] donne:$ar[6] totali:$ar[7] gruppo:$ar[8]','id_parz:$id_parz ora: $ora data:$giorno voti uomini:$voti_u donne:$voti_d totali:$voti_t id_gruppo:$id_gruppo','".$prefix."_ele_voti_parziale')", $dbi);
|
---|
| 1119 | $result = mysql_query("update ".$prefix."_ele_voti_parziale set voti_uomini='$voti_u', voti_donne='$voti_d', voti_complessivi='$voti_t' where id_parz='$id_parz'", $dbi);
|
---|
| 1120 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_voti_parziale set voti_uomini='$voti_u', voti_donne='$voti_d', voti_complessivi='$voti_t' where id_parz='$id_parz';\n");
|
---|
| 1121 | }
|
---|
| 1122 | }
|
---|
| 1123 | }
|
---|
| 1124 | if ($fileout)fclose($fp);
|
---|
| 1125 | Header("Location: admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&ops=1&do=spoglio");
|
---|
| 1126 | }
|
---|
| 1127 |
|
---|
| 1128 |
|
---|
| 1129 |
|
---|
| 1130 | function finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
| 1131 | global $aid, $prefix, $dbi,$id_cons_gen,$genere,$votog,$fascia,$limite;
|
---|
| 1132 | ////////////////////////////////////////////
|
---|
| 1133 | // da qua va la sezione per i voti finali
|
---|
| 1134 | ///////////////////////////////////////////
|
---|
| 1135 | $bgcolor1="#7777ff";
|
---|
| 1136 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 1137 |
|
---|
| 1138 |
|
---|
| 1139 |
|
---|
| 1140 | echo "<form name=\"spogliovoti\" action=\"admin.php\">"
|
---|
| 1141 | ."<input type=\"hidden\" name=\"op\" value=\"rec_finale\">";
|
---|
| 1142 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 1143 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
| 1144 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
| 1145 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">";
|
---|
| 1146 |
|
---|
| 1147 | echo "<table border=\"0\" width=\"90%\" align=\"center\"><tr bgcolor=\"$bgcolor1\" align=\"center\">";
|
---|
| 1148 | /* if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
| 1149 | echo "<td width=\"32\"><b>"._VOTI_LISTA."</b></td>";
|
---|
| 1150 | else */
|
---|
| 1151 | echo "<td width=\"32\"><b>"._VALIDI."</b></td>";
|
---|
| 1152 | echo "<td width=\"82\"><b>"._NULLI."</b></td>"
|
---|
| 1153 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
| 1154 | ."<td width=\"32\"><b>"._VOTINULLI."</b></td>"
|
---|
| 1155 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
| 1156 | ."<td><b>"._TOTNON."</b></td>"
|
---|
| 1157 | ."<td><b>"._TOTALEVOTI."</b></td>"
|
---|
| 1158 | ."<td bgcolor=\"#ffffff\"></td> </tr>";
|
---|
| 1159 | /*if($ops==3 and ($genere==3 or ($genere==5 and $fascia>$limite)) )
|
---|
| 1160 | $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' ", $dbi);
|
---|
| 1161 | else */
|
---|
| 1162 | $result = mysql_query("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' ", $dbi);
|
---|
| 1163 | list($id_cons2,$id_sez2,$validi, $nulli, $bianchi, $contestati,$votinulli,$sg,$conts,$nullis,$sololista) = mysql_fetch_row($result);
|
---|
| 1164 | $tot_nulli=$nulli+$bianchi+$contestati+$votinulli;
|
---|
| 1165 | $tot_voti=$validi+$tot_nulli+$conts+$nullis;
|
---|
| 1166 | // ."</td><td><input name=\"sololista\" value=\"$sololista\" size=\"5\" style=\"text-align:right\">" --- ."<td><b>"._SOLOLIS."</b></td>"
|
---|
| 1167 |
|
---|
| 1168 |
|
---|
| 1169 | echo "<tr bgcolor=\"$bgcolor2\" align=\"center\"><td align=\"left\"><input name=\"validi\" value=\"$validi\" size=\"5\" style=\"text-align:right\">";
|
---|
| 1170 | /* if(($genere==3 or $genere==5) and !$votog and $ops==3){
|
---|
| 1171 | echo "</td><td>$nulli"
|
---|
| 1172 | ."</td><td>$bianchi";
|
---|
| 1173 | echo "<input type=\"hidden\" name=\"nulli\" value=\"$nulli\"><input type=\"hidden\" name=\"bianchi\" value=\"$bianchi\">";
|
---|
| 1174 | }else{ */
|
---|
| 1175 | echo "</td><td><input name=\"nulli\" value=\"$nulli\" size=\"5\" style=\"text-align:right\">"
|
---|
| 1176 | ."</td><td><input name=\"bianchi\" value=\"$bianchi\" size=\"5\" style=\"text-align:right\">";
|
---|
| 1177 | // }
|
---|
| 1178 | echo "</td><td><input name=\"votinulli\" value=\"$votinulli\" size=\"5\" style=\"text-align:right\">"
|
---|
| 1179 | ."</td><td><input name=\"contestati\" value=\"$contestati\" size=\"5\" style=\"text-align:right\">"
|
---|
| 1180 | ."</td><td>$tot_nulli"
|
---|
| 1181 | ."</td><td>$tot_voti</td><td>"
|
---|
| 1182 | // ."<input type=\"hidden\" name=\"id_cand\" value=\"$id_cand\">"
|
---|
| 1183 | ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">"
|
---|
| 1184 | ."<input type=\"submit\" name=\"update\" value=\""._OK."\">"
|
---|
| 1185 | ."</td></tr></table></form>"; //</td></tr>";
|
---|
| 1186 |
|
---|
| 1187 |
|
---|
| 1188 | // echo "</table>";
|
---|
| 1189 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
| 1190 | if (!$validi) {
|
---|
| 1191 | echo "document.spogliovoti.validi.focus()\n";
|
---|
| 1192 | echo "document.spogliovoti.validi.select()\n";
|
---|
| 1193 | }
|
---|
| 1194 | echo "//-->\n"
|
---|
| 1195 | ."</script>\n";
|
---|
| 1196 |
|
---|
| 1197 |
|
---|
| 1198 | }
|
---|
| 1199 |
|
---|
| 1200 |
|
---|
| 1201 |
|
---|
| 1202 |
|
---|
| 1203 |
|
---|
| 1204 |
|
---|
| 1205 | ///////////////////////////
|
---|
| 1206 | // registra voti finali
|
---|
| 1207 | ///////////////////////////
|
---|
| 1208 |
|
---|
| 1209 | function rec_finale() {
|
---|
| 1210 | global $prefix, $dbi,$aid,$id_cons,$fileout,$genere,$votog;
|
---|
| 1211 |
|
---|
| 1212 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 1213 | $arg2 = func_get_args();
|
---|
| 1214 | $arg = split(",",$arg2[0]);
|
---|
| 1215 | $id_cons_gen=intval($arg[1]);
|
---|
| 1216 | $id_sez = intval($arg[2]);
|
---|
| 1217 | $id_circ = intval($arg[3]);
|
---|
| 1218 | $id_sede = intval($arg[4]);
|
---|
| 1219 | $validi = intval($arg[5]);
|
---|
| 1220 | $nulli = intval($arg[6]);
|
---|
| 1221 | $bianchi = intval($arg[7]);
|
---|
| 1222 | $votinulli = intval($arg[8]);
|
---|
| 1223 | $contestati = intval($arg[9]);
|
---|
| 1224 | //$sololista = intval($arg[10]);
|
---|
| 1225 | $ops = $arg[10];
|
---|
| 1226 | $username="$aid";
|
---|
| 1227 | $log_data= date("Y/m/d");
|
---|
| 1228 | $log_ora=getdate(time());
|
---|
| 1229 | $orario=($log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']);
|
---|
| 1230 | mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1231 |
|
---|
| 1232 | $result= mysql_query("select voti_complessivi from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' order by id_parz desc", $dbi);
|
---|
| 1233 | list($voti_t) = mysql_fetch_row($result);
|
---|
| 1234 | $tot_voti=$validi+$nulli+$bianchi+$contestati+$votinulli;
|
---|
| 1235 | $sololista=$voti_t-$tot_voti;
|
---|
| 1236 | $result= mysql_query("select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ", $dbi);
|
---|
| 1237 | list($flagsg,$disgiunto)=mysql_fetch_row($result);
|
---|
| 1238 | $result= mysql_query("select * from ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 1239 | $ar=mysql_fetch_array($result);
|
---|
| 1240 | $validilista=$validi-$ar['solo_gruppo'];
|
---|
| 1241 | if ($ar['solo_lista'] or !$disgiunto) $rigasl=''; else $rigasl=", solo_lista='$sololista'";
|
---|
| 1242 | #die("qui: if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and $votog){");
|
---|
| 1243 | if($ops==3 and ($genere==3 or $genere==4 or $genere==5) and ($votog or $genere==4)){
|
---|
| 1244 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','$orario','validi_lista:$ar[14] nulli:$ar[7] bianchi:$ar[8] contestati_lista:$ar[15] voti_nulli_lista:$ar[16]','validi_lista=$validilista, nulli=$nulli,bianchi=$bianchi,contestati_lista=$contestati,voti_nulli_lista=$votinulli','_ele_sezioni')", $dbi);
|
---|
| 1245 |
|
---|
| 1246 | /* $result = mysql_query("update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', validi_lista='$validi', nulli='$nulli',bianchi='$bianchi',contestati_lista='$contestati', voti_nulli_lista='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 1247 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', validi_lista='$validi', nulli='$nulli',bianchi='$bianchi',contestati_lista='$contestati', voti_nulli_lista='$votinulli' where id_cons='$id_cons' and id_sez='$id_sez';\n"); */
|
---|
| 1248 | $result = mysql_query("update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', validi_lista='$validi', nulli='$nulli',bianchi='$bianchi',contestati_lista='$contestati', voti_nulli='$votinulli' $rigasl where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 1249 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set validi='$validi', contestati='$contestati', validi_lista='$validilista', nulli='$nulli',bianchi='$bianchi',contestati_lista='$contestati', voti_nulli='$votinulli' $rigasl where id_cons='$id_cons' and id_sez='$id_sez';\n");
|
---|
| 1250 | }else{
|
---|
| 1251 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','$orario','validi:$ar[6] nulli:$ar[7] bianchi:$ar[8] contestati:$ar[9] voti_nulli:$ar[13]','validi=$validi, nulli=$nulli,bianchi=$bianchi,contestati=$contestati, voti_nulli=$votinulli','_ele_sezioni')", $dbi);
|
---|
| 1252 | $valista="";
|
---|
| 1253 | if ($ar['validi_lista']){
|
---|
| 1254 | $tvalista=$validi-$ar['solo_gruppo']-$ar['voti_nulli_lista']-$ar['contestati_lista'];
|
---|
| 1255 | $valista=",validi_lista='$tvalista'";
|
---|
| 1256 | }
|
---|
| 1257 |
|
---|
| 1258 | $result = mysql_query("update ".$prefix."_ele_sezioni set validi='$validi', nulli='$nulli',bianchi='$bianchi',contestati='$contestati',voti_nulli='$votinulli' $rigasl $valista where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 1259 | if ($fileout) fwrite($fp,"update ".$prefix."_ele_sezioni set validi='$validi', nulli='$nulli',bianchi='$bianchi',contestati='$contestati',voti_nulli='$votinulli' $rigasl $valista where id_cons='$id_cons' and id_sez='$id_sez';\n");
|
---|
| 1260 | }
|
---|
| 1261 | // }
|
---|
| 1262 | // Il test non e' piu' necessario perche' le sezioni sono state gia' inserite in precedenza
|
---|
| 1263 | if ($fileout) fclose($fp);
|
---|
| 1264 | Header("Location: admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&do=spoglio&ops=$ops");
|
---|
| 1265 |
|
---|
| 1266 | /*}else{
|
---|
| 1267 |
|
---|
| 1268 | echo "<b><br><center><h1>I voti totali non corrispondono con i votanti</h1><b>";
|
---|
| 1269 | echo "<hr><a href=\"admin.php?op=voti&id_cons=$id_cons&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&do=spoglio&ops=$ops\">Torna e correggi i dati immessi</a></center>";
|
---|
| 1270 | }*/
|
---|
| 1271 | }
|
---|
| 1272 |
|
---|
| 1273 |
|
---|
| 1274 | function preferenze_gruppi($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops){
|
---|
| 1275 | global $aid, $prefix, $dbi, $tipo_cons, $genere,$id_cons_gen,$sezi,$circo,$dettnulli;
|
---|
| 1276 | ////////////////////////////////////////////
|
---|
| 1277 | // da qua va la sezione per le preferenze ai gruppi
|
---|
| 1278 | ///////////////////////////////////////////
|
---|
| 1279 | // Controllo immmissioni
|
---|
| 1280 |
|
---|
| 1281 | $bgcolor1="#7777ff";
|
---|
| 1282 | $bgcolor2=$_SESSION['bgcolor2'];
|
---|
| 1283 | $res = mysql_query("SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' ", $dbi);
|
---|
| 1284 | $max = mysql_num_rows($res);
|
---|
| 1285 | $max = $max-1;
|
---|
| 1286 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n";
|
---|
| 1287 | if ($genere==0) {
|
---|
| 1288 | echo "document.sezioni.si1.focus()\n";
|
---|
| 1289 | echo "document.sezioni.si1.select()\n";
|
---|
| 1290 | } else {
|
---|
| 1291 | echo "document.sezioni.voti1.focus()\n"
|
---|
| 1292 | ."document.sezioni.voti1.select()\n";
|
---|
| 1293 | }
|
---|
| 1294 | echo "//-->\n"
|
---|
| 1295 | ."</script>\n";
|
---|
| 1296 | // tabella votanti
|
---|
| 1297 | echo "<center>";
|
---|
| 1298 | if ($genere!=0){
|
---|
| 1299 | $result = mysql_query("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", $dbi);
|
---|
| 1300 | list( $voti_u, $voti_d, $voti_t) = mysql_fetch_row($result);
|
---|
| 1301 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black;\">"
|
---|
| 1302 | ."<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>"
|
---|
| 1303 | ."<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>";
|
---|
| 1304 | echo "</table>";
|
---|
| 1305 | }
|
---|
| 1306 | echo "<table class=\"table-menu\" style=\"width: 50%; color: black\">";
|
---|
| 1307 | if ($genere==0){
|
---|
| 1308 | $res = mysql_query("SELECT id_gruppo,si+no,validi,nulli,bianchi,contestati FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi);
|
---|
| 1309 | while (list($id_gruppo,$voti_parz,$validi,$nulli,$bianchi,$contestati) = mysql_fetch_row($res)){
|
---|
| 1310 | if ($voti_parz!=$validi){
|
---|
| 1311 | $res2 = mysql_query("SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo' ", $dbi);
|
---|
| 1312 | list($num_gruppo) = mysql_fetch_row($res2);
|
---|
| 1313 | 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>";
|
---|
| 1314 | }
|
---|
| 1315 | $res2 = mysql_query("SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ", $dbi);
|
---|
| 1316 | list($tot) = mysql_fetch_row($res2);
|
---|
| 1317 | if (($validi+$nulli+$bianchi+$contestati)!= $tot ){
|
---|
| 1318 | $res2 = mysql_query("SELECT num_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1319 | list($num_gruppo) = mysql_fetch_row($res2);
|
---|
| 1320 | 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>";
|
---|
| 1321 | }
|
---|
| 1322 | }
|
---|
| 1323 | }else{
|
---|
| 1324 | $result= mysql_query("select solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons' ", $dbi);
|
---|
| 1325 | list($flagsg,$disgiunto)=mysql_fetch_row($result);
|
---|
| 1326 | $res = mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1327 | list($voti_parz) = mysql_fetch_row($res);
|
---|
| 1328 | $res = mysql_query("SELECT validi,nulli,bianchi,contestati,solo_lista,voti_nulli FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1329 | list($validi,$nulli,$bianchi,$contestati,$solo_lista,$votinulli) = mysql_fetch_row($res);
|
---|
| 1330 | if ($voti_parz!=($validi-$solo_lista) and $voti_parz>0){
|
---|
| 1331 | 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>";
|
---|
| 1332 | }
|
---|
| 1333 | $res2 = mysql_query("SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1334 | list($tot) = mysql_fetch_row($res2);
|
---|
| 1335 | if ($validi+$nulli+$bianchi+$contestati+$votinulli!=$tot and $validi+$nulli+$bianchi+$contestati+$votinulli>0){
|
---|
| 1336 | 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>";
|
---|
| 1337 | }
|
---|
| 1338 | $resg=mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons=$id_cons and id_sez=$id_sez",$dbi);
|
---|
| 1339 | list($voti_sez)=mysql_fetch_row($resg);
|
---|
| 1340 | if(($genere==5 and !$disgiunto and $voti_sez and $flagsg and ($tipo_cons==18 or $tipo_cons==19))){
|
---|
| 1341 |
|
---|
| 1342 | $resg = mysql_query("SELECT sum(solo_gruppo) from ".$prefix."_ele_voti_gruppo where id_cons=$id_cons and id_sez=$id_sez",$dbi);
|
---|
| 1343 | list($sgpl)=mysql_fetch_row($resg);
|
---|
| 1344 | $resg = mysql_query("SELECT solo_gruppo from ".$prefix."_ele_sezioni where id_cons=$id_cons and id_sez=$id_sez",$dbi);
|
---|
| 1345 | list($sg)=mysql_fetch_row($resg);
|
---|
| 1346 | 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>";
|
---|
| 1347 | }
|
---|
| 1348 | #controllo voti a liste collegate <= voto di gruppo per voto non disgiunto
|
---|
| 1349 | if($genere==5 and !$disgiunto and $flagsg and ($tipo_cons==18 or $tipo_cons==19)){
|
---|
| 1350 | $resref = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi);
|
---|
| 1351 | $errgrulis=array();
|
---|
| 1352 | $res4= mysql_query("SELECT count(0) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'", $dbi);
|
---|
| 1353 | list($sezscrl)=mysql_fetch_row($res4);
|
---|
| 1354 | if ($sezscrl)
|
---|
| 1355 | while ( list($id_gruppo)=mysql_fetch_row($resref))
|
---|
| 1356 | {
|
---|
| 1357 | $res3= mysql_query("SELECT sum(voti-solo_gruppo) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1358 | $res4= mysql_query("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')", $dbi);
|
---|
| 1359 | list($vgruppo)=mysql_fetch_row($res3);
|
---|
| 1360 | list($vliste)=mysql_fetch_row($res4);
|
---|
| 1361 | if($vliste>$vgruppo and ($tipo_cons=18 or $tipo_cons=19))
|
---|
| 1362 | {
|
---|
| 1363 | $errgrulis[$id_gruppo]=1;
|
---|
| 1364 | $result = mysql_query("SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1365 | list($dgruppo)=mysql_fetch_row($result);
|
---|
| 1366 | 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> ATTENZIONE!<BR/>I voti delle liste collegate<br/> superano i voti assegnati al gruppo $dgruppo </b><br></td></tr>";
|
---|
| 1367 | }
|
---|
| 1368 | elseif($vliste<$vgruppo and ($tipo_cons=18 or $tipo_cons=19))
|
---|
| 1369 | {
|
---|
| 1370 | $errgrulis[$id_gruppo]=1;
|
---|
| 1371 | $result = mysql_query("SELECT descrizione FROM ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1372 | list($dgruppo)=mysql_fetch_row($result);
|
---|
| 1373 | 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> ATTENZIONE!<BR/>I voti assegnati al gruppo $dgruppo <br/> superano i voti delle liste collegate</b><br></td></tr>";
|
---|
| 1374 | }
|
---|
| 1375 | }
|
---|
| 1376 | }
|
---|
| 1377 |
|
---|
| 1378 | }
|
---|
| 1379 | if(!isset($votinulli)) $votinulli=0;
|
---|
| 1380 | echo "<tr><td></td></tr></table>";
|
---|
| 1381 | if ($validi+$nulli+$bianchi+$contestati+$votinulli>0 or $genere==0) {
|
---|
| 1382 | echo "<table class=\"table-menu\" style=\" width: 60%; color: black\"><tr><td colspan=\"3\"><form name=\"sezioni\" action=\"admin.php\">";
|
---|
| 1383 | echo "<input type=\"hidden\" name=\"op\" value=\"rec_voti_gruppi\">"
|
---|
| 1384 | ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
| 1385 | ."<input type=\"hidden\" name=\"id_sez\" value=\"$id_sez\">"
|
---|
| 1386 | ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">"
|
---|
| 1387 | ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">"
|
---|
| 1388 | ."<input type=\"hidden\" name=\"do\" id=\"do\" value=\"0\">";
|
---|
| 1389 | echo "<br><br> <table class=\"table-menu\" style=\"width: 100%; color: black\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"
|
---|
| 1390 | ."<td width=\"3%\"><b>"._NUM."</b></td>"
|
---|
| 1391 | ."<td width=\"50%\"><b>"._GRUPPO."</b></td>";
|
---|
| 1392 | if ($genere==0){
|
---|
| 1393 | echo "<td><b>"._SI."</b></td>"
|
---|
| 1394 | ."<td><b>"._NO."</b></td>"
|
---|
| 1395 | ."<td><b>"._VALIDI."</b></td>"
|
---|
| 1396 | ."<td><b>"._BIANCHI."</b></td>"
|
---|
| 1397 | ."<td><b>"._CONTESTATI."</b></td>"
|
---|
| 1398 | ."<td><b>"._NULLI."</b></td>"
|
---|
| 1399 | ."<td><b>"._TOTNON."</b></td>"
|
---|
| 1400 | ."<td><b>"._TOTALEVOTI."</b></td>"
|
---|
| 1401 | ."<td><b>"._VOTANTI."</b></td>";
|
---|
| 1402 | }else{
|
---|
| 1403 | echo "<td width=\"5%\"><b>"._VOTI."</b></td>";
|
---|
| 1404 | if($dettnulli) echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._SOLO_GRUPPO."</b></td>";
|
---|
| 1405 | }
|
---|
| 1406 | echo "</tr>";
|
---|
| 1407 | $res = mysql_query("SELECT * FROM ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ", $dbi);
|
---|
| 1408 | $max = mysql_num_rows($res);
|
---|
| 1409 | //echo "Massimo:$max - id=$id_cons - circo: $circo";
|
---|
| 1410 | $result = mysql_query("select * from ".$prefix."_ele_gruppo where id_cons='$id_cons' $circo ORDER BY num_gruppo ", $dbi);
|
---|
| 1411 | $i=1;
|
---|
| 1412 | $tot_pref=0;
|
---|
| 1413 | $totsg=0;
|
---|
| 1414 | while(list($id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo) = mysql_fetch_row($result)){
|
---|
| 1415 |
|
---|
| 1416 | //echo "test: $id_cons2,$id_gruppo,$num_gruppo, $descr_gruppo, $simbolo";
|
---|
| 1417 |
|
---|
| 1418 |
|
---|
| 1419 | if ($num_gruppo != ''){
|
---|
| 1420 | if ($genere==0){
|
---|
| 1421 | $res = mysql_query("SELECT max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ", $dbi);
|
---|
| 1422 | list($tot) = mysql_fetch_row($res);
|
---|
| 1423 | $res = mysql_query("SELECT * FROM ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ", $dbi);
|
---|
| 1424 | $pro= mysql_fetch_array($res, 3);
|
---|
| 1425 |
|
---|
| 1426 | 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)){
|
---|
| 1427 | echo "<tr style=\"background-color: rgb(255, 0, 0); text-align:center\">";
|
---|
| 1428 | }else{
|
---|
| 1429 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\">";
|
---|
| 1430 | }
|
---|
| 1431 | $descr = explode('.',$descr_gruppo, 100);
|
---|
| 1432 | echo "<td align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>"
|
---|
| 1433 | ."</td><td align=\"left\" width=\"50%\"><b> $descr[0] </b>";
|
---|
| 1434 | $pro['si']=(isset($pro['si']) and $pro['si']>=0) ? $pro['si']:'';
|
---|
| 1435 | $pro['no']=(isset($pro['no']) and $pro['no']>=0) ? $pro['no']:'';
|
---|
| 1436 | $pro['validi']=(isset($pro['validi']) and $pro['validi']>=0) ? $pro['validi']:'';
|
---|
| 1437 | $pro['bianchi']=(isset($pro['bianchi']) and $pro['bianchi']>=0) ? $pro['bianchi']:'';
|
---|
| 1438 | $pro['contestati']=(isset($pro['contestati']) and $pro['contestati']>=0) ? $pro['contestati']:'';
|
---|
| 1439 | $pro['nulli']=(isset($pro['nulli']) and $pro['nulli']>=0) ? $pro['nulli']:'';
|
---|
| 1440 | $tot_nulli=$pro['nulli']+$pro['bianchi']+$pro['contestati'];
|
---|
| 1441 | $tot_voti=$pro['validi']+$tot_nulli;
|
---|
| 1442 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"si$i\" value=\"".$pro['si']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1443 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"no$i\" value=\"".$pro['no']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1444 | echo "</td><td align=\"right\" width=\"3%\"><input name=\"val$i\" value=\"".$pro['validi']."\" size=\"7\" style=\"text-align:right\" ></td>";
|
---|
| 1445 | echo "</td><td align=\"right\"><input name=\"bia$i\" value=\"".$pro['bianchi']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1446 | echo "</td><td align=\"right\"><input name=\"con$i\" value=\"".$pro['contestati']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1447 | echo "</td><td align=\"right\"><input name=\"nul$i\" value=\"".$pro['nulli']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1448 | echo "</td><td align=\"right\">$tot_nulli</td>";
|
---|
| 1449 | echo "</td><td align=\"right\">$tot_voti</td>";
|
---|
| 1450 | echo "</td><td align=\"right\">$tot</td>";
|
---|
| 1451 | }else{
|
---|
| 1452 | echo "<tr style=\"background-color: $bgcolor2; text-align:center\"><td align=\"center\"><input type=\"hidden\" name=\"id_gruppo$i\" value=\"$id_gruppo\"><b>$num_gruppo</b>"
|
---|
| 1453 | ."</td><td align=\"left\"><b> $descr_gruppo </b>";
|
---|
| 1454 | $res = mysql_query("SELECT * FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo' ", $dbi);
|
---|
| 1455 | $pro= mysql_fetch_array($res, 3);
|
---|
| 1456 | $errcolor='';
|
---|
| 1457 | if(isset($errgrulis[$id_gruppo])) $errcolor="style=\"background-color: rgb(255, 0, 0);\"";
|
---|
| 1458 | echo "</td><td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\"></td>";
|
---|
| 1459 | # $lisgrures = mysql_query("SELECT count(id_lista) FROM ".$prefix."_ele_lista where id_cons='$id_cons' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1460 | # list($totlis) = mysql_fetch_row($lisgrures);
|
---|
| 1461 | # if($totlis>1) $insinp=""; else $insinp= "type =\"hidden\" ";
|
---|
| 1462 | if($dettnulli) {echo "<td align=\"right\"><input name=\"solog$i\" value=\"".$pro['solo_gruppo']."\" size=\"7\" style=\"text-align:right\"></td>"; $totsg+=$pro['solo_gruppo'];}
|
---|
| 1463 | $tot_pref += $pro['voti'];
|
---|
| 1464 | echo "</tr>";
|
---|
| 1465 | }
|
---|
| 1466 |
|
---|
| 1467 | $i++;
|
---|
| 1468 | }
|
---|
| 1469 |
|
---|
| 1470 | }
|
---|
| 1471 | if ($genere!=0) {
|
---|
| 1472 | $res = mysql_query("SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ", $dbi);
|
---|
| 1473 | list($disgiunto)=mysql_fetch_row($res);
|
---|
| 1474 | $res = mysql_query("SELECT solo_lista FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' ", $dbi);
|
---|
| 1475 | list($sololis)=mysql_fetch_row($res);
|
---|
| 1476 | echo "<tr style=\"background-color: $bgcolor1; text-align:center\"><td></td><td>"._TOTPREF."</td><td>$tot_pref</td>";
|
---|
| 1477 | if($dettnulli) echo "<td>$totsg</td>";
|
---|
| 1478 | echo "</tr>";
|
---|
| 1479 | if($disgiunto)
|
---|
| 1480 | 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>";
|
---|
| 1481 | }
|
---|
| 1482 |
|
---|
| 1483 | echo "<tr><td></td><td></td><td align=\"center\"><input type=\"submit\" name=\"update\" id=\"update\" value=\" "._OK. "\"></td>";
|
---|
| 1484 |
|
---|
| 1485 | echo "</tr></table></form></td></tr>";
|
---|
| 1486 | if(chisei($id_cons_gen)>=64){
|
---|
| 1487 | echo "<tr><td><input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_dati()\">"._DELETE."";
|
---|
| 1488 | }
|
---|
| 1489 |
|
---|
| 1490 | echo "</td></tr></table></center>";
|
---|
| 1491 | }
|
---|
| 1492 | if ($genere!=0){
|
---|
| 1493 | finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);
|
---|
| 1494 | }
|
---|
| 1495 | }
|
---|
| 1496 |
|
---|
| 1497 |
|
---|
| 1498 |
|
---|
| 1499 |
|
---|
| 1500 |
|
---|
| 1501 |
|
---|
| 1502 | ///////////////////////////
|
---|
| 1503 | // registra le preferenze ai gruppi
|
---|
| 1504 | ///////////////////////////
|
---|
| 1505 |
|
---|
| 1506 | function rec_voti_gruppi() {
|
---|
| 1507 | global $prefix, $dbi,$aid, $tipo_cons, $genere,$id_cons,$ops,$fileout,$dettnulli;
|
---|
| 1508 | if ($fileout) while (!$fp = fopen($fileout,"a"));
|
---|
| 1509 |
|
---|
| 1510 | $username="$aid";
|
---|
| 1511 | $log_data= date("Y/m/d");
|
---|
| 1512 | $log_ora=getdate(time());
|
---|
| 1513 | $arg2 = func_get_args();
|
---|
| 1514 | $arg = split(",",$arg2[0]);
|
---|
| 1515 | $id_cons_gen=intval($arg[1]);
|
---|
| 1516 | $id_sez = intval($arg[2]);
|
---|
| 1517 | $id_circ = intval($arg[3]);
|
---|
| 1518 | $id_sede = intval($arg[4]);
|
---|
| 1519 | $do = intval($arg[5]);
|
---|
| 1520 | $y=count($arg)-1;
|
---|
| 1521 | mysql_query("delete from ".$prefix."_ele_controllosez where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1522 | if($do==1) {
|
---|
| 1523 | mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1524 | mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1525 | mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1526 | mysql_query("delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1527 | mysql_query("update ".$prefix."_ele_sezioni set validi_lista='',contestati_lista='',voti_nulli_lista='',solo_gruppo='',solo_lista='' where id_cons='$id_cons' and id_sez='$id_sez'", $dbi);
|
---|
| 1528 |
|
---|
| 1529 | }else{
|
---|
| 1530 |
|
---|
| 1531 | if ($genere==0) {
|
---|
| 1532 | $tab="_ele_voti_ref";
|
---|
| 1533 | } else {
|
---|
| 1534 | $tab="_ele_voti_gruppo";
|
---|
| 1535 | $y--;
|
---|
| 1536 | $res = mysql_query("SELECT disgiunto FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons' ", $dbi);
|
---|
| 1537 | list($disgiunto)=mysql_fetch_row($res);
|
---|
| 1538 | if($disgiunto)
|
---|
| 1539 | $res=mysql_query("update ".$prefix."_ele_sezioni set solo_lista='".$arg[$y--]."' where id_sez='$id_sez'", $dbi);
|
---|
| 1540 |
|
---|
| 1541 | }
|
---|
| 1542 |
|
---|
| 1543 | for($i=6;$i< $y;) {
|
---|
| 1544 | $id_gruppo = intval($arg[$i++]);
|
---|
| 1545 | $testval=0;
|
---|
| 1546 | switch ($genere){
|
---|
| 1547 | case (0):
|
---|
| 1548 | if($arg[$i].$arg[$i+1]=='' ) {
|
---|
| 1549 | $i+=6;
|
---|
| 1550 | $testval=1;
|
---|
| 1551 | }else{
|
---|
| 1552 | $si=intval($arg[$i++]);
|
---|
| 1553 | $no=intval($arg[$i++]);
|
---|
| 1554 | $val=intval($arg[$i++]);
|
---|
| 1555 | if ($val==0){$val=$si+$no;}
|
---|
| 1556 | $bia=intval($arg[$i++]);
|
---|
| 1557 | $con=intval($arg[$i++]);
|
---|
| 1558 | $nul=intval($arg[$i++]);
|
---|
| 1559 | $voti = "'$si','$no','$val','$nul','$bia','$con'";
|
---|
| 1560 | $riga="si=$si,no=$no,validi=$val,nulli=$nul,bianchi=$bia,contestati=$con";
|
---|
| 1561 | $sgriga='';
|
---|
| 1562 | }
|
---|
| 1563 | break;
|
---|
| 1564 | default:
|
---|
| 1565 | $voti = intval($arg[$i++]);
|
---|
| 1566 | if($dettnulli) { $sg=intval($arg[$i++]); $sgriga = ', solo_gruppo='.$sg;} else {$sgriga=''; $sg=0;}
|
---|
| 1567 | if (!$voti) {$voti="0";}
|
---|
| 1568 | $riga="voti=$voti".$sgriga;
|
---|
| 1569 | $sgriga=",'$sg'";
|
---|
| 1570 | break;
|
---|
| 1571 | }
|
---|
| 1572 | if($testval) continue;
|
---|
| 1573 | $result = mysql_query("select * from ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1574 | $ar=mysql_fetch_array($result);
|
---|
| 1575 | $res = mysql_query("select num_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1576 | list($num_gruppo)=mysql_fetch_array($res);
|
---|
| 1577 | $oldval='';
|
---|
| 1578 | if ($ar){
|
---|
| 1579 | switch ($genere){
|
---|
| 1580 | case (0):
|
---|
| 1581 | if ($ar['si']!=$si or $ar['no']!=$no or $ar['validi']!=$val or $ar['nulli']!=$nul
|
---|
| 1582 | or $ar['bianchi']!=$bia or $ar['contestati']!=$con){
|
---|
| 1583 | $oldval=" si:$ar[3] no:$ar[4] validi:$ar[5] nulli:$ar[6] bianchi:$ar[7] contestati:$ar[8]";
|
---|
| 1584 | }
|
---|
| 1585 | break;
|
---|
| 1586 | default:
|
---|
| 1587 | if ($ar['voti']!=$voti or $ar['solo_gruppo']!=$sg) {
|
---|
| 1588 | $oldval="voti:".$ar['voti'];
|
---|
| 1589 | $voti.=",null";
|
---|
| 1590 | }
|
---|
| 1591 | if (isset($ar['num_gruppo'])) $dstgruppo=$ar['num_gruppo'];
|
---|
| 1592 | break;
|
---|
| 1593 | }
|
---|
| 1594 | if ($oldval) {
|
---|
| 1595 | mysql_query("update ".$prefix."$tab set $riga where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi);
|
---|
| 1596 | if ($fileout) fwrite($fp,"update ".$prefix."$tab set $riga where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$id_gruppo';\n");
|
---|
| 1597 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','".$log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']."','$oldval','num_gruppo:$num_gruppo $riga','$tab')", $dbi);
|
---|
| 1598 | }
|
---|
| 1599 | } else { #die ("test in corso: insert into ".$prefix."$tab values ('$id_cons', '$id_gruppo','$id_sez',$voti)");
|
---|
| 1600 | mysql_query("insert into ".$prefix."_ele_log values('$id_cons','$id_sez','$username','$log_data','".$log_ora['hours'].":".$log_ora['minutes'].":".$log_ora['seconds']."','','num_gruppo:$num_gruppo $riga','$tab')", $dbi);
|
---|
| 1601 | mysql_query("insert into ".$prefix."$tab values ('$id_cons', '$id_gruppo','$id_sez',$voti $sgriga)", $dbi);
|
---|
| 1602 | if ($fileout) fwrite($fp,"insert into ".$prefix."$tab values ('$id_cons', '$id_gruppo','$id_sez',$voti $sgriga);\n");
|
---|
| 1603 | //
|
---|
| 1604 | }
|
---|
| 1605 |
|
---|
| 1606 | }
|
---|
| 1607 | }
|
---|
| 1608 | //$ops = $arg[$argc];
|
---|
| 1609 | if ($fileout) fclose($fp);
|
---|
| 1610 | Header("Location: admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_sez=$id_sez&do=spoglio&ops=4");
|
---|
| 1611 |
|
---|
| 1612 | }
|
---|
| 1613 |
|
---|
| 1614 |
|
---|
| 1615 | if (!preg_match("/rec/",$op)) {
|
---|
| 1616 | ele(); //menu
|
---|
| 1617 | /* echo "\n<table align=\"left\" border=\"0\" width=\"200\"><tr bgcolor=\"$bgcolor1\">";
|
---|
| 1618 | numeri_sezione(8);
|
---|
| 1619 | echo "<td></td></tr></table>\n";*/
|
---|
| 1620 | echo"</td></tr></table>";
|
---|
| 1621 | }
|
---|
| 1622 |
|
---|
| 1623 | switch ($op){
|
---|
| 1624 | case "voti": //fa eccezione perche' chiamata con minor numero di parametri - riesaminare
|
---|
| 1625 | # voti($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
|
---|
| 1626 | voti($id_cons,$do,$id_circ,$id_sede,$ops,$ov,$mv,$gv,$msv,$av,$id_lista);
|
---|
| 1627 | break;
|
---|
| 1628 | default :
|
---|
| 1629 | $op($vari); //chiamata a funzione variabile con parametri variabili (da cambiare!)
|
---|
| 1630 | }
|
---|
| 1631 | echo"</td></tr></table>";
|
---|
| 1632 | include_once("modules/Elezioni/language/lang-$currentlang.php");
|
---|
| 1633 | include ("footer.php");
|
---|
| 1634 | ?>
|
---|
| 1635 |
|
---|