길선아버님의 미니달력 2.xx  ====> 3.0버전대로 변신 > 그누3 팁자료실

그누3 팁자료실

길선아버님의 미니달력 2.xx  ====> 3.0버전대로 변신 정보

PHP 길선아버님의 미니달력 2.xx  ====> 3.0버전대로 변신

본문

function gs_cal($input_y='',$input_m='',$bo_table='')
{
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; $res = checkdate($input_m,$i,$input_y);
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!$res)
 &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;$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'>
";

$today_schedule = "";//일정 목록

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

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

$sql = " select *
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from $cfg[write_table_prefix]$bo_table
where wr_link1 = '$currentday$dispnum' ";
$result = sql_query($sql);
$s_num = mysql_num_rows($result);//일정의 갯수
if($dispnum == $input_d) {
$bgc = "bgcolor='#C7E1E7'";
while($row=mysql_fetch_array($result)) {
$s_name = $row[wr_subject];
$s_memo = get_text(cut_str($row[wr_content], 500, "…"));
$s_str .= "<FONT COLOR='#FF3300'>*</FONT> <a href='./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$row[wr_id]}' title='$s_memo'>$s_name</a><br>";
}
if(strlen($s_str)>0){
$today_schedule = "<table width=100% cellpadding=0 cellspacing=1><tr><td class='subject subjecttitlebg'>
<table width=100% cellpadding=0 cellspacing=1>
<tr><td class='subject subjectbg ht' align=center height=25>오늘의 일정</TD></TR> </table>
</td></tr></table>
<!-- 공백 -->
<table width='100%' cellpadding=0 cellspacing=0><tr><td height=5></td></tr></table>
<!--<marquee direction=up scrollamount=1 width=100% height=20>-->
<div align=left>
$s_str
</div>
<!--</marquee>-->
</a>";
}
}

if ($s_num != 0) {
 $dlink ="<a href='./?doc=bbs/gbform.php&bo_table=$bo_table&link1={$currentday}$dispnum' title='{$s_num}개의 &nbsp;일정이 있습니다. 다시 일정을 등록하시려면 날짜를 클릭하세요.'><b> ";
} else {
$dlink = "<a href='./?doc=bbs/gbform.php&bo_table=$bo_table&link1={$currentday}$dispnum' title='일정등록'>";
}
if($dispnum < 1)
echo"<td $bgc> </td>";
 &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; 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; for($i = 1; $i <= $td_tail; $i++) echo "<td> </td>";
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "</tr></table>";
 &nbsp; &nbsp; &nbsp;}
echo($today_schedule);
}


위의 내용을 [lib/developer.lib.php]에 넣어 주시고, &nbsp; &nbsp;<===== 개발자 라이브러리를 저장하는 곳입니다..
필요한 곳에서
<?php gs_cal('','','bo_table')?> <======= &nbsp;여기 부분의 bo_table의 부분은 아무 게시판 명도 가능합니다...
함수 호출해 주시면 됩니다. bo_table은 일정을 기록할 게시판이구요.
주의점은 게시판의 link #1을 일정의 날짜로 &nbsp;사용한다는 것입니다.
추천
1
  • 복사

댓글 전체

주의점은 게시판의 link #1을 일정의 날짜로  사용한다는 것입니다.

이말이 무슨 의미인가요?
오늘의 일정이 안나옵니다. 윗 글이 해법일것 같은데 link#1에다 날짜를 적어라는 말씀인가요?
© SIRSOFT
현재 페이지 제일 처음으로