|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/jaejoong_X/pages/ |
Upload File : |
<?
//넘어오는 값이 없을 경우 이번달의 달력을 표시
if(!$y) {$y = date("Y");}
if(!$m) {$m = date("n");}
//날짜 체크
if($y < 2012 or $m < 1 or $m > 12){
echo ("<script>
window.alert('2012년 1월이후부터 서비스가 가능합니다.');
history.go(-1)
</script>");
exit;
}
//이전//다음 달 계산
//기본적으로 년도는 올해와 같게, 이전/다음달은 현재 달에서 +1,-1한 값으로 설정
$b_y = $y;
$n_y = $y;
$b_m = $m - 1;
$n_m = $m + 1;
//1월이면 이전달은 12, 이전해는 현재 해 -1
//12월이면 다음달은 1, 다음해는 현재 해 +1로 변경
if($m == 1){
$b_y = $y - 1;
$b_m = 12;
}else if($m == 12) {
$n_y = $y + 1;
$n_m = 1;
}
//이번 달 마지막날 구함
$last_day = date("t",mktime(0,0,0,$m,1,$y));
//이번 달 첫 요일/마지막 요일을 숫자로 리턴한 값 구함
$start = date("w",mktime(0,0,0,$m,1,$y));
$end = date("w",mktime(0,0,0,$m,$last_day,$y));
//달력 넘기는 링크, 년/월, 요일 등 날짜 위 부분 표시
$page_name = $SCRIPT_NAME;
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
<table width="250" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="25" height="25" align="center" ><a href='?y=<?=$b_y?>&m=<?=$b_m?>'> <strong>«</strong></a></td>
<td width="200" height="25" align='center' style="font-family:Arial, Helvetica, sans-serif; font-size:30px; font-weight:bold;"><?=$y?>. <?=$m?></td>
<td width="25" height="25" align="center" ><a href='?y=<?=$n_y?>&m=<?=$n_m?>'> <strong>»</strong></a></td>
</tr>
</table>
<br />
<form name="form" method="post" target="_self" onsubmit="return false;" >
<table width="98%" cellpadding="3" cellspacing="1" border="0" bgcolor="#DCDCDC" >
<tr bgcolor="#f7f7f7">
<td width="14%" height="25" align='center' class="basicfont_b"><font color="#F74D4D"><strong>SUN</strong></font></td>
<td width="14%" height="25" align='center' class="basicfont_b"><strong>MON</strong></td>
<td width="14%" height="25" align='center' class="basicfont_b"><strong>TUE</strong></td>
<td width="14%" height="25" align='center' class="basicfont_b"><strong>WED</strong></td>
<td width="14%" height="25" align='center' class="basicfont_b"><strong>THU</strong></td>
<td width="14%" height="25" align='center' class="basicfont_b"><strong>FRI</strong></td>
<td width="14%" height="25" align='center' class="basicfont_b"><font color="steelblue"><strong>SAT</strong></font></td>
</tr>
<?
//달력 시작 부분 빈칸 표시
//현재 달의 시작 요일이 일요일이 아니면 해당 만큼 colspan을 줌
if($start != 0){
?>
<tr>
<td height="120" colspan='<?=$start?>' bgcolor="#ffffff"></td>
<?
}
$k=1;
for($i = 1;$i <= $last_day;$i++){
//1일부터 마지막 날까지 루프를 돌아 해당만큼 <td>를 줌
//일요일이면 <tr>을 넣어줌
$s = mktime(0,0,0,$m,$i,$y);
$t = "";
$p = $i;
//오늘은 로 강조
if($y == date("Y") and $m == date("m") and $i == date("d"))
$p = "<font color='blue'><u><strong>$p</strong></u></font>";
//일요일은 빨간색, 토요일은 파란색으로 강조 및 각각 <tr>과 </tr>넣어줌
if(date("w",$s) == 0){
$p = "<font color='#F74D4D'><strong>$p</strong></font>";
$print .= "<tr>";
$k++;
}else if(date("w",$s) == 6){
$p = "<font color='steelblue'><strong>$p</strong></font>";
$t = "</tr>\n";
$t .="<tr id=contents_$k style='display:none'><td colspan=7 style='padding:18px;' bgcolor='#96C14B' align=left><span id='span_contents_$k' value='$k'></span></td></tr>";
}
$pre_month = sprintf("%02d", $m);
$pre_days = sprintf("%02d", $i);
$writen_date = $y."-".$pre_month."-".$pre_days;
$query30 = mysql_query("SELECT * FROM board_schedule WHERE is_delete = 'N' and schedule_date = '$writen_date'",$db_con) or die (mysql_error());
?>
<td width="14%" height="120" valign="top" style="padding:3px;" bgcolor="#ffffff" onMouseOver="this.style.background='#f7f7f7'" onMouseOut="this.style.background='#ffffff'"><strong><?=$p?></strong><br><br>
<?
UNSET($tmp_subject,$tmp_contents_arr,$tmp_contents);
while ($list30 = mysql_fetch_array($query30)){
if($list30[time]) $list30[time] = "[".$list30[time]."]";
$tmp_subject .=$list30[subject]."<br />";
$tmp_contents_arr .= "<b>".$list30[subject]."</b> ".$list30[time]." <br/>".$list30[contents]."<br />";
$tmp_k = "<font size=4px color=#ffff>".$writen_date." SCHEDULE</font><br><font size=3px color=#ffffff>".$tmp_contents_arr."</font>";
$tmp_contents = "<input type='hidden' id='tmp_contents_$i' value='$tmp_k'>";
?>
<?
}
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<a href="javascript: contentsChk(<?=$k?>,'<?=$i?>')" title="<?=stripslashes($list30[contents])?>"><?=$tmp_subject?> </a>
<?=$tmp_contents?>
</td>
</tr>
</table>
</td>
<?=$t?>
<?
}
//달력 끝부분 빈칸 표시
//토요일이 아니면 6 - 요일 숫자만큼 빈칸을 줌
if($end != 6){ $col = (6 - $end);
?>
<td height="120" colspan=<?=$col?> bgcolor="#ffffff"></td>
<?
}
?>
</tr>
<?echo $t .="<tr id=contents_5 style='display:none'><td colspan=7 style='padding:10px;' bgcolor='#96C14B' align=left><span id='span_contents_5' value='5'></span></td></tr>";?>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/JavaScript">
function contentsChk(value,days)
{
var f = document.form;
$("#span_contents_"+value).html($("#tmp_contents_"+days).val());
for(var k=1;k < 6;k++){
if($("#contents_"+k).show()){
$("#contents_"+k).hide();
$("#contents_"+value).show();
}
}
}
</script>
<!--달력 끝-->