<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/header.php";
include $_SERVER[DOCUMENT_ROOT] . "/module/board/board.lib.php";
if(!in_array("board_manage",$_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["AUTH"]) && $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["GRADE"]!="ROOT"):
	jsMsg("권한이 없습니다.");
	jsHistory("-1");
endif;

//DB연결
$dblink = SetConn($_conf_db["main_db"]);

$arrList = getCommentList("", "", $scale, $_REQUEST[offset]);
//_DEBUG($arrList);

//DB해제
SetDisConn($dblink);
?>
<div id="admin-container">
	<? include "menu.php"; ?>
    <div id="admin-content">
		<h2 class="admin-title">댓글 관리</h2>

<script language="javascript" src="/common/util.js"></script>
<script language="javascript">
function delComment(idx){
	var cfm;
	cfm =false;
	cfm = confirm("이 코멘트를 삭제 하시겠습니까?");
	if(cfm==true){
		document.frmContentsHidden.idx.value = idx;
		document.frmContentsHidden.submit();
	}
}
</script>
<div class="mgb5">&nbsp;<strong>전체 : <?=number_format($arrList['total'])?> 개</strong></div>
<table class="admin-table-type1">
<colgroup>
<col width="70" />
<col width="100" />
<col width="100" />
<col width="*" />
<col width="120" />
<col width="100" />
<col width="80" />
</colgroup>
<thead>
<tr>
  <th>No.</th>
  <th>ID</th>
  <th>작성자</th>
  <th>내용</th>
  <th>IP주소</th>
  <th>등록일</th>
  <th>삭제</th>
</tr>
</thead>
<tbody>
<?if($arrList['list']['total'] > 0):?>

<?for ($i=0;$i<$arrList['list']['total'];$i++) {?>
<tr>
  <td><?=number_format($arrList['total']-$i-$offset)?></td>
  <td><?=$arrList['list'][$i]['user_id']?></td>
  <td><?=$arrList['list'][$i]['user_name']?></td>
  <td class="space-left"><a href="board_view.php?boardid=<?=$arrList['list'][$i]['boardid']?>&mode=view&idx=<?=$arrList['list'][$i]['board_idx']?>&c_idx=<?=$arrList['list'][$i]['idx']?>"> <?=stripslashes($arrList['list'][$i]['comment'])?></a></td>
  <td><?=$arrList['list'][$i]['ip']?></td>
  <td><?=substr($arrList['list'][$i]['wdate'],0,10)?></td>
  <td><a href="javascript:delComment('<?=$arrList['list'][$i]['idx']?>');"><img src="/backoffice/images/k_delete.gif" alt="삭제" /></a></td>
</tr>
<?}?>

<?else:?>
<tr height="100">
  <td width="100%" colspan="8" >등록된 댓글이 없습니다.</td>
</tr>
<?endif;?>
</tbody>
</table>

<div class="paginate">
  <?=pageNavigation($arrList['total'],$scale,$pagescale,$offset,"")?>
</div>

<form name="frmContentsHidden" method="post" action="/module/board/board_evn.php">
<input type="hidden" name="evnMode" value="comment_delete">
<input type="hidden" name="idx">
<input type="hidden" name="returnURL" value="<?=$_SERVER[REQUEST_URI]?>">
</form>
	</div>
</div>
<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/footer.php";
?>