<?
//DB연결 - 공통디비 디비가 틀리기 때문에 이곳에서 연결시키자.
$dblink = SetConn($_conf_db["zipcode"]);

//음력달력
//가져올날짜 시작일 ~ 종료일 (yyyy-mm-dd, yyyy-mm-dd)
$arrLunarCalendar = getCalendarLunar($arrSolarCalendar[first_before], $arrSolarCalendar[last_after]);

//DB해제
SetDisConn($dblink);
?>
<div class="calendar">
	<div class="head">
		<a href="<?=$_SERVER[PHP_SELF]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&cal_date=<?=$arrSolarCalendar[prev_month]?>" class="btn btn-prev">이전달</a>
		<span><?=$arrDate[0]?>년 <?=$arrDate[1]?>월</span>
		<a href="<?=$_SERVER[PHP_SELF]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&cal_date=<?=$arrSolarCalendar[next_month]?>" class="btn btn-next">다음달</a>
	</div>
	<div class="body">
		<table>
			<colgroup>
			<col width="14.285714%" span="7">
			</colgroup>
			<thead>
			<tr>
				<th scope="col" class="sun">Sun</th>
				<th scope="col" class="week">Mon</th>
				<th scope="col" class="week">Tue</th>
				<th scope="col" class="week">Wed</th>
				<th scope="col" class="week">Thu</th>
				<th scope="col" class="week">Fri</th>
				<th scope="col" class="sat">Sat</th>
			</tr>
			</thead>
			<tbody>
				<?for($i=0;$i<count($arrSolarCalendar["box"]);$i++){?>		
				<tr>
				  <?for($j=0;$j<7;$j++){
					//국경일, 법정공휴일, 일요일의 경우
					if($arrLunarCalendar[$arrSolarCalendar["box"][$i][$j]][holiday]=="1" || $j==0){
						$bgcolor = "sun";
					//토요일의 경우
					}else if($j==6){
						$bgcolor = "sat";
					}else{
						$bgcolor = "week";
					}
					?>
					<td class="<?=$bgcolor?>"><? if($arrDate[1]==substr($arrSolarCalendar["box"][$i][$j],5,2)) {?><div class="day"><?=substr($arrSolarCalendar["box"][$i][$j],-2)?></div>
					<ul class="cal_text">
					<?
					//일정표시
					if(is_array($arrBoardList["list"][$arrSolarCalendar["box"][$i][$j]])){
						foreach($arrBoardList["list"][$arrSolarCalendar["box"][$i][$j]] AS $key => $val){
					?>
					<li><?=$val[etc_2]?>:<?=$val[etc_3]?><br><a href="<?=$_SERVER[PHP_SELF]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&mode=view&idx=<?=$val[idx]?>"><?=text_cut($val[subject],$arrBoardInfo["list"][0][subjectcut])?></a></li>
					<?}}?>
					</ul>
					<?}?>
				  </td>
				<?}?>
				</tr>
				<?}?>
			</tbody>
		</table>
	</div>
</div>

<?if($arrBoardInfo["list"][0]["useadminonly"] !="Y" || $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["ID"]):?>
<div class="buttons">
	<div class="fr">
		<a href="<?=$_SERVER[PHP_SELF]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&mode=write&category=<?=$_GET[category]?>" class="btn-pack medium">글쓰기</a>
	</div>
</div>
<?endif;?>