You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

287 lines
10 KiB

<br>
<?php
if($_POST['go']){
for($i=0;$i<count(@$_POST["farmacie"]);$i++){
$q=mysqli_query($dbConn, "INSERT INTO giorni VALUES(null,'".converti($_POST['nome'])."','".converti($_POST['sigla'])."','".$_POST["farmacie"][$i]."',
'".$_POST['notte_stato']."','".$_POST['pranzo_stato']."','".$_POST['sera_stato']."',
'".$_POST['mattina_from_h'].":".$_POST['mattina_from_m'].":00',
'".$_POST['mattina_to_h'].":".$_POST['mattina_to_m'].":00','".$_POST['mattina_stato']."',
'".$_POST['pomeriggio_from_h'].":".$_POST['pomeriggio_from_m'].":00',
'".$_POST['pomeriggio_to_h'].":".$_POST['pomeriggio_to_m'].":00','".$_POST['pomeriggio_stato']."',
'".$_POST['colore']."')");
}
if($q){
@include 'res_ok.php';
}else{
@include 'res_ko.php';
}
}else{
?>
<form method="post">
<table border="0" cellspacing="2" cellpadding="0" width="750">
<tr><td align="left" valign="middle" class="title">&nbsp; <b>Ambito territoriale</b></td></tr>
<tr><td width="750" colspan="2"><select name="ida" style="width: 750px" onChange="this.form.submit()">
<option value=""> - Seleziona l'ambito territoriale - </option>
<?php
$qa=mysqli_query($dbConn, "SELECT * FROM ambiti ORDER BY descrizione");
while($ra=mysqli_fetch_array($qa)){
echo "<option value=\"".$ra['id']."\" ";
if($ra['id']==@$_POST['ida']){echo "selected";}
echo ">".$ra['descrizione']."</option>\n";
}
?>
</select></td></tr>
</table>
<table border="0" cellspacing="5" cellpadding="0" width="760">
<?php
if(@$_POST['ida']){
$qac=mysqli_query($dbConn, "SELECT comuni FROM ambiti WHERE id='".@$_POST['ida']."'");
$rac=mysqli_fetch_array($qac);
?>
<tr><td align="center" valign="top" colspan="2">&nbsp;</td></tr>
<tr><td width="200" class="title" align="left">&nbsp; <b>Farmacie</b></td><td class="title" align="left">&nbsp; <b>Giorni tipici generici</b></td></tr>
<tr><td width="200" align="left" valign="top" rowspan="4" bgcolor="#ffffff"><br>
<table border="0" cellspacing="0" cellpadding="0">
<?php
$q=mysqli_query($dbConn, "SELECT * FROM farmacie WHERE comune IN(".str_replace("#",",",$rac['comuni']).") ORDER BY nome");
while($r=mysqli_fetch_array($q)){
echo "<tr><td align=\"left\" valign=\"top\"><input type=\"checkbox\" id=\"farmacie\" name=\"farmacie[]\" value=\"".$r['id']."\"></td>\n";
echo "<td align=\"left\" valign=\"middle\">".$r['nome']."</td></tr>\n";
}
?>
</table><br><br><center>
<input type="button" value=" seleziona tutto " onClick="selectAllFarmacie()">
</center><br><br>
</td><td align="right" valign="top" height="25">
<select name="idg" style="width: 560px" onChange="this.form.submit()">
<option value=""> - Seleziona un giorno - </option>
<?php
$qg=mysqli_query($dbConn, "SELECT * FROM giorni WHERE farmacia='ALL'");
while($rg=mysqli_fetch_array($qg)){
echo "<option value=\"".$rg['id']."\" ";
if($rg['id']==@$_POST['idg']){echo "selected";}
echo ">".$rg['sigla']." - ".$rg['nome']."</option>\n";
}
?>
</select>
</td></tr>
<tr><td align="right" valign="top" height="60"><br>
<?php
if(@$_POST['idg']){
$qgg=mysqli_query($dbConn, "SELECT * FROM giorni WHERE id='".@$_POST['idg']."'");
$rgg=mysqli_fetch_array($qgg);
}
?>
<table border="0" cellspacing="2" cellpadding="0" width="100%">
<tr><td class="title" align="left">&nbsp; <b>Nome</b></td><td class="title" align="left">&nbsp; <b>Sigla</b></td></tr>
<tr><td width="50%"><input type="text" name="nome" style="width: 275px" value="<?php echo $rgg['nome'];?>"></td>
<td width="50%"><input type="text" name="sigla" style="width: 275px" value="<?php echo $rgg['sigla'];?>"></td></tr>
</table>
</td></tr>
<tr><td align="center" valign="top" colspan="2" height="15">&nbsp;</td></tr>
<tr><td align="center" valign="top" colspan="2">
<table border="0" cellspacing="2" cellpadding="0" width="100%">
<tr><td class="title" width="180" align="left">&nbsp; <b>Notte (dalle ore 00.00)</b></td><td class="title" colspan="2" align="left">&nbsp; <b>Mattino</b></td></tr>
<tr><td align="left" valign="top">
<select name="notte_stato" style="width: 100%">
<option value="Chiuso" <?php if($rgg['notte']=="Chiuso"){echo "selected";}?>>Chiuso</option>
<option value="Reperible" <?php if($rgg['notte']=="Reperible"){echo "selected";}?>>Reperible</option>
<option value="Aperto" <?php if($rgg['notte']=="Aperto"){echo "selected";}?>>Aperto</option>
</select></td>
<td valign="top" align="right" class="txt_lit_grey">dalle:
<select name="mattina_from_h">
<?php
for($i=5;$i<=11;$i++){
echo "<option value=\"".str_pad($i, 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['mattina_from'],0,2)==str_pad($i, 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad($i, 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
<select name="mattina_from_m">
<?php
for($i=0;$i<12;$i++){
echo "<option value=\"".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['mattina_from'],3,2)==str_pad(($i*5), 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
alle:
<select name="mattina_to_h">
<?php
for($i=11;$i<=16;$i++){
echo "<option value=\"".str_pad($i, 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['mattina_to'],0,2)==str_pad($i, 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad($i, 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
<select name="mattina_to_m">
<?php
for($i=0;$i<12;$i++){
echo "<option value=\"".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['mattina_to'],3,2)==str_pad(($i*5), 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
</td><td align="right">
<select name="mattina_stato">
<option value="Chiuso" <?php if($rgg['mattina_stato']=="Chiuso"){echo "selected";}?>>Chiuso</option>
<option value="Reperible" <?php if($rgg['mattina_stato']=="Reperible"){echo "selected";}?>>Reperible</option>
<option value="Aperto" <?php if($rgg['mattina_stato']=="Aperto"){echo "selected";}?>>Aperto</option>
</select></td></tr>
<tr><td align="center" valign="top" colspan="3">&nbsp;</td></tr>
</table>
<table border="0" cellspacing="2" cellpadding="0" width="100%">
<tr><td class="title" width="180" align="left">&nbsp; <b>Pausa pranzo</b></td><td class="title" colspan="2" align="left">&nbsp; <b>Pomeriggio</b></td></tr>
<tr><td align="left" valign="top">
<select name="pranzo_stato" style="width: 100%">
<option value="Chiuso" <?php if($rgg['pranzo']=="Chiuso"){echo "selected";}?>>Chiuso</option>
<option value="Reperible" <?php if($rgg['pranzo']=="Reperible"){echo "selected";}?>>Reperible</option>
<option value="Aperto" <?php if($rgg['pranzo']=="Aperto"){echo "selected";}?>>Aperto</option>
</select></td>
<td valign="top" align="right" class="txt_lit_grey">dalle:
<select name="pomeriggio_from_h">
<?php
for($i=14;$i<=20;$i++){
echo "<option value=\"".str_pad($i, 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['pomeriggio_from'],0,2)==str_pad($i, 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad($i, 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
<select name="pomeriggio_from_m">
<?php
for($i=0;$i<12;$i++){
echo "<option value=\"".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['pomeriggio_from'],3,2)==str_pad(($i*5), 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
alle:
<select name="pomeriggio_to_h">
<?php
for($i=17;$i<=23;$i++){
echo "<option value=\"".str_pad($i, 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['pomeriggio_to'],0,2)==str_pad($i, 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad($i, 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
<select name="pomeriggio_to_m">
<?php
for($i=0;$i<12;$i++){
echo "<option value=\"".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."\" ";
if(substr($rgg['pomeriggio_to'],3,2)==str_pad(($i*5), 2, 0, STR_PAD_LEFT)){echo "selected";}
echo ">".str_pad(($i*5), 2, 0, STR_PAD_LEFT)."</option>\n";
}
?>
</select>
</td><td align="right">
<select name="pomeriggio_stato">
<option value="Chiuso" <?php if($rgg['pomeriggio_stato']=="Chiuso"){echo "selected";}?>>Chiuso</option>
<option value="Reperible" <?php if($rgg['pomeriggio_stato']=="Reperible"){echo "selected";}?>>Reperible</option>
<option value="Aperto" <?php if($rgg['pomeriggio_stato']=="Aperto"){echo "selected";}?>>Aperto</option>
</select></td></tr>
<tr><td align="center" valign="top" colspan="3">&nbsp;</td></tr>
</table>
<table border="0" cellspacing="2" cellpadding="0" width="100%">
<tr><td class="title" width="180" align="left">&nbsp; <b>Sera (fino alle 23.59)</b></td><td class="title" colspan="2" align="left">&nbsp; <b>Colore</b></td></tr>
<tr><td align="left" valign="top">
<select name="sera_stato" style="width: 100%">
<option value="Chiuso" <?php if($rgg['sera']=="Chiuso"){echo "selected";}?>>Chiuso</option>
<option value="Reperible" <?php if($rgg['sera']=="Reperible"){echo "selected";}?>>Reperible</option>
<option value="Aperto" <?php if($rgg['sera']=="Aperto"){echo "selected";}?>>Aperto</option>
</select></td>
<td valign="top" align="right" class="txt_lit_grey">
<?php
for($i=0;$i<3;$i++){
for($y=0;$y<3;$y++){
for($x=0;$x<3;$x++){
echo "<input type=\"button\" name=\"color_select\" ".
"style=\"width: 35px; height:35px; background-color: rgb(".($i*127).",".($y*127).",".($x*127)."); margin:2px; float:left\" ".
" onClick=\"document.getElementById('colore').value='rgb(".($i*127).",".($y*127).",".($x*127).")';document.getElementById('colore_sel').style.backgroundColor='rgb(".($i*127).",".($y*127).",".($x*127).")';\">\n ";
}}}
?>
<div id="colore_sel" style="position:relative;width:350px;float:left; height:50px;background-color:<?php if($rgg['colore']){echo $rgg['colore'];}else{echo "rgb(0,0,0)";};?>">
<br><center>COLORE SELEZIONATO</center>
</div>
<input type="hidden" name="colore" id="colore" value="<?php if($rgg['colore']){echo $rgg['colore'];}else{echo "rgb(0,0,0)";};?>">
</td></tr>
<tr><td align="center" valign="top" colspan="2">&nbsp;</td></tr>
</table>
</td></tr>
<tr><td align="center" valign="top" colspan="2">&nbsp;</td></tr>
<tr><td width="750" align="right" colspan="2"><input type="submit" name="go" value=" Crea giorno tipico " class="button"></td></tr>
<tr><td align="center" valign="top" colspan="2">&nbsp;</td></tr>
<?php
}
?>
</table></form>
<?php
}
?>