해결 부탁드립니다.. > 그누4 질문답변

그누4 질문답변

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

해결 부탁드립니다.. 정보

해결 부탁드립니다..

본문

<? /*
<!--
 탈루 (*** 개인정보보호를 위한 이메일주소 노출방지 ***) 님 소스를 수정하였습니다.
-->
*/
if (eregi('%', $width)) {
 $col_width = "14%"; //표의 가로 폭이 100보다 크면 픽셀값입력
}else{
 $col_width = round($width/7); //표의 가로 폭이 100보다 작거나 같으면 백분율 값을 입력
}
$col_height= 115 ;//내용 들어갈 사각공간의 세로길이를 가로 폭과 같도록
$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));
?>
<table width="<?=$width?>" border=0 cellpadding="0" cellspacing="0">
  <tr>
       <td width="20%"> </td>
       <td width="60%" height="30" align="center">
  <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_prev.gif" border="0" title="<?=$year_pre?>년" align="abbottom"></a>
  <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&"?><?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/m_prev.gif" border="0" title="<?=$month_pre?>월" align="abbottom"></a>
     <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&"?>" title="오늘로" onfocus="this.blur()"><b><? echo ("$year".년."$month".월); ?></b></span></a>    
  <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&"?><?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="<?=$board_skin_path?>/img/m_next.gif" border="0" title="<?=$month_pre?>월" align="abbottom"></a>
  <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&"?><?if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_next.gif" border="0" title="<?=$year_pre?>년" align="abbottom"></a>
 </td>
 <td width="20%" align="right" valign="bottom">
<?
  if ($write_href) { echo "  <a href='$write_href' title='일정추가' onfocus='this.blur()'><img src='$board_skin_path/img/btn_write.gif' border=0></a>\n"; }
  if ($admin_href) { echo "   <a href='$admin_href' title='관리자' onfocus='this.blur()'><img src='$board_skin_path/img/admin.gif' border=0 align=absmiddle></a>\n"; }
?>
</td>
  </tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 bgcolor=#999999 width='<?=$width?>' align="center" border=0><tr><td>
<table border=1 cellpadding=0 cellspacing=0 width=100% bgcolor=white bordercolor=white bordercolorlight=#c8d8e0>
    <tr class=size2 height=30>    
 <td align=center valign="middle" bgcolor="#FFECFF">일요일</td>    
 <td align=center valign="middle" bgcolor="#efefef">월요일</td>    
 <td align=center valign="middle" bgcolor="#efefef">화요일</td>    
 <td align=center valign="middle" bgcolor="#efefef">수요일</td>    
 <td align=center valign="middle" bgcolor="#efefef">목요일</td>    
 <td align=center valign="middle" bgcolor="#efefef">금요일</td>    
 <td align=center valign="middle" bgcolor="#afeeee" >토요일</td>
    </tr>
<?
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) <= '$year$sel_mon'  and left(wr_link2,6) >= '$year$sel_mon'  ORDER BY wr_id ASC";
$result = sql_query($query);
// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {  // 제목글 뽑아서 링크 문자열 만들기..
 if( substr($row[wr_link1],0,6) <  $year.$sel_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.$sel_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++) {
 // $html_day[$i].= 은  문자를 덧붙이는 작업이다. 바로 . (쩜) 의 위력이다.
 if ($admin_href)  {
 $html_day[$i].= "        <br><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]'><!-- <img src='$board_skin_path/img/icon.gif'
--------------------------------여기부터--------------------------------------------
border=0> -->"." 거망: ".$row[wr_1]."<BR>"." 황석: ".$row[wr_2]."<BR>"." 기백: ".$row[wr_3]."<br>"." 금원: ".$row[wr_4]."<br>"." 덕유: ".$row[wr_5]."<br>"." 지리: ".$row[wr_6]."<BR>"."</a>"."\n";
 } else {
 $html_day[$i].= "      <span style=\"font:9pt 돋음체;color:#777777;\"><br>"."거망 : ".$row[wr_1]."<BR>"."황석 : ".$row[wr_2]."<BR>"."기백 : ".$row[wr_3]."<br>"." 금원 : ".$row[wr_4]."<br>"." 덕유 : ".$row[wr_5]."<br>"." 지리 : ".$row[wr_6]."<BR></span>"."\n";
 }
 //$html_day[$i].= "<br><a href='?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]'>".substr($row[wr_subject],0,18)."</a>"."\n";
 // substr로 끊으면 경우에 따라 지져분해 지므로..
   }
 }
