예약 프로그램 스킨에서 궁금증...
본문
아래는 전체 소스이고... 혼자 하다보니 코드가 완전 초보 코드입니다..
아래 코드대로하면 예약이 되면 시간이 항목에서 빠지기 때문에 셀렉트 display:none 부분이 다른 항목으로
넘어가면 빠진부분에서 항목이 채워져서 앞에 항목으로 따라 올라가는데..
혹시 이 부분을 코드를 좀 고쳐서 해결할 수 있을까요....ㅜㅜ
아니면.. 현재는 시간이 지나면
if ($v_strtotime > $now_strtotime )
{
$reservation_yn = "Y";
}
이 부분으로 클릭을 하면 예약 불가가 되게 만들어져있는데
예약이 되면 항목이 사라지는 것이 아니라 예약 불가로 만들 수는 없을까요..?
고수님들 도와주세요 도움이 필요합니다 ㅜㅜ 흐엉
<code>
<?php
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING );
include_once('./_common.php');
$currdate = $_GET["currdate"];
$nowdate = date("Ymd",time());
$day_type = date("N",strtotime($currdate)); // 1~5 평일, 6 토요일
//echo $k2 = substr($bb,6, 6);
$time_array[1] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$time_array[2] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$time_array[3] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$time_array[4] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$time_array[5] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$time_array[6] = array("오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00","오전 09:30","오전 10:00","오전 10:30","오전 11:00","오전 11:30","오후 12:00","오후 12:30","오후 13:00","오후 13:30","오후 14:00","오후 14:30","오후 15:00","오후 15:30","오후 16:00","오후 16:30",
"오전 09:00 ~ 11:30","오전 11:30 ~ 오후 14:00","오후 14:00 ~ 오후 17:00");
$now_hour = date("H:i",time());
$query = "select * from g5_write_res WHERE wr_1='".$currdate."' ";
$result = sql_query($query);
$a = array();
$b = array();
$c = array();
$d = array();
$e = array();
for($i=0;$row=sql_fetch_array($result);$i++){ $a[$i]=$row['wr_2']; }
$a1 = count($a);
$b1 = count($b);
$c1 = count($c);
$d1 = count($d);
$e1 = count($e);
$admin_write1 = sql_fetch("select count(*) as cnt from g5_write_res where wr_1='".$currdate."' ");
$total = count($time_array[$day_type]) - $admin_write1['cnt'];
?>
<div class="schedule">
<div class="time">
<div class="time_list" id="time_list">
<select onChange="change(this.options[this.selectedIndex].value)">
<option>::: 선택하기 :::</option>
<option value="selectBox01">AI 600 (Chemi doc)</option>
<option value="selectBox02">형광 현미경</option>
<option value="selectBox03">FACS</option>
<option value="selectBox04">Realtime PCR</option>
</select>
<!--------------------------------------------------------------------->
<ul class="bu4" id="view1" style="display:none">
<?php
$sym_diff = array_values(array_diff(array_merge($time_array[$day_type], $a), array_intersect($time_array[$day_type], $a)));
for($i=0; $i<16-$b1; $i++){
$reservation_yn = "N";
$aaa = $sym_diff[$i];
$k2 = substr($aaa,6, 6);
$now = date("H:i");
$k2 = str_replace(':','',$k2);
$now = str_replace(':','',$now);
$v_strtotime = strtotime($currdate.$k2);
$now_strtotime = strtotime($nowdate.$now);
if ($v_strtotime > $now_strtotime )
{
$reservation_yn = "Y";
}
?>
<li class="time_cls {currtime:'<?php echo $aaa?>',reservation_yn:'<?php echo $reservation_yn?>'}"><a href="javascript:void(0);" class="showme"><?php echo $aaa?> <?php echo $reservation_yn=="Y"?"(예약가능)":"(예약불가)"?></a></li>
<?} ?>
</ul>
<!--------------------------------------------------------------------->
<ul id="view2" style="display:none">
<?php
$sym_diff = array_values(array_diff(array_merge($time_array[$day_type], $a), array_intersect($time_array[$day_type], $a)));
for($i=16-$b1; $i<32-$c1; $i++){
$reservation_yn = "N";
$aaa = $sym_diff[$i];
$k2 = substr($aaa,6, 6);
$now = date("H:i");
$k2 = str_replace(':','',$k2);
$now = str_replace(':','',$now);
$v_strtotime = strtotime($currdate.$k2);
$now_strtotime = strtotime($nowdate.$now);
if ($v_strtotime > $now_strtotime )
{
$reservation_yn = "Y";
}
?>
<li class="time_cls {currtime:'<?php echo $aaa?>',reservation_yn:'<?php echo $reservation_yn?>'}"><a href="javascript:void(0);" class="showme"><?php echo $aaa?> <?php echo $reservation_yn=="Y"?"(예약가능)":"(예약불가)"?></a></li>
<?} ?>
</ul>
<!--------------------------------------------------------------------->
<ul class="bu4" id="view3" style="display:none">
<?php
$sym_diff = array_values(array_diff(array_merge($time_array[$day_type], $a), array_intersect($time_array[$day_type], $a)));
for($i=32-$c1; $i<48-$d1; $i++){
$reservation_yn = "N";
$aaa = $sym_diff[$i];
$k2 = substr($aaa,6, 6);
$now = date("H:i");
$k2 = str_replace(':','',$k2);
$now = str_replace(':','',$now);
$v_strtotime = strtotime($currdate.$k2);
$now_strtotime = strtotime($nowdate.$now);
if ($v_strtotime > $now_strtotime )
{
$reservation_yn = "Y";
}
?>
<li class="time_cls {currtime:'<?php echo $aaa?>',reservation_yn:'<?php echo $reservation_yn?>'}"><a href="javascript:void(0);" class="showme"><?php echo $aaa?> <?php echo $reservation_yn=="Y"?"(예약가능)":"(예약불가)"?></a></li>
<?} ?>
</ul>
<!--------------------------------------------------------------------->
<ul class="bu4" id="view4" style="display:none">
<?php
$sym_diff = array_values(array_diff(array_merge($time_array[$day_type], $a), array_intersect($time_array[$day_type], $a)));
for($i=48-$d1; $i<51-$e1; $i++){
$reservation_yn = "N";
$aaa = $sym_diff[$i];
$k2 = substr($aaa,6, 6);
$now = date("H:i");
$k2 = str_replace(':','',$k2);
$now = str_replace(':','',$now);
$v_strtotime = strtotime($currdate.$k2);
$now_strtotime = strtotime($nowdate.$now);
if ($v_strtotime > $now_strtotime )
{
$reservation_yn = "Y";
}
?>
<li class="time_cls {currtime:'<?php echo $aaa?>',reservation_yn:'<?php echo $reservation_yn?>'}"><a href="javascript:void(0);" class="showme"><?php echo $aaa?> <?php echo $reservation_yn=="Y"?"(예약가능)":"(예약불가)"?></a></li>
<?} ?>
</ul>
<!--------------------------------------------------------------------->
</div>
</div>
</div>
<div class="date_ok timedate">
<span class="date_choice time_class"></span><span>을 선택하셨습니다.</span>
</div>
<SCRIPT>
<!--
function change(style) {
if( style == "selectBox01" )
{
view1.style.display = "inline"
view2.style.display = "none"
view3.style.display = "none"
view4.style.display = "none"
}
if( style == "selectBox02" )
{
view1.style.display = "none"
view2.style.display = "inline"
view3.style.display = "none"
view4.style.display = "none"
}
if( style == "selectBox03" )
{
view1.style.display = "none"
view2.style.display = "none"
view3.style.display = "inline"
view4.style.display = "none"
}
if( style == "selectBox04" )
{
view1.style.display = "none"
view2.style.display = "none"
view3.style.display = "none"
view4.style.display = "inline"
}
}
//-->
</SCRIPT>
</code>