\n \n \n"; $circo='';$circo2=''; $currentlang=$_SESSION['lang']; $res = mysql_query("SELECT circo FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' and lingua='$currentlang'", $dbi); list($cons_circ)= mysql_fetch_row($res); if($cons_circ) //elezioni circoscrizionali { echo "
"; echo "

"; $res = mysql_query("SELECT * FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons'", $dbi); echo ""; echo "
"._SCEGLI_CIRCO.":
"; $circo="and id_circ='$id_circ'"; $circo2="and t2.id_circ='$id_circ'"; } if($id_cand) { $res = mysql_query("SELECT * FROM ".$prefix."_ele_candidati where id_cand='$id_cand'", $dbi); $pro= mysql_fetch_array($res, 3); }else{ $pro['cognome']='';$pro['num_cand']='';$pro['nome']=''; } if (!isset($id_lista)) { $res_lista=mysql_query("SELECT id_lista from ".$prefix."_ele_lista where id_cons=$id_cons $circo and num_lista=1", $dbi); list($id_lista)=mysql_fetch_row($res_lista); } $cond=($id_lista>0) ? "and t1.id_lista=".$id_lista :''; echo "

"._CANDIDATO."


" ."" ."" .""; echo ""; if ($genere==3 or $genere==5) { $query= "SELECT t1.id_cand,t1.id_lista,t1.num_cand,t1.cognome,t1.nome, t1.simbolo, t2.simbolo as sim_lista,t2.descrizione, t3.simbolo as sim_gruppo, t3.descrizione FROM ".$prefix."_ele_candidati as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_gruppo as t3 WHERE t1.id_lista=t2.id_lista and t2.id_gruppo=t3.id_gruppo and t1.id_cons=t2.id_cons and t1.id_cons=$id_cons $circo2 $cond order by t2.num_lista, t1.num_cand limit $min,$offset"; } else { $query= "SELECT t1.id_cand,t1.id_lista,t1.num_cand,t1.cognome,t1.nome, t1.simbolo, t2.simbolo as sim_lista,t2.descrizione, '', '' FROM ".$prefix."_ele_candidati as t1, ".$prefix."_ele_lista as t2 WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons and t1.id_lista=t2.id_lista $circo2 $cond order by t2.num_lista,t1.num_cand limit $min,$offset"; } echo ""; $result = mysql_query($query, $dbi); if($cons_circ) $res = mysql_query("SELECT count(0) FROM ".$prefix."_ele_candidati as t1,".$prefix."_ele_lista as t2 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons and t2.id_circ=$id_circ and t1.id_lista=t2.id_lista $cond ", $dbi); else $res = mysql_query("SELECT count(0) FROM ".$prefix."_ele_candidati as t1 where t1.id_cons='$id_cons' $cond ", $dbi); list($max) = mysql_fetch_row($res); if($id_lista){ $numero=$max+1;} else $numero=''; //-----------------------lo stemma e la circoscrizione devono essere associati alla lista - echo "" .""; if ($pro['cognome']) { echo ""; echo ""; }else{ echo ""; echo ""; } echo ""; echo ""; //.""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($pro['cognome']) { echo ""; echo ""; }else{ echo ""; echo ""; } echo ""; echo "\n"; if ($result) while(list($id_cand,$id_lista2,$num_cand,$cognome, $nome,$simbolo,$simb_lista, $descr_lista,$simb_gruppo,$descr_gruppo) = mysql_fetch_row($result)) { $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; echo ""; } echo "
"._NUM.""._COGNOME.""._NOME.""._LISTA.""._FUNZIONI."
$num_cand" ."$cognome" ."$nome"; echo "$descr_lista "; echo "[ "._EDIT."]"; echo "["._DELETE." ]"; echo "
"; #'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."

