Changeset 265


Ignore:
Timestamp:
Jun 11, 2017, 8:39:00 PM (7 years ago)
Author:
roby
Message:

client - sistemazione pagina dei risultati per sezione e circoscrizione

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/versione.php

    r264 r265  
    11<?php
    2 $versione = "2.0 rev 263";
     2$versione = "2.0 rev 265";
    33$version_number = $versione;
    4 $version = "Eleonline $version_number (<i>Data Release: 7 giugno 2017</i>)";
     4$version = "Eleonline $version_number (<i>Data Release: 11 giugno 2017</i>)";
    55
    66?>
  • trunk/client/modules/Elezioni/gruppo.php

    r261 r265  
    44/* by Luciano Apolito & Roberto Gigli                                   */
    55/* http://www.eleonline.it                                              */
    6 /* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
     6/* info@eleonline.it                    rgigli@libero.it               */
    77/************************************************************************/
    88
     
    2828if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
    2929if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
    30 if (isset($param['info'])) get_magic_quotes_gpc() ? $info=$param['info']:$info=addslashes($param['info']); else $info='';
    31 if (isset($param['files'])) get_magic_quotes_gpc() ? $files=$param['files']:$files=addslashes($param['files']); else $files='';
     30if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
     31if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
    3232if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
    3333if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
    34 if (isset($param['lettera'])) get_magic_quotes_gpc() ? $lettera=$param['lettera']:$lettera=addslashes($param['lettera']); else $lettera='';
     34if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
    3535if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
    3636#if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
    3737if (isset($param['pdf'])) $pdf=intval($param['pdf']); else $pdf='';
    38 if (isset($param['orienta'])) get_magic_quotes_gpc() ? $orienta=$param['orienta']:$orienta=addslashes($param['orienta']); else $orienta='';
    39 if (isset($param['datipdf'])) get_magic_quotes_gpc() ? $datipdf=$param['datipdf']:$datipdf=addslashes($param['datipdf']); else $datipdf='';
    40 if (isset($param['formato'])) get_magic_quotes_gpc() ? $formato=$param['formato']:$formato=addslashes($param['formato']); else $formato='';
     38if (isset($param['orienta'])) $orienta=addslashes($param['orienta']); else $orienta='';
     39if (isset($param['datipdf'])) $datipdf=addslashes($param['datipdf']); else $datipdf='';
     40if (isset($param['formato'])) $formato=addslashes($param['formato']); else $formato='';
    4141# anti-xss nov. 2009
    4242$id_comune=htmlentities($id_comune);
     
    6363$res = mysql_query("SELECT t1.descrizione, t1.tipo_cons,t2.genere, t2.voto_g, t2.voto_l, t2.voto_c, t2.circo FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_tipo as t2 where t1.tipo_cons=t2.tipo_cons and t1.id_cons_gen='$id_cons_gen' ", $dbi);
    6464list($descr_cons,$tipo_cons,$genere,$votog,$votol,$votoc,$circo) = mysql_fetch_row($res);
    65 $res = mysql_query("SELECT t2.id_cons,t2.solo_gruppo,t2.disgiunto 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);
     65$res = mysql_query("SELECT t2.id_cons,t2.solo_gruppo,0 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);
    6666list($id_cons,$dettnulli,$disgiunto) = mysql_fetch_row($res);
    6767
     
    177177                        list($minsez)=mysql_fetch_row($res_min);
    178178                        }
     179                elseif (strstr( $op,'circo'))
     180                        $res_sez = mysql_query("SELECT count(num_circ),min(num_circ),max(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons",$dbi);
    179181                else
    180                         $res_sez = mysql_query("SELECT count(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons",$dbi);
    181                 list($tot_sez)=mysql_fetch_row($res_sez);
     182                        $res_sez = mysql_query("SELECT count(num_sez),min(num_sez),max(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons",$dbi);
     183                list($tot_sez,$numsezmin,$numsezmax)=mysql_fetch_row($res_sez);
    182184                $num_sez=$tot_sez;//mysql_data_seek($res_sez,0);
    183                 if ($circo) $offsetsez=$num_sez+$minsez-1;//setta offsetsez sull'ultima sezione della circoscrizione
    184                 if(strstr( $op,"circo")) {
    185                                 $res_sez = mysql_query("SELECT count(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons",$dbi);  //estrae il numero delle circoscrizioni
    186                                 list($num_sez)=mysql_fetch_row($res_sez);
    187                         }
     185                if ($circo) $offsetsez=$numsezmax; //$num_sez+$minsez-1;//setta offsetsez sull'ultima sezione della circoscrizione
     186#               if(strstr( $op,"circo")) {
     187#                               $res_sez = mysql_query("SELECT count(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons",$dbi);  //estrae il numero delle circoscrizioni
     188#                               list($num_sez)=mysql_fetch_row($res_sez);
     189#                       }
    188190#Tolgo la scelta della circoscrizione o collegio perché gestita per tutte le pagine in index.php
    189191/*                      if ($circo){ // elenco per scelta circoscrizione
     
    299301                                group by $t.num_$tab15,$tab3
    300302                                order by $tab3,$t.num_$tab15",$dbi);
     303                       
    301304                        }
    302305                        if ($res_scr) list($tot_scr)=mysql_fetch_row($res_scr);else $tot_scr=0;
    303306                        if ($res_cand) $num_cand=mysql_num_rows($res_cand); else $num_cand=0;
    304                         if(!$circo){
    305                                 if (!(0 < $minsez and $minsez<=$num_sez)) $minsez=1;
    306                                 if (!(0<$offsetsez and $offsetsez<=$num_sez)) $offsetsez=$num_sez;
     307                        if(!$circo){ 
     308                                if (!(0 < $minsez and $minsez<=$numsezmax)) $minsez=1;
     309                                if (!(0<$offsetsez and $offsetsez<=$numsezmax)) $offsetsez=$numsezmax;
    307310                        }
    308311                        if (!(0 < $min and $min<=$num_cand)) $min=1;
     
    334337                                if(!$circo){
    335338                                echo "<p>"._SCEGLI." $tipo1 n. <input  name=\"minsez\" value=\"$minsez\" size=\"4\" ></input>";
    336                                 echo _A." n. <input  name=\"offsetsez\" value=\"$offsetsez\" size=\"4\" ></input> (max. $num_sez)";
     339                                echo _A." n. <input  name=\"offsetsez\" value=\"$offsetsez\" size=\"4\" ></input> (max. $numsezmax)";
    337340                                }
    338341                                # pagine
    339                                 $diff=($offsetsez-$minsez);
    340                                 if ($minsez>1){
    341                                         $minsez_p= ($minsez-$diff)>1 ? $minsez-$diff-1:1;
     342############
     343if (strstr( $op,'circo'))
     344$resnsez = mysql_query("SELECT count(num_circ) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons and num_circ>=$minsez and num_circ<=$offsetsez",$dbi);
     345else
     346$resnsez = mysql_query("SELECT count(num_sez) from ".$prefix."_ele_sezioni where id_cons=$id_cons and num_sez>=$minsez and num_sez<=$offsetsez",$dbi);
     347                list($diff)=mysql_fetch_row($resnsez);
     348########
     349                        #       $diff=($offsetsez-$minsez);
     350                        if ($minsez>1){
     351                                        $minsez_p= ($minsez-$diff)>1 ? $minsez-$diff:1;
    342352                                         
    343                                         $offsetsez_p=$offsetsez-$diff-1;
     353                                        $offsetsez_p=$offsetsez-$diff;
    344354                                                                echo "<div style=\"float: right; width:200px;margin-left:10px;margin-right:400px;font-size:12px \"><a href=\"modules.php?name=Elezioni&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;op=$op&amp;min=$min&amp;offset=$offset&amp;minsez=$minsez_p&amp;offsetsez=$offsetsez_p&amp;perc=$perc&amp;id_lista=$id_lista\"> <- $tipo2 Precedenti</a></div>";
    345355                                }else{echo "";}
    346356
    347                                 if ($offsetsez<$num_sez){
    348                                         $minsez_s=$minsez+$diff+1;
    349                                         $offsetsez_s= ($offsetsez+$diff)>$num_sez ? $num_sez: $offsetsez+$diff+1;
     357                                if ($offsetsez<$numsezmax){
     358                                        $minsez_s=$minsez+$diff;
     359                                        $offsetsez_s= ($offsetsez+$diff)>$num_sez ? $num_sez: $offsetsez+$diff;
    350360
    351361                                                                echo "<div style=\"float: left; width:200px; margin-left:10px;\"><a href=\"modules.php?name=Elezioni&amp;file=index&amp;op=$op&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;orvert=$orvert&amp;min=$min&amp;offset=$offset&amp;minsez=$minsez_s&amp;offsetsez=$offsetsez_s&amp;perc=$perc&amp;id_lista=$id_lista\"> $tipo2 Successive -></a></div>";
     
    490500                                echo "</h5>&nbsp;";
    491501                        }
    492                        
    493502                        $y=1;
    494503                        $ar[0][0]=$tipo3;
     
    506515                      // sandro: carica i numeri di sezione dal DB - giugno 2009
    507516                      // caso: sezioni in collegi diversi non consecutive
     517                        if (strstr( $op,'circo'))
     518                                $res_numsez=mysql_query("select num_circ,id_circ from ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and num_circ>='$minsez' and num_circ<='$offsetsez' order by num_circ",$dbi);
     519                        else{                 
    508520                        if($circo) { $secirco=" and t2.id_circ=$id_circ";} else $secirco="and t1.num_sez >= $minsez and t1.num_sez <= $offsetsez";
    509521                                $numsezioni = $offsetsez-$ominsez;
    510522                                $res_numsez = mysql_query("SELECT t1.num_sez,t1.id_sez from ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons=$id_cons and t1.id_sede=t2.id_sede $secirco order by t1.num_sez",$dbi);
    511                                 for ($z=1;$z<=($offsetsez-$ominsez);$z++) {
    512                                         $res=mysql_fetch_row($res_numsez);
     523                        }
     524#                               for ($z=1;$z<=($offsetsez-$ominsez);$z++) {
     525                                while($res=mysql_fetch_row($res_numsez)) {
     526$z=$res[0];
    513527
    514528##############inserimento percentuale di scrutinio nella sezione
     
    550564                        if ($res_voti)
    551565                        while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
    552                                 if ($num_circ<$minpos or $num_circ>$maxpos) continue;
    553566                                        $z=array_search($num_circ, $pos);
    554567                                if (!isset($votitot[($z)])) {
     
    568581
    569582
    570 
    571 
    572                         for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]="&nbsp;";
    573                         for ($z=1;$z<=($offsetsez-$ominsez);$z++)
    574                                 for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]="&nbsp;"; //inizializza le celle interne
    575                         $onetime="";
     583for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]="&nbsp;";
     584if (strstr( $op,'circo'))
     585$lis_sez=mysql_query("select num_circ from ".$prefix."_ele_circoscrizione where id_cons='$id_cons' and num_circ>='$minsez' and num_circ<='$offsetsez' order by num_circ",$dbi);
     586else
     587        $lis_sez=mysql_query("select num_sez from ".$prefix."_ele_sezioni where id_cons='$id_cons' and num_sez>='$minsez' and num_sez<='$offsetsez' order by num_sez",$dbi);
     588$nsezsel=mysql_num_rows($lis_sez);
     589while(list($z)=mysql_fetch_row($lis_sez))
     590{ for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]="&nbsp;";} //inizializza le celle interne
     591
     592###################################################################
     593#                       for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[0][$y]="&nbsp;";
     594#                       for ($z=1;$z<=($offsetsez-$ominsez);$z++)
     595 #                              for ($y=$min;$y<=($offset+$piuvot);$y++) $ar[$z][$y]="&nbsp;"; //inizializza le celle interne
     596                        $onetime="";
    576597                        if ($res_voti)
    577598                        {
     
    585606                                                }
    586607
    587                                          mysql_data_seek($res_voti,0);                 
     608                                         if(mysql_num_rows($res_voti)) mysql_data_seek($res_voti,0);           
    588609                        while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = mysql_fetch_row($res_voti)){
    589                                 $z=array_search($num_circ, $pos);
     610                                if (!isset($temp[$num_cand])) $temp[$num_cand]=0;$temp[$num_cand]+=$voti;
     611                                $z=array_search($num_circ, $pos); if (!$z) continue;
    590612                                if ($num_cand>=$min and $num_cand<=$offset){
    591613                                        if($num_circ>=$minpos and $num_circ <=$maxpos){
     
    599621                                                $ar[($z)][$num_cand]=$percento;
    600622                                        }
    601                                         if (!isset($temp[$num_cand])) $temp[$num_cand]=0;
    602                                         $temp[$num_cand]+=$voti;
     623                                       
     624                                       
    603625                                       
    604626                                }
     
    613635                                $ar[0][$posvoti+5]='<b>Voti Nulli</b>';
    614636                                if (($maxpos)>=$num_circ and $minpos<=$num_circ){ 
    615                                 $posvoti++;
    616                                 $ar[($z)][$posvoti++]="<b>$sevalidi</b>";
    617                                 $ar[($z)][$posvoti++]="<b>$senulli</b>";
    618                                 $ar[($z)][$posvoti++]="<b>$sebianchi</b>";
    619                                 $ar[($z)][$posvoti++]="<b>$secontestati</b>";
    620                                 $ar[($z)][$posvoti]="<b>$sevonulli</b>";
    621                                 }
    622                                 }
     637                                //$posvoti++;
     638                                $ar[($z)][$posvoti+1]="<b>$sevalidi</b>";
     639                                $ar[($z)][$posvoti+2]="<b>$senulli</b>";
     640                                $ar[($z)][$posvoti+3]="<b>$sebianchi</b>";
     641                                $ar[($z)][$posvoti+4]="<b>$secontestati</b>";
     642                                $ar[($z)][$posvoti+5]="<b>$sevonulli</b>";
     643                                }
     644                                } 
    623645                        }
    624646                        }
    625647                        if (($offsetsez+1)>=$num_sez){
    626                                 $ar[(2+$offsetsez-$minsez)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>";
     648                                $ar[(1+$numsezmax)][0]="<b>"._TOT."<br />"._COMPLESSIVO."</b>";
    627649                                if(isset($temp)) {
    628650                                         if (!isset($tab15) or !$tab15) $tab15="candidati";
     
    644666                                        $resvt = mysql_query("SELECT voti from ".$prefix."_ele_voti_$tab15 where id_cons='$id_cons'",$dbi);
    645667                                        if($resvt) list($votlt)=mysql_fetch_row($resvt); else $votlt=0;
    646                                         if($perc) $temp3=arrayperc($tempar,$sevaltot);
     668                                        if($perc) $temp3=arrayperc($temp,$sevaltot);
    647669                                        while (list($key,$voti)= each($temp)) {
    648670                                                if ($perc=='true' and $voticompl)
     
    651673                                                } else
    652674                                                        $percento="<b>$voti</b>";
    653                                                 $ar[2+$offsetsez-$minsez][$key]=$percento;
     675                                                $ar[1+$numsezmax][$key]=$percento;
    654676                                        }
    655677                                }
     
    664686                         $percento="<b>$voti<br /><span class=\"red\"><i>".$temp3[$k]." %</i></span></b>";
    665687                     } else $percento="<b>$voti</b>";
    666                      $ar[2+$offsetsez-$minsez][++$key]=$percento;
     688                     $ar[1+$numsezmax][++$key]=$percento;
    667689
    668690                                }
  • trunk/client/versione.php

    r264 r265  
    11<?php
    22
    3 $versione = "2.0 rev 263";
     3$versione = "2.0 rev 265";
    44$version_number = $versione;
    5 $version = "Eleonline $version_number (<i>Data Release: 7 giugno 2017</i>)";
     5$version = "Eleonline $version_number (<i>Data Release: 11 giugno 2017</i>)";
    66
    77?>
Note: See TracChangeset for help on using the changeset viewer.