<?
$sub_menu = "400110";
include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token		= get_token();
include_once("$g4[path]/head.sub.php");

$winstyle	= array("1"=>"새창", "2"=>"레이어", "3"=>"모바일");
?>
<script type="text/javascript" src="<?=$g4[path]?>/js/sideview.js"></script>
<style>
.tbl_box	{ border:1px solid #CBCBCB; border-top:2px solid #989898; }
.tbl_box tr th	{ background:#F7F7F7; height:30px; border-right:1px solid #EFEFEF; border-bottom:1px solid #EFEFEF; }
.tbl_box tr th:last-child	{ border-right:0; }
.tbl_box tr td	{ padding:6px; border-right:1px solid #EFEFEF; border-bottom:1px solid #EFEFEF; }
.tbl_box tr td:last-child	{ border-right:0; }
.tbl_box tr:last-child td	{ border-bottom:0; }
table tr td a	{ cursor:pointer; margin:0 5px 0 5px; }
table tr td a:hover	{ text-decoration:underline; }
span.member:hover	{ text-decoration:underline; }
</style>
<link rel="stylesheet" href="<?=$g4[path]?>/adm/admin.style.css" type="text/css">
<?
$colspan = 9;
$g4[title] = "공지사항";

include_once("./admin.head.php");

//-- 공지사항 읽어오기
$s_where	= "where 1";
if(!$s_orderby)
	$s_orderby	= "order by db_recno desc";

$sql	= "select count(*) as cnt from $zmb[table_popup_notice] $s_where";
$row	= sql_fetch($sql);
$total_count = $row[cnt];
$rows	= 25;
$total_page  = ceil($total_count / $rows);		// 전체 페이지 계산
if ($page == "") { $page = 1; }					// 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows;				// 시작 열을 구함
$rs			= sql_query("select * from $zmb[table_popup_notice] $s_where $s_orderby limit $from_record, $rows");

?>
<?=subtitle("팝업 공지사항")?>
<div class="subtitle_msg">홈페이지 접속 했을 때 팝업 공지창입니다.</div>
<table width=100% cellpadding=0 cellspacing=0 border=0 class="tbl_box">
<colgroup width=5%>
<colgroup width=35%>
<colgroup width=10%>
<colgroup width=8%>
<colgroup width=10%>
<colgroup width=8%>
<colgroup width=8%>
<colgroup width=*>
<tr>
    <th>번호</th>
	<th>제목</th>
	<th>작성일</th>
	<th>시작일</th>
	<th>종료일</th>
	<th>종류</th>
	<th>레벨</th>
	<th></th>
</tr>
<?
$i		= 0;
while($rd = sql_fetch_array($rs)) :
$i++;
$win_size	= explode("x", $rd[db_winsize]);
$ncode		= base64_encode($rd[db_recno]);
if($rd[db_winstyle] == "3") {
	$skin_path	= "$g4[path]/skin.mobile/popup/$rd[db_skin]/popup.skin.php?ncode=$ncode";		//-- 모바일 스킨
}else{
	$skin_path	= "$g4[path]/skin/popup/$rd[db_skin]/popup.skin.php?ncode=$ncode";
}
?>
<tr class='list<?=$list?> col1 ht center' onMouseOver="this.style.backgroundColor='#EFEFEF'" onMouseOut="this.style.backgroundColor=''">
	<td align="left"><?=$i?></td>
    <td align="left"><?=cut_str($rd[db_subject], 50)?></td>
    <td><?=substr($rd[db_datetime], 0, 10)?></td>
    <td><?=substr($rd[db_start_datetime], 0, 10)?></td>
    <td><?=substr($rd[db_end_datetime], 0, 10)?></td>
    <td><?=$winstyle[$rd[db_winstyle]]?></td>
	<td align=left><?=$rd[db_target_level]?>:<?=$zm_levelname[$rd[db_target_level]]?></td>
    <td align="center"><a onclick="zm_gourl('./zm.popup_notice_write.php?ncode=<?=$ncode?>');">수정</a>
	<a onClick="window.open('<?=$skin_path?>', 'popup', 'width=<?=$win_size[0]?>, height=<?=$win_size[1]?>, scrollbar=0, toolbar=0');">미리보기</a>
	<a onClick="if(confirm('선택한 공지사항을 삭제 합니다.')) zm_gourl('./zm.popup_notice_process.php?mode=del&ncode=<?=$ncode?>');">삭제</a>
	</td>
</tr>
<? endwhile; ?>
<? if ($i == 0)
    echo "<tr height='50'><td colspan='$colspan' align=center height=100 bgcolor=#ffffff>내용이 없습니다.</td></tr>"; 
?>
</table>
<div style="padding-top:5px;">
	<input type="button" value="공지사항 작성하기" class="bttn_common" onClick="zm_gourl('./zm.popup_notice_write.php')">
</div>
<?
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");
?>
<div><?=$pagelist?></div>
<script language="javascript">
</script>
<? include_once("./admin.tail.php"); ?>
</body>
</html>