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

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

$scale = 20;

//제품 리스트
$arrList = getBannerList($scale, $_REQUEST[offset]);

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

<script language="javascript">
function delBanner(idx){
	var cfm;
	cfm =false;
	cfm = confirm("이 배너를 삭제 하시겠습니까?");
	if(cfm==true){
		document.frmListHidden.idx.value = idx;
		document.frmListHidden.submit();
	}
}
</script>
<div class="admin-search">
<form name="frm" method="get" action="<?=$_SEVER[PHP_SELF]?>">
	<div class="total">&nbsp;<strong>전체 : <?=number_format($arrList['total'])?> 개</strong></div>
	<div class="keyword">배너구분: 
		<select name="b_type" class="select" style="width:200px;">
			<option value="">== 선택 ==</option>
			<? for ($i=1;$i<count($_SITE["BANNER"]["OPTION"])+1;$i++){?>
			<option value="<?=$i?>"<?=$_REQUEST[b_type]==$i?" selected":""?>><?=$_SITE["BANNER"]["OPTION"][$i]?></option>
			<?}?>
			<!-- <option value="1"<?=$_REQUEST[b_type]=="1"?" selected":""?>>1. 메인 배너(702px * 450px)</option>
			<option value="2"<?=$_REQUEST[b_type]=="2"?" selected":""?>>2. 메인 우측배너1( 가로 280px )</option>
			<option value="3"<?=$_REQUEST[b_type]=="3"?" selected":""?>>3. 메인 우측배너2(280px * 157px)</option>
			<option value="4"<?=$_REQUEST[b_type]=="4"?" selected":""?>>4. 메인 우측배너3(280px * 135px)</option>
			<option value="5"<?=$_REQUEST[b_type]=="5"?" selected":""?>>5. 메인 중앙배너 2개(342px * 135px)</option>
			<option value="6"<?=$_REQUEST[b_type]=="6"?" selected":""?>>6. 메인 좌측 퀵배너( 가로 102px )</option>
			<option value="7"<?=$_REQUEST[b_type]=="7"?" selected":""?>>7. 기기장비패키지몰 배너(1000px * 336px)</option>
			<option value="8"<?=$_REQUEST[b_type]=="8"?" selected":""?>>8. 커피머신쇼핑몰 배너(1000px * 336px)</option> -->
		</select>
		<select name="st">
			<option value="1"<?=$_REQUEST[st]=="1"?" selected":""?>>정렬역순</option>
			<option value="2"<?=$_REQUEST[st]=="2"?" selected":""?>>등록순</option>
		</select>
		<input type="image" src="/backoffice/images/btn_search.gif" name="btn" alt="검색" />
	</div>
</form>
</div>

<table class="admin-table-type1">
  <thead>
	<tr>
	  <th width="5%">No.</th>
	  <th width="20%">배너</th>
	  <th width="25%">제목</th>
	  <th width="5%">타입</th>
	  <!-- <th width="5%">타겟</th> -->
	  <th width="5%">보임</th>
	  <th width="5%">정렬</th>
	  <th width="5%">클릭</th>
	  <th width="15%">등록일</th>
	  <th width="10%">관리</th>
	</tr>
  </thead>
  <tbody>
	<?if($arrList['list']['total'] > 0):?>

	<?for ($i=0;$i<$arrList['list']['total'];$i++) {?>
	<tr height="60">
		<td><?=$arrList['list'][$i]['idx']?></td>
		<td><a href="<?=$arrList['list'][$i]['b_url']?>" target="_blank"><img src="/uploaded/banner/<?=$arrList['list'][$i]['b_image']?>" height="40"></a></td>
		<td><?=$arrList['list'][$i]['b_subject']?></td>
		<td><?=$arrList['list'][$i]['b_type']?></td>
		<!-- <td><?=$arrList['list'][$i]['b_target']?></td> -->
		<td><?=$arrList['list'][$i]['b_show']?></td>
		<td><?=$arrList['list'][$i]['b_sort']?></td>
		<td><?=number_format($arrList['list'][$i]['b_hit'])?></td>
		<td><?=$arrList['list'][$i]['b_date']?></td>
		<td><a href="banner_info.php?idx=<?=$arrList['list'][$i]['idx']?>"><img src="/backoffice/images/k_modify.gif" alt="수정" /></a> <a href="javascript:delBanner('<?=$arrList['list'][$i]['idx']?>');"><img src="/backoffice/images/k_delete.gif" alt="삭제" /></a></td>
	</tr>
	<?}?>

	<?else:?>
	<tr height="100">
	  <td width="100%" colspan="12" >등록된 배너가 없습니다.</td>
	</tr>
	<?endif;?>
  </tbody>
</table>

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

<form name="frmListHidden" method="post" action="banner_evn.php">
<input type="hidden" name="evnMode" value="delete">
<input type="hidden" name="idx">
</form>
  </div>
</div>
<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/footer.php";
?>