모바일 사용후기 상품문의 추가

This commit is contained in:
chicpro
2013-07-18 17:30:19 +09:00
parent 73b838aff3
commit 2d6423301e
14 changed files with 1196 additions and 526 deletions

View File

@ -1,240 +0,0 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<section id="sit_qa_list">
<h3>등록된 상품문의</h3>
<?php
$sql_common = " from {$g4['shop_item_qa_table']} where it_id = '{$it['it_id']}' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$qa_total_count = $row['cnt'];
$qa_total_page = ceil($qa_total_count / $qa_page_rows); // 전체 페이지 계산
if ($qa_page == "") $qa_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$qa_from_record = ($qa_page - 1) * $qa_page_rows; // 시작 레코드 구함
$sql = "select *
$sql_common
order by iq_id desc
limit $qa_from_record, $qa_page_rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $qa_total_count - ($qa_page - 1) * $qa_page_rows - $i;
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50, '…');
$iq_question = conv_content($row['iq_question'],0);
$iq_answer = conv_content($row['iq_answer'],0);
$iq_time = substr($row['iq_time'], 2, 14);
//$qa = "<img src='$g4[shop_img_path]/icon_poll_q.gif' border=0>";
//if ($row[iq_answer]) $qa .= "<img src='$g4[shop_img_path]/icon_answer.gif' border=0>";
//$qa = "$qa";
$iq_stats = '';
$iq_answer = '';
$iq_flag = 0;
if ($row['iq_answer'])
{
$iq_answer = conv_content($row['iq_answer'],0);
$iq_stats = '답변완료';
} else {
$iq_stats = '답변전';
$iq_answer = '답변이 등록되지 않았습니다.';
$iq_flag = 1;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
?>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
<dt>상태</dt>
<dd><?php echo $iq_stats; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<p class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</p>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
<textarea id="tmp_iq_id<?php echo $i; ?>"><?php echo $row['iq_id']; ?></textarea>
<textarea id="tmp_iq_name<?php echo $i; ?>"><?php echo $row['iq_name']; ?></textarea>
<textarea id="tmp_iq_subject<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></textarea>
<textarea id="tmp_iq_question<?php echo $i; ?>"><?php echo $row['iq_question']; ?></textarea>
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
<div class="sit_qa_cmd">
<button type="button" onclick="javascript:itemqa_update(<?php echo $i; ?>);" class="btn01">수정</button>
<button type="button" onclick="javascript:itemqa_delete(fitemqa_password<?php echo $i; ?>, <?php echo $i; ?>);" class="btn01">삭제</button>
</div>
<?php } ?>
</div>
<div id="sit_qa_pw_<?php echo $i; ?>" class="sit_qa_pw">
<form name="fitemqa_password<?php echo $i; ?>" method="post" action="./itemqaupdate.php" autocomplete="off">
<input type="hidden" name="w" value="">
<input type="hidden" name="iq_id" value="">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<span>삭제하시려면 글 작성 시 입력하신 패스워드를 입력해주세요.</span>
<label for="iq_password_<?php echo $i; ?>">패스워드</label>
<input type="password" name="iq_password" id="iq_password_<?php echo $i; ?>" required class="frm_input">
<input type="submit" value="확인" class="btn_frmline">
</form>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">상품문의가 없습니다.</p>';
?>
</section>
<div id="sit_qa_wbtn">
<button type="button" id="iq_write" class="btn_submit" onclick="javascript:itemqa_insert();">상품문의 쓰기</button>
</div>
<section id="sit_qa_w">
<h3>상품문의 작성</h3>
<form name="fitemqa" method="post" onsubmit="return fitemqa_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="iq_id" value="">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<?php if (!$is_member) { ?>
<tr>
<th scope="row"><label for="iq_name">이름</label></th>
<td><input type="text" name="iq_name" id="iq_name" required class="frm_input" maxlength="20" minlength="2"></td>
</tr>
<tr>
<th scope="row"><label for="iq_password">패스워드</label></th>
<td>
<span class="frm_info">패스워드는 최소 3글자 이상 입력하십시오.</span>
<input type="password" name="iq_password" id="iq_password" required class="frm_input" maxlength="20" minlength="3">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="iq_subject">제목</label></th>
<td><input type="text" name="iq_subject" id="iq_subject" required class="frm_input" size="71" maxlength="100"></td>
</tr>
<tr>
<th scope="row"><label for="iq_question">내용</label></th>
<td><textarea name="iq_question" id="iq_question" required></textarea></td>
</tr>
<tr>
<th scope="row">자동등록방지</th>
<td><?php echo $captcha_html; ?></td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</section>
<?php if ($qa_pages) get_paging(10, $qa_page, $qa_total_page, './item.php?it_id='.$it_id.'&amp;'.$qstr.'&amp;qa_page=', '#qa'); // 페이징 ?>
<script>
$(function() {
});
function fitemqa_submit(f)
{
<?php echo chk_captcha_js(); ?>
f.action = "itemqaupdate.php";
return true;
}
function itemqa_insert()
{
/*
if (!g4_is_member) {
alert("로그인 하시기 바랍니다.");
return;
}
*/
var f = document.fitemqa;
var id = document.getElementById('sit_qa_w');
id.style.display = 'block';
f.w.value = '';
f.iq_id.value = '';
if (!g4_is_member)
{
f.iq_name.value = '';
f.iq_name.readOnly = false;
f.iq_password.value = '';
}
f.iq_subject.value = '';
f.iq_question.value = '';
}
function itemqa_update(idx)
{
var f = document.fitemqa;
var id = document.getElementById('sit_qa_w');
id.style.display = 'block';
f.w.value = 'u';
f.iq_id.value = document.getElementById('tmp_iq_id'+idx).value;
if (!g4_is_member)
{
f.iq_name.value = document.getElementById('tmp_iq_name'+idx).value;
f.iq_name.readOnly = true;
}
f.iq_subject.value = document.getElementById('tmp_iq_subject'+idx).value;
f.iq_question.value = document.getElementById('tmp_iq_question'+idx).value;
}
function itemqa_delete(f, idx)
{
var id = document.getElementById('sit_qa_w');
f.w.value = 'd';
f.iq_id.value = document.getElementById('tmp_iq_id'+idx).value;
if (g4_is_member)
{
if (confirm("삭제하시겠습니까?"))
f.submit();
}
else
{
id.style.display = 'none';
document.getElementById('itemqa_password'+idx).style.display = 'block';
}
}
</script>

