날자옆에 요일을 표시하고 싶습니다. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

날자옆에 요일을 표시하고 싶습니다. 정보

날자옆에 요일을 표시하고 싶습니다.

본문

날자옆에 요일을 표시하고 싶습니다.
방법을 알려주시면 감사하겠습니다.
수고하세요...

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once("$board_skin_path/moonday.php"); // 석봉운님의 음력날짜 함수

//가로 세로 폭 지정
if (eregi('%', $width)) { $col_width = "14%"; }
else { $col_width = round($width/7); }

$prevmonth = $month - 1;
$nextmonth = $month + 1;
$prevyear = $year;
$nextyear = $year;
if ($month == 1) {
  $prevmonth = 12;
  $prevyear = $year - 1;
} elseif ($month == 12) {
  $nextmonth = 1;
  $nextyear = $year + 1;
}

//$maxdate = date(t, mktime(0, 0, 0, $month, 1, $year));  // the final date of $month
//$offset  = date(w, mktime(0, 0, 0, $month, 1, $year));

$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));
?>
<link rel="stylesheet" href="<?=$board_skin_path?>/style.css" type="text/css">
<!--년, 월 form 스크립트 -->
<script language="JavaScript">
<!--
function namosw_goto_byselect(sel, targetstr)
{
  var index = sel.selectedIndex;
  if (sel.options[index].value != '') {
    if (targetstr == 'blank') {
      window.open(sel.options[index].value, 'win1');
    } else {
      var frameobj;
      if (targetstr == '') targetstr = 'self';
      if ((frameobj = eval(targetstr)) != null)
        frameobj.location = sel.options[index].value;
    }
  }
}

// 레이어 뷰 스크립트
var iDelay = 80 // Delay to hide in milliseconds
var iNSWidth=250 // Default width for netscape
var sDisplayTimer = null, oLastItem

function getRealPosition(i,which) {
iPos = 0
while (i!=null) {
iPos += i["offset" + which]
i = i.offsetParent
}
return iPos
}
function showLayers(sDest,itop,ileft,iWidth) {
if (document.all!=null) {
var i = window.event.srcElement
stopTimer()
dest = document.all[sDest]
if ((oLastItem!=null) && (oLastItem!=dest))
hideItem()
if (dest) {
// Netscape Hack
if (i.offsetWidth==0)
if (iWidth)
i.offsetWidth=iWidth
else
i.offsetWidth=iNSWidth;
if (ileft)
dest.style.pixelLeft = ileft
else
dest.style.pixelLeft = getRealPosition(i,"Left") - 5 // 불러오는 메뉴 좌표
// dest.style.pixelLeft = getRealPosition(i,"Left") + i.offsetWidth *0.1 // 불러오는 메뉴 좌표
if (itop)
dest.style.pixelTop = itop
else
  dest.style.pixelTop = getRealPosition(i,"Top") + 15 // 불러오는 메뉴 좌표
dest.style.visibility = "visible"
}
oLastItem = dest
}
}

function stopTimer() {
clearTimeout(sDisplayTimer)
}

function startTimer(el) {
if (!el.contains(event.toElement)) {
stopTimer()
sDisplayTimer = setTimeout("hideItem()",iDelay)
}
}

function hideItem() {
if (oLastItem)
oLastItem.style.visibility="hidden"
}

function checkOver() {
if ((oLastItem) && (oLastItem.contains(event.srcElement))) {
stopTimer()
}
}

function checkOut() {
if (oLastItem==event.srcElement)
startTimer(event.srcElement)
}

