"; /******************************************************/ /*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"); $res = mysql_query("SELECT id_cons FROM ".$prefix."_ele_comuni where id_comune=$id_comune", $dbi); if (isset($res)) list($idpred) = mysql_fetch_row($res); else $idpred=''; $res = mysql_query("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' " , $dbi); $max = mysql_num_rows($res); echo "
"; echo "
"; echo ""; echo "
" ." "._CONSPRED." "; echo ""; echo ""; echo ""; echo "

"; echo "

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


" ."" ."" ."" ."" .""; $result = mysql_query("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", $dbi); $i=0; while(list($chiusa,$id_cons2,$idconsgen2, $descr_cons, $data_inizio, $data_fine,$tipo) = mysql_fetch_row($result)) { $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; $ressez = mysql_query("select count(id_cons) from ".$prefix."_ele_sezioni where id_cons='$id_cons2'", $dbi); list($somma)=mysql_fetch_row($ressez); $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=mysql_query("$sql",$dbi); list($id_consulta)=mysql_fetch_row($res); $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=mysql_query("$sql",$dbi); list($descr_cons2)=mysql_fetch_row($res); if ($do == "add") { if ($id_cons2) { // copia circoscrizione $res=mysql_query("select * from ".$prefix."_ele_circoscrizione where id_cons='$id_consulta'", $dbi); while (list($id,$idcirc,$num,$des2)=mysql_fetch_row($res)){ $des=addslashes($des2); $resconnew=mysql_query("select count(0) from ".$prefix."_ele_circoscrizione where id_cons='$id_cons2' and num_circ='$num'", $dbi); list($contr_circ)=mysql_fetch_row($resconnew); if (! $contr_circ){ mysql_query("insert into ".$prefix."_ele_circoscrizione (id_cons,num_circ,descrizione) values ('$id_cons2',$num,'$des')", $dbi) || die("Impossibile inserire i dati delle circoscrizioni! ".mysql_error()); } $res0=mysql_query("select id_circ from ".$prefix."_ele_circoscrizione where id_cons=$id_cons2 and num_circ=$num", $dbi); list($id_circ)=mysql_fetch_row($res0); // copia sede $res1=mysql_query("select * from ".$prefix."_ele_sede where id_cons='$id_consulta' and id_circ='$idcirc'", $dbi); while(list($id1,$idsede1,$idcirc1,$ind2,$tel,$tel2,$fax,$resp,$mappa2,$filemappa2)=mysql_fetch_row($res1)){ $filemappa=addslashes($filemappa2); $mappa=addslashes($mappa2); $ind=addslashes($ind2); $ressednew=mysql_query("select count(0) from ".$prefix."_ele_sede where id_cons='$id_cons2' and indirizzo='$ind'", $dbi); list($contr_sed)=mysql_fetch_row($ressednew); if (! $contr_sed){ mysql_query("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')", $dbi) || die("Impossibile inserire i dati delle sedi! ".mysql_error()); } $res2=mysql_query("select id_sede from ".$prefix."_ele_sede where id_cons=$id_cons2 and id_circ=$id_circ and indirizzo='$ind'", $dbi); list($id_sede)=mysql_fetch_row($res2); //copia sezione $res3=mysql_query("select * from ".$prefix."_ele_sezioni where id_cons=$id_consulta and id_sede=$idsede1", $dbi); while (list($id3,$idsez3,$idsede3,$numero,$maschi3,$femmine3,$validi3,$nulli3, $bianchi3,$contest3,$sg3,$aut_m,$aut_f)=mysql_fetch_row($res3)){ 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')"; mysql_query("$sql", $dbi) || die("Impossibile inserire i dati delle sezioni! ".mysql_error()); } } } # 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{ $result = mysql_query("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", $dbi); if (!$result) return; Header("Location: admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen"); } } if ($do == "update") { if ($predefinita) $result = mysql_query("update ".$prefix."_ele_comuni set id_cons='$predefinita' WHERE id_comune='$id_comune'", $dbi); else $result = mysql_query("update ".$prefix."_ele_cons_comune set chiusa='$chiusa' WHERE id_cons2='$id_cons2'", $dbi); if (!$result) 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"); ?>