Changeset 185


Ignore:
Timestamp:
May 24, 2013, 2:17:59 PM (11 years ago)
Author:
roby
Message:

admin: gestione di più preferenze

Location:
trunk
Files:
1 added
5 edited

Legend:

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

    r95 r185  
    4242if (isset($_GET['help'])) $help=intval($_GET['help']);
    4343if (isset($_GET['pwd4'])) $pwd4=intval($_GET['pwd4']);
     44if (isset($_GET['preferenze'])) $preferenze=intval($_GET['preferenze']); else $preferenze=1;
    4445
    4546$offset=15;
     
    5253        //
    5354        function all() {
    54         global $user, $admin, $bgcolor1, $bgcolor2, $prefix,$descr_cons, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$id_cons_gen,$id_collegio,$idcomune,$chiusa,$id_conf,$tipo_cons,$language,$help;
     55        global $user, $admin, $bgcolor1, $bgcolor2, $prefix,$descr_cons, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$id_cons_gen,$id_collegio,$idcomune,$chiusa,$id_conf,$tipo_cons,$language,$help,$preferenze;
    5556$aid=$_SESSION['aid'];
    5657$dbi=$_SESSION['dbi'];
     
    9293#       echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";
    9394        echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
     95        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
    9496        echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td><td bgcolor=\"$bgcolor1\">";
    9597        if($tipo_cons==3)
     
    128130        }
    129131        echo "</td>";
     132        echo "<td><input type=\"text\" name=\"preferenze\" value=\"$preferenze\" size=\"2\"></td>";
    130133        $selez['0']='';
    131134        $selez['1']='';
     
    158161                echo "<input type=\"hidden\" name=\"idcomune\" value=\"$idcomune\">";
    159162                echo "<input type=\"submit\" id=\"add\" name=\"add\" value=\""._MODIFY."\" ></td></tr>";
    160                 echo "<tr><td colspan=\"4\"><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov1\">"._SPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_cons()\"></label></fieldset></td></tr>";
     163                echo "<tr><td colspan=\"5\"><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov1\">"._SPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_cons()\"></label></fieldset></td></tr>";
    161164# <div  id=\"trspunta\" style=\"visibility:hidden\">   </div>
    162165                echo "<tr id=\"trspunta\" style=\"visibility:hidden\"><td colspan=\"4\"><fieldset><legend>"._SPUNTALABEL2."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd4\" name=\"pwd4\" value=\"1\" onclick=\"javascript:del_cons()\"></label></fieldset>";
     
    172175#       echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>";
    173176        echo "<td width=\"25%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
    174         echo "<td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
     177        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
     178        echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
    175179        if($tipo_cons==3)
    176180                echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
    177         echo "<td></td></tr>";
     181        echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b>&nbsp;"._FUNZIONI."</td></tr>";
    178182###############
    179183
     
    181185#       $resmod = mysql_query("SELECT t1.id_collegio,t1.id_comune,t2.descrizione as descr,t1.id_cons, t3.descrizione, t4.chiusa,t4.id_conf FROM ".$prefix."_ele_comu_collegi as t1, ".$prefix."_ele_collegi as t2, ".$prefix."_ele_comuni as t3, ".$prefix."_ele_cons_comune as t4 where t1.id_cons_gen='$id_cons_gen' and t1.id_collegio=t2.id_collegio and t1.id_comune=t3.id_comune and t1.id_comune=t4.id_comune and t2.id_cons_gen=t4.id_cons_gen order by t2.descrizione, t3.descrizione", $dbi);
    182186#       else
    183         $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione", $dbi);
    184         while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
     187        $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione", $dbi);
     188        while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
    185189                $resconf = mysql_query("SELECT descrizione FROM ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi);
    186190                list($descr_conf) = mysql_fetch_row($resconf);
    187191                $i++;
    188192                $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
    189                 echo "<tr><td colspan=\"5\">";
     193                echo "<tr><td colspan=\"6\">";
    190194                echo "<form name=\"modello$i\" action=\"admin.php\">"
    191195                        ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">";
     
    198202                echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">";
    199203                echo "<table width=\"100%\"><tr align=\"center\" bgcolor=\"$bgcolor1\">";
    200                 echo "<td width=\"25%\"><b>$descr_coll</b></td>";
    201                 echo "<td width=\"25%\"><b>$descr_comu</b></td>";
     204                echo "<td width=\"27%\"><b>$descr_cons</b></td>";
     205                echo "<td width=\"27%\"><b>$descr_comu</b></td>";
     206                echo "<td width=\"12%\"><b>$preferenze2</b></td>";
    202207                $stato['0']=_ATTIVA;
    203208                $stato['1']=_CHIUSA;
    204209                $stato['2']=_NULLA;
    205                 echo "<td  width=\"15%\"><b>".$stato[$chiusa]."</b></td>";
     210                echo "<td  width=\"11%\"><b>".$stato[$chiusa]."</b></td>";
    206211                if($tipo_cons==3)
    207212                        echo "<td  width=\"25%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>";
     
    215220        }
    216221
    217 function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf) {
     222function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf,$preferenze) {
    218223        global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4;
    219224        $delcons=0;
     
    223228                        list($delcons)=mysql_fetch_row($rescomu);
    224229                        if (!$max){                     //se no la inserisce
    225                         $result = mysql_query("insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf) values ('0','$idcomunenew','$id_cons_gen','$id_conf')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
     230                        $result = mysql_query("insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf,preferenze) values ('0','$idcomunenew','$id_cons_gen','$id_conf','$preferenze')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
    226231                        $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi);
    227232                list($id_cons_comu)=mysql_fetch_row($rescomu);
     
    237242                        $result = mysql_query("update ".$prefix."_ele_comu_collegi set id_collegio= '$id_collegio' $newid where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi) || die(mysql_error());
    238243                        if (!$result) return;
    239                         $result = mysql_query("update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi)|| die(mysql_error());
     244                        $result = mysql_query("update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi)|| die(mysql_error());
    240245                        Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen");
    241246                }elseif ($do == "add") {
     
    282287//****************************
    283288        if ($op=="associazioni"){
    284                 associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$idcomune,$chiusa,$id_conf);
     289                associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$idcomune,$chiusa,$id_conf,$preferenze);
    285290        }
    286291        ele();
  • trunk/admin/modules/Elezioni/ele_voti.php

    r182 r185  
    489489$bgcolor2=$_SESSION['bgcolor2'];
    490490    //controlla se sono stati inseriti i votanti
     491$result = mysql_query("SELECT preferenze from ".$prefix."_ele_cons_comune where id_cons='$id_cons'",$dbi);
     492list($numprefs)=mysql_fetch_row($result);
    491493   
    492494if(!$votog and ($genere==3 or $genere==5))
     
    532534                        }
    533535                        list($votisezlis)=mysql_fetch_row($result);
    534                         if($votisezcand>$votisezlis)
     536                        if($votisezcand>($votisezlis*$numprefs))
    535537                                $segna="style=\"background-color: #dd0000;\"";
    536538
     
    581583                        }
    582584                        list($votisezlis)=mysql_fetch_row($result);
    583                         if($votisezcand>$votisezlis)
     585                        if($votisezcand>($votisezlis*$numprefs))
    584586                                echo "<table class=\"table-menu\" style=\"width: 50%;\"><tr><td style=\"background-color: rgb(255, 0, 0); color: black; text-align: center\"><img src=\"modules/Elezioni/images/alert.gif\" align=\"middle\" alt=\"\"><br/><b> ATTENZIONE!<BR/>I voti di preferenza $votisezcand <br/>superano i voti di lista $votisezlis</b><br></td></tr></table>";
    585587                       
  • trunk/admin/versione.php

    r183 r185  
    11<?php
    2 $versione="2.0 rev 183";
     2$versione="2.0 rev 185";
    33?>
  • trunk/client/versione.php

    r183 r185  
    11<?php
    2 $versione="2.0 rev 183";
     2$versione="2.0 rev 185";
    33?>
  • trunk/install/sql/eleonline.sql

    r162 r185  
    333333  `id_conf` int(11) NOT NULL default '0',
    334334  `preferita` enum('0','1') NOT NULL default '0',
     335  `preferenze` TINYINT( 1 ) NOT NULL DEFAULT '1',
    335336  PRIMARY KEY  (`id_cons`),
    336337  UNIQUE KEY `comune` (`id_comune`,`id_cons_gen`)
Note: See TracChangeset for help on using the changeset viewer.