Ignore:
Timestamp:
Feb 22, 2022, 10:40:08 PM (2 years ago)
Author:
roby
Message:

Admin: aggiunta la funzione di gestione dello spoglio per la singola sezione tramite tema per cellulari

File:
1 edited

Legend:

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

    r344 r358  
    8383        echo "} \n";
    8484        echo "</script>\n";
     85       
     86        ##############  onsubmit=\"check_aid()\"
     87/*      echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
     88        ."//-->\n";
     89        echo "function check_aid() {
     90          var elem=document.getElementById('descrcons'); var num=elem.length; alert (\"Please fill in your first name.\".num);
     91    for (i=0; i < elem.length; i++) { var sel=elem[i].value;
     92        if (elem[i].value == document.consultazione.descr_cons2.value) {
     93            document.consultazione.descr_cons2.style.backgroundColor = \"#ccc\";
     94               document.consultazione.descr_cons2.focus();
     95               return false;
     96        }
     97    }
     98        return false;
     99        }
     100       
     101            function hide(){
     102          var elem = document.getElementById('descrcons');
     103          elem.style.display = 'none';
     104        }";
     105
     106        echo "</script>\n"; */
     107###################
     108        $sql="select descrizione from ".$prefix."_ele_consultazione";
     109        $sth = $dbi->prepare("$sql");
     110        $sth->execute();       
     111        $row = $sth->fetch(PDO::FETCH_NUM);
     112        echo "<select id=\"descrcons\" style=\"visibility:hidden;\">";
     113        while(list($val)=$sth->fetch(PDO::FETCH_NUM)) {
     114                echo "<option value=\"$val\">$val</option>";
     115        }
     116        echo "</select>";
    85117#########################
    86118        if (isset($help)) include("language/$language/ele_consultazioni.html");
     
    127159                echo "<option value=\"$dfa1\" selected>$dfa1</option>"; anno();
    128160                echo "</td></tr><tr>";
    129                 $resdel = daticonscom();
    130                 if(count($resdel)==0)
    131                         echo "<td><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\"name=\"pwd3\" value=\"\" onclick=\"del_cons()\"></label></fieldset></td>";
     161                $sql="SELECT t1.tipo_cons,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'";
     162                $sth = $dbi->prepare("$sql");
     163                $sth->execute();
     164                $resdel=$sth->rowCount();       
     165                if($resdel==0)
     166                        echo "<td colspan=\"2\"><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\"name=\"pwd3\" value=\"\" onclick=\"del_cons()\" size=\"200px\"></label></fieldset></td>";
    132167                else echo "<td></td>";
    133                 echo "<td><input type=\"submit\" id=\"update\" name=\"update\" value=\""._MODIFY."\">"
     168                echo "</tr><tr><td><input type=\"submit\" id=\"update\" name=\"update\" value=\""._MODIFY."\">"
    134169                ."</td></tr></table></form>";
    135170        } else {
     
    249284                                $id_consulta=$id_cons_gen;
    250285                                $sql="insert into ".$prefix."_ele_consultazione (descrizione,data_inizio,data_fine,tipo_cons) values ('$descr_cons2','$data_inizio','$data_fine','$tipocons')";
    251                                 $sth = $dbi->prepare("$sql");
    252                                 $sth->execute();       
    253 
     286                                try {
     287                                        $sth = $dbi->prepare("$sql");
     288                                        $sth->execute();
     289                                }catch(PDOException $e) {
     290                                        if ($e->getCode() == 23000)
     291                                                echo "<h2 style=\"color:red;\">     Inserimento fallito: Esiste già una consultazione con il nome \"$descr_cons2\"</h2";
     292                                        else
     293                                                echo "<h2 style=\"color:red;\">     Inserimento fallito: ". $e->getMessage()."</h2";
     294                                }       
    254295                        } else {
    255296                        OpenTable();
     
    262303                        $data_fine="$dfa-$dfm-$dfg";
    263304                        $sql="update  ".$prefix."_ele_consultazione set  descrizione='$descr_cons2',data_inizio='$data_inizio',data_fine='$data_fine' WHERE id_cons_gen='$id_cons_gen'";
    264                         $sth = $dbi->prepare("$sql");
    265                         $sth->execute();       
     305                        try {
     306                                $sth = $dbi->prepare("$sql");
     307                                $sth->execute();
     308                        }catch(PDOException $e) {
     309                                if ($e->getCode() == 23000)
     310                                        echo "<h2 style=\"color:red;\">     Inserimento fallito: Esiste già una consultazione con il nome \"$descr_cons2\"</h2";
     311                                else
     312                                        echo "<h2 style=\"color:red;\">     Inserimento fallito: ". $e->getMessage()."</h2";
     313                        }       
    266314                        if (!$sth->rowCount()) return;
    267315                        Header("Location: admin.php?op=consultazione&id_cons_gen=$id_cons_gen");
Note: See TracChangeset for help on using the changeset viewer.