// 달력의 틀을 보여주는 부분
$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 = "#ffffe9";      //  "#DFFDDF"; // 오늘날짜 연두색으로 표기
 if (($iz%7) == 1) echo ("  <tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.
 if ($dayoftheweek < $iz  &&  $iz <= $lastday[$month]+$dayoftheweek) {
  // 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
  // 즉 11월 달에서 1일부터 30 일까지만 해당
    $daytext = "$cday";   // $cday 는 숫자 예> 11월달은 1~ 30일 까지
    //$daytext 은 셀에 써질 날짜 숫자 넣을 공간
    if ($iz%7 == 1) $daytext = "<font color=red>$daytext</font>"; // 일요일
    if ($iz%7 == 0) $daytext = "<font color=blue>$daytext</font>"; // 토요일
  
       // 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고
       // 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
     if ($iz%7 == 0) echo ("     <td width=$ height=$col_height bgcolor=$bgcolor valign=top class='cal_title'>\n");
    else echo ("     <td width=13% height=$col_height bgcolor=$bgcolor valign=top class='cal_title'>\n");
    if ($write_href) {
   // $write_href (글쓰기 권한)이 있으면
   // 날짜에 누르면 글씨쓰기가 가능한 링크를 넣어서 출력하기
   $f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
         echo "        <a href='$write_href&f_date=$f_date&t_date=$f_date'>$daytext</a>\n";
    }
    else { // 글쓰기 권한이 없으면 글쓰기 링크는 넣지 않고 그냥 숫자만 출력하기
         echo "        $daytext\n";
       }
    echo $html_day[$cday];
    echo ("     </td>\n");  // 한칸을 마무리
   $cday++; // 날짜를 카운팅
 }
 // 11월에서 1일부터 30일에 해당되지 않으면 그냥 회색을 칠한다.
 else { echo ("     <td width=$col_width height=$col_height bgcolor=#F7F7F7 valign=top class=size1> </td>\n"); }
   if (($iz%7) == 0) echo ("  </tr>\n");
  
} // 반복구문이 끝남
?>
</table></td></tr></table><p> </p>
 
위에 표시한 부분 바로 아래에 $row[wr_1] ,$row[wr_2],$row[wr_3]...  =완료와 같다면 빨간색으로, 대기라면 노랑색으로
가능은 파란색으로 표시하고 싶습니다..
if문이나 사용가능한 태그(?)로 작성 부탁드립니다.아래것으로 수정해봤는데 잘 안되더군요..
 
번거롭게 해서 죄송합니다..
  • 복사

댓글 전체

$color_str=array( '완료'=>'red', '대기'=>'yellow', '가능'=>'blue');

echo <font color='{$color_str[ $row['wr_1']]}'>{$row['wr_1']}</font>";
echo <font color='{$color_str[ $row['wr_2']]}'>{$row['wr_2']}</font>";
echo <font color='{$color_str[ $row['wr_3']]}'>{$row['wr_3']}</font>";
<? $color_str=array( '완료'=>'red', '대기'=>'yellow', '가능'=>'blue'); ?>

...

<font color='<?={$color_str[ $row['wr_1']]}?>'><?=$row['wr_1']?></font>
....

<font color='<?={$color_str[ $row['wr_2']]}?>'><?=$row['wr_2']?></font>

...
<font color='<?={$color_str[ $row['wr_3']]}?>'><?=$row['wr_3']?></font>
© SIRSOFT
현재 페이지 제일 처음으로