146
mobile/shop/itemqa.php Normal file
View File

@ -0,0 +1,146 @@
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
$itemqa_list = "./itemqalist.php";
$itemqa_form = "./itemqaform.php?it_id=".$it_id;
$itemqa_formupdate = "./itemqaformupdate.php?it_id=".$it_id;
$thumbnail_width = 500;
?>
<!-- 상품문의 목록 시작 { -->
<section id="sit_qa_list">
<h3>등록된 상품문의</h3>
<?php
$sql_common = " from `{$g4['shop_item_qa_table']}` where it_id = '{$it_id}' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 5;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
$sql = "select * $sql_common order by iq_id desc limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$iq_num = $total_count - ($page - 1) * $rows - $i;
$iq_star = get_star($row['iq_score']);
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50,"…");
$iq_question = get_view_thumbnail($row['iq_question'], $thumbnail_width);
$iq_time = substr($row['iq_time'], 2, 8);
$hash = md5($row['iq_id'].$row['iq_time'].$row['iq_ip']);
// http://stackoverflow.com/questions/6967081/show-hide-multiple-divs-with-jquery?answertab=votes#tab-top
$iq_stats = '';
$iq_style = '';
$iq_answer = '';
if ($row['iq_answer'])
{
$iq_answer = get_view_thumbnail($row['iq_answer'], $thumbnail_width);
$iq_stats = '답변완료';
$iq_style = 'sit_qaa_done';
$is_answer = true;
} else {
$iq_stats = '답변전';
$iq_style = 'sit_qaa_yet';
$iq_answer = '답변이 등록되지 않았습니다.';
$is_answer = false;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
?>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $iq_num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
<dt>상태</dt>
<dd class="<?php echo $iq_style; ?>"><?php echo $iq_stats; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<div class="sit_qa_p">
<div class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</div>
<div class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</div>
<?php if ($is_admin || ($row['mb_id'] == $member['mb_id'] && !$is_answer)) { ?>
<div class="sit_qa_cmd">
<a href="<?php echo $itemqa_form."&amp;iq_id={$row['iq_id']}&amp;w=u"; ?>" class="itemqa_form btn01" onclick="return false;">수정</a>
<a href="<?php echo $itemqa_formupdate."&amp;iq_id={$row['iq_id']}&amp;w=d&amp;hash={$hash}"; ?>" class="itemqa_delete btn01">삭제</a>
<!-- <button type="button" onclick="javascript:itemqa_update(<?php echo $i; ?>);" class="btn01">수정</button>
<button type="button" onclick="javascript:itemqa_delete(fitemqa_password<?php echo $i; ?>, <?php echo $i; ?>);" class="btn01">삭제</button> -->
</div>
<?php } ?>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">상품문의가 없습니다.</p>';
?>
</section>
<?php
echo itemqa_page($config['cf_mobile_pages'], $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_qa_wbtn">
<!-- <a href="javascript:itemqawin('it_id=<?php echo $it_id; ?>');">상품문의 쓰기<span class="sound_only"> 새 창</span></a> -->
<a href="<?php echo $itemqa_form; ?>" class="btn02 itemqa_form">상품문의 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemqa_list; ?>" id="itemqa_list" class="btn01">더보기</a>
</div>
<script>
$(function(){
$(".itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=500,scrollbars=1");
return false;
});
$(".itemqa_delete").click(function(){
return confirm("정말 삭제 하시겠습니까?\n\n삭제후에는 되돌릴수 없습니다.");
});
$(".qa_href").click(function(){
var $content = $("#qa_div"+$(this).attr("target"));
$(".qa_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
$(".qa_page").click(function(){
$("#itemqa").load($(this).attr("href"));
return false;
});
});
</script>
<!-- } 상품문의 목록 끝 -->

View File

@ -0,0 +1,83 @@
<?php
include_once('./_common.php');
include_once(G4_EDITOR_LIB);
// 상품문의의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)
$iq_question_max_length = 10000;
$w = escape_trim($_REQUEST['w']);
$it_id = escape_trim($_REQUEST['it_id']);
$iq_id = escape_trim($_REQUEST['iq_id']);
if (!$is_member) {
alert_login("상품문의는 회원만 작성 가능합니다.", urlencode($_SERVER['REQUEST_URI']));
}
if ($w == "u")
{
$qa = sql_fetch(" select * from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ");
if (!$qa) {
alert_close("상품문의 정보가 없습니다.");
}
$it_id = $qa['it_id'];
if (!$iq_admin && $qa['mb_id'] != $member['mb_id']) {
alert_close("자신의 상품문의만 수정이 가능합니다.");
}
}
include_once(G4_PATH.'/head.sub.php');
?>
<!-- 상품문의 쓰기 시작 { -->
<div id="sit_qa_write" class="new_win">
<h1 class="new_win_title">상품문의 쓰기</h1>
<form name="fitemqa" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqa_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_2">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="iq_subject">제목</label></th>
<td><input type="text" name="iq_subject" value="<?php echo get_text($qa['iq_subject']); ?>" id="iq_subject" required class="frm_input" minlength="2" maxlength="250"></td>
</tr>
<tr>
<th scope="row"><label for="iq_question">질문</label></th>
<td><?php echo editor_html('iq_question', $qa['iq_question']); ?></td>
</tr>
</tbody>
</table>
<div class="btn_win">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</div>
<script type="text/javascript">
function fitemqa_submit(f)
{
<?php echo get_editor_js('iq_question'); ?>
if (iq_question_editor_data.length > <?php echo $iq_question_max_length; ?>) {
alert("내용은 <?php echo $iq_question_max_length; ?> 글자 이내에서 작성해 주세요. (한글은 영문 3자)\n\n현재 : "+iq_question_editor_data.length+" 글자");
CKEDITOR.instances.iq_question.focus();
return false;
}
return true;
}
</script>
<!-- } 상품문의 쓰기 끝 -->
<?php
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,76 @@
<?php
include_once('./_common.php');
if (!$is_member) {
alert_close("상품문의는 회원만 작성이 가능합니다.");
}
$iq_id = escape_trim($_POST['iq_id']);
$iq_subject = escape_trim($_POST['iq_subject']);
$iq_question = escape_trim(stripslashes($_POST['iq_question']));
$iq_answer = escape_trim(stripslashes($_POST['iq_answer']));
$hash = escape_trim($_POST['hash']);
if ($w == "" || $w == "u") {
$iq_name = $member['mb_name'];
$iq_password = $member['mb_password'];
if (!$iq_subject) alert("제목을 입력하여 주십시오.");
if (!$iq_question) alert("질문을 입력하여 주십시오.");
}
$url = "./item.php?it_id=$it_id&amp;_=".get_token()."#sit_qa";
if ($w == "")
{
$sql = "insert {$g4['shop_item_qa_table']}
set it_id = '$it_id',
mb_id = '{$member['mb_id']}',
iq_name = '$iq_name',
iq_password = '$iq_password',
iq_subject = '$iq_subject',
iq_question = '$iq_question',
iq_time = '".G4_TIME_YMDHIS."',
iq_ip = '$REMOTE_ADDR' ";
sql_query($sql);
alert_opener("상품문의가 등록 되었습니다.", $url);
}
else if ($w == "u")
{
if (!$is_amdin)
{
$sql = " select count(*) as cnt from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
alert("자신의 상품문의만 수정하실 수 있습니다.");
}
$sql = " update {$g4['shop_item_qa_table']}
set iq_subject = '$iq_subject',
iq_question = '$iq_question'
where iq_id = '$iq_id' ";
sql_query($sql);
alert_opener("상품문의가 수정 되었습니다.", $url);
}
else if ($w == "d")
{
if (!$is_admin)
{
$sql = " select iq_answer from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if (!$row)
alert("자신의 상품문의만 삭제하실 수 있습니다.");
if ($row['iq_answer'])
alert("답변이 있는 상품문의는 삭제하실 수 없습니다.");
}
//$sql = " delete from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$sql = " delete from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
sql_query($sql);
alert("상품문의가 삭제 되었습니다.", $url);
}
?>

170
mobile/shop/itemqalist.php Normal file
View File

@ -0,0 +1,170 @@
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);
$stx = escape_trim($_REQUEST['stx']);
$g4['title'] = '상품문의';
include_once(G4_MSHOP_PATH.'/_head.php');
$sql_common = " from `{$g4['shop_item_qa_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where (1) ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case "a.it_id" :
$sql_search .= " ($sfl like '$stx%') ";
break;
case "a.iq_name" :
case "a.mb_id" :
$sql_search .= " ($sfl = '$stx') ";
break;
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "a.iq_id";
$sod = "desc";
}
$sql_order = " order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<!-- 전체 상품 문의 목록 시작 { -->
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name", true); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.iq_subject" <?php echo get_selected($sfl, "a.is_subject"); ?>>문의제목</option>
<option value="a.iq_question"<?php echo get_selected($sfl, "a.iq_question"); ?>>문의내용</option>
<option value="a.iq_name" <?php echo get_selected($sfl, "a.it_id"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
</form>
<div id="sps">
<!-- <p><?php echo $config['cf_title']; ?> 전체 상품문의 목록입니다.</p> -->
<?php
$sql = " select a.*, b.it_name
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$star = get_star($row['is_score']);
$small_image = $row['it_id'];
$it_href = G4_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$iq_question = get_view_thumbnail($row['iq_question'], 500);
if ($row['iq_answer'])
{
$iq_answer = get_view_thumbnail($row['iq_answer'], 500);
$iq_stats = '답변완료';
$iq_style = 'sit_qaa_done';
$is_answer = true;
} else {
$iq_stats = '답변전';
$iq_style = 'sit_qaa_yet';
$iq_answer = '답변이 등록되지 않았습니다.';
$is_answer = false;
}
if ($i == 0) echo '<ol>';
?>
<li>
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<span><?php echo $row['it_name']; ?></span>
</a>
</div>
<section class="sps_section">
<h2><?php echo $row['iq_subject']; ?></h2>
<dl class="sps_dl">
<dt>작성자</dt>
<dd><?php echo $row['iq_name']; ?></dd>
<dt>작성일</dt>
<dd><?php echo substr($row['iq_time'],0,10); ?></dd>
<dt>상태</dt>
<dd class="<?php echo $iq_style; ?>"><?php echo $iq_stats; ?></dd>
</dl>
<div id="sqa_con_<?php echo $i; ?>" style="display:none;">
<div class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</div>
<div class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</div>
<div class="sqa_con_btn"><button class="sqa_con_<?php echo $i; ?>">보기</button></div>
</section>
</li>
<?php }
if ($i > 0) echo '</ol>';
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
?>
</div>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function(){
// 사용후기 더보기
$(".sqa_con_btn button").click(function(){
var sqa_con_no = $(this).attr("class");
$("#"+sqa_con_no).is(":hidden") ? $("#"+sqa_con_no).show() : $("#"+sqa_con_no).hide();
});
$(".sqa_con_btn button").toggle(function(){
$(this).text("닫기");
}, function(){
$(this).text("보기");
});
});
</script>
<!-- } 전체 상품 사용후기 목록 끝 -->
<?php
include_once(G4_MSHOP_PATH.'/_tail.php');
?>

