일정 내용이 나오는 레이어 달력 소스 latest
로빈아빠
본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$cellh = 25;
$cellw = 24;
?>
<style type="text/css">
td.title { text-align: left; padding-top: 1pt; padding-bottom: 1pt; height: 25px; font-weight:bold;}
td.invalid { background-color:#FaFaFa; } // 빈 공백 color ///
td.valid { color:#FFFFFF; } // 일반 color ///
td.big_today { padding-top:10px;padding-left:10px;color:#ffd81c; background-color:#CCCCCC; }
td.big_sunday { padding-top:10px;padding-left:10px;color: red;background-color:#FFFFFF;}
td.big_saturday { padding-top:10px;padding-left:10px; color: #3366cc;background-color:#FFFFFF;}
td.big_weekday { padding-top:10px;padding-left:10px; width:85px;background-color:#FFFFFF;}
td.big_writeday { padding-top:10px;padding-left:10px;background-color:#F7D6D8;} // 내용 있으면 나타나는 폰트 color
p.title {font-size: 1em; font-weight:bold}
a:link.big_writeday, a:visited.big_writeday {} // 내용 있으면 나타나는 폰트 color
</style>
<?
$year=$_GET[year];
$month=$_GET[month];
if ($_GET[year]) set_session("calendar_year",$_GET[year]);
if ($_GET[month]) set_session("calendar_month",$_GET[month]);
if (!$year) $year=get_session("calendar_year");
if (!$month) $month=get_session("calendar_month");
$today = getdate();
$b_mon = $today['mon'];
$b_day = $today['mday'];
$b_year = $today['year'];
if ($year < 1) {
$month = $b_mon;
$mday = $b_day;
$year = $b_year;
}
$lastday=array(0,31,28,31,30,31,30,31,31,30,31,30,31);
if ($year%4 == 0) $lastday[2] = 29;
$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
//var_dump($_SERVER);
$href=$_SERVER[REQUEST_URI];
$arr=array("&year="=>"&","&month="=>"&","&="=>"&","&&"=>"&","&".date("Y")."&"=>"&","&".date("m")."&"=>"&","&".date("n")."&"=>"&");
$href=strtr($href,$arr);
$href=strtr($href,$arr);
if (strstr($href,"?")) $href.="&";
else $href.="?";
?>
<STYLE>
.ttip {border:1px solid black;font-size:12px;layer-background-color:lightyellow;background-color:lightgreen}
</STYLE>
<center>
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td align="center"><a href="<?=$href?><?if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$latest_skin_path?>/img3/y_prev.gif" alt="이전해" border="0" title="<?=$year_pre?>년"></a></td>
<td align="center"><a href="<?=$href?><?if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$latest_skin_path?>/img3/first.gif" alt="전달" border="0" title="<?=$month_pre?>월"></a></td>
<td align="center" style='padding:5px'><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>" onfocus="this.blur()" title="일정관리 바로가기"><strong><font color=#000000><?=$year?>-<?=$month?></strong></font></a> </td>
<td align="center"><a href="<?=$href?><?if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$latest_skin_path?>/img3/end.gif" alt="" border="0" title="<?=$month_pre?>월"></a></td>
<td align="center"><a href="<?=$href?><?if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year+1; $month_pre=$month;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$latest_skin_path?>/img3/y_next.gif" alt="다음해" border="0" title="<?=$year_pre?>년"></a></td>
<!-- <td width="64"><img src="<?=$latest_skin_path?>/img3/month2_<?=$month?>.gif" width="64" height="23"></td> -->
</tr>
</table>
<style>
#disp_mon_big {
text-align:left;
color: #5577DD;
background-color:#FFFFFF;
border:1px solid black;
width:380px;
padding:10px;
line-height:25px;
filter:alpha(opacity=90);
opacity:0.90;
}
</style>
<div id='disp_mon_big' style='left:0px;top:0px;position:absolute;z-index:1000'>
</div>
<script>
var last_td;
function show_mon(rows,lines,td_id,html) {
if (last_td==td_id) return;
if (html=='')
{
last_td=0;
$("#disp_mon_big").hide();
return;
}
last_td=td_id;
var td=$("#"+td_id).offset();
var left=td.left+20;
if (left>720) left=410;
else if (left>620) left=620;
var top=td.top+20;
if (rows>=3)
{
top-=70;
top-=lines*25;
}
//alert('pos:'+left+'/'+top);
//$("#disp_mon_big").html(html);
html=html.replace("\n"," ");
$("#disp_mon_big").html(html);
//alert($("disp_mon_big").html);
$('#disp_mon_big').removeClass("disp_mon_big");
$('#disp_mon_big').addClass("disp_mon_big");
$('#disp_mon_big').css({"left":left+"px"});
$('#disp_mon_big').css({"top":top+"px"});
$("#disp_mon_big").show();
}
function hide_mon() {
last_td=0;
$("#disp_mon_big").hide();
}
</script>
<table border=0 cellpadding=2 cellspacing=1 width=98% bgcolor="#CCCCCC">
<!-- <TABLE bgcolor="#D9D9D9" width=<?=$cellw*7?> cellSpacing=1 cellPadding=0 border=0 align=center > -->
<TR align=center bgcolor="#F0F0F0">
<td class=sunday height=30>일</td>
<td class=weekday>월</td>
<td class=weekday>화</td>
<td class=weekday>수</td>
<td class=weekday>목</td>
<td class=weekday>금</td>
<td class=saturday>토</td>
</TR>
<TR>
<?
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$sql = "SELECT * FROM $tmp_write_table WHERE left(wr_datetime,7) = '$year-$sel_mon' ORDER BY wr_datetime";
$result = sql_query($sql);
// 내용을 보여주는 부분
$html_day_count=array();
$html_day_href=array();
$html_day_wr_id=array();
while ($row = mysql_fetch_array($result)) { // 제목글 뽑아서 링크 문자열 만들기..
$date=substr($row[wr_datetime],0,10); //2010-12-31
if (!$html_day[$date]) $html_day[$date]="<center><B>$date 교육일정</center></B>";
$href="/bbs/board.php?bo_table=$bo_table&wr_id=$row[wr_id]";
$html_day[$date].="<a href=$href>[$row[wr_5]] $row[wr_1] <font color=#000000><B>$row[wr_subject]</B></font></a><BR> $row[wr_7]<BR>";
$html_day_count[$date]++;
$html_day_href[$date][]=$href;
$html_day_wr_id[$date][]=$row[wr_id];
}
$temp = 7- (($lastday[$month]+$dayoftheweek)%7);
if ($temp == 7) $temp = 0;
$lastcount = $lastday[$month]+$dayoftheweek + $temp;
$rows=0;
for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.
$offset = $iz%7;
if ($offset == 1) {
$rows++;
echo ("<tr valign=top>\n");
}
if ($dayoftheweek < $iz && $iz <= $lastday[$month]+$dayoftheweek) {
$f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
$f_date2 = sprintf("%04d-%02d-%02d",$year,$month,$cday);
if ($html_day[$f_date2]) $cstyle = 'big_writeday';
else if ($b_year==$year && $b_mon==$month && $b_day==$cday) $cstyle = 'big_today';
else if ($offset==1) $cstyle = 'big_sunday';
else if ($offset==0) $cstyle = 'big_saturday';
else $cstyle = 'big_weekday';
if ($_GET[wr_id] && $html_day_wr_id[$f_date2] && in_array($_GET[wr_id],$html_day_wr_id[$f_date2]))
$cstyle = 'big_today';
// 요일에 따라 날짜의 색깔 결정
// 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
// 즉 11월 달에서 1일부터 30 일까지만 해당
$daytext = "$cday"; // $cday 는 숫자 예> 11월달은 1~ 30일 까지
//$daytext 은 셀에 써질 날짜 숫자 넣을 공간
// 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고
// 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
echo "<td class=$cstyle height=40 valign=top ";
//if ($html_day[$f_date2]) echo "title='".htmlspecialchars($html_day[$f_date2])."'";
if ($html_day[$f_date2]) {
echo "onMouseover=\"show_mon($rows,".substr_count($html_day[$f_date2],'<BR>').",'td_$iz','".htmlspecialchars(str_replace("\n"," ",nl2br($html_day[$f_date2])))."');\"";
}
if ($html_day_href[$f_date2] && count($html_day_href[$f_date2])) {
echo "
style='cursor:hand;'
onclick=\"document.location='{$html_day_href[$f_date2][0]}';\"; ";
}
//echo " onMouseOut=\"hidetip()\">\n";
echo " > \n";
echo "<div id='td_$iz'>$daytext</div><BR>";
if ($html_day[$f_date2]) {
echo "<font color=blue>교육 <b>{$html_day_count[$f_date2]}</b>건\n";
}
// echo $html_day[$cday];
echo ("</td>\n"); // 한칸을 마무리
$cday++; // 날짜를 카운팅
}
// 11월에서 1일부터 30일에 해당되지 않으면 그냥 회색을 칠한다.
else {
echo ("<td class=invalid></td>\n"); }
if (($iz%7) == 0) echo (" </tr>\n");
} // 반복구문이 끝남
?>
</table>
<div style='padding:7px;'></div>
댓글목록
등록된 댓글이 없습니다.