Changeset 77 for trunk/admin/modules/Elezioni/ele_associazioni.php
- Timestamp:
- Apr 15, 2010, 1:52:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_associazioni.php
r54 r77 49 49 /*Funzione di visualizzazione globale */ 50 50 /*****************************************************/ 51 // crea la pagina delle affluenze51 // 52 52 function all() { 53 53 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 55 $dbi=$_SESSION['dbi']; 56 56 $prefix=$_SESSION['prefix']; 57 57 ############# Controllo flag per cancellazione consultazione 58 echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n" 59 ."//-->\n"; 60 echo "function del_cons() {\n"; 61 echo "if (document.model.pwd3.checked==false) {\n"; 62 echo "document.model.chiusa.options[3].selected=false \n"; 63 echo "} \n"; 64 echo "if (document.model.chiusa.options[3].selected==false) { 65 \n"; 66 echo "document.model.add.value=\""._MODIFY."\" \n"; 67 echo "document.model.do.value=\"update\" \n"; 68 echo "}else{\n"; 69 echo "document.model.add.value=\""._DELETE." "._CONSULTA."\" \n"; 70 echo "document.model.do.value=\"delete\" \n"; 71 echo "} \n"; 72 echo "} \n"; 73 echo "</script>\n"; 74 ######################### 58 75 if (isset($help)) include("language/$language/ele_associazioni.html"); 59 76 OpenTable(); 60 echo "< hr><br>";77 echo "<tr><td><hr><br>"; 61 78 $res = mysql_query("SELECT descrizione FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'" , $dbi); 62 79 list ($descr_cons) = mysql_fetch_row($res); 63 80 //inserire avviso su mancanza dei permessi 64 81 echo "<form name=\"model\" action=\"admin.php\">"; 65 echo "<table >";82 echo "<table width=\"100%\" border=\"3\">"; 66 83 echo "<tr align=\"center\"><td bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>"; 67 84 # echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>"; 68 85 echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 69 echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td> ";86 echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td><td bgcolor=\"$bgcolor1\">"; 70 87 if($tipo_cons==3) 71 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>"; 72 echo "</tr>"; 88 echo "<b>"._CONF."</b>"; 73 89 echo "<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 74 echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&id_cons_gen=\">"; 75 echo "<tr align=\"center\">"; 76 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><td>$descr_cons</td>"; 90 # echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&id_cons_gen=\">"; 91 echo "</td></tr>"; 92 echo "<tr align=\"center\"><td>"; 93 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">$descr_cons</td>"; 77 94 # $ressede = mysql_query("SELECT id_collegio, descrizione from ".$prefix."_ele_collegi where id_cons_gen='$id_cons_gen' order by descrizione desc", $dbi); 78 95 # if ($num_coll=mysql_num_rows($ressede)){ … … 85 102 # } else echo "<td></td>"; 86 103 $rescomu = mysql_query("SELECT id_comune, descrizione from ".$prefix."_ele_comuni order by descrizione asc", $dbi); 87 echo "<td><select name=\"idcomunenew\">"; 104 echo "<td>"; 105 if($idcomune) { 106 while ($listele=mysql_fetch_array($rescomu)) 107 if($listele['id_comune']==$idcomune) { 108 echo $listele['descrizione']; 109 echo "<input type=\"hidden\" name=\"idcomunenew\" value=\"$idcomune\">"; 110 } 111 112 }else{ 113 echo "<select name=\"idcomunenew\">"; 88 114 echo "<option value=\"0\"> "; 89 115 while(list($id,$descr_comu)=mysql_fetch_row($rescomu)){ … … 91 117 echo "<option value=\"$id\" $sel>$descr_comu"; 92 118 } 93 echo "</select></td>"; 119 echo "</select>"; 120 } 121 echo "</td>"; 94 122 $selez['0']=''; 95 123 $selez['1']=''; 96 124 $selez['2']=''; 125 $selez['3']=''; 97 126 $selez[$chiusa]="selected"; 98 echo "<td><select name=\"chiusa\" >";127 echo "<td><select name=\"chiusa\" onChange=\"del_cons()\">"; 99 128 echo "<option value=\"0\" ".$selez[0].">"._ATTIVA; 100 129 echo "<option value=\"1\" ".$selez[1].">"._CHIUSA; 101 130 echo "<option value=\"2\" ".$selez[2].">"._NULLA; 131 132 if($idcomune) echo "<option value=\"3\" ".$selez[3].">"._ELIMINA; 102 133 echo "</select></td>"; 103 134 if($tipo_cons==3){ … … 113 144 } 114 145 unset($sel); 115 echo "< input type=\"hidden\" name=\"ok\" value=0>";146 echo "<td><input type=\"hidden\" name=\"ok\" value=0>"; 116 147 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"; 117 148 if ($idcomune) { 118 149 echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; 119 150 echo "<input type=\"hidden\" name=\"idcomune\" value=\"$idcomune\">"; 120 echo "<td><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td></tr></form>"; 151 echo "<input type=\"submit\" name=\"add\" value=\""._MODIFY."\" ></td></tr>"; 152 echo "<tr><td colspan=\"4\"><fieldset><legend>Abilita la cancellazione</legend><label id=\"prov\">Metti la spunta per poter eliminare la consultazione: <input type=\"checkbox\" name=\"pwd3\" value=\"\" onchange=\"del_cons()\"></label></fieldset>"; 121 153 }else{ 122 154 echo "<input type=\"hidden\" name=\"do\" value=\"add\">"; 123 echo "< td><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td></tr></form>";155 echo "<input type=\"submit\" name=\"add\" value=\""._ADD."\">"; 124 156 } 125 157 $i=0; 158 echo "</td></tr></table></form>"; 159 ############ 160 echo "<hr><br><table width=\"100%\" border=\"3\">"; 161 echo "<tr align=\"center\"><td width=\"25%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>"; 162 # echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>"; 163 echo "<td width=\"25%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 164 echo "<td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>"; 165 if($tipo_cons==3) 166 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>"; 167 echo "<td></td></tr>"; 168 ############### 169 126 170 # if ($num_coll>0) 127 171 # $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); … … 133 177 $i++; 134 178 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 179 echo "<tr><td colspan=\"5\">"; 135 180 echo "<form name=\"modello$i\" action=\"admin.php\">" 136 181 ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 137 182 // echo "<input type=\"hidden\" name=\"do\" value=\"update\">"; 138 echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio\">";183 # echo "<input type=\"hidden\" name=\"id_collegio\" value=\"$id_collegio\">"; 139 184 echo "<input type=\"hidden\" name=\"idcomune\" value=\"$id_comune2\">"; 140 185 echo "<input type=\"hidden\" name=\"id_cons_comu\" value=\"$id_cons_comu\">"; … … 142 187 echo "<input type=\"hidden\" name=\"desc\" value=\"$descr_cons\">"; 143 188 echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">"; 144 echo "<t r align=\"center\" bgcolor=\"$bgcolor1\">";145 echo "<td width=\" 32\"><b>$descr_coll</b></td>";146 echo "<td width=\" 32\"><b>$descr_comu</b></td>";189 echo "<table width=\"100%\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"; 190 echo "<td width=\"25%\"><b>$descr_coll</b></td>"; 191 echo "<td width=\"25%\"><b>$descr_comu</b></td>"; 147 192 $stato['0']=_ATTIVA; 148 193 $stato['1']=_CHIUSA; 149 194 $stato['2']=_NULLA; 150 echo "<td width=\"32\"><b>".$stato[$chiusa]."</b></td>";195 echo "<td width=\"15%\"><b>".$stato[$chiusa]."</b></td>"; 151 196 if($tipo_cons==3) 152 echo "<td width=\"32\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>"; 153 echo "<input type=\"hidden\" name=\"ok\" value=0>"; 154 echo "</td>"; 155 echo "<td><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">" 156 ."</td></tr></form>"; 157 } 158 echo "</table>"; 197 echo "<td width=\"25%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>"; 198 echo "<td width=\"10\"><input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">" 199 ."</td></tr></table></form></td></tr>\n"; 200 } 201 echo "</table></td></tr>"; 202 echo "</table></td></tr>"; 159 203 CloseTable(); 204 echo "</div>"; 160 205 } 161 206 162 207 function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf) { 163 208 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew; 209 $delcons=0; 164 210 if ($do !="" and $id_cons_gen>0 and $idcomunenew>0) { 165 $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi); 211 $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi); 166 212 $max = mysql_num_rows($rescomu); //esiste autorizzazione? 167 if (!$max){ //se no la inserisce 213 list($delcons)=mysql_fetch_row($rescomu); 214 if (!$max){ //se no la inserisce 168 215 $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()); 169 216 $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi); … … 181 228 $result = mysql_query("insert into ".$prefix."_ele_comu_collegi (id_collegio,id_cons,id_comune,id_cons_gen) values ('$id_collegio','$id_cons_comu','$idcomunenew','$id_cons_gen')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error()); 182 229 Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen"); 230 }elseif ($do == "delete" and $delcons>0) { 231 $idcns=$delcons; 232 $res_del = mysql_query("delete from ".$prefix."_ele_voti_ref where id_cons=$idcns" ,$dbi); 233 $res_del = mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons=$idcns" ,$dbi); 234 $res_del = mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons=$idcns" ,$dbi); 235 $res_del = mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons=$idcns" ,$dbi); 236 $res_del = mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons=$idcns" ,$dbi); 237 $res_del = mysql_query("delete from ".$prefix."_ele_candidati where id_cons=$idcns" ,$dbi); 238 $res_del = mysql_query("delete from ".$prefix."_ele_lista where id_cons=$idcns" ,$dbi); 239 $res_del = mysql_query("delete from ".$prefix."_ele_gruppo where id_cons=$idcns" ,$dbi); 240 $res_del = mysql_query("delete from ".$prefix."_ele_sezioni where id_cons=$idcns" ,$dbi); 241 $res_del = mysql_query("delete from ".$prefix."_ele_cons_comune where id_cons=$idcns" ,$dbi); 242 243 Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen"); 183 244 } 184 245 } 185 246 } 186 247 248 249 250 251 # die ("do:$do - id_cons:$id_cons_comu - idcomune:$id_comune - new: $idcomunenew"); 187 252 188 253 //****************************
Note:
See TracChangeset
for help on using the changeset viewer.