prepare("$sql"); $res->execute(); list($tipo_cons,$descr_cons) = $res->fetch(PDO::FETCH_NUM); include("modules/Elezioni/funzionidata.php"); include("modules/Elezioni/ele.php"); if (isset($param['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do=''; if (isset($param['ok'])) get_magic_quotes_gpc() ? $ok=$param['ok']:$ok=addslashes($param['ok']); else $ok=''; if (isset($param['id_cons2'])) $id_cons2=intval($param['id_cons2']); else $id_cons2=''; if (isset($param['min'])) $min=intval($param['min']); else $min=0; if (isset($param['duplica'])) $duplica=intval($param['duplica']); else $duplica=''; if (isset($param['elettori'])) get_magic_quotes_gpc() ? $elettori=$param['elettori']:$elettori=addslashes($param['elettori']); else $elettori=''; if (isset($param['predefinita'])) $predefinita=intval($param['predefinita']); else $predefinita=''; if (isset($param['help'])) $help=intval($param['help']); $offset=10; $hiddenInfo = ""; /******************************************************/ /*Funzione di visualizzazione globale */ /*****************************************************/ function all() { global $bgcolor1, $bgcolor2, $bgcolor6, $prefix, $dbi, $offset, $min, $id_cons,$id_cons2, $id_comune,$descr_cons,$id_cons_gen,$perms,$language,$help; if (isset($help)) include("language/$language/ele_cons_comuni.html"); $sql="SELECT id_cons FROM ".$prefix."_ele_comuni where id_comune=$id_comune"; $res = $dbi->prepare("$sql"); $res->execute(); if ($res->rowCount()) list($idpred) = $res->fetch(PDO::FETCH_NUM); else $idpred=''; $sql="SELECT t1.id_cons, t2.descrizione FROM ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_consultazione as t2 on t1.id_cons_gen=t2.id_cons_gen where t1.id_comune='$id_comune' "; $res = $dbi->prepare("$sql"); $res->execute(); $max = $res->rowCount(); echo "
"; echo "
"; echo ""; echo "
" ." "._CONSPRED." "; echo ""; echo ""; echo ""; echo "

"; echo "

"._COPIA." "._LA." "._STRUTTURA." "._DA." $descr_cons


" ."" ."" ."" ."" .""; $sql="select t2.chiusa,t2.id_cons,t1.* from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t2.id_comune='$id_comune' and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons!=$id_cons ORDER BY data_fine desc LIMIT $min,$offset"; $res = $dbi->prepare("$sql"); $res->execute(); $i=0; while(list($chiusa,$id_cons2,$idconsgen2, $descr_cons, $data_inizio, $data_fine,$tipo) = $res->fetch(PDO::FETCH_NUM)) { $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; $sql="select count(id_cons) from ".$prefix."_ele_sezioni where id_cons='$id_cons2'"; $ressez = $dbi->prepare("$sql"); $ressez->execute(); list($somma)=$ressez->fetch(PDO::FETCH_NUM); $data_inizio=form_data($data_inizio);$data_fine=form_data($data_fine); echo "" ."" .""; if ($somma==0){ $i++; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; }elseif($perms==256){ $i++; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; } echo "
 "._DESCR."  "._DATAIN." "._DATAFINE.""._COPIA." "._NUM." "._ELETTORI.""._FUNZIONI."
$descr_cons$data_inizio$data_fine
Aggiorna il numero elettori
"; #'Pagina precedente' e 'Pagina Successiva' echo ""; $prev=$min-$offset; if ($prev>=0) { echo ""; } $next=$min+$offset; if ($next>=($offset-1)) { if($next>=$max) $next = $max; else { echo ""; } } echo "
"; echo "$offset "._PREV_MATCH.""; echo "$offset "._NEXT_MATCH."

"; } function cons_comuni($ok, $id_cons2,$do, $duplica,$elettori) { global $prefix, $dbi,$id_comune,$id_cons_gen,$perms,$predefinita; if ($perms>32) { $sql="select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune=$id_comune"; $res = $dbi->prepare("$sql"); $res->execute(); list($id_consulta)=$res->fetch(PDO::FETCH_NUM); $sql="select t1.descrizione from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t2.id_cons='$id_cons2' and t1.id_cons_gen=t2.id_cons_gen"; $res = $dbi->prepare("$sql"); $res->execute(); list($descr_cons2)=$res->fetch(PDO::FETCH_NUM); if ($do == "add") { if ($id_cons2) { // copia circoscrizione $sql="select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'"; $res = $dbi->prepare("$sql"); $res->execute(); while (list($id,$idcirc,$num,$des2)=$res->fetch(PDO::FETCH_NUM)){ $des=addslashes($des2); $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons='$id_cons2' and num_circ='$num'"; $resconnew = $dbi->prepare("$sql"); $resconnew->execute(); list($contr_circ)=$resconnew->fetch(PDO::FETCH_NUM); if (! $contr_circ){ $sql="insert into ".$prefix."_ele_circoscrizione (id_cons,num_circ,descrizione) values ('$id_cons2',$num,'$des')"; $res5 = $dbi->prepare("$sql"); $res5->execute(); } $sql="select id_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons2 and num_circ=$num"; $res0 = $dbi->prepare("$sql"); $res0->execute(); list($id_circ)=$res0->fetch(PDO::FETCH_NUM); // copia sede $sql="select * from ".$prefix."_ele_sede where id_cons='$id_consulta' and id_circ='$idcirc'"; $res1 = $dbi->prepare("$sql"); $res1->execute(); while(list($id1,$idsede1,$idcirc1,$ind2,$tel,$tel2,$fax,$resp,$mappa2,$filemappa2)=$res1->fetch(PDO::FETCH_NUM)){ $filemappa=addslashes($filemappa2); $mappa=addslashes($mappa2); $ind=addslashes($ind2); $sql="select count(0) from ".$prefix."_ele_sede where id_cons='$id_cons2' and indirizzo='$ind'"; $ressednew = $dbi->prepare("$sql"); $ressednew->execute(); list($contr_sed)=$ressednew->fetch(PDO::FETCH_NUM); if (! $contr_sed){ $sql="insert into ".$prefix."_ele_sede (id_cons,id_circ,indirizzo,telefono1,telefono2,fax,responsabile,mappa,filemappa) values ('$id_cons2','$id_circ','$ind','$tel','$tel2','$fax','$resp','$mappa','$filemappa')"; $res0 = $dbi->prepare("$sql"); $res0->execute(); } $sql="select id_sede from ".$prefix."_ele_sede where id_cons=$id_cons2 and id_circ=$id_circ and indirizzo='$ind'"; $res2 = $dbi->prepare("$sql"); $res2->execute(); list($id_sede)=$res2->fetch(PDO::FETCH_NUM); //copia sezione $sql="select * from ".$prefix."_ele_sezioni where id_cons=$id_consulta and id_sede=$idsede1"; $res3 = $dbi->prepare("$sql"); $res3->execute(); while (list($id3,$idsez3,$idsede3,$numero,$maschi3,$femmine3,$validi3,$nulli3, $bianchi3,$contest3,$sg3,$aut_m,$aut_f)=$res3->fetch(PDO::FETCH_NUM)){ if ($elettori=='true') $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez,maschi,femmine) values ('$id_cons2','$id_sede','$numero','$maschi3','$femmine3')"; else $sql="insert into ".$prefix."_ele_sezioni (id_cons,id_sede,num_sez) values ('$id_cons2','$id_sede','$numero')"; $res4 = $dbi->prepare("$sql"); $res4->execute(); } } } # Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); } } if ($do == "elettori") { if ($ok !="1") { ele(); echo "


"._DOMAGGIORNA." Consultazione $descr_cons2 ?
"; echo "[ "._NO." ] - ["._YES." ]";exit; }else{ $sql="update ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sezioni as t2 set t1.maschi=t2.maschi, t1.femmine=t2.femmine WHERE t1.id_cons=$id_cons2 and t2.id_cons=$id_consulta and t1.num_sez=t2.num_sez"; $result = $dbi->prepare("$sql"); $result->execute(); if (!$result->rowCount()) return; Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); } } if ($do == "update") { if ($predefinita) { $sql="update ".$prefix."_ele_comuni set id_cons='$predefinita' WHERE id_comune='$id_comune'"; $result = $dbi->prepare("$sql"); $result->execute(); }else{ $sql="update ".$prefix."_ele_cons_comune set chiusa='$chiusa' WHERE id_cons2='$id_cons2'"; $result = $dbi->prepare("$sql"); $result->execute(); } if (!$result->rowCount()) return; Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); } } } function help_cons() { //da mettere } if ($do) { cons_comuni($ok, $id_cons2,$do, $duplica, $elettori); } ele(); //OpenTable(); all(); CloseTable(); include("footer.php"); ?>