Changeset 358 for trunk/admin/modules/Elezioni/ele_permessi.php
- Timestamp:
- Feb 22, 2022, 10:40:08 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_permessi.php
r344 r358 24 24 list($tipo_cons,$id_cons) = $res->fetch(PDO::FETCH_NUM); 25 25 if (isset($param['aid2'])) $aid2=addslashes($param['aid2']); else $aid2=''; 26 if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede= '';26 if (isset($param['id_sede'])) $id_sede=intval($param['id_sede']); else $id_sede=0; 27 27 if (isset($param['do'])) $do=addslashes($param['do']); else $do=''; 28 28 if (isset($param['permessi'])) $permessi=addslashes($param['permessi']); else $permessi=''; … … 30 30 if (isset($param['ok'])) $ok=intval($param['ok']); else $ok=''; 31 31 if (isset($param['mex'])) $mex=addslashes($param['mex']); else $mex=''; 32 if (isset($param['id_sez'])) $id_sez=intval($param['id_sez']); else $id_sez=0; 32 33 33 34 include("modules/Elezioni/funzionidata.php"); … … 39 40 //crea la pagina delle affluenze 40 41 function all() { 41 global $adminop,$adminsuper,$admincomune,$aid, $offset, $prefix, $dbi,$id_cons,$aid2,$permessi,$id_sede,$id_cons_gen,$id_comune,$mex ;42 global $adminop,$adminsuper,$admincomune,$aid, $offset, $prefix, $dbi,$id_cons,$aid2,$permessi,$id_sede,$id_cons_gen,$id_comune,$mex,$id_sez; 42 43 $bgcolor1=$_SESSION['bgcolor1']; 44 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n" 45 46 ."//-->\n"; 47 echo "function controlloref(idsede,idsez) {\n"; 48 echo "let element = window.document.getElementById(idsede); \n"; 49 echo "let elecontr = window.document.getElementById(idsez); \n"; 50 echo "element.selectedIndex = 0 ; \n"; 51 echo "}\n"; 52 echo "function controllosez(idsez, idsede) {\n"; 53 echo "let element = window.document.getElementById(idsez); \n"; 54 echo "let elecontr = window.document.getElementById(idsede); \n"; 55 echo "element.selectedIndex = 0; \n"; 56 echo "}\n"; 57 echo "</script>\n"; 43 58 if (isset($mex)){ 44 59 echo "<table align=\"center\"><tr><td style=\"background-color: rgb(255, 0, 0)\">"; … … 54 69 echo "<td><b>"._UTENTE."</b></td>" 55 70 ."<td bgcolor=\"$bgcolor1\"><b>"._SEDE."</b></td>" 71 ."<td bgcolor=\"$bgcolor1\"><b>"._SEZIONE."</b></td>" 56 72 ."<td bgcolor=\"$bgcolor1\"><b>"._PERMESSI."</b></td>"; 57 73 echo "<td bgcolor=\"$bgcolor1\"><b>"._FUNZIONI."</b></td></tr>"; … … 71 87 72 88 if (!$listmp) $listmp="''"; 73 $sql="select aid from ".$prefix."_authors where id_comune=$id_comune and (admincomune= 1and aid not in ($listmp)) order by aid"; // operatori registrati ma non ancora autorizzati89 $sql="select aid from ".$prefix."_authors where id_comune=$id_comune and (admincomune=0 and adminop=0 and aid not in ($listmp)) order by aid"; // operatori registrati ma non ancora autorizzati 74 90 $resins = $dbi->prepare("$sql"); 75 91 $resins->execute(); 76 77 92 78 93 echo "<form name=\"autorizza\" action=\"admin.php\">" 79 94 ."<input type=\"hidden\" name=\"op\" value=\"permessi\">"; … … 90 105 $ressede = $dbi->prepare("$sql"); 91 106 $ressede->execute(); 92 echo "<td><select name=\"id_sede\">";107 echo "<td><select id=\"id_sede\" name=\"id_sede\" onchange=controllosez('id_sez','id_sede')>"; 93 108 echo "<option value=\"0\"> "._TUTTESEDI; 94 109 if($ressede->rowCount()) … … 99 114 } 100 115 echo "</select></td>"; 116 $sql="SELECT id_sez, num_sez from ".$prefix."_ele_sezioni where id_cons=$id_cons order by num_sez"; 117 $ressez = $dbi->prepare("$sql"); 118 $ressez->execute(); 119 echo "<td><select id=\"id_sez\" name=\"id_sez\" onchange=controlloref('id_sede','id_sez')>"; 120 echo "<option value=\"0\"> "; 121 if($ressez->rowCount()) 122 while(list($id,$descr)=$ressez->fetch(PDO::FETCH_NUM)){ 123 $sel= ($id == $id_sez) ? "selected":""; 124 $arr[$id]=$descr; 125 echo "<option value=\"$id\" $sel>$descr"; 126 } 127 echo "</select></td>"; 101 128 echo "<td><select name=\"permessi\">"; 102 129 if(!isset($permessi)) $permessi=16; … … 115 142 if($resmod->rowCount()){ 116 143 $i=1; 117 while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente ) = $resmod->fetch(PDO::FETCH_NUM)){144 while (list($id_cons2,$id_sede2,$id_comunetemp,$perm,$utente,$id_circ2,$id_sez2) = $resmod->fetch(PDO::FETCH_NUM)){ 118 145 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 119 146 echo "<form name=\"modello$i\" action=\"admin.php\">" … … 128 155 $ressede = $dbi->prepare("$sql"); 129 156 $ressede->execute(); 130 echo "<td><select name=\"id_sede\">"; 131 echo "<option value=\"0\"> "._TUTTESEDI; 157 echo "<td><select id=\"id_sede$i\" name=\"id_sede\" onchange=controllosez('id_sez$i','id_sede$i')>"; 158 # if($id_sez2) 159 # echo "<option value=\"0\"> "; 160 # else 161 echo "<option value=\"0\"> "._TUTTESEDI; 132 162 while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){ 133 163 $sel= ($id == $id_sede2) ? "selected":""; … … 136 166 } 137 167 echo "</select></td>"; 168 $sql="SELECT id_sez, num_sez from ".$prefix."_ele_sezioni where id_cons=$id_cons order by num_sez"; 169 $ressez = $dbi->prepare("$sql"); 170 $ressez->execute(); 171 echo "<td><select id=\"id_sez$i\" name=\"id_sez\" onchange=controlloref('id_sede$i','id_sez$i')>"; 172 echo "<option value=\"0\"> "; 173 if($ressez->rowCount()) 174 while(list($id,$descr)=$ressez->fetch(PDO::FETCH_NUM)){ 175 $sel= ($id == $id_sez2) ? "selected":""; 176 $arr[$id]=$descr; 177 echo "<option value=\"$id\" $sel>$descr"; 178 } 179 echo "</select></td>"; 138 180 echo "<td><select name=\"permessi\">"; 139 181 if(!isset($perm)) $perm=16; … … 153 195 } 154 196 155 function permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune ) {197 function permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune,$id_sez) { 156 198 global $prefix, $dbi, $id_cons,$id_cons_gen,$currentlang; 157 199 $perms=ChiSei($id_cons_gen); … … 159 201 if ($perms>32 and $permessi<$perms and $aid2) { 160 202 if ($do == "autorizza") { 161 $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid ) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2')";203 $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid,id_sez) values ('$id_cons','$id_sede','$id_comune','$permessi','$aid2','$id_sez')"; 162 204 $res = $dbi->prepare("$sql"); 163 205 $res->execute(); 164 206 Header("Location: admin.php?op=permessi&id_cons_gen=$id_cons_gen"); 165 207 } elseif ($do == "update") { 166 $sql="update ".$prefix."_ele_operatori set id_sede='$id_sede' , permessi='$permessi' where id_cons='$id_cons' and aid='$aid2' ";208 $sql="update ".$prefix."_ele_operatori set id_sede='$id_sede', permessi='$permessi', id_sez='$id_sez' where id_cons='$id_cons' and aid='$aid2' "; 167 209 $res = $dbi->prepare("$sql"); 168 210 $res->execute(); … … 178 220 // switch 179 221 //**************************** 180 if ($do) permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune );222 if ($do) permessi($ok, $do,$aid2,$id_sede,$permessi,$id_comune,$id_sez); 181 223 ele(); 182 224 all();
Note:
See TracChangeset
for help on using the changeset viewer.