Ignore:
Timestamp:
Mar 20, 2018, 11:19:10 PM (6 years ago)
Author:
roby
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/modules/Elezioni/ele.php

    r254 r255  
    2121    }
    2222}
    23 
     23global $dbi;
    2424$aid=$_SESSION['aid'];
    25 $dbi=$_SESSION['dbi'];
     25#$dbi=$_SESSION['dbi'];
    2626$id_comune=$_SESSION['id_comune'];
    2727$prefix=$_SESSION['prefix'];
     
    4242        }       
    4343}
    44 
    45 if ($id_cons_gen) {
    46         if ($id_comune and $perms<256)
    47                 $sql = "SELECT t1.tipo_cons,t1.descrizione,t2.id_cons_gen FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen'";
    48         else
    49                 $sql = "SELECT t1.tipo_cons,t1.descrizione,t1.id_cons_gen FROM ".$prefix."_ele_consultazione as t1 where  t1.id_cons_gen='$id_cons_gen'";
    50 }else{
    51         if($perms>128)
    52                 $sql = "SELECT tipo_cons,descrizione,id_cons_gen FROM ".$prefix."_ele_consultazione order by data_fine desc limit 0,1 ";
    53         else
    54                 $sql = "SELECT t1.tipo_cons,t1.descrizione,t2.id_cons_gen FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_operatori as t3 where t3.id_comune=$id_comune and t3.id_comune=t2.id_comune and t1.id_cons_gen=t2.id_cons_gen and t2.chiusa='0' and (t3.id_cons=t2.id_cons or t3.id_cons=0) and t3.permessi>0 and t3.aid='$aid' order by t1.data_fine desc limit 0,1 ";
    55 }
    56 
    57         $res = mysql_query("$sql",$dbi);
    58         $espandi=0;
    59         if (mysql_num_rows($res))
    60                 list($tipo_cons,$descr_cons,$id_cons_gen) = mysql_fetch_row($res);
    61         $res = mysql_query("SELECT t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
    62         if (mysql_num_rows($res)) list($id_cons) = mysql_fetch_row($res);
    63         else    $espandi=1;
    64         if(!isset($tipo_cons))$tipo_cons=0;
    65         $res = mysql_query("SELECT genere,voto_g,voto_l,voto_c,circo FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' and lingua='$currentlang'" , $dbi);
    66         list($genere,$votog,$votol,$votoc,$conscirc) = mysql_fetch_row($res);
     44include_once("modules/Elezioni/query.sql");
     45
     46$row=setconsultazione(); $tipo_cons=$row[0]; $descr_cons=$row[1];$id_cons_gen=$row[2];
     47$row=tipocons(); $genere=$row[0];$votog=$row[1];$votol=$row[2];$votoc=$row[3];$conscirc=$row[4];
     48
    6749if (!$perms) $perms=ChiSei($id_cons_gen);
    6850        //include("modules/Elezioni/language/lang-$currentlang.php");
     
    7052        //        ELE
    7153        //**************************************************************************
    72         if(!isset($id_cons))$id_cons=0;
    73 
    74         $res = mysql_query("SELECT t1.limite FROM ".$prefix."_ele_conf as t1 left join ".$prefix."_ele_cons_comune as t2 on t1.id_conf=t2.id_conf where t2.id_cons='$id_cons'" , $dbi);
    75         list($limite) = mysql_fetch_row($res);
     54
    7655
    7756function ele() {
     
    8463        $bullet_red="<img src=\"temi/$tema/images/bullet_red.gif\" alt =\" \" align=\"left\" border=\"0\">";
    8564        $bgcolor1='#e7e7e7';
    86         $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'";
    87         $res = mysql_query($sqlcomu);
    88         list($descr_comu)=mysql_fetch_row($res);
     65        $row=descr_comune();$descr_comu=$row['descrizione'];
     66#       $sqlcomu="select descrizione from ".$prefix."_ele_comuni where id_comune='$id_comune'";
     67#       $res = mysql_query($sqlcomu);
     68#       list($descr_comu)=mysql_fetch_row($res);
    8969        $sqlcomu="select fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
    9070        $res = mysql_query($sqlcomu);
     
    10484        echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?id_cons_gen=\">";
    10585        echo "<input type=\"hidden\" name=\"op\" value=\"ele\">";
    106        
    107         if ($perms<128) {
    108                 $res = mysql_query("select t3.id_cons, t2.descrizione,t4.genere, t2.id_cons_gen, t3.chiusa from ".$prefix."_ele_operatori as t1, ".$prefix."_ele_consultazione as t2, ".$prefix."_ele_cons_comune as t3, ".$prefix."_ele_tipo as t4 where t4.lingua='$currentlang' and t2.tipo_cons=t4.tipo_cons and t1.aid='$aid' and t3.id_cons_gen=t2.id_cons_gen and (t1.id_cons=t3.id_cons or t1.permessi=64) and t1.id_comune=t3.id_comune and t1.id_comune=$id_comune and t3.chiusa='0' order by t2.data_inizio desc", $dbi);
    109         }else{
    110                 $res = mysql_query("SELECT '', t1.descrizione,t2.genere, t1.id_cons_gen,'' FROM ".$prefix."_ele_consultazione as t1,".$prefix."_ele_tipo as t2 where t2.lingua='$currentlang' and t1.tipo_cons=t2.tipo_cons order by t1.data_inizio desc", $dbi);
    111                 $sqlcomu="select id_comune,descrizione from ".$prefix."_ele_comuni order by descrizione asc";
    112         }
     86###########################
     87$row=elenco_cons();     
     88
     89
     90##################################
    11391        echo "<font size=-1><b>"._SCELTA_CONS.":</b> </font><select name=\"id_cons_gen\" onChange=\"top.location.href=this.form.pag_cons.value+this.form.id_cons_gen.options[this.form.id_cons_gen.selectedIndex].value;return false\">";
    114         while(list($id,$descrizione,$gen2,$idgen,$chiusa) = mysql_fetch_row($res)) {
     92
     93        foreach ($row as $riga)
     94        {
     95        $id=$riga[0];$descrizione=$riga[1];$gen2=$riga[2];$idgen=$riga[3];$chiusa=$riga[4];
     96#       while(list() = mysql_fetch_row($res)) {
    11597                if (($chiusa==0) OR ($perms>32)) {
    11698                        if (($idgen==$id_cons_gen or !$id_cons_gen)) {
     
    143125        if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare
    144126        {
    145                 $rescomu= mysql_query("$sqlcomu",$dbi);
     127                $row=elenco_comuni();
    146128                echo "<select name=\"id_comune\" onChange=\"top.location.href=this.form.pag_cons.value+$id_cons_gen+'&amp;id_comune='+this.form.id_comune.options[this.form.id_comune.selectedIndex].value;return false\"><option value=\"\">";
    147                 while (list($id,$descrizione)=mysql_fetch_row($rescomu))
     129                foreach($row as $riga)
    148130                {
     131                $id=$riga[0];$descrizione=$riga[1];
    149132                $sel=($id == $id_comune) ? "selected":"";
    150133                echo "<option value=\"$id\" $sel>$descrizione";
     
    292275
    293276        //echo "<hr /><a href=\"../client/modules.php\" target=\"_blank\">$bullet Guarda il sito</a><br /><hr />";
    294         echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI."</a>";
     277        echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI.$_SESSION['aid']."</a>";
    295278        echo "</td></tr></table>";
    296279        // continua la tabella su ele.voti con le sezioni
Note: See TracChangeset for help on using the changeset viewer.