133
mobile/shop/itemuse.php Normal file
View File

@ -0,0 +1,133 @@
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
$itemuse_list = "./itemuselist.php";
$itemuse_form = "./itemuseform.php?it_id=".$it_id;
$itemuse_formupdate = "./itemuseformupdate.php?it_id=".$it_id;
?>
<!-- 상품 사용후기 시작 { -->
<section id="sit_use_list">
<h3>등록된 사용후기</h3>
<?php
/*
여분필드 용도
wr_1 : 상품코드
wr_2 : 상품명
wr_3 : 평점 1~5
wr_4 : 관리자확인
*/
//$sql_common = " from `{$g4['write_prefix']}itemuse` where wr_is_comment = 0 and wr_1 = '{$it['it_id']}' and wr_4 = '1' ";
$sql_common = " from `{$g4['shop_item_use_table']}` where it_id = '{$it_id}' and is_confirm = '1' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 5;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
$sql = "select * $sql_common order by is_id desc limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$is_num = $total_count - ($page - 1) * $rows - $i;
$is_star = get_star($row['is_score']);
$is_name = get_text($row['is_name']);
$is_subject = conv_subject($row['is_subject'],50,"…");
//$is_content = ($row['wr_content']);
$is_content = get_view_thumbnail($row['is_content'], 300);
$is_time = substr($row['is_time'], 2, 8);
$is_href = './itemuselist.php?bo_table=itemuse&amp;wr_id='.$row['wr_id'];
$hash = md5($row['is_id'].$row['is_time'].$row['is_ip']);
// http://stackoverflow.com/questions/6967081/show-hide-multiple-divs-with-jquery?answertab=votes#tab-top
if ($i == 0) echo '<ol id="sit_use_ol">';
?>
<li class="sit_use_li">
<button type="button" class="sit_use_li_title" onclick="javascript:qa_menu('sit_use_con_<?php echo $i; ?>')"><b><?php echo $is_num; ?>.</b> <?php echo $is_subject; ?></button>
<dl class="sit_use_dl">
<dt>작성자</dt>
<dd><?php echo $is_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $is_time; ?></dd>
<dt>선호도<dt>
<dd class="sit_use_star"><img src="<?php echo G4_URL; ?>/img/shop/s_star<?php echo $is_star; ?>.png" alt="별<?php echo $is_star; ?>개"></dd>
</dl>
<div id="sit_use_con_<?php echo $i; ?>" class="sit_use_con">
<div class="sit_use_p">
<?php echo $is_content; // 사용후기 내용 ?>
</div>
<?php if ($is_admin || $row['mb_id'] == $member['mb_id']) { ?>
<div class="sit_use_cmd">
<a href="<?php echo $itemuse_form."&amp;is_id={$row['is_id']}&amp;w=u"; ?>" class="itemuse_form btn01" onclick="return false;">수정</a>
<a href="<?php echo $itemuse_formupdate."&amp;is_id={$row['is_id']}&amp;w=d&amp;hash={$hash}"; ?>" class="itemuse_delete btn01">삭제</a>
</div>
<?php } ?>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">사용후기가 없습니다.</p>';
?>
</section>
<?php
echo itemuse_page($config['cf_mobile_pages'], $page, $total_page, "./itemuse.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_use_wbtn">
<a href="<?php echo $itemuse_form; ?>" class="btn02 itemuse_form" onclick="return false;">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_list; ?>" class="btn01 itemuse_list">더보기</a>
</div>
<script>
$(function(){
$(".itemuse_form").click(function(){
window.open(this.href, "itemuse_form", "width=800,height=500,scrollbars=1");
return false;
});
$(".itemuse_delete").click(function(){
if (confirm("정말 삭제 하시겠습니까?\n\n삭제후에는 되돌릴수 없습니다.")) {
return true;
} else {
return false;
}
});
$(".use_href").click(function(){
var $content = $("#use_div"+$(this).attr("target"));
$(".use_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
$(".pg_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemuse').load($(this).attr("href"));
return false;
});
});
</script>
<!-- } 상품 사용후기 끝 -->

View File

@ -1,104 +1,133 @@
<?php
include_once('./_common.php');
// 사용후기의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)
$is_content_max_length = 10000;
$w = escape_trim($_REQUEST['w']);
$it_id = escape_trim($_REQUEST['it_id']);
$is_id = escape_trim($_REQUEST['is_id']);
if (!$is_member) {
alert("사용후기는 회원만 평가가 가능합니다.", G4_BBS_URL."/login.php");
}
if ($w == "") {
$is_score = 10;
} else if ($w == "u") {
$use = sql_fetch(" select * from {$g4['shop_item_use_table']} where is_id = '$is_id' ");
if (!$use) {
alert_close("사용후기 정보가 없습니다.");
}
$it_id = $use['it_id'];
$is_score = $use['is_score'];
if (!$is_admin && $use['mb_id'] != $member['mb_id']) {
alert_close("자신의 사용후기만 수정이 가능합니다.");
}
}
include_once(G4_PATH.'/head.sub.php');
?>
<style>
ul {list-style:none;margin:0px;padding:0px;}
label {width:130px;vertical-align:top;padding:3px 0;}
</style>
<div style="padding:10px;">
<form name="fitemuse" method="post" action="./itemuseformupdate.php" onsubmit="return fitemuse_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<input type="hidden" name="is_id" value="<?php echo $is_id; ?>">
<fieldset style="padding:0 10px 10px;">
<legend><strong>사용후기 쓰기</strong></legend>
<ul style="padding:10px;">
<li>
<label for="is_subject">제목</label>
<input type="text" id="is_subject" name="is_subject" size="100" class="ed" minlength="2" maxlength="250" required itemname="제목" value="<?php echo get_text($use['is_subject']); ?>">
</li>
<li>
<label for="is_content" style="width:200px;">내용</label>
<textarea name="is_content" id="is_content"><?php echo $$use['is_content']; ?></textarea>
</li>
<li>
<label>평가</label>
<input type=radio name=is_score value='10' <?php echo ($is_score==10)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star5.gif' align=absmiddle>
<input type=radio name=is_score value='8' <?php echo ($is_score==8)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star4.gif' align=absmiddle>
<input type=radio name=is_score value='6' <?php echo ($is_score==6)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star3.gif' align=absmiddle>
<input type=radio name=is_score value='4' <?php echo ($is_score==4)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star2.gif' align=absmiddle>
<input type=radio name=is_score value='2' <?php echo ($is_score==2)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star1.gif' align=absmiddle>
</li>
</ul>
<input type="submit" value=" 확 인 ">
</fieldset>
</form>
</div>
<script type="text/javascript">
self.focus();
function fitemuse_submit(f)
{
/*
if (document.getElementById('tx_is_content')) {
var len = ed_is_content.inputLength();
if (len == 0) {
alert('내용을 입력하십시오.');
ed_is_content.returnFalse();
return false;
} else if (len > 1000) {
alert('내용은 1000글자 까지만 입력해 주세요.');
ed_is_content.returnFalse();
return false;
}
}
*/
if (is_content_editor_data.length > <?php echo $is_content_max_length; ?>) {
alert("내용은 <?php echo $is_content_max_length; ?> 글자 이내에서 작성해 주세요. (한글은 영문 3자)\n\n현재 : "+is_content_editor_data.length+" 글자");
CKEDITOR.instances.is_content.focus();
return false;
}
return true;
}
$(function() {
$("#is_subject").focus();
});
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
<?php
include_once('./_common.php');
include_once(G4_EDITOR_LIB);
// 사용후기의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)
$is_content_max_length = 10000;
$w = escape_trim($_REQUEST['w']);
$it_id = escape_trim($_REQUEST['it_id']);
$is_id = escape_trim($_REQUEST['is_id']);
if (!$is_member) {
alert_close("사용후기는 회원만 작성 가능합니다.");
}
if ($w == "") {
$is_score = 10;
} else if ($w == "u") {
$use = sql_fetch(" select * from {$g4['shop_item_use_table']} where is_id = '$is_id' ");
if (!$use) {
alert_close("사용후기 정보가 없습니다.");
}
$it_id = $use['it_id'];
$is_score = $use['is_score'];
if (!$is_admin && $use['mb_id'] != $member['mb_id']) {
alert_close("자신의 사용후기만 수정이 가능합니다.");
}
}
include_once(G4_PATH.'/head.sub.php');
?>
<!-- 사용후기 쓰기 시작 { -->
<div id="sit_use_write" class="new_win">
<h1 class="new_win_title">사용후기 쓰기</h1>
<form name="fitemuse" method="post" action="./itemuseformupdate.php" onsubmit="return fitemuse_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<input type="hidden" name="is_id" value="<?php echo $is_id; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_2">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="is_subject">제목</label></th>
<td><input type="text" name="is_subject" value="<?php echo get_text($use['is_subject']); ?>" id="is_subject" required class="frm_input" minlength="2" maxlength="250"></td>
</tr>
<tr>
<th scope="row"><label for="" style="width:200px;">내용</label></th>
<td><?php echo editor_html('is_content', $use['is_content']); ?></td>
</tr>
<tr>
<th scope="row">평가</th>
<td>
<ul id="sit_use_write_star">
<li>
<input type="radio" name="is_score" value="10" id="is_score10" <?php echo ($is_score==10)?'checked="checked"':''; ?>>
<label for="is_score10">매우만족</label>
<img src="<?php echo G4_URL; ?>/img/shop/s_star5.png">
</li>
<li>
<input type="radio" name="is_score" value="8" id="is_score8" <?php echo ($is_score==8)?'checked="checked"':''; ?>>
<label for="is_score8">만족</label>
<img src="<?php echo G4_URL; ?>/img/shop/s_star4.png">
</li>
<li>
<input type="radio" name="is_score" value="6" id="is_score6" <?php echo ($is_score==6)?'checked="checked"':''; ?>>
<label for="is_score6">보통</label>
<img src="<?php echo G4_URL; ?>/img/shop/s_star3.png">
</li>
<li>
<input type="radio" name="is_score" value="4" id="is_score4" <?php echo ($is_score==4)?'checked="checked"':''; ?>>
<label for="is_score4">불만</label>
<img src="<?php echo G4_URL; ?>/img/shop/s_star2.png">
</li>
<li>
<input type="radio" name="is_score" value="2" id="is_score2" <?php echo ($is_score==2)?'checked="checked"':''; ?>>
<label for="is_score2">매우불만</label>
<img src="<?php echo G4_URL; ?>/img/shop/s_star1.png">
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="btn_win">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</div>
<script type="text/javascript">
function fitemuse_submit(f)
{
/*
if (document.getElementById('tx_is_content')) {
var len = ed_is_content.inputLength();
if (len == 0) {
alert('내용을 입력하십시오.');
ed_is_content.returnFalse();
return false;
} else if (len > 1000) {
alert('내용은 1000글자 까지만 입력해 주세요.');
ed_is_content.returnFalse();
return false;
}
}
*/
<?php echo get_editor_js('is_content'); ?>
if (is_content_editor_data.length > <?php echo $is_content_max_length; ?>) {
alert("내용은 <?php echo $is_content_max_length; ?> 글자 이내에서 작성해 주세요. (한글은 영문 3자)\n\n현재 : "+is_content_editor_data.length+" 글자");
CKEDITOR.instances.is_content.focus();
return false;
}
return true;
}
</script>
<!-- } 사용후기 쓰기 끝 -->
<?php
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,85 @@
<?php
include_once('./_common.php');
if (!$is_member) {
alert_close("사용후기는 회원만 작성이 가능합니다.");
}
$is_subject = trim($_REQUEST['is_subject']);
$is_content = trim($_REQUEST['is_content']);
if ($w == "" || $w == "u") {
$is_name = $member['mb_name'];
$is_password = $member['mb_password'];
if (!$is_subject) alert("제목을 입력하여 주십시오.");
if (!$is_content) alert("내용을 입력하여 주십시오.");
}
$url = "./item.php?it_id=$it_id&amp;_=".get_token()."#sit_use";
if ($w == "")
{
/*
$sql = " select max(is_id) as max_is_id from {$g4['shop_item_use_table']} ";
$row = sql_fetch($sql);
$max_is_id = $row['max_is_id'];
$sql = " select max(is_id) as max_is_id from {$g4['shop_item_use_table']} where it_id = '$it_id' and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ($row['max_is_id'] && $row['max_is_id'] == $max_is_id)
alert("같은 상품에 대하여 계속해서 평가하실 수 없습니다.");
*/
$sql = "insert {$g4['shop_item_use_table']}
set it_id = '$it_id',
mb_id = '{$member['mb_id']}',
is_score = '$is_score',
is_name = '$is_name',
is_password = '$is_password',
is_subject = '$is_subject',
is_content = '$is_content',
is_time = '".G4_TIME_YMDHIS."',
is_ip = '{$_SERVER['REMOTE_ADDR']}' ";
if (!$default['de_item_use_use'])
$sql .= ", is_confirm = '1' ";
sql_query($sql);
if ($default['de_item_use_use']) {
alert_opener("평가하신 글은 관리자가 확인한 후에 출력됩니다.", $url);
} else {
alert_opener("사용후기가 등록 되었습니다.", $url);
}
}
else if ($w == "u")
{
$sql = " select is_password from {$g4['shop_item_use_table']} where is_id = '$is_id' ";
$row = sql_fetch($sql);
if ($row['is_password'] != $is_password)
alert("패스워드가 틀리므로 수정하실 수 없습니다.");
$sql = " update {$g4['shop_item_use_table']}
set is_subject = '$is_subject',
is_content = '$is_content',
is_score = '$is_score'
where is_id = '$is_id' ";
sql_query($sql);
alert_opener("사용후기가 수정 되었습니다.", $url);
}
else if ($w == "d")
{
if (!$is_admin)
{
$sql = " select count(*) as cnt from {$g4['shop_item_use_table']} where mb_id = '{$member['mb_id']}' and is_id = '$is_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
alert("자신의 사용후기만 삭제하실 수 있습니다.");
}
$sql = " delete from {$g4['shop_item_use_table']} where is_id = '$is_id' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
sql_query($sql);
alert("사용후기를 삭제 하였습니다.", $url);
}
?>

View File

@ -1,153 +1,150 @@
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);
$stx = escape_trim($_REQUEST['stx']);
$g4['title'] = '사용후기';
include_once(G4_MSHOP_PATH.'/_head.php');
$sql_common = " from `{$g4['shop_item_use_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where a.is_confirm = '1' ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case "a.it_id" :
$sql_search .= " ($sfl like '$stx%') ";
break;
case "a.is_name" :
case "a.mb_id" :
$sql_search .= " ($sfl = '$stx') ";
break;
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "a.is_id";
$sod = "desc";
}
$sql_order = " order by $sst $sod ";
/*
$sql_common = " from {$g4['shop_item_use_table']} where is_confirm = '1' ";
$sql_order = " order by is_id desc ";
*/
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($_GET['sfl'], "b.it_name", true); ?>>상품</option>
<option value="a.it_id" <?php echo get_selected($_GET['sfl'], "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($_GET['sfl'], "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content">후기제목</option>
<option value="a.is_name">작성자</option>
<option value="a.mb_id">작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
</form>
<div id="sps">
<!-- <p><?php echo $config['cf_title']; ?> 전체 사용후기 목록입니다.</p> -->
<?php
$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], 500);
$is_time = substr($row['is_time'], 2, 14);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g4['shop_item_table']} where it_id = '{$row['it_id']}' ");
$it_href = G4_SHOP_URL."/item.php?it_id={$row['it_id']}";
if ($i == 0) echo '<ol>';
?>
<li>
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<span><?php echo $row2['it_name']; ?></span>
</a>
</div>
<section class="sps_section">
<h2><?php echo $row['is_subject']; ?></h2>
<dl class="sps_dl">
<dt>작성</dt>
<dd><?php echo $row['is_name']; ?></dd>
<dt>작성일</dt>
<dd><?php echo substr($row['is_time'],0,10); ?></dd>
<dt>평가점수</dt>
<dd><img src="<?php echo G4_URL; ?>/img/shop/s_star<?php echo $star; ?>.png" alt="별<?php echo $star; ?>개"></dd>
</dl>
<div id="sps_con_<?php echo $i; ?>" style="display:none;">
<?php echo $is_content; // 상품 문의 내용 ?>
</div>
<div class="sps_con_btn"><button class="sps_con_<?php echo $i; ?>">보기</button></div>
</section>
</li>
<?php }
if ($i > 0) echo '</ol>';
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
?>
</div>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function(){
// 사용후기 더보기
$(".sps_con_btn button").click(function(){
var sps_con_no = $(this).attr("class");
$("#"+sps_con_no).is(":hidden") ? $("#"+sps_con_no).show() : $("#"+sps_con_no).hide();
});
$(".sps_con_btn button").toggle(function(){
$(this).text("닫기");
}, function(){
$(this).text("보기");
});
});
</script>
<?php
include_once(G4_MSHOP_PATH.'/_tail.php');
?>
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);
$stx = escape_trim($_REQUEST['stx']);
$g4['title'] = '사용후기';
include_once(G4_MSHOP_PATH.'/_head.php');
$sql_common = " from `{$g4['shop_item_use_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where a.is_confirm = '1' ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case "a.it_id" :
$sql_search .= " ($sfl like '$stx%') ";
break;
case "a.is_name" :
case "a.mb_id" :
$sql_search .= " ($sfl = '$stx') ";
break;
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "a.is_id";
$sod = "desc";
}
$sql_order = " order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<!-- 전체 상품 사용후기 목록 시작 { -->
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name"); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($sfl, "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content"<?php echo get_selected($sfl, "a.is_content"); ?>>후기내용</option>
<option value="a.is_name" <?php echo get_selected($sfl, "a.is_name"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
</form>
<div id="sps">
<!-- <p><?php echo $config['cf_title']; ?> 전체 사용후기 목록입니다.</p> -->
<?php
$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], 500);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g4['shop_item_table']} where it_id = '{$row['it_id']}' ");
$it_href = G4_SHOP_URL."/item.php?it_id={$row['it_id']}";
if ($i == 0) echo '<ol>';
?>
<li>
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<span><?php echo $row2['it_name']; ?></span>
</a>
</div>
<section class="sps_section">
<h2><?php echo $row['is_subject']; ?></h2>
<dl class="sps_dl">
<dt>작성자</dt>
<dd><?php echo $row['is_name']; ?></dd>
<dt>작성</dt>
<dd><?php echo substr($row['is_time'],0,10); ?></dd>
<dt>평가점수</dt>
<dd><img src="<?php echo G4_URL; ?>/img/shop/s_star<?php echo $star; ?>.png" alt="별<?php echo $star; ?>개"></dd>
</dl>
<div id="sps_con_<?php echo $i; ?>" style="display:none;">
<?php echo $is_content; // 사용후기 내용 ?>
</div>
<div class="sps_con_btn"><button class="sps_con_<?php echo $i; ?>">보기</button></div>
</section>
</li>
<?php }
if ($i > 0) echo '</ol>';
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
?>
</div>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function(){
// 사용후기 더보기
$(".sps_con_btn button").click(function(){
var sps_con_no = $(this).attr("class");
$("#"+sps_con_no).is(":hidden") ? $("#"+sps_con_no).show() : $("#"+sps_con_no).hide();
});
$(".sps_con_btn button").toggle(function(){
$(this).text("닫기");
}, function(){
$(this).text("보기");
});
});
</script>
<!-- } 전체 상품 사용후기 목록 끝 -->
<?php
include_once(G4_MSHOP_PATH.'/_tail.php');
?>

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqa.php');
return;
}
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
@ -39,7 +45,6 @@ $thumbnail_width = 500;
$iq_subject = conv_subject($row['iq_subject'],50,"…");
$iq_question = get_view_thumbnail($row['iq_question'], $thumbnail_width);
$iq_time = substr($row['iq_time'], 2, 8);
$iq_href = './itemqalist.php?bo_table=itemqa&amp;wr_id='.$row['wr_id'];
$hash = md5($row['iq_id'].$row['iq_time'].$row['iq_ip']);
@ -114,7 +119,7 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start" onclick="return false;">처음</a>'.PHP_EOL;
$str .= '<a href="'.$url.'1'.$add.'" class="qa_page qa_start">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
@ -122,21 +127,21 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="qa_page pg_prev">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="pg_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
$str .= '<a href="'.$url.$k.$add.'" class="qa_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
}
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="qa_page pg_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end" onclick="return false;">맨끝</a>'.PHP_EOL;
$str .= '<a href="'.$url.$total_page.$add.'" class="qa_page pg_end">맨끝</a>'.PHP_EOL;
}
if ($str)
@ -145,12 +150,12 @@ function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
return "";
}
echo itemqa_page(10, $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
echo itemqa_page($config['cf_write_pages'], $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_qa_wbtn">
<!-- <a href="javascript:itemqawin('it_id=<?php echo $it_id; ?>');">상품문의 쓰기<span class="sound_only"> 새 창</span></a> -->
<a href="<?php echo $itemqa_form; ?>" class="btn02 itemqa_form" onclick="return false;">상품문의 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemqa_form; ?>" class="btn02 itemqa_form">상품문의 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemqa_list; ?>" id="itemqa_list" class="btn01">더보기</a>
</div>
@ -158,6 +163,7 @@ echo itemqa_page(10, $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=",
$(function(){
$(".itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=500,scrollbars=1");
return false;
});
$(".itemqa_delete").click(function(){
@ -175,9 +181,9 @@ $(function(){
});
});
$(".pg_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemqa').load($(this).attr("href"));
$(".qa_page").click(function(){
$("#itemqa").load($(this).attr("href"));
return false;
});
});
</script>

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqaform.php');
return;
}
include_once(G4_EDITOR_LIB);
// 상품문의의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)

176
shop/itemqalist.php Normal file
View File

@ -0,0 +1,176 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemqalist.php');
return;
}
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);
$stx = escape_trim($_REQUEST['stx']);
$g4['title'] = '상품문의';
include_once('./_head.php');
$sql_common = " from `{$g4['shop_item_qa_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where (1) ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case "a.it_id" :
$sql_search .= " ($sfl like '$stx%') ";
break;
case "a.iq_name" :
case "a.mb_id" :
$sql_search .= " ($sfl = '$stx') ";
break;
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "a.iq_id";
$sod = "desc";
}
$sql_order = " order by $sst $sod ";
$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<!-- 전체 상품 문의 목록 시작 { -->
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name", true); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.iq_subject" <?php echo get_selected($sfl, "a.is_subject"); ?>>문의제목</option>
<option value="a.iq_question"<?php echo get_selected($sfl, "a.iq_question"); ?>>문의내용</option>
<option value="a.iq_name" <?php echo get_selected($sfl, "a.it_id"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
</form>
<div id="sps">
<!-- <p><?php echo $config['cf_title']; ?> 전체 상품문의 목록입니다.</p> -->
<?php
$sql = " select a.*, b.it_name
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$star = get_star($row['is_score']);
$small_image = $row['it_id'];
$it_href = G4_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$iq_question = get_view_thumbnail($row['iq_question'], 500);
if ($row['iq_answer'])
{
$iq_answer = get_view_thumbnail($row['iq_answer'], 500);
$iq_stats = '답변완료';
$iq_style = 'sit_qaa_done';
$is_answer = true;
} else {
$iq_stats = '답변전';
$iq_style = 'sit_qaa_yet';
$iq_answer = '답변이 등록되지 않았습니다.';
$is_answer = false;
}
if ($i == 0) echo '<ol>';
?>
<li>
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<span><?php echo $row['it_name']; ?></span>
</a>
</div>
<section class="sps_section">
<h2><?php echo $row['iq_subject']; ?></h2>
<dl class="sps_dl">
<dt>작성자</dt>
<dd><?php echo $row['iq_name']; ?></dd>
<dt>작성일</dt>
<dd><?php echo substr($row['iq_time'],0,10); ?></dd>
<dt>상태</dt>
<dd class="<?php echo $iq_style; ?>"><?php echo $iq_stats; ?></dd>
</dl>
<div id="sqa_con_<?php echo $i; ?>" style="display:none;">
<div class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</div>
<div class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</div>
<div class="sqa_con_btn"><button class="sqa_con_<?php echo $i; ?>">보기</button></div>
</section>
</li>
<?php }
if ($i > 0) echo '</ol>';
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
?>
</div>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function(){
// 사용후기 더보기
$(".sqa_con_btn button").click(function(){
var sqa_con_no = $(this).attr("class");
$("#"+sqa_con_no).is(":hidden") ? $("#"+sqa_con_no).show() : $("#"+sqa_con_no).hide();
});
$(".sqa_con_btn button").toggle(function(){
$(this).text("닫기");
}, function(){
$(this).text("보기");
});
});
</script>
<!-- } 전체 상품 사용후기 목록 끝 -->
<?php
include_once('./_tail.php');
?>

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemuse.php');
return;
}
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
//$it_id = $_REQUEST['it_id'];
@ -96,7 +102,7 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start" onclick="return false;">처음</a>'.PHP_EOL;
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
@ -104,12 +110,12 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="pg_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
$str .= '<a href="'.$url.$k.$add.'" class="pg_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
@ -118,7 +124,7 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end" onclick="return false;">맨끝</a>'.PHP_EOL;
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end">맨끝</a>'.PHP_EOL;
}
if ($str)
@ -131,7 +137,7 @@ echo itemuse_page($config['cf_write_pages'], $page, $total_page, "./itemuse.php?
?>
<div id="sit_use_wbtn">
<a href="<?php echo $itemuse_form; ?>" class="btn02 itemuse_form" onclick="return false;">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_form; ?>" class="btn02 itemuse_form">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_list; ?>" class="btn01 itemuse_list">더보기</a>
</div>
@ -162,8 +168,8 @@ $(function(){
});
$(".pg_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemuse').load($(this).attr("href"));
$("#itemuse").load($(this).attr("href"));
return false;
});
});
</script>

View File

@ -17,6 +17,9 @@ include_once('./_head.php');
$sql_common = " from `{$g4['shop_item_use_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
$sql_search = " where a.is_confirm = '1' ";
if(!$sfl)
$sfl = 'b.it_name';
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
@ -40,11 +43,6 @@ if (!$sst) {
}
$sql_order = " order by $sst $sod ";
/*
$sql_common = " from {$g4['shop_item_use_table']} where is_confirm = '1' ";
$sql_order = " order by is_id desc ";
*/
$sql = " select count(*) as cnt
$sql_common
$sql_search
@ -64,12 +62,12 @@ $from_record = ($page - 1) * $rows; // 시작 열을 구함
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="sfl" required title="검색항목선택">
<option value="">선택</option>
<option value="b.it_name" <?php echo get_selected($_GET['sfl'], "b.it_name", true); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($_GET['sfl'], "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($_GET['sfl'], "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content">후기제목</option>
<option value="a.is_name">작성자명</option>
<option value="a.mb_id">작성자아이디</option>
<option value="b.it_name" <?php echo get_selected($sfl, "b.it_name"); ?>>상품명</option>
<option value="a.it_id" <?php echo get_selected($sfl, "a.it_id"); ?>>상품코드</option>
<option value="a.is_subject"<?php echo get_selected($sfl, "a.is_subject"); ?>>후기제목</option>
<option value="a.is_content"<?php echo get_selected($sfl, "a.is_content"); ?>>후기내용</option>
<option value="a.is_name" <?php echo get_selected($sfl, "a.is_name"); ?>>작성자명</option>
<option value="a.mb_id" <?php echo get_selected($sfl, "a.mb_id"); ?>>작성자아이디</option>
</select>
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
<input type="submit" value="검색">
@ -92,7 +90,6 @@ $from_record = ($page - 1) * $rows; // 시작 열을 구함
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], 500);
$is_time = substr($row['is_time'], 2, 14);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g4['shop_item_table']} where it_id = '{$row['it_id']}' ");