Changeset 189 for trunk/admin/modules/Elezioni/ele_associazioni.php
- Timestamp:
- Mar 2, 2014, 4:49:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_associazioni.php
r187 r189 39 39 if (isset($_GET['chiusa'])) $chiusa=intval($_GET['chiusa']); else $chiusa=''; 40 40 if (isset($_GET['id_conf'])) $id_conf=intval($_GET['id_conf']); else $id_conf=0; 41 if (isset($_GET['idfascia'])) $idfascia=intval($_GET['idfascia']); else $idfascia=0; 41 42 if (isset($_GET['min'])) $min=intval($_GET['min']); else $min=0; 42 43 if (isset($_GET['help'])) $help=intval($_GET['help']); 43 44 if (isset($_GET['pwd4'])) $pwd4=intval($_GET['pwd4']); 44 45 if (isset($_GET['preferenze'])) $preferenze=intval($_GET['preferenze']); else $preferenze=1; 46 if (isset($_GET['vismf'])) $vismf=intval($_GET['vismf']); else $vismf=0; 45 47 46 48 $offset=15; … … 53 55 // 54 56 function all() { 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 ;57 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,$idfascia,$vismf; 56 58 $aid=$_SESSION['aid']; 57 59 $dbi=$_SESSION['dbi']; … … 94 96 echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 95 97 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>"; 96 echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td><td bgcolor=\"$bgcolor1\">"; 97 if($tipo_cons==3) 98 echo "<b>"._CONF."</b>"; 98 echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>"; 99 if($tipo_cons==3){ 100 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>"; 101 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>"; 102 } 103 echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>"; 104 # echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&id_cons_gen=\">"; 105 echo "</tr>"; 106 echo "<tr align=\"center\"><td>"; 99 107 echo "<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; 100 # echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?op=associazioni&id_cons_gen=\">";101 echo "</td></tr>";102 echo "<tr align=\"center\"><td>";103 108 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">$descr_cons</td>"; 104 109 # $ressede = mysql_query("SELECT id_collegio, descrizione from ".$prefix."_ele_collegi where id_cons_gen='$id_cons_gen' order by descrizione desc", $dbi); … … 144 149 echo "</select></td>"; 145 150 if($tipo_cons==3){ 151 if($idcomune) { 152 $rescomu = mysql_query("SELECT id_fascia from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomune'", $dbi); 153 if($rescomu) 154 list($fasciacom)=mysql_fetch_row($rescomu); 155 } else $fasciacom=0; 146 156 $rescomu = mysql_query("SELECT id_conf, descrizione from ".$prefix."_ele_conf order by descrizione asc", $dbi); 147 echo "<td><select name=\"id_conf\" >";157 echo "<td><select name=\"id_conf\" id=\"id_conf\" onchange=\"javascript:showdate('modules/Elezioni/ele_desc_fasce.php?fascia=$fasciacom&id_conf=' + model.id_conf.options[model.id_conf.selectedIndex].value,'fasceconf');\">"; 148 158 echo "<option value=\"0\"> "; 149 159 while(list($id,$descr_conf)=mysql_fetch_row($rescomu)){ … … 153 163 } 154 164 echo "</select></td>"; 165 if(!$id_conf) $id_conf=1; 166 $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi); 167 168 echo "<td id=\"fasceconf\"><select name=\"idfascia\">"; 169 echo "<option value=\"0\"> "; 170 $inffascia=0; 171 while(list($id,$abitanti)=mysql_fetch_row($rescomu)){ 172 $sel=''; 173 if ($idcomune and $id == $fasciacom) $sel="selected"; elseif ($id==1) $sel="selected"; 174 echo "<option value=\"$id\" $sel>$inffascia - $abitanti"; 175 $inffascia=$abitanti; 176 } 177 echo "</select></td>"; 178 179 155 180 } 156 181 unset($sel); 182 $rescomu = mysql_query("SELECT vismf from ".$prefix."_ele_cons_comune where id_cons='$id_cons'", $dbi); 183 list($vismf)=mysql_fetch_row($rescomu); 184 echo "<td><select name=\"vismf\">"; 185 if ($vismf==0) $sel="selected"; else $sel=""; 186 echo "<option value=\"0\" $sel>No"; 187 if ($vismf==1) $sel="selected"; else $sel=""; 188 echo "<option value=\"1\" $sel>Si"; 189 echo "</select></td>"; 190 157 191 echo "<td><input type=\"hidden\" name=\"ok\" value=0>"; 158 192 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"; … … 172 206 ############ 173 207 echo "<hr><br><table width=\"100%\" border=\"3\">"; 174 echo "<tr align=\"center\"><td width=\" 25%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";208 echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>"; 175 209 # echo "<td bgcolor=\"$bgcolor1\"><b>"._COLLEGI."</b></td>"; 176 echo "<td width=\"2 5%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";210 echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"; 177 211 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>"; 178 212 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>"; 179 if($tipo_cons==3) 180 echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>"; 213 if($tipo_cons==3){ 214 echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>"; 215 echo "<td width=\"20%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>"; 216 } 217 echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>"; 181 218 echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b> "._FUNZIONI."</td></tr>"; 182 219 ############### … … 185 222 # $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); 186 223 # else 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 inseriti224 $resmod = mysql_query("SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze,t1.id_fascia,t1.vismf 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); 225 while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2,$fasciacom,$vismf) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti 189 226 $resconf = mysql_query("SELECT descrizione FROM ".$prefix."_ele_conf where id_conf='$id_conf'", $dbi); 190 227 list($descr_conf) = mysql_fetch_row($resconf); 191 228 $i++; 192 229 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; 193 echo "<tr><td colspan=\"6\">";230 if($tipo_cons==3) echo "<tr><td colspan=\"8\">"; else echo "<tr><td colspan=\"6\">"; 194 231 echo "<form name=\"modello$i\" action=\"admin.php\">" 195 232 ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">"; … … 203 240 echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">"; 204 241 echo "<table width=\"100%\"><tr align=\"center\" bgcolor=\"$bgcolor1\">"; 205 echo "<td width=\" 27%\"><b>$descr_cons</b></td>";206 echo "<td width=\"2 7%\"><b>$descr_comu</b></td>";207 echo "<td width=\"1 2%\"><b>$preferenze2</b></td>";242 echo "<td width=\"15%\"><b>$descr_cons</b></td>"; 243 echo "<td width=\"20%\"><b>$descr_comu</b></td>"; 244 echo "<td width=\"10%\"><b>$preferenze2</b></td>"; 208 245 $stato['0']=_ATTIVA; 209 246 $stato['1']=_CHIUSA; 210 247 $stato['2']=_NULLA; 211 echo "<td width=\"11%\"><b>".$stato[$chiusa]."</b></td>"; 212 if($tipo_cons==3) 213 echo "<td width=\"25%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>"; 248 echo "<td width=\"10%\"><b>".$stato[$chiusa]."</b></td>"; 249 if($tipo_cons==3){ 250 echo "<td width=\"20%\"><input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\"><b>".$descr_conf."</b></td>"; 251 $rescomu = mysql_query("SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'", $dbi); 252 $inffascia=0; 253 while(list($id,$abitanti)=mysql_fetch_row($rescomu)){ 254 $sel=''; 255 if ($id == $fasciacom) 256 echo "<td width=\"20%\">$inffascia - $abitanti</td>"; 257 $inffascia=$abitanti; 258 } 259 260 } 261 if ($vismf==0) $sel=_NO; else $sel=_SI; 262 echo "<td width=\"10%\">$sel</td>"; 214 263 echo "<td width=\"10\"><input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">" 215 264 ."</td></tr></table></form></td></tr>\n"; … … 222 271 223 272 function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf,$preferenze) { 224 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4 ;273 global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4,$idfascia,$vismf; 225 274 $delcons=0; 226 275 if ($do !="" and $id_cons_gen>0 and $idcomunenew>0) { … … 229 278 list($delcons)=mysql_fetch_row($rescomu); 230 279 if (!$max){ //se no la inserisce 231 $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());280 $result = mysql_query("insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf,preferenze,id_fascia,vismf) values ('0','$idcomunenew','$id_cons_gen','$id_conf','$preferenze','$idfascia','$vismf')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error()); 232 281 $rescomu = mysql_query("SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'", $dbi); 233 282 list($id_cons_comu)=mysql_fetch_row($rescomu); … … 243 292 $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()); 244 293 if (!$result) return; 245 $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());294 $result = mysql_query("update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze',id_fascia='$idfascia',vismf='$vismf' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi)|| die(mysql_error()); 246 295 Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen"); 247 296 }elseif ($do == "add") {
Note:
See TracChangeset
for help on using the changeset viewer.