document.onmouseover = checkOver
document.onmouseout = checkOut
//-->
</SCRIPT>
<style type="text/css">
/* 카테고리 스타일*/
.day_navi {font-size:18px;color:#6cb20b;font-weight:bold; text-shadow: 1px 1px 2px #6cb20b;}
#box_day{width:45px; padding-left: 7px; padding-top: 4px; font-size:12pt; font-family:NanumGothicBoldWeb; font-weight:bold; float:left;}
#box_list{width:100%;}
#box_list2{width:100%; padding:5px 0px 5px 7px;}

#box00{font-family:NanumGothicBoldWeb;width:40px;float:left;}
#box01{font-family:NanumGothicBoldWeb;width:500px;float:left;}
#box02{font-family:NanumGothicBoldWeb;width:1px;float:right;}
#box03{font-family:NanumGothicBoldWeb;width:1px;float:right;}
#box04{font-family:NanumGothicBoldWeb;width:1px;float:right;}

a.day1:link, a.day1:visited, a.day1:active { font-family:NanumGothicBoldWeb; font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day1:hover { font-family:NanumGothicBoldWeb; font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }

a.day2:link, a.day2:visited, a.day2:active { font-family:NanumGothicBoldWeb; font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day2:hover { font-family:NanumGothicBoldWeb; font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }

a.day3:link, a.day3:visited, a.day3:active { font-family:NanumGothicBoldWeb; font-size:14px; text-decoration:none; color:#9e9e9e; }
a.day3:hover { font-family:NanumGothicBoldWeb; font-size:16px;color:#9e9e9e; text-decoration:underline; font-weight:bold; }

.day4 {font-family:Trebuchet MS;font-size:20px;color:#BFCF27;}
.day5 {font-family:NanumGothicBoldWeb;font-size:14px;color:#6c91c3;}
</style>

<table width="100%"  border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom">
      </span>
      <div align="center">
<a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m&"?><?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="<?=$board_skin_path?>/img/btn_prev_c.png" border="0" title="이전달" align="absbottom" /></a>&nbsp;
<span class="day_navi">
<?
if(strlen($month) == 1) { echo $year."년0".$month ; }
else { echo $year."년".$month ; }
?>월 세무일정 </span>
<a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m&"?><? if ($month == 12) { $year_next=$year+1; $month_next=1; } else {$year_next=$year; $month_next=$month+1;} echo ("&year=$year_next&month=$month_next");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/btn_next_c.png" border="0" title="다음달" align="absbottom" /></a>

</div> </td>
  </tr>
<tr><td height="10"></td></tr>
</table>

<table width="100%" border="0" height="10" background="<?=$board_skin_path?>/img/bg_cal_day.gif" style="border: 1px solid #B7BDCC;">
  <tr>
    <td height="22">
<div id='box00' align="center">날짜</div>
<div id='box01' align="center">일정</div>

  </tr>
</table>


<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-left: 1px solid #B7BDCC; border-right: 1px solid #B7BDCC;">
<?
$cday = 1;
$cel_mon = sprintf("%02d",$month);

$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) <= '$year$cel_mon' and left(wr_link2,6) >= '$year$cel_mon' ORDER BY wr_id ASC";
$result = sql_query($query);

$j=0; // layer id
// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {
  if( substr($row[wr_link1],0,6) <  $year.$cel_mon ) {
$start_day =1;
$start_day= (int)$start_day;
  } else {
$start_day = substr($row[wr_link1],6,2);
    $start_day= (int)$start_day;
  }

  if( substr($row[wr_link2],0,6) >  $year.$cel_mon ) {
$end_day = $lastday[$month];
$end_day= (int)$end_day;
  } else {
$end_day = substr($row[wr_link2],6,2);
$end_day= (int)$end_day;
  }

for ($i = $start_day ; $i <= $end_day;  $i++) {

$j++; // layer ID

    $from_date = str_replace("http://","",$row[wr_link1]);
    $to_date = str_replace("http://","",$row[wr_link2]);
    $from_date = substr($from_date,0,4)."년 ".sprintf("%2d",substr($from_date,4,2))."월 ".sprintf("%2d",substr($from_date,6,2))."일";
    $to_date  = substr($to_date,0,4)."년 ".sprintf("%2d",substr($to_date,4,2))."월 ".sprintf("%2d",substr($to_date,6,2))."일";

$html_day[$i].= "<div id='box_list2'>
<div id='box01' align='left'>".$row[wr_5]." ".$row[wr_subject]. "</div>
</div>"."\n";
$html_day1[$i].= "<div id='box_list3'>
<div id='box01' align='left'><a onmouseover=\"showLayers('popup_schd".$j."')\" onmouseout=\"startTimer(this)\"  href='$g4[bbs_path]/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]&mode=m' style='font-family:NanumGothicBoldWeb;'>".$row[wr_5]." ".$row[wr_subject]. "</a></div>
</div>"."\n";

?>
<?
}
}
?>
<?
$html_day[$i].= "<div id='box_list2'>
<div id='box01' align='left'><a onmouseover=\"showLayers('popup_schd".$j."')\" onmouseout=\"startTimer(this)\"  href='$g4[bbs_path]/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]&mode=m' style='font-family:NanumGothicBoldWeb;'>".$row[wr_5]." ".$row[wr_subject]. "</a></div>
</div>"."\n";
  // 달력의 틀을 보여주는 부분

  $temp = 7- (($lastday[$month]+$dayoftheweek)%7);

  if ($temp == 7) $temp = 0;
    $lastcount = $lastday[$month]+$dayoftheweek + $temp;

  for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.
 
 

    $bgcolor = "#ffffff";  // 쭉 흰색으로 칠하고
    if ($b_year==$year && $b_mon==$month && $b_day==$cday) $bgcolor = "#ffffff";      //  "#DFFDDF"; // 오늘날짜 연두색으로 표기
    if (($iz%7) == 1) echo ("<tr>"); // 주당 7개씩 한쎌씩을 쌓는다.
    if ($dayoftheweek < $iz  &&  $iz <= $lastday[$month]+$dayoftheweek) {
      // 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
      // 즉 11월 달에서 1일부터 30 일까지만 해당
      $daytext = "$cday";  // $cday 는 숫자 예> 11월달은 1~ 30일 까지
      //$daytext 은 셀에 써질 날짜 숫자 넣을 공간
      $daycontcolor = "" ;
      $daycolor = "";
      if ($iz%7 == 1) {$daycolor = "#E75A53"; $bgcolor = "#ffffff";} // 일요일
      if ($iz%7 == 0) {$daycolor = "#6c91c3"; $bgcolor = "#ffffff";} // 토요일
//   if($html_day[$cday]){ //<-이부분 추가

// 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고

// 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
echo ("<tr><td class=tbline3 bgcolor=$bgcolor valign=top onmouseover=this.style.backgroundColor='#ffffff' onmouseout=this.style.backgroundColor=''>\n");

      $f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);

      // 기념일 파일 내용 비교위한 변수 선언, 월과 일을 두자리 포맷으로 고정
      if (strlen($month) == 1) {
        $monthp = "0".$month ;
      } else {
        $monthp = $month ;
      }
      if (strlen($cday) == 1) {
        $cdayp = "0".$cday ;
      } else {
        $cdayp = $cday ;
      }
      $memday = $year.$monthp.$cdayp;
      // *.0000 파일인 해마다 동일한 양력기념일은 월일로만 구분한다.
      if( !file_exists($file_index.".".$year)) { $memday = $monthp.$cdayp; }
      $daycont = "" ;

      // 년월일 8자리 또는 4자리를 잘라 비교하여 뒷 문장을 출력
      for($i=0 ; $i < sizeof($dayfile) ; $i++) {  // 파일 첫 행부터 끝행까지 루프
        if($memday == substr($dayfile[$i],$cutpoint1,$cutpoint2)){$daycont = substr($dayfile[$i],9,strlen($dayfile[$i])-10);
        // r,b,y,g 구분자로 글자색깔 구분
        $daycl = substr($dayfile[$i],0,1) ;
        if($daycl == "r"){
          $daycontcolor = "red" ; // 휴일
          $daycolor = "red";
        }
        else if($daycl == "y"){$daycontcolor = "brown" ;} // 생일
        else if($daycl == "g"){$daycontcolor = "gray" ;} // 음력
        else{$daycontcolor = "blue" ;}
      }
    }

    // 석봉운님의 음력날짜 변수선언
    $myarray = soltolun($year,$month,$cday);
    if ($myarray[day]==1 || $myarray[day]==11 || $myarray[day]==21) {
      //$moonday ="<font color=gray>&nbsp;(음)$myarray[month].$myarray[day]$myarray[leap]</font>";
  $moonday="";
    } else {
      $moonday="";
    }

    //include("$schedule_file.moon"); // 음력절기 & 음력기념일
    if ($annivmoonday&&$daycont) $blank="<br>"; // 음력절기와 양력기념일이 동시에 있으면 한칸 띔
    else $blank="";

//글쓰기 권한여부
if ($write_href) {
echo "<div id='box_day' align='center'><a href='$write_href&f_date=$f_date&t_date=$f_date&mode=m' style='font-family:NanumGothicBoldWeb; font-size:12px;'><font color='$daycolor' style='font-family:NanumGothicBoldWeb;'>$daytext</font></a></div>\n";
}
else {
echo "<div id='box_day' align='center'><font color='$daycolor' style='font-family:NanumGothicBoldWeb; font-size:12px;'>$daytext</font></div>\n";
}

echo "<div id='box_list2'>$html_day1[$cday]</div>\n";
echo ("</td></tr>\n");  // 한칸을 마무리

// }//<- 이부분 추가

$cday++; // 날짜를 카운팅
}

// 날짜가 없을경우
else { echo ("\n"); }

if (($iz%7) == 0) echo ("</tr>\n");
}
?>

댓글 전체

소스에 보면
$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));

이부분이 요일을 가져오는 겁니다.

$dayoftheweek 이변수를 원하는 위치에 출력해주면 됩니다.
$dayoftheweek 는

0(일요일) ~ 6(토요일) 이런식으로 출력이되요.

$hanDayoftheWeek = "";
 
switch($dayoftheweek) {
"0" : $hanDayoftheWeek = "일요일"; break;
"1" : $hanDayoftheWeek = "월요일"; break;
"2" : $hanDayoftheWeek = "화요일"; break;
"3" : $hanDayoftheWeek = "수요일"; break;
"4" : $hanDayoftheWeek = "목요일"; break;
"5" : $hanDayoftheWeek = "금요일"; break;
"6" : $hanDayoftheWeek = "토요일"; break;
}

echo $hanDayoftheWeek;

이런식으로 하시면되죠
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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