미니 달력 수정... 오늘의 일정 표시 > 그누3 팁자료실

그누3 팁자료실

미니 달력 수정... 오늘의 일정 표시 정보

일반 미니 달력 수정... 오늘의 일정 표시

본문

/*
 * 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
 *
 * 수정 : 2003-08-29
 */
function gs_cal($input_y='',$input_m='',$bo_table='theo_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'>
";

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

 &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;
}

$sql = " select *
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from $cfg[write_table_prefix]$bo_table
where wr_link1 = '$currentday$dispnum' ";
$result = sql_query_error($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 = $row[wr_content];
$s_str .= "<FONT COLOR='#FF3300'>*</FONT> <a href='{$gnu_path}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 border=0 width=100% cellspacing=0 cellpadding=0 bgcolor=#ffffff>
<TR><TD height=1 bgcolor='#CCCCCC'></TD></TR>
<TR><TD height=20 align=center &nbsp;bgcolor='#EEEEEE'><B style='color:#999999'>오늘의 일정</B></TD></TR>
<TR>
<TD>
<!-- <marquee direction=up scrollamount=1 width=100% height=20> -->
<div align=left>
$s_str
</div>
<!-- </marquee> -->
</TD>
</TR>
</TABLE>";
}
}

if ($s_num > 0)
{
&nbsp;$dlink ="<a href='{$gnu_path}bbs/gnuboard.php?bo_table=$bo_table' title='{$s_num}개의 &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; }
echo($today_schedule);
}

//-----------------------------------------------------------
오늘날짜의 일정 목록을 보여주도록 수정했습니다.
사용법은 이전과 동일합니다.
위의 내용을 libdev.php에 넣어 주시고,
필요한 곳에서
<?php gs_cal('','','bo_table')?>
함수 호출해 주시면 됩니다. bo_table은 일정을 기록할 게시판이구요.
주의점은 게시판의 link #1을 일정의 날짜로 &nbsp;사용한다는 것입니다.
추천
0

댓글 전체

전체 1,026
그누3 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT