팝업 레이어 접속기기 설정할 수 있도록 수정

This commit is contained in:
chicpro
2013-12-06 10:21:23 +09:00
parent e5cc941e0c
commit 9ab109aca6
8 changed files with 92 additions and 5 deletions

View File

@ -16,6 +16,7 @@ if ($w == "u")
else
{
$html_title .= " 입력";
$nw['nw_device'] = 'both';
$nw['nw_disable_hours'] = 24;
$nw['nw_left'] = 10;
$nw['nw_top'] = 10;
@ -44,6 +45,17 @@ include_once (G5_ADMIN_PATH.'/admin.head.php');
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="nw_device">접속기기</label></th>
<td>
<?php echo help("팝업레이어가 표시될 접속기기를 설정합니다."); ?>
<select name="nw_device" id="nw_device">
<option value="both"<?php echo get_selected($nw['nw_device'], 'both', true); ?>>PC와 모바일</option>
<option value="pc"<?php echo get_selected($nw['nw_device'], 'pc'); ?>>PC</option>
<option value="mobile"<?php echo get_selected($nw['nw_device'], 'mobile'); ?>>모바일</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="nw_disable_hours">시간</label></th>
<td>

View File

@ -10,7 +10,8 @@ if ($W == 'd')
else
auth_check($auth[$sub_menu], "w");
$sql_common = " nw_begin_time = '$nw_begin_time',
$sql_common = " nw_device = '$nw_device',
nw_begin_time = '$nw_begin_time',
nw_end_time = '$nw_end_time',
nw_disable_hours = '$nw_disable_hours',
nw_left = '$nw_left',
@ -23,9 +24,6 @@ $sql_common = " nw_begin_time = '$nw_begin_time',
if($w == "")
{
$sql = " alter table {$g5['g5_shop_new_win_table']} auto_increment=1 ";
sql_query($sql);
$sql = " insert {$g5['g5_shop_new_win_table']} set $sql_common ";
sql_query($sql);

View File

@ -31,6 +31,7 @@ $result = sql_query($sql);
<tr>
<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">접속기기</th>
<th scope="col">시작일시</th>
<th scope="col">종료일시</th>
<th scope="col">시간</th>
@ -45,10 +46,23 @@ $result = sql_query($sql);
<?php
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2);
switch($row['nw_device']) {
case 'pc':
$nw_device = 'PC';
break;
case 'mobile':
$nw_device = '모바일';
break;
default:
$nw_device = '모두';
break;
}
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $row['nw_id']; ?></td>
<td><?php echo $row['nw_subject']; ?></td>
<td><?php echo $nw_device; ?></td>
<td class="td_datetime"><?php echo substr($row['nw_begin_time'],2,14); ?></td>
<td class="td_datetime"><?php echo substr($row['nw_end_time'],2,14); ?></td>
<td class="td_num"><?php echo $row['nw_disable_hours']; ?>시간</td>
@ -65,7 +79,7 @@ $result = sql_query($sql);
}
if ($i == 0) {
echo '<tr><td colspan="10" class="empty_table">자료가 한건도 없습니다.</td></tr>';
echo '<tr><td colspan="11" class="empty_table">자료가 한건도 없습니다.</td></tr>';
}
?>
</tbody>

View File

@ -737,4 +737,10 @@ if(!sql_query(" select it_soldout from {$g5['g5_shop_item_table']} limit 1 ", fa
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
ADD `it_soldout` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_use` ", true);
}
// 팝업 레이어 접속기기 필드 추가
if(!sql_query(" select nw_device from {$g5['g5_shop_new_win_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_new_win_table']}`
ADD `nw_device` varchar(10) NOT NULL DEFAULT 'both' AFTER `nw_id` ", true);
}
?>

View File

@ -579,6 +579,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_item_relation` (
DROP TABLE IF EXISTS `g5_shop_new_win`;
CREATE TABLE IF NOT EXISTS `g5_shop_new_win` (
`nw_id` int(11) NOT NULL AUTO_INCREMENT,
`nw_device` varchar(10) NOT NULL DEFAULT 'both',
`nw_begin_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`nw_end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`nw_disable_hours` int(11) NOT NULL DEFAULT '0',

View File

@ -0,0 +1,48 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$sql = " select * from {$g5['g5_shop_new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'mobile' )
order by nw_id asc ";
$result = sql_query($sql);
for ($i=0; $row_nw=sql_fetch_array($result); $i++)
{
// 이미 체크 되었다면 Continue
if ($_COOKIE["hd_pops_{$row_nw['nw_id']}"])
continue;
$sql = " select * from {$g5['g5_shop_new_win_table']} where nw_id = '{$row_nw['nw_id']}' ";
$nw = sql_fetch($sql);
?>
<!-- 팝업레이어 시작 { -->
<div id="hd_pops_<?php echo $nw['nw_id'] ?>" class="hd_pops" style="top:<?php echo $nw['nw_top']?>px;left:<?php echo $nw['nw_left']?>px;width:<?php echo $nw['nw_width'] ?>px;height:<?php echo $nw['nw_height'] ?>px">
<div class="hd_pops_con">
<?php echo conv_content($nw['nw_content'], 1); ?>
</div>
<div class="hd_pops_footer">
<button class="hd_pops_reject hd_pops_<?php echo $nw['nw_id']; ?> <?php echo $nw['nw_disable_hours']; ?>"><strong><?php echo $nw['nw_disable_hours']; ?></strong>시간 동안 다시 열람하지 않습니다.</button>
<button class="hd_pops_close hd_pops_<?php echo $nw['nw_id']; ?>">닫기</button>
</div>
</div>
<?php }
if ($i == 0) echo '<span class="sound_only">팝업레이어 알림이 없습니다.</span>';
?>
<script>
$(function() {
$(".hd_pops_reject").click(function() {
var id = $(this).attr('class').split(' ');
var ck_name = id[1];
var exp_time = parseInt(id[2]);
$("#"+id[1]).css("display", "none");
set_cookie(ck_name, 1, exp_time, g5_cookie_domain);
});
$('.hd_pops_close').click(function() {
var idb = $(this).attr('class').split(' ');
$('#'+idb[1]).css('display','none');
});
});
</script>
<!-- } 팝업레이어 끝 -->

View File

@ -12,6 +12,13 @@ include_once(G5_LIB_PATH.'/popular.lib.php');
<div id="skip_to_container"><a href="#container">본문 바로가기</a></div>
<?php if(defined('_INDEX_')) { // index에서만 실행 ?>
<div id="hd_pop">
<h2>팝업레이어 알림</h2>
<?php include G5_MSHOP_PATH.'/newwin.inc.php'; // 팝업레이어 ?>
</div>
<?php } ?>
<div id="logo"><a href="<?php echo G5_SHOP_URL; ?>/"><img src="<?php echo G5_DATA_URL; ?>/common/mobile_logo_img" alt="<?php echo $config['cf_title']; ?> 메인"></a></div>
<a href="<?php echo G5_SHOP_URL; ?>/category.php" target="_blank" id="hd_ct">분류</a>

View File

@ -3,6 +3,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$sql = " select * from {$g5['g5_shop_new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'pc' )
order by nw_id asc ";
$result = sql_query($sql);
for ($i=0; $row_nw=sql_fetch_array($result); $i++)