"; } //////////////////////////////////////////////////////// // Aggiunge candidato //////////////////////////////////////////////////////// function candidato($ok, $do,$id_cand, $id_lista,$id_circ, $id_gruppo,$cognome, $nome, $note, $simbolo,$id_cand2,$num_cand) { global $param, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$simbolo2,$min,$id_cons_gen,$id_comune,$id_sez; $aid=$_SESSION['aid']; $perms=ChiSei($id_cons_gen); if ($perms >16) { if($id_cand) { $res = mysql_query("SELECT * FROM ".$prefix."_ele_candidati where id_cand='$id_cand'", $dbi); }else{ $res = mysql_query("SELECT * FROM ".$prefix."_ele_candidati where id_lista='$id_lista' and id_cons=$id_cons and cognome=$cognome and nome=$nome", $dbi); } $username=$aid; $data=date("Y/m/d"); $tempo=date("H:i:s"); if ($do == "delete") { if ($ok !="1") { ele(); echo "


"._DOMCANCELLA." "._CANDIDATO." $cognome $nome ?
"; echo "[ "._NO." ] - ["._YES." ]"; }else{ $pro= mysql_fetch_array($res, MYSQL_ASSOC); $result = mysql_query("delete from ".$prefix."_ele_candidati where id_cand='$id_cand'", $dbi); mysql_query("insert into ".$prefix."_ele_log values ('$id_cons','$id_sez','$username','$data','$tempo','DELETE:id_lista:$pro[id_lista],cognome:$pro[cognome],nome:$pro[nome]','','".$prefix."_ele_candidati')", $dbi); if (!$result)return; Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&id_lista=$id_lista&min=$min"); } }elseif ($do == "add") { if ($cognome) { // dati gruppo if (!$num_cand){ $result = mysql_query("select max(num_cand) from ".$prefix."_ele_candidati where id_lista='$id_lista'", $dbi); if ($result) list($num_cand)=mysql_fetch_row($result); else $num_cand=0; $num_cand++; } $result = mysql_query("select id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'", $dbi); list($id_gruppo)=mysql_fetch_row($result); $result = mysql_query("insert into ".$prefix."_ele_candidati(id_cons,id_lista,cognome,nome,note,simbolo,num_cand) values ('$id_cons','$id_lista','$cognome','$nome','$note','$simbolo','$num_cand')", $dbi); mysql_query("insert into ".$prefix."_ele_log values ('$id_cons','$id_sez','$username','$data','$tempo','','ADD:id_lista:$id_lista,cognome:$cognome,nome:$nome','".$prefix."_ele_candidati')", $dbi); if (!$result) return; Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); } else { ele(); OpenTable(); echo "
"._GESTIONE." "._CANDIDATO." "; echo "

"._IMM." "._CANDIDATO."
"; CloseTable();exit; } }elseif ($do == "update") { $pro= mysql_fetch_array($res, MYSQL_ASSOC); $result = mysql_query("select id_gruppo from ".$prefix."_ele_lista where id_lista='$id_lista'", $dbi); list($id_gruppo)=mysql_fetch_row($result); $cond=''; if (isset($note)) {$cond=", note='$note'";} if (isset($simbolo)) {$cond.=", simbolo='$simbolo'";} $result = mysql_query("update ".$prefix."_ele_candidati set id_lista='$id_lista', cognome='$cognome', nome='$nome', num_cand='$num_cand' $cond where id_cand='$id_cand' ", $dbi); mysql_query("insert into ".$prefix."_ele_log values ('$id_cons','$id_sez','$username','$data','$tempo','UPDATE:id_lista:$pro[id_lista],cognome:$pro[cognome],nome:$pro[nome],num_cand:$pro[num_cand]','id_lista:$id_lista,cognome:$cognome,nome:$nome,num_cand:$num_cand','".$prefix."_ele_candidati')", $dbi); if (!$result) return; Header("Location: admin.php?op=candidato&id_cons=$id_cons&id_lista=$id_lista&id_cons_gen=$id_cons_gen&id_comune=$id_comune&id_circ=$id_circ&min=$min"); } } } if ($do and $do!='modify') candidato($ok, $do,$id_cand, $id_lista,$id_circ, $id_gruppo,$cognome, $nome, $note, $simbolo,$id_cand2,$num_cand); else ele(); //if (!$do)ele(); all(); echo""; include("footer.php"); ?>