Changeset 297 for trunk/client


Ignore:
Timestamp:
May 6, 2019, 8:08:18 PM (5 years ago)
Author:
roby
Message:
 
Location:
trunk/client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/modules/Elezioni/consiglieri.php

    r295 r297  
    2323if (isset($param['listecol'])) $listecol=intval($param['listecol']); else $listecol=0;
    2424
    25 $sql = "select id_conf,id_fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'"
     25$sql = "select id_conf,id_fascia from ".$prefix."_ele_cons_comune where id_cons='$id_cons'";
    2626$result = $dbi->prepare("$sql");
    2727$result->execute();
     
    2929list($id_conf,$fascia) = $result->fetch(PDO::FETCH_NUM);
    3030
    31 $sql = "SELECT limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,supminpremio,infminpremio from ".$prefix."_ele_conf where id_conf='$id_conf'"
     31$sql = "SELECT limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,supminpremio,infminpremio from ".$prefix."_ele_conf where id_conf='$id_conf'";
    3232$res = $dbi->prepare("$sql");
    3333$res->execute();
     
    5050        $x++;
    5151}
    52 $sql = "SELECT t1.tipo_cons,t2.id_cons,t2.id_fascia,t2.id_conf 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'" 
     52$sql = "SELECT t1.tipo_cons,t2.id_cons,t2.id_fascia,t2.id_conf 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'";
    5353$res = $dbi->prepare("$sql");
    5454$res->execute();
     
    5656if ($res->rowCount()){
    5757        list($tipo_cons,$id_cons,$fascia,$conf) = $res->fetch(PDO::FETCH_NUM);
    58         $sql = "select capoluogo from ".$prefix."_ele_comuni where id_comune='$id_comune'"
     58        $sql = "select capoluogo from ".$prefix."_ele_comuni where id_comune='$id_comune'";
    5959$result = $dbi->prepare("$sql");
    6060$result->execute();
    6161
    6262        list($capoluogo) = $result->fetch(PDO::FETCH_NUM);
    63         $sql = "select fascia_capoluogo from ".$prefix."_ele_conf where id_conf='$conf'"
     63        $sql = "select fascia_capoluogo from ".$prefix."_ele_conf where id_conf='$conf'";
    6464$result = $dbi->prepare("$sql");
    6565$result->execute();
     
    6868        if($fascia<$fascia2 and $capoluogo) $fascia=$fascia2;
    6969
    70                 $sql = "SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and id_conf=$id_conf"
     70                $sql = "SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and id_conf=$id_conf";
    7171$result = $dbi->prepare("$sql");
    7272$result->execute();
    7373
    7474                list($numcons) = $result->fetch(PDO::FETCH_NUM);
    75 $sql = "SELECT id_cand, sum(voti) from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' group by id_cand"
     75$sql = "SELECT id_cand, sum(voti) from ".$prefix."_ele_voti_candidati where id_cons='$id_cons' group by id_cand";
    7676$res_val = $dbi->prepare("$sql");
    7777$res_val->execute();
     
    8484}
    8585        if (!$gruppo){
    86                 $sql = "SELECT sum(validi) from ".$prefix."_ele_sezioni where id_cons='$id_cons'"
     86                $sql = "SELECT sum(validi) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
    8787$res_val = $dbi->prepare("$sql");
    8888$res_val->execute();
    8989
    9090                list($validi) = $res_val->fetch(PDO::FETCH_NUM);
    91                 $sql = "SELECT t1.num_gruppo,sum(t2.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_voti_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo group by t1.num_gruppo order by voti desc limit 0,2"
     91                $sql = "SELECT t1.num_gruppo,sum(t2.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_voti_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo group by t1.num_gruppo order by voti desc limit 0,2";
    9292$res_lis = $dbi->prepare("$sql");
    9393$res_lis->execute();
     
    100100        }
    101101        if ($fascia<=$limite){
    102                 $sql = "SELECT t1.num_gruppo,sum(t2.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_voti_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo group by t1.num_gruppo order by voti desc limit 0,2"
     102                $sql = "SELECT t1.num_gruppo,sum(t2.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_voti_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo group by t1.num_gruppo order by voti desc limit 0,2";
    103103$res_lis = $dbi->prepare("$sql");
    104104$res_lis->execute();
     
    112112        elseif ($gruppo>0) conssup($fascia,$gruppo,$collegate,$collperd,$primoturno);
    113113        elseif ($numgruppo>0){
    114                 $sqllis = "SELECT t1.id_lista,t1.num_lista,t1.descrizione,t1.id_gruppo from ".$prefix."_ele_lista as t1, ".$prefix."_ele_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t2.num_gruppo not in (".$_SESSION['ballo1'].",".$_SESSION['ballo2'].")"
     114                $sqllis = "SELECT t1.id_lista,t1.num_lista,t1.descrizione,t1.id_gruppo from ".$prefix."_ele_lista as t1, ".$prefix."_ele_gruppo as t2 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t2.num_gruppo not in (".$_SESSION['ballo1'].",".$_SESSION['ballo2'].")";
    115115$res_lis = $dbi->prepare("$sqllis");
    116116$res_lis->execute();
    117117
    118118                $yy=$res_lis->rowCount();
    119                         $sql = "select sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons'"
     119                        $sql = "select sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons'";
    120120$res_voti = $dbi->prepare("$sql");
    121121$res_voti->execute();
     
    124124                if ($yy){
    125125while(list($id_lista,$num_lista,$descr,$pgrup) = $res_lis->fetch(PDO::FETCH_NUM)) {
    126                         $sql = "select sum(voti) from ".$prefix."_ele_voti_lista where id_lista='$id_lista'"
     126                        $sql = "select sum(voti) from ".$prefix."_ele_voti_lista where id_lista='$id_lista'";
    127127$res_voti = $dbi->prepare("$sql");
    128128$res_voti->execute();
     
    168168                echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"/>";
    169169                echo "<input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\"/>";
    170                 $sql = "SELECT t1.id_gruppo,t1.num_gruppo,t1.descrizione, sum(t2.voti) as pref FROM ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_voti_gruppo as t2 where t1.id_gruppo=t2.id_gruppo and t1.id_cons='$id_cons' group by t1.num_gruppo,t1.descrizione order by pref desc limit 0,2"
     170                $sql = "SELECT t1.id_gruppo,t1.num_gruppo,t1.descrizione, sum(t2.voti) as pref FROM ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_voti_gruppo as t2 where t1.id_gruppo=t2.id_gruppo and t1.id_cons='$id_cons' group by t1.num_gruppo,t1.descrizione order by pref desc limit 0,2";
    171171$res = $dbi->prepare("$sql");
    172172$res->execute();
     
    212212#carica numero di liste e voti, i voti sono quelli del gruppo se non c'e' voto di lista
    213213if($votolista=='0')
    214         $sql = "SELECT sum(validi) from ".$prefix."_ele_sezioni where id_cons='$id_cons'"
     214        $sql = "SELECT sum(validi) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
    215215else
    216         $sql = "SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons'"
     216        $sql = "SELECT sum(voti) from ".$prefix."_ele_voti_lista where id_cons='$id_cons'";
    217217$res_val = $dbi->prepare("$sql");
    218218$res_val->execute();
     
    222222if ($fisso==1){
    223223        #seleziona il sindaco
    224 $sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_gruppo as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t1.id_gruppo=t3.id_gruppo group by t1.descrizione, t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc limit 0,1"
     224$sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_gruppo as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t1.id_gruppo=t3.id_gruppo group by t1.descrizione, t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc limit 0,1";
    225225$res_per = $dbi->prepare("$sql");
    226226$res_per->execute();
    227227
    228228        list($descr,$num_gruppo,$id_lista1,$num_lista,$descr_lista,$voti)= $res_per->fetch(PDO::FETCH_NUM);
    229 $sql = "SELECT t2.id_lista, sum(t2.voti) as voti from ".$prefix."_ele_voti_lista as t2 where t2.id_cons='$id_cons' and t2.id_lista!='$id_lista1' group by t2.id_lista order by voti desc limit 0,1"
     229$sql = "SELECT t2.id_lista, sum(t2.voti) as voti from ".$prefix."_ele_voti_lista as t2 where t2.id_cons='$id_cons' and t2.id_lista!='$id_lista1' group by t2.id_lista order by voti desc limit 0,1";
    230230$res_per = $dbi->prepare("$sql");
    231231$res_per->execute();
     
    234234      #e la lista di minoranza
    235235        $ordine= $id_lista1>$id_lista2 ? "desc":"";
    236 $sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_lista as t3 where (t2.id_lista='$id_lista1' or t2.id_lista='$id_lista2') and t1.id_gruppo=t2.id_gruppo and t2.id_lista=t3.id_lista group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by t2.id_lista $ordine"
     236$sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_lista as t3 where (t2.id_lista='$id_lista1' or t2.id_lista='$id_lista2') and t1.id_gruppo=t2.id_gruppo and t2.id_lista=t3.id_lista group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by t2.id_lista $ordine";
    237237$res_per = $dbi->prepare("$sql");
    238238$res_per->execute();
    239239
    240240        }else{
    241 $sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_gruppo as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t1.id_gruppo=t3.id_gruppo group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc"
     241$sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1, ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_gruppo as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t1.id_gruppo=t3.id_gruppo group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc";
    242242$res_per = $dbi->prepare("$sql");
    243243$res_per->execute();
     
    279279    foreach ($listagruppo as $lista=>$val){
    280280    $id_lista=$idlst[$lista];
    281     $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,t1.num_cand"
     281    $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,t1.num_cand";
    282282$res_can = $dbi->prepare("$sql");
    283283$res_can->execute();
     
    476476#per voti validi non si intendono i voti validi alle liste ma i voti validi espressi
    477477#$res_val = mysql_query("SELECT sum(validi_lista) from ".$prefix."_ele_sezioni where id_cons='$id_cons'",$dbi);
    478 $sql = "SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons'"
     478$sql = "SELECT sum(voti) from ".$prefix."_ele_voti_gruppo where id_cons='$id_cons'";
    479479$res_val = $dbi->prepare("$sql");
    480480$res_val->execute();
     
    483483
    484484$sbarra=($validi*$supsbarramento)/100;
    485 $sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_lista as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t2.id_lista=t3.id_lista group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc"
     485$sql = "SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_lista as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t2.id_lista=t3.id_lista group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc";
    486486$res_per = $dbi->prepare("$sql");
    487487$res_per->execute();
     
    504504################### carica array ... 25  maggio 2014
    505505foreach($collegate as $key=>$val){     
    506         $sql = "SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$val' and id_cons='$id_cons'"
     506        $sql = "SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$val' and id_cons='$id_cons'";
    507507$res = $dbi->prepare("$sql");
    508508$res->execute();
    509509
    510510                list($tempig)=$res->fetch(PDO::FETCH_NUM);
    511                 $sql = "SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'"
     511                $sql = "SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'";
    512512$res = $dbi->prepare("$sql");
    513513$res->execute();
     
    612612                $z=0;
    613613                $arvin[$x][$pos++]=$desliste[$lst];
    614                 $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,num_cand"
     614                $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,num_cand";
    615615$res_can = $dbi->prepare("$sql");
    616616$res_can->execute();
     
    636636        if($vall==0) continue;
    637637
    638                 $sql = "SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$keyl' and id_cons='$id_cons'"
     638                $sql = "SELECT id_gruppo from ".$prefix."_ele_lista where num_lista='$keyl' and id_cons='$id_cons'";
    639639$res = $dbi->prepare("$sql");
    640640$res->execute();
    641641
    642642                list($tempig)=$res->fetch(PDO::FETCH_NUM);
    643                 $sql = "SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'"
     643                $sql = "SELECT num_gruppo from ".$prefix."_ele_gruppo where id_gruppo='$tempig' and id_cons='$id_cons'";
    644644$res = $dbi->prepare("$sql");
    645645$res->execute();
     
    713713                if(!$premio and $key==$gruppo) $arvin[$x][$pos++]=$desliste[$lst];
    714714                else $arper[$x][$pos++]=$desliste[$lst];
    715                 $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,num_cand"
     715                $sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,num_cand";
    716716$res_can = $dbi->prepare("$sql");
    717717$res_can->execute();
  • trunk/client/temi/facebook/menu.php

    r292 r297  
    104104         
    105105            while(list($id,$descrizione) = $res->fetch(PDO::FETCH_NUM)) {
     106                        $descrizione=ucfirst(strtolower($descrizione));
    106107                echo "<li class=\"icon matita\" ><a href=\"modules.php?op=gruppo&amp;name=Elezioni&amp;id_comune=$id_comune&amp;file=index&amp;id_cons_gen=$id\">
    107108              ".substr($descrizione,0,33)."</a></li>";
Note: See TracChangeset for help on using the changeset viewer.