/home/mjc1/public_html/j3demo/adm/faq.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php
$sub_menu 
"600200";
include(
"./_common.php");
include(
"./auth_check.php"); // 관리자 권한 체크
include($j3_adm_path."/shop_header.php");

$cate_array faq_cate_list_get(); // FAQ 카테고리 가져오기

if($order_key==''){ 
    if(
$_COOKIE['ok_customer']!=''){
        
$order_key $_COOKIE['ok_customer']; 
    } else {
        
$order_key 'faq_seq, idx desc'
    }
}

$where2 "";

if(
$stx!=''){
    
$where2 .= " and {$sti} like '%{$stx}%' ";
}

$list_num $config['page_line'];
if(
$_COOKIE['page_line']!=''){ $list_num $_COOKIE['page_line']; }
if (
$page 1) { $page 1; } // 페이지가 없으면 첫 페이지 (1 페이지)

$list_array faq_list_get($faq_idx$where2$page$list_num);

$total_page $list_array[0]['total_page'];
$list_num $list_array[0]['list_num'];
$total_count $list_array[0]['total_count'];

$qstr $_SERVER['QUERY_STRING'];

?>
<?php
if($shop_du_size>$limit_mbyte){ 
?>
<script src="<?php echo $j3_lib_url?>/ckeditor-nf/ckeditor.js"></script>
<?php } else { ?>
<script src="<?php echo $j3_lib_url?>/ckeditor/ckeditor.js"></script>
<?php }?>
<div id="wrap" class='container_wrap'>
    <div id="sub-title">
        <h2>FAQ리스트</h2>
        <div class="sub-location">
            <a href="./index.php" class="home"><span class="screen_out">홈</span></a>
            <span class="location-gt"></span>
            <a>게시판관리</a>
            <span class="location-gt"></span>
            <a>FAQ리스트</a>
        </div>
    </div>
<!-- 검색영역 -->
    <form name='faq_search_form' method='get'>
    <input type='hidden' name='faq_idx' size='' value='<?php echo $faq_idx;?>'>
    <input type='hidden' name='page' size='' value='<?php echo $page;?>'>
    <div id="sub-contents-area">
        <div class="sub-btn-area">
            <div class="sub-btn">
                <a class="lignt-blue-btn" id='btn_order_new'>신규등록</a><!--<a class="blue-btn">주문복사</a><?php if($Orow['ordstate']==0){ ?><a class="black-btn">전체삭제</a><?php }?><a class="gray-btn" id='buy_print'>인쇄</a><a class="gray-btn" id='xls_down'>엑셀</a>--><a class="black-btn" id='sel_delete'>선택삭제</a>
            </div>
        </div>
        <div class="sub-btn-area">
            <div class="sub-btn sub-btn-search">
                <select name='sti'>
                    <option value='a.w_subject' <?php if($sti=='a.w_subject'){?>selected<?php }?>>제목</option>
                    <option value='a.w_content' <?php if($sti=='a.w_content'){?>selected<?php }?>>내용</option>
                </select>
                <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class">&nbsp;<a href="#" class="black-btn" id='search_btn_press'>검색</a>
            </div>
        </div>
    </div>
    </form>
<!-- 검색 영영 끝 -->
<!-- 탭 구분 영역 끝 -->
    <div class="item_tab">
        <div class="item_tab_navi">
<?php 
    
foreach($cate_array as $key=>$cate){
        if(
$cate['idx']==$faq_idx){ $class "on"; } else { $class ""; }
?>
            <a value='<?php echo $cate['idx'];?>' class="<?php echo $class;?>"><span><?php echo $cate['faq_cate'];?></span></a>
<?php 
    
}
?>
            <!--<a value='2'><span>매입.매출처 관리</span></a>-->
        </div>
    </div><!--//item_tab-->
<!-- 탭 구분 영역 끝 -->

    <form name='faq_list_form' method='post'>
    <input type='hidden' name='sel_del' value=''>
    <input type='hidden' name='b_table' value='<?php echo $b_table;?>'>
    <div class="div-list-area">
        <div class="cust-list-area">
            <table class="order-sheet2">
                <caption class="screen_out">매입처 원장 조회<caption>
                <colgroup>
                <col style="width:30px;">
                <col style="width:50px;"><col style="width:400px;">
                <col style="width:80px;"><col style="width:80px;"><col style="width:50px;">
                </colgroup>

                <thead>
                    <tr>
                        <th scope="col"><input type='checkbox' name='ck_all' class='check_all_class'></th>
                        <th scope="col">번호</th><th scope="col">제목</th>
                        <th scope="col">순서</th>
                    </tr>
                </thead>
                <tbody>
<?php 
    
for($i=0;$i<count($notice_array);$i++){ // 공지리스트 처리
        
$info $notice_array[$i];
?>
                    <tr class='notice_class'>
                        <td class="tcenter ">
                            <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>' class='code_idx_class'>
                            <input type='hidden' name='codes[]' value='<?php echo $info['idx'];?>'>
                            <input type='hidden' name='b_tables[]' value='<?php echo $info['b_table'];?>'>
                        </td>
                        <td class="tcenter ">공지</td>
                        <td class="linetxt click_edit"><?php echo $info['w_rep_icon'].$info['w_subject'].$info['comm_cnt'].$info['w_file_icon'];?></td>
                        <td class="tcenter "><?php echo $info['w_name'];?></td>
                        <td class="tcenter "><?php echo $info['faq_seq'];?></td>
                    </tr>
<?php 
    

?>
<?php 
    
for($i=0;$i<count($list_array);$i++){ // 게시물 처리
        
$info $list_array[$i];
?>
                    <tr>
                        <td class="tcenter ">
                            <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>' class='code_idx_class'>
                            <input type='hidden' name='codes[]' value='<?php echo $info['idx'];?>'>
                            <input type='hidden' name='b_tables[]' value='<?php echo $info['b_table'];?>'>
                        </td>
                        <td class="tcenter "><?php echo $info['idx'];?></td>
                        <td class="linetxt click_edit"><?php echo $info['faq_subject'];?></td>
                        <td class="tcenter "><?php echo $info['faq_seq'];?></td>
                    </tr>
<?php 
    

?>
                </tbody>
            </table>
        </div>
    </div>
    </form>

    <div class='pg_wrap' style='padding-top:0px;'>
        <?php echo get_paging($list_num$page$total_page"?$qstr");?>
    </div>

</div><!--//wrap-->
<script>
var qstr = '<?php echo $qstr;?>';
$(function(){
    $(".item_tab_navi a").click(function(){ //네비게이션 탭 처리
        v = $(this).attr("value");
        $("form[name='faq_search_form'] input[name='faq_idx']").val(v);
        $("form[name='faq_search_form']").submit();
    });

    $(".click_edit").css("cursor","pointer").click(function(){ // 수정
        var code = $(this).closest("tr").find("input[name='codes[]']").val();
        faq_add(code);
    });

    $(".sub-btn #btn_order_new").click(function(){ // 신규 버튼
        setsave("qstr",qstr,1);
        faq_add('');
    });

    $(".check_all_class").click(function(){ // 전체선택 전체선택 해제
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $("#sel_delete").click(function(){ // 선택삭제
        var ck_cnt = 0;
        var v = $("input[name='code_idx[]']").each(function(){
            if($(this).is(":checked")){ ck_cnt++; }
        });
        if(ck_cnt==0){ alert('삭제하실 게시물을 선택하세요.'); return; }

        if(confirm('정말로 '+ck_cnt+'개의 게시물을 삭제하시겠습니까?')){
            $("input[name='sel_del']").val("Y");
            var form_data = $("form[name='faq_list_form']").serialize();

            $.ajax({type:"post", url:"ajax.faq_reg_process.php?", data:form_data, async:false, dataType : "xml", 
                success:function(xml){    
                    var v_mode = $(xml).find("mode").text();
                    var v_mode_ok = $(xml).find("mode_ok").text();
                    var v_msg = $(xml).find("msg").text();
                    var v_faq_cnt = $(xml).find("faq_cnt").text();
                    if(v_mode_ok=='Y'){
                        document.location.reload();
                    } else {
                        alert(v_msg);
                    }
                },
                error:function(rtn,status,error){    alert(error);        }
            });
        }
    });

    $(".bbs_write_view").css("cursor","pointer").click(function(){
        $tr_obj = $(this).closest("tr");
        $b_table = $tr_obj.find("input[name='b_tables[]']").val();
        document.location.href='faq.php?b_table='+$b_table;
    });


    $("#search_btn_press").click(function(){ // 검색버튼 누를때
        document.faq_search_form.action='?';
        document.faq_search_form.target = '';
        document.faq_search_form.submit();
    });

});

function faq_add(code){
    $.get("faq_reg.inc.php?faq_idx=<?php echo $faq_idx;?>&code="+code,function(rtn){
        if(code==''){ title = "신규"; } else { title = "수정"; }
        $("#modal_member_box").html(rtn).dialog({
            resizable: true, height:570, width:1050, modal: true, title:"FAQ분류 ["+title+"]",
            buttons: {
                저장: function() {
                    form_save();
                },
                닫기: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });
}

function form_save(){
    var form_obj = $("form[name='faq_reg_form']");
    if($(form_obj).find("input[name='faq_subject']").val()==''){
        alert('제목을 입력하세요.'); return;
    }
    v = CKEDITOR.instances.faq_content.getData();
    $(form_obj).find("textarea[name='faq_content']").val(v);
    if($(form_obj).find("textarea[name='faq_content']").val()==''){
        alert('내용을을 입력하세요.'); return;
    }
    $(form_obj).find("input[name='qstr']").val('<?php echo $qstr;?>');
    if(confirm('저장하시겠습니까?')){
        var form_data = $(form_obj).serialize();

        $.ajax({type:"post", url:"ajax.faq_reg_process.php", data:form_data, async:false, dataType : "xml", 
            success:function(xml){    
                var v_mode = $(xml).find("mode").text();
                var v_mode_ok = $(xml).find("mode_ok").text();
                var v_msg = $(xml).find("msg").text();
                var v_after_add = $(xml).find("after_add").text();
                if(v_mode_ok!='Y'){
                    alert(v_msg);
                } else {
                    document.location.reload();
                }
            },
            error:function(rtn,status,error){    alert(error);        }
        });
    }
}
</script>

<?php
include($j3_adm_path."/shop_footer.php");
?>
<div id="modal_member_box" title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>