<?
$pages=intval($arrBoardList["total"]/$arrBoardInfo["list"][0]["scale"]); 
if ($arrBoardList["total"] % $arrBoardInfo["list"][0]["scale"]) { 
	$pages++; 
} 
?>

<div class="board-search"> 
	<div class="total-page">페이지정보 : <?=number_format(($_REQUEST[offset]/$arrBoardInfo["list"][0]["scale"])+1)?> / <?=number_format($pages)?> </div> 
    <div class="search">
        <form name="form1" method="get" action="<?=$_SERVER[PHP_SELF]?>"> 
		<input type="hidden" name="boardid" value="<?=$arrBoardInfo["list"][0]["boardid"]?>">
		<input type="hidden" name="category" value="<?=$_GET["category"]?>">
        	<label for="bbsOption" class="hide">검색옵션</label>
            <select name="sw" id="bbsOption" class="select">
              <option value='a'<?=$_GET[sw]=="a"?" selected='selected'":""?>>전체</option>
			  <option value='s'<?=$_GET[sw]=="s"?" selected='selected'":""?>>제목</option>
			  <option value='c'<?=$_GET[sw]=="c"?" selected='selected'":""?>>내용</option>
			  <option value='n'<?=$_GET[sw]=="n"?" selected='selected'":""?>>작성자</option>
            </select>
            <label for="keyword" class="hide">search_word</label>
        	<input type="text" name="sk" id="keyword" value="<?=$_GET[sk]?>" class="input" title="검색어" /> 
			<button type="submit" class="btn btn-pack">검색</button>
        </form>
    </div>
</div>

<div class="board-list">
	<table summary="이 표는 <?=$arrBoardInfo["list"][0]["boardname"]?> 목록이 번호, 제목, 작성자, 작성일자, 조회로 구성되어 있습니다.">
	  <caption><?=$arrBoardInfo["list"][0]["boardname"]?> 목록</caption>
	  <colgroup>
			<col width="60">
			<col>
			<col width="110">
			<col width="90">
			<col width="60">
		</colgroup>
		<thead>
			<tr>
				<th scope="col">번호</th>
				<th scope="col">제목</th>
				<th scope="col">작성자</th>
				<th scope="col">처리현황</th>
				<th scope="col">조회</th>
			</tr>
		</thead>
	  <tbody>
	    <?
		if($arrBoardList["list"]["total"] > 0){
			//공지글 이미지
			$noticeImage ="<img src='/images/bbs/icon_notice.gif' alt='공지글' />";
			for($i=0; $i < $arrBoardList["list"]["total"]; $i++){
				//신규글 표시
				if(strtotime($arrBoardList["list"][$i][wdate])+($arrBoardInfo["list"][0]["newmark"]*86400) > time()){
					$newImage =" <img src='/images/bbs/icon_new.gif' alt='New' />";
				}else{
					$newImage ="";
				}
				//베스트 조회 표시
				if($arrBoardList["list"][$i][hit] >= $arrBoardInfo["list"][0]["besthit"]){
					$bestImage =" <img src='".$_SITE["BOARD_SKIN_URL"]."/".$arrBoardInfo["list"][0][skin]."/images/icon_best.gif' align='absmiddle' />";
				}else{
					$bestImage ="";
				}

				//글잠금 표시
				if($arrBoardList["list"][$i][uselock] == "Y"){
					$lockImage =" <img src='/images/bbs/icon_secret.gif' alt='비밀글' />";
				}else{
					$lockImage ="";
				}

				//댓글수 표시
				if($arrBoardList["list"][$i][cmt_count] > 0){
					$cmt_count = "<span class='comment'>(".number_format($arrBoardList["list"][$i][cmt_count]).")</span>";
				}else{
					$cmt_count = "";
				}
		?>
		<tr>
		  <td scope="row"><?=$arrBoardList["list"][$i][no]=="0"?$noticeImage:$arrBoardList["total"]-$i-$_GET[offset]?></td>
		  <td class="subject"><?=$arrBoardList["list"][$i][depth]>0 ? "<img src='/images/bbs/icon_reply.gif' alt='답변'>":""?>&nbsp;
		  <a href="<?=$_SERVER[PHP_SELF]?>?boardid=<?=$arrBoardInfo["list"][0]["boardid"]?>&mode=view&idx=<?=$arrBoardList["list"][$i][idx]?>&sk=<?=$_GET[sk]?>&sw=<?=$_GET[sw]?>&offset=<?=$_GET[offset]?>&category=<?=$_GET[category]?>" title="<?=stripslashes($arrBoardList["list"][$i][subject])?>"><?=$arrBoardList["list"][$i][subject]!=""?text_cut(stripslashes($arrBoardList["list"][$i][subject]),$arrBoardInfo["list"][0][subjectcut]):"제목없음"?></a> <?=$cmt_count?><?=$newImage?><?=$lockImage?></a></td>
		  <td><?=$arrBoardList["list"][$i][name]?></td>
		  <!-- <td><?=substr(str_replace("-",".",$arrBoardList["list"][$i][wdate]),0,10)?></td> -->
		  <td><?if($arrBoardList["list"][$i][depth]!="1"){?><img src="/images/bbs/icon_<?=$arrBoardList["list"][$i][category]!="YES"?"no":"yes"?>.gif" alt="<?=$arrBoardList["list"][$i][category]?>" /><?}?></td>
		  <td><?=number_format($arrBoardList["list"][$i][hit])?></td>
		  
		</tr>
		<?
			}
		}else{
		?>
		<tr> 
			<td colspan="9" align="center" height="100">등록된 게시물이 없습니다.</td>
		</tr>
		<?
			}
		?>
	  </tbody>
	</table>
</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;?>

<div class="paginate">
    <?=pageNavigation($arrBoardList["total"],$arrBoardInfo["list"][0]["scale"],$arrBoardInfo["list"][0]["pagescale"],$_GET[offset],"boardid=".$arrBoardInfo["list"][0]["boardid"]."&sk=".$_GET[sk]."&sw=".$_GET[sw]."&category=".$_GET[category])?>
</div>
