미니 달력입니다.

calendar.gif
/*
* calendar
* 소스 : phpschool 박성환
* http://phpschool.com/bbs2/inc_view.html?id=7631&code=tnt2&start=0&mode=search&field=title&search_name=&operator=and&period=all&category_id=&s_que=%B4%DE%B7%C2
*
*/
function gs_cal($input_y='',$input_m='',$bo_table='schedule')
{
global $cfg, $gnu_path , $mb_id;

     // 주어진 날짜가 없으면 현재날짜 구하기
      if(!$input_y) $input_y = date('Y',time());
      if(!$input_m) $input_m = date('m',time());
      if(!$input_d) $input_d = date('d',time());

      $weekdate=date('w', mktime(0,0,0,$input_m,1,$input_y));

$currentday = "$input_y$input_m" ;

for($i=28;$i<33;$i++)
&nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$res = checkdate($input_m,$i,$input_y);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(!$res)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tday = $i;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $i = 33;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; $changerow =0;

&nbsp; &nbsp; &nbsp; echo "<table border=0 cellspacing=0 cellpadding=2 width=100% bgcolor='#DDDDDD' style='font-size:12px; cursor:default'>";
&nbsp; &nbsp; &nbsp; echo "<tr><td colspan=7 bgcolor='#FFFFFF' align=center> $input_y - $input_m - $input_d </th></tr>";
&nbsp; &nbsp; &nbsp; echo "<tr bgcolor='#EEEEEE'>
<td bgcolor='#e2cbcb'>일</td>
<td>월</td>
<td>화</td>
<td>수</td>
<td>목</td>
<td>금</td>
<td bgcolor='#cbd5e2'>토</td>
</tr>
<tr bgcolor='#FFFFFF'>
";

&nbsp; &nbsp; &nbsp; for($i=1; $i < $tday + $weekdate; $i++)
&nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dispnum = $i - $weekdate;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$changerow += 1;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;switch ($changerow % 7) {
case 1 :
$bgc = "bgcolor='#fcf5f5'";
break;
&nbsp;case 0 :
$bgc = "bgcolor='#eff4f9'";
break;
default:
$bgc = "";
break;
}
if($dispnum == $input_d)
$bgc = "bgcolor='#C7E1E7'";

$sql = " select count(0)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from $cfg[write_table_prefix]$bo_table
where wr_link1 = '$currentday$dispnum' ";
$result = sql_fetch_array($sql);

if ($result[0] > 0)
{
&nbsp;$dlink ="<a href='{$gnu_path}bbs/gnuboard.php?bo_table=$bo_table' title='$result[0]개의 &nbsp;일정이 있습니다.'><b> ";
}
else
{
if(is_admin($mb_id))
{
$dlink = "<a href='{$gnu_path}bbs/gbform.php?bo_table=$bo_table&link1={$currentday}$dispnum' title='일정등록'>";
&nbsp;}
else
{
$dlink = "<a title='일정없음'>";
}
}
if($dispnum < 1)
echo"<td $bgc>&nbsp;</td>";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else
echo "<td $bgc onMouseOver=this.style.backgroundColor='#FFCC66' onMouseOut=this.style.backgroundColor=''>$dlink<font face=Tahoma size='1' color='#777777'>".$dispnum."</font></b></a></td>";

if(!($changerow % 7)&&($changerow < $tday + $weekdate))
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo "</tr><tr bgcolor='#FFFFFF'>";
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; $td_tail = &nbsp;7 - ($changerow % 7);

&nbsp; &nbsp; &nbsp; if($td_tail != 7)
&nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for($i = 1; $i <= $td_tail; $i++) echo "<td>&nbsp;</td>";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo "</tr></table>";
&nbsp; &nbsp; &nbsp; }
}


계시판과 연동 하도록 했지만, 지금 제가 사용하고 있는 그누보드가 2.65이라 괜찮을지 모르겠습니다.
좀더 만진 후에 일정 스킨도 올리겠습니다.
현재로서는 다른 시스템상에서 게시판과 제대로 연동 될지 모르겠군요.

첨부파일

calendar.gif (1.7 KB)
15회 2004-02-18 22:21
|

댓글 6개

함수로 작성되어 있습니다.
위의 내용을 libdev.php에 넣어 주시고
달력을 출력하고 싶은 곳에서
<?php gs_cal('','','schedule');?>
이렇게 넣으면 됩니다.
여기서 'schedule' 이부분은 일정을 기록할 게시판의 아이디입니다.
주의 할 것은 link #1 을 날짜로 사용한다는 것입니다.
어떤 게시판 스킨에서든 이점만 주의 하시면 될 것 같네요.
좀더 수정해서 이 달력과 같이 사용하는 게시판 스킨을 올리겠습니다.
아직은 공개하기가 좀 그러네요. ^ ^;
전 이거 아무것도 안나오거든요
소스 그냥 복사해서 php로 만들면 되는거 아닌가요?
22년 전
2.65 좋지요. ㅎㅎ
자료 감사드려요.
기존에 소스가 공개되어 있고, 최근에 [박갑성]님께서 수정판을 올려주신 소스의 경우,
게시물-일정, 일기...-이 추가되면, 테이블이 길어지거나, 넓어지는(??) 단점이 있었습니다.
현재도 아마 그 부분은 어떻게 처리될 문제가 아닌것 같군요.
굳이 바뀐다면 게시물 제목대신에 일정(1),일기(2),알림(0) 등의 기본문구만 출력되게 만든다면
테이블이 변형되는 것은 막을 수 있겠죠.

개인적으로는 [길선아빠]님께서 올려주신 미니달력에 좀 더 애정이 쏠리는 군요.
수고하셨습니다. 그리고... 수고하시구요.
어우.... 무슨 그리 섭섭한 말씀을....

왠지 정이가며, 좋기만 한... 265
헌데 요즘은 2.65 쓰시는 분이 없는갑네요. ^ ^;

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고