Changeset 226
- Timestamp:
- Nov 2, 2014, 7:01:21 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_associazioni.php
r208 r226 335 335 $res_del = mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons=$idcns" ,$dbi); 336 336 $res_del = mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons=$idcns" ,$dbi); 337 $res_del = mysql_query("delete from ".$prefix."_ele_controllosez where id_cons=$idcns" ,$dbi); 337 338 if ($pwd4==1){ 338 339 $res_del = mysql_query("delete from ".$prefix."_ele_candidati where id_cons=$idcns" ,$dbi); -
trunk/admin/modules/Elezioni/ele_voti.php
r221 r226 73 73 74 74 function stato_rilevazione($id_sez,$solosede){ 75 global $id_cons, $prefix, $dbi, $id_cons_gen,$status,$genere,$votol, $votog, $ idrefgruppo;76 77 if($idrefgruppo ) $perref= "and id_gruppo='$idrefgruppo'";75 global $id_cons, $prefix, $dbi, $id_cons_gen,$status,$genere,$votol, $votog, $votoc,$idrefgruppo,$num_ril; 76 77 if($idrefgruppo and $genere==0) $perref= "and id_gruppo='$idrefgruppo'"; 78 78 else $perref=""; 79 79 $ops=0; 80 80 $status=0; 81 $stret=0; $contains=0; 82 ########### 83 $res = mysql_query("SELECT data,orario FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data asc,orario asc", $dbi); 84 $num_ril=mysql_num_rows($res); 85 $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); 86 87 if(mysql_num_rows($res3)){ 88 list($aff,$val,$gru,$lis,$can,$status)=mysql_fetch_row($res3); 89 if ($can) {$ops=-5;} 90 elseif ($lis) {$ops=-3;} 91 elseif($gru) {$ops=-4;} 92 elseif ($val) {$ops=-2;} 93 elseif($aff) {$ops=-1;} 94 # if($can==1) $status=1; 95 }else{ 96 $aff=0;$lis=0;$val=0;$gru=0;$can=0;$stret=0;$status=0; 97 ########################## 81 98 if($ops==0){ 82 99 #controllo congruenza affluenze 83 $res = mysql_query("SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc", $dbi); 100 $res3= mysql_query("SELECT count(num_sez) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi); 101 list($numtot) = mysql_fetch_row($res3); 102 $test_ril=0;$pre_rilc=0;$pre_rilm=0;$pre_rilf=0; 84 103 if($res) 85 while (list($ora,$giorno) = mysql_fetch_row($res)){ 104 while (list($giorno,$ora) = mysql_fetch_row($res)){ 105 $test_ril++; 106 $query="SELECT voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' $perref and orario='$ora' and data='$giorno'"; 107 $res2 = mysql_query("$query", $dbi); 108 $numscru=mysql_num_rows($res2); 86 109 $query="SELECT sum(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' $perref and orario='$ora' and data='$giorno'"; 87 110 $res2 = mysql_query("$query", $dbi); 88 111 list($voti)=mysql_fetch_row($res2); 89 if($ voti) {112 if($numscru) { 90 113 if(isset($ora)){ 91 114 $query="SELECT count(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' $perref and orario='$ora' and data='$giorno'"; 92 $res3 = mysql_query("$query", $dbi); 93 list($numscru)=mysql_fetch_row($res3); 94 $res3= mysql_query("SELECT count(num_sez) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi); 95 list($numtot) = mysql_fetch_row($res3); 115 # $res3 = mysql_query("$query", $dbi); 116 # list($numscru)=mysql_fetch_row($res3); 96 117 $res3= mysql_query("SELECT maschi+autorizzati_m,femmine+autorizzati_f FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi); 97 118 list($iscrittim,$iscrittif) = mysql_fetch_row($res3); … … 101 122 $res3 = mysql_query("$query", $dbi); 102 123 list($voti, $uomini, $donne)=mysql_fetch_row($res3); 103 # if($voti>0) {#echo $query; 104 if ((($uomini+$donne)==0 and ($voti)<=$iscritti) or ((($uomini+$donne)==$voti) and ($uomini<=$iscrittim) and ($donne<=$iscrittif))){ 105 #if($numscru<$numtot and $numscru>0) 106 {$status=1;$ops=-1;break;}# 107 # else 108 # {$status=0;$ops=-1;break;} 109 }else {return 1;} 110 # } else return 0; 124 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) 125 { 126 $ops=-1;$aff=1; $status=$test_ril; 127 }elseif($numscru) {$aff=-1;$stret=1;break;} 128 else {$status=0;$ops=-1;break;} 111 129 } 112 } else {return -1;} 113 } 114 # return 0; 130 } else {$stret=-1;$aff=0;} 131 $pre_rilc=$voti; $pre_rilm=$uomini;$pre_rilf=$donne; 132 } 133 #if(isset($num_ril) and $num_ril==$test_ril) $status=1; 134 115 135 #controllo congruenza voti espressi 116 136 #per referendum 117 if($genere==0){ 137 if($genere==0){ 138 $resref = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi); 139 $numscru=mysql_num_rows($resref); $rifscru=0; 140 while(list($idrefgruppo)=mysql_fetch_row($resref)) { 118 141 $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); 119 $refscru=mysql_num_rows($res2); 142 $refscru=mysql_num_rows($res2); 120 143 if($refscru){ 121 # echo "$voti - $ora - $giorno :<br>"; 144 $query="SELECT voti_complessivi FROM ".$prefix."_ele_voti_parziale where id_sez='$id_sez' and id_gruppo='$idrefgruppo' order by data desc, orario desc"; 145 $res3 = mysql_query("$query", $dbi); 146 list($voti)=mysql_fetch_row($res3); 147 148 $rifscru++; 122 149 list($si,$no,$validi,$nulli,$bianchi,$contestati)=mysql_fetch_row($res2); 123 if(($si+$no==$validi) and ($validi+$nulli+$bianchi+$contestati==$voti)) {$status=1;return (-4);} 124 else return (4); 125 } else {$status=0; return (-4);} 126 } 150 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);} 151 else {$val=-1;$stret=4;break;} #return (4); 152 } else { $stret=4;break;} 153 } 154 }else{ 127 155 #per le altre consultazione 128 $res2= mysql_query("SELECT sum(validi) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'", $dbi);156 $res2= mysql_query("SELECT validi FROM ".$prefix."_ele_sezioni where id_sez='$id_sez' and id_cons='$id_cons' ", $dbi); 129 157 if($res2){ 130 158 list($validi) = mysql_fetch_row($res2); … … 136 164 if($validi>0) { 137 165 if (($validi+$nulli+$bianchi+$contestati+$votinulli+$sololista)==$voti) 138 {$status= 1;$ops=(-4+$votog);}139 else return (4-$votog);166 {$status=2;$ops=(-4+$votog);$val=1;} 167 else {$val=-1;$stret=(4-$votog);} 140 168 } #else return 0; 141 169 } 142 170 } 143 171 #controllo congruenza voti di gruppo 144 $res3= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons'", $dbi); 145 if($res3 and !$votog){$status=0;$ops=-4; 146 list($votig) = mysql_fetch_row($res3); 147 if($votig and $genere!=2) { 148 $status=0; 149 $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'"; 150 $res4 = mysql_query("$query", $dbi); 151 list($votigs)=mysql_fetch_row($res4); 172 if($genere!=4){ 173 $res3= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_cons='$id_cons'", $dbi); 174 if($res3 and !$votog){#$status=0;$ops=-4; 175 list($votigs) = mysql_fetch_row($res3); 176 if($votigs and $genere!=2) { 177 # $status=0; 178 # $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'"; 179 # $res4 = mysql_query("$query", $dbi); 180 # list($votigs)=mysql_fetch_row($res4); 152 181 if($votigs>0) { 153 182 if (($votigs)==$validi) 154 {$status= 1;$ops=-3;}155 else return 4;183 {$status=3;$ops=-3;$gru=1;} 184 else {$gru=-1; $stret=4;} 156 185 } #else return 0; 157 186 } 158 187 } 188 }#else {$gru=1;echo "--$votigs -- $votog";} 189 if(($genere>1 and !$votol)){#$status=0; 159 190 $res4= mysql_query("SELECT t1.preferenze,t1.id_fascia,t2.limite 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); 160 191 if($res4) list($testpref,$fascia,$limite)=mysql_fetch_row($res4); else {$testpref=0;$fascia=0;$limite=0;} 161 192 162 193 #controllo congruenza voti di lista 163 $res3= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons'", $dbi); 164 if($res3 and ($genere>1 and !$votol)){$status=0; 165 list($votil) = mysql_fetch_row($res3); 166 if($votil) { 167 $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez'"; 168 $res4 = mysql_query("$query", $dbi); 194 # $res3= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_cons='$id_cons'", $dbi); 195 # list($votil) = mysql_fetch_row($res3); 196 $tablg=$fascia<=$limite ? "gruppo":"lista"; 197 $query="SELECT sum(voti) FROM ".$prefix."_ele_voti_$tablg where id_sez='$id_sez' and id_cons='$id_cons'"; 198 $res4 = mysql_query($query, $dbi); 169 199 list($votils)=mysql_fetch_row($res4); 200 $query="SELECT voti FROM ".$prefix."_ele_voti_$tablg where id_sez='$id_sez' and id_cons='$id_cons'"; 201 $res4 = mysql_query($query, $dbi); 202 $sezscru=mysql_num_rows($res4); 203 if($sezscru) { 204 if($genere==4 or $votog) $contrlis= ($validilista==$validi) ? 1:0; 205 else $contrlis=($sologruppo+$validilista+$contestatilista+$votinullilista-$sololista)==$validi ? 1:0; 206 if((($contrlis) and $validilista==$votils) or ($fascia<=$limite and $fascia)) {$status=4;$lis=1;$ops=-4;} 207 elseif($sezscru) {$stret=3;$lis=-1;} 208 170 209 # if($votils>0) { 171 210 if(mysql_num_rows($res4)>0) { 172 $query="SELECT stato_aff, stato_val,stato_gru,stato_lis,stato_can FROM ".$prefix."_ele_controllosez where id_sez='$id_sez' and id_cons='$id_cons'"; 173 $res3 = mysql_query("$query", $dbi); 174 $res4= mysql_query("SELECT count(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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 175 list($contains)=mysql_fetch_row($res4); 176 if($contains==0) $tutte=1; else $tutte=0; 177 if(mysql_num_rows($res3)){ 178 list($aff,$val,$gru,$lis,$can)=mysql_fetch_row($res3); 179 }else{ 211 # $res4= mysql_query("SELECT count(0) FROM ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez' ", $dbi); 212 # list($contains)=mysql_fetch_row($res4); 213 # if($contains==0) $tutte=1; else $tutte=0; 214 180 215 $query="SELECT id_lista FROM ".$prefix."_ele_lista where id_cons='$id_cons'"; 181 216 $res3 = mysql_query("$query", $dbi); 182 $testcand=0; 183 217 $contaliste=mysql_num_rows($res3); 184 218 $res4= mysql_query("SELECT preferenze FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi); 185 219 if($res4) list($testpref)=mysql_fetch_row($res4); else $testpref=0; 186 220 while(list($testlista)=mysql_fetch_row($res3)){ 187 $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); 221 if($fascia<=$limite) 222 { 223 $res4= mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_lista where id_cons='$id_cons' and id_lista='$testlista'", $dbi); 224 list($idgruppo)=mysql_fetch_row($res4); 225 $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); 226 227 }else{ 228 $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); 229 } 188 230 if($res4) list($testvotil)=mysql_fetch_row($res4); else $testvotil=0; 189 231 $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); 190 232 if($res4) list($testvotic)=mysql_fetch_row($res4); else $testvotic=0; 191 192 if(($testvotil*$testpref)<$testvotic) { $testcand=1;break;}193 233 $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); 234 if(mysql_num_rows($res4)) $contains++; 235 $totvotic=0; 194 236 while(list($testvotic)=mysql_fetch_row($res4)) 195 if($testvotil<$testvotic) { $testcand=1;break;} 237 { 238 $totvotic+=$testvotic; 239 if($testvotil<$testvotic) { $can=-1;break;} 240 } 241 if(($testvotil*$testpref)<$totvotic) { $can=-1;break;} 196 242 } 197 } 198 if(!isset($can)){ 199 $can=($testcand==0) ? 1:-1; 200 if($genere==4 or $votog) $contestatilista=0; 201 $val=(($votils+$sologruppo+$contestatilista+$votinullilista)==($validi+$sololista))?1:-1; 202 $lis=($validilista==$votils) ? 1:-1; 203 $res4=mysql_query("insert into ".$prefix."_ele_controllosez values('$id_sez','$id_cons','0','$val','0','$lis','$can')",$dbi); 204 } 205 # $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$testlista' and id_cons='$id_cons' ", $dbi); 206 # $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); 207 if($genere==4 or $votog) $contestatilista=0; 208 # if (($votils+$sologruppo+$contestatilista+$votinullilista)==($validi+$sololista) and $validilista==$votils and $testcand==0) 209 if ($val==1 and $lis==1 and $can==1) 210 {$status=$tutte;$ops=-3;} 211 else {return 3;} 212 } #else return 0; 213 }elseif($genere==5 and $fascia<=$limite){ 214 /* $testcand=0; 215 $query="SELECT id_lista,id_gruppo FROM ".$prefix."_ele_lista where id_cons='$id_cons'"; 216 $res3 = mysql_query("$query", $dbi); 217 $tutte=1; 218 while(list($testlista,$testgruppo)=mysql_fetch_row($res3)){ 219 $res4= mysql_query("SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id_sez' and id_gruppo='$testgruppo'", $dbi); 220 if($res4) list($testvotit)=mysql_fetch_row($res4); else $testvotit=0; 221 $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); 222 if($res4) list($testvotic)=mysql_fetch_row($res4); else $testvotic=0; 223 $res4= mysql_query("SELECT count(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_cons='$id_cons' and t1.id_sez='$id_sez' and t2.id_lista='$testlista'", $dbi); 224 list($contains)=mysql_fetch_row($res4); 225 if($contains==0) $tutte=0; 226 227 228 if(($testvotit*$testpref)<$testvotic) {$testcand=1;break;} 229 $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); 230 while( list($testvotic)=mysql_fetch_row($res4)) 231 if(($testvotit)<$testvotic) {$testcand=1;break;} 232 }*/ 233 if($testcand==0) 234 {$status=$tutte;$ops=-3;} 235 else {return 3;} 236 } 237 }elseif($ops==-3){ $ops=-4;} 238 239 243 if($contains==$contaliste and $can==0) {$status=5;$can=1;$ops=-3;} 244 elseif($can==-1) {$stret=3;} 245 } 246 } 247 }elseif($ops==-3){ $ops=-4;} 248 } 249 if(isset($can)){ 250 $res4=mysql_query("insert into ".$prefix."_ele_controllosez values('$id_sez','$id_cons','$aff','$val','$gru','$lis','$can','$status')",$dbi); 251 } 252 } 253 } 254 if($aff==-1) {$stret=1;} 255 elseif($val==-1) {$stret=(4-$votog);} 256 elseif($gru==-1) {$stret=4;} 257 elseif($lis==-1) {$stret=3;} 258 elseif($can==-1) {$stret=3;} 259 elseif($can==1) {$stret=-3;} 260 elseif($lis==1) {$stret=-3;} 261 elseif($gru==1) {$stret=-4;} 262 elseif($val==1) {$stret=-(4-$votog);} 263 else ($stret=-1); 264 if($stret) return($stret); 240 265 return ($ops); 241 }266 242 267 243 268 } … … 250 275 function numeri_sezione($nums) { 251 276 // tabella visualizzazione sezioni per numero 252 global $aid,$bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min, $tipo_cons, $genere,$id_cons_gen,$id_cons,$id_lista,$ops, $perms,$id_sez; 253 // $ressup = mysql_query("select permessi from ".$prefix."_ele_operatori where aid='$aid'",$dbi); 254 // list ($perms)=mysql_fetch_row($ressup); 277 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; 278 $idrefgruppo=''; 255 279 $solosede=''; 256 280 if ($perms<32) { … … 277 301 //colora la sezione 278 302 $sezstat=0; #die($ops); 279 global $status; 280 global $idrefgruppo; $idrefgruppo=''; 281 if($genere==0){ 282 $resref = mysql_query("SELECT id_gruppo FROM ".$prefix."_ele_gruppo where id_cons='$id_cons'", $dbi); 283 while(list($idrefgruppo)=mysql_fetch_row($resref)) { 284 $sezstat=stato_rilevazione($sez_id,$solosede); 285 if ($sezstat>0) break; 286 } 287 }else 288 $sezstat=stato_rilevazione($sez_id,$solosede); 303 $sezstat=stato_rilevazione($sez_id,$solosede); 289 304 $cursez="style=\" background: #bbbbbb;"; 290 305 $bgsez=""; 291 # if ($sezstat==(-1)) $bgsez="#99CC33"; #verde 292 293 # if ($status==1 and $sezstat<0) { $ops=abs($sezstat);$bgsez="#99CC33";} #verde 294 if ($status==1 and $sezstat<0) { $ops=abs($sezstat);$cursez="style=\" background: #99CC33;";} #verde 295 elseif ($sezstat<0) {$ops=abs($sezstat);} 296 elseif ($sezstat>0) { 297 # $bgsez="#FF3300";#rosso; 306 if ($sezstat>0) { 298 307 $cursez="style=\" background: #FF3300;";#rosso; 299 if ($sezstat) $ops=$sezstat; else $ops=1; 308 }else{ 309 if($sezstat==-5 or ($sezstat==-3 and $votoc)) 310 if($status<$num_ril or ($votoc and $status==0) or ($genere==5 and $status==2)) {$cursez="style=\" background: #ADFF2F;";}#verde-giallo 311 else $cursez="style=\" background: #99CC33;"; #verde 312 elseif($sezstat==-3){ 313 if($status==0) {$cursez="style=\" background: #B0E0E6;";}#powder-blue 314 elseif(($genere==4 and $status==5) or $votoc or $status==5 or ($genere==3 and $status==4)) $cursez="style=\" background: #99CC33;"; #verde 315 else $cursez="style=\" background: #00BFFF;"; #deepsky-blue 316 } 317 elseif($sezstat==-4){ 318 if($status==2) {$cursez="style=\" background: #F5F5F5;";}#whitesmoke 319 elseif ($genere>1 or ($genere==0 and $status<5)) $cursez="style=\" background: #98FB98;"; #palegreen 320 elseif ($genere==0 and $status==0) {$cursez="style=\" background: #DAA520;";} #gold 321 else $cursez="style=\" background: #99CC33;"; #verde 322 } 323 elseif($sezstat==-2){ 324 if($status==0) {$cursez="style=\" background: #B0E0E6;";}#powder-blue 325 else $cursez="style=\" background: #00BFFF;"; #deepsky-blue 326 } 327 elseif($sezstat==-1){ 328 if($status==0 and $status<$num_ril) {$cursez="style=\" background: #F5F5DC;";}#beige 329 elseif($status==1 and $status<$num_ril) {$cursez="style=\" background: #D3D3D3;";}#lightgray 330 elseif($status==2 and $status<$num_ril) {$cursez="style=\" background: #E0FFFF;";}#lightcyan 331 elseif($status==3 and $status<$num_ril) {$cursez="style=\" background: #F0E68C;";}#kaki 332 else {$sezstat=-4;$cursez="style=\" background: #DAA520;";} #gold 333 } 300 334 } 301 else{$cursez="style=\" background: #8CC8C7;";} 335 336 if ($sezstat) $ops=abs($sezstat); else $ops=1; 337 302 338 if(!$ops) $ops=1; 303 339 $res2= mysql_query("SELECT num_sez FROM ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi); 304 340 list($numero_sez) = mysql_fetch_row($res2); 305 # if ($sez_num==$numero_sez) {$cursez= "style=\" border-color: YELLOW; border-width: 5px;\"";}306 341 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.="\""; 307 # echo "\n<td align=\"center\" width=\"5%\" bgcolor=\"$bgsez\" $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></td>\n";308 342 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"; 309 # if (($i%$nums) ==0) echo "</ul></div></td></tr></table>\n"; #<tr bgcolor=\"$bgcolor1\">310 343 } 311 344 //} 312 345 echo "</ul></div></td></tr></table>\n"; 313 # echo"</td></tr></table>";314 346 //}// fine tabella per numero sezioni 315 // inizio tabella centrale316 # echo "\n</td><td valign=\"top\" align=\"left\">";317 347 } 318 348 /////////////////////////////////////////////////////////////////////////////////// … … 324 354 echo "<table border=\"0\" width=\"770\" align=\"left\"><tr>"; 325 355 echo "\n<td bgcolor=\"$bgcolor1\" align=\"left\">"; 326 //echo "<h6>";327 # echo "\n<table align=\"left\" width=\"100%\" border=\"3\"><tr bgcolor=\"$bgcolor1\"><td>";328 356 numeri_sezione(22); 329 # echo "<td></td></tr></table>\n";330 # echo "</td></tr></table>\n";331 357 echo "\n</td></tr><tr><td>\n"; 332 358 … … 416 442 /////////////////////// 417 443 if ($do == "spoglio") { 418 /* echo "\n<form name=\"sezione\" action=\"admin.php\">"; 419 OpenTable(); 420 echo "<tr><td>"; 421 $res= mysql_query("SELECT descrizione FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' AND id_circ='$id_circ' order by num_circ", $dbi); 422 list($descr_circ) = mysql_fetch_row($res); 423 $res= mysql_query("SELECT indirizzo FROM ".$prefix."_ele_sede where id_cons='$id_cons' AND id_sede='$id_sede' order by indirizzo", $dbi); 424 list($indir) = mysql_fetch_row($res); 425 echo "<input type=\"hidden\" name=\"pag_sez\" value=\"admin.php?op=voti&do=spoglio&ops=$ops&id_cons_gen=$id_cons_gen&id_circ=$id_circ&id_sede=$id_sede&id_lista=$id_lista&id_sez=\">"; 426 echo "<a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=circo\">"._CIRCO."</a> $descr_circ -> 427 <a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&id_circ=$id_circ&do=sede\">"._INDIRIZZO."</a> $indir -> 428 <input type=\"hidden\" name=\"op\" value=\"voti\"> 429 <input type=\"hidden\" name=\"do\" value=\"spoglio\">" 430 // Sezioni:lista 431 //************************************** 432 ."<b>"._SEZIONE."</b>: " 433 ."<select name=\"id_sez\" onChange=\"top.location.href=this.form.pag_sez.value+this.form.id_sez.options[this.form.id_sez.selectedIndex].value;return false\">"; 434 $res= mysql_query("SELECT id_sez,num_sez FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' and id_sede='$id_sede' order by num_sez", $dbi); 435 $rif_sez=0; 436 $next_sez=0; 437 unset($prev_sez); 438 while(list($id,$num) = mysql_fetch_row($res)) { 439 if (!($id_sez>0)) {$id_sez=$id;} 440 if ($id == $id_sez) { 441 $sel = "selected"; 442 $prev_sez=$rif_sez; 443 } else { 444 $sel = ""; 445 if (isset($prev_sez) and ($next_sez==0)) { $next_sez=$id;} 446 $rif_sez=$id; 447 } 448 echo "<option value=\"$id\" $sel>$num"; 449 } 450 echo "</select>" 451 //************************************* 452 ."<input type=\"hidden\" name=\"id_circ\" value=\"$id_circ\">\n" 453 ."<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">\n" 454 ."<input type=\"hidden\" name=\"id_sede\" value=\"$id_sede\">\n" 455 ."<input type=\"hidden\" name=\"ops\" value=\"$ops\">\n" 456 ." <input type=\"submit\" name=\"update\" value=\""._OK."\">\n"; 457 if ($prev_sez) { 458 echo " <a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=spoglio&id_circ=$id_circ&id_sede=$id_sede&id_sez=$prev_sez&ops=$ops&id_lista=$id_lista\">"._PREV."</a> \n"; 459 }else {echo " <span style=\"color: rgb(204, 204, 204);\">"._PREV."</span> ";} 460 if ($next_sez) { 461 echo "<a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=spoglio&id_circ=$id_circ&id_sede=$id_sede&id_sez=$next_sez&ops=$ops&id_lista=$id_lista\">"._NEXT."</a>\n"; 462 }else {echo " <span style=\"color: rgb(204, 204, 204);\">"._NEXT."</span>\n";} 463 echo "\n</td></tr>"; 464 CloseTable(); 465 466 echo "</form>\n"; 467 echo "\n</td></tr><tr><td>\n"; 468 // echo "\n</td></tr></table>\n"; 469 */ 444 470 445 471 446 //************************************ … … 475 450 list($id_cons2,$id_sez2,$id_sede,$num_sez, $maschi, $femmine) = mysql_fetch_row($result); 476 451 477 //$bgcolor1="#b0b0b0";478 # echo "<hr><table border=\"0\" width=\"60%\" align=\"center\"><tr>";479 452 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>"; 480 453 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"; … … 486 459 } 487 460 echo "</tr></table></td></tr></table><hr>\n"; 488 /* 489 ######################## 490 echo "<hr><table class=\"table-menu\"><tr>"; 491 echo "\n<td bgcolor=\"$bgcolor1\" align=\"center\"><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></td>\n"; 492 if(!($genere==4) and !($votog)){ //if(!($genere==4) and !($tipo_cons==10 or $tipo_cons==11)){ 493 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><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></td>\n"; 494 } 495 if(($genere>2 or $votog)){ //if(($genere>2 or $tipo_cons==10 or $tipo_cons==11)){ 496 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><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\">"._PREFLISTA."</a></b></td>\n"; 497 } 498 echo "</tr></table><hr>\n"; */ 499 // echo "\n</td></tr></table>\n"; 461 500 462 ############# 501 463 # posizionamento in mancanza di scelta … … 510 472 if (!$voti) $ops=1; 511 473 else { 512 # $res= mysql_query("SELECT validi from ".$prefix."_ele_sezioni where id_sez='$id_sez'", $dbi);513 # list($voti) = mysql_fetch_row($res);514 474 if($genere<4){ 515 475 $res= mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez'", $dbi); … … 544 504 echo "</script>\n"; 545 505 } 546 /*547 if ($ops == 2) {548 finale($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops);549 }550 */551 506 if ($ops == 3) { 552 507 preferenze($id_cons,$do,$id_circ,$id_sede,$id_sez,$ops); … … 584 539 else 585 540 $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); 586 #e587 541 list($validi,$nulli,$bianchi,$contestati,$votinulli) = mysql_fetch_row($result); 588 # if ($validi+$nulli+$bianchi) die("entra($genere==3) OR ($genere==5)) and !$id_lista and ($fascia>$limite)");589 542 echo "<table class=\"table-menu\" style=\"width: 100%;\"><tr>"; 590 543 $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); … … 616 569 list($votisezcand)=mysql_fetch_row($result); 617 570 if(($fascia>$limite or !$id_conf) or $genere==4) 618 619 571 $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_rif'", $dbi); 572 else{ 620 573 621 574 $result = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_rif'", $dbi); 622 575 list($id_gruppo)=mysql_fetch_row($result); 623 576 $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi); 624 577 } 625 578 list($votisezlis)=mysql_fetch_row($result); 626 579 if($votisezcand>($votisezlis*$numprefs)) 627 $segna="style=\"background-color: #dd0000;\"";580 {$segna="style=\"background-color: #dd0000;\"";} 628 581 elseif($ctrvoticand) 629 582 $segna="style=\"background-color: #99CC33;\""; 630 $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='$id_rif'", $dbi); 631 while(list($testvotic)=mysql_fetch_row($res4)) 632 if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";} 583 $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); 584 $errcand[$id_rif]=array(); 585 while(list($testvotic,$numcand)=mysql_fetch_row($res4)) 586 if($votisezlis<$testvotic) { $segna="style=\"background-color: #dd0000;\"";$errcand[$id_rif][]=$numcand;} 633 587 634 588 $sel = ($id_rif == $id_lista) ? "selected" : ""; … … 645 599 if ((!$id_lista)){$tab="_ele_voti_lista";} else {$tab="_ele_voti_candidati";} 646 600 if(($genere==4 or ($genere==5 and $votog)) and !$id_lista) 647 $result = mysql_query("SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli 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);601 $result = mysql_query("SELECT sum(t1.voti),t2.validi, t2.solo_gruppo,t2.contestati_lista,t2.voti_nulli,t2.bianchi,t2.nulli,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); 648 602 else 649 $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 from ".$prefix."_ele_sezioni as t2 left join ".$prefix.$tab." as t1 on (t1.id_sez=t2.id_sez) where t2.id_sez= $id_sezgroup by t1.id_sez",$dbi);603 $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 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); 650 604 list( $voti_sez, $validi2, $sg,$cont2,$vnulli2,$bia2,$nul2,$con2,$vnul2) = mysql_fetch_row($result); 651 605 $valista=$validi2; … … 664 618 list($votisezcand)=mysql_fetch_row($result); 665 619 if($fascia>$limite or !$id_conf) 666 667 620 $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_sez='$id_sez' and id_lista='$id_lista'", $dbi); 621 else{ 668 622 669 623 $result = mysql_query("SELECT id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'", $dbi); 670 624 list($id_gruppo)=mysql_fetch_row($result); 671 625 $result = mysql_query("SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_sez='$id_sez' and id_gruppo='$id_gruppo'", $dbi); 672 626 } 673 627 list($votisezlis)=mysql_fetch_row($result); 674 628 if($votisezcand>($votisezlis*$numprefs)) … … 730 684 $res = mysql_query("SELECT * FROM ".$prefix."$tab where id_cons='$id_cons' and id_sez='$id_sez' $cond_sele", $dbi); 731 685 $pro= mysql_fetch_array($res, 3); 732 echo "<td align=\"right\"><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\">"; 686 if(in_array($num_cand,$errcand[$id_lista])) $errcolor="style=\"background-color: rgb(255, 0, 0);\""; else $errcolor=''; 687 echo "<td align=\"right\" $errcolor><input name=\"voti$i\" value=\"".$pro['voti']."\" size=\"7\" style=\"text-align:right\">"; 733 688 echo "<input type=\"hidden\" name=\"id_cand$i\" value=\"$id_cand\"></td></tr>\n"; 734 689 $i++; … … 1416 1371 mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1417 1372 mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1373 mysql_query("delete from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_sez='$id_sez'", $dbi); 1418 1374 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); 1419 1375 -
trunk/admin/versione.php
r225 r226 1 1 <?php 2 $versione="2.0 rev 22 5";2 $versione="2.0 rev 226"; 3 3 ?> -
trunk/client/temi/facebook/menu.php
r212 r226 59 59 if ($multicomune=='1') 60 60 { 61 $sqlcomu="select t1.id_comune,t1.descrizione,count(0) from ".$prefix."_ele_comuni as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_comune=t2.id_comune and t2.chiusa <2group by t1.id_comune,t1.descrizione order by t1.descrizione asc";61 $sqlcomu="select t1.id_comune,t1.descrizione,count(0) from ".$prefix."_ele_comuni as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_comune=t2.id_comune and t2.chiusa!='2' group by t1.id_comune,t1.descrizione order by t1.descrizione asc"; 62 62 $rescomu= mysql_query("$sqlcomu",$dbi); 63 63 $esiste_multi=mysql_num_rows($rescomu); -
trunk/client/versione.php
r225 r226 1 1 <?php 2 $versione="2.0 rev 22 5";2 $versione="2.0 rev 226"; 3 3 ?> -
trunk/sql/update_2014.php
r223 r226 35 35 # Creazione tabella soraldo_ele_controllosez per il controllo delle sezioni 36 36 echo "<b>Creata tabella soraldo_ele_controllosez per il controllo delle sezioni<br/> 37 Inserimento aggiornamento-2.0_2014- 06-01.sql</b> <br/>";38 update_sql("aggiornamento-2.0_2014- 06-01.sql");37 Inserimento aggiornamento-2.0_2014-11-01.sql</b> <br/>"; 38 update_sql("aggiornamento-2.0_2014-11-01.sql"); 39 39 40 40 echo"</br></br>Fine update... nel caso ci fossero problemi leggere i messaggi di errore<br/>"; … … 45 45 $queries = file_get_contents($sqlfile); 46 46 // Rimuovo eventuali commenti 47 $queries = preg_replace(array('/\/\*.*(\n)*.*(\*\/)?/', '/\s*--.*\n/', '/\s*#.*\n/' ), "\n", $queries);47 $queries = preg_replace(array('/\/\*.*(\n)*.*(\*\/)?/', '/\s*--.*\n/', '/\s*#.*\n/','/\r\n/'), "\n", $queries); 48 48 // recupero le singole istruzioni 49 49 $statements = explode(";\n", $queries);
Note:
See TracChangeset
for help on using the changeset viewer.