/home/mjc1/public_html/manage/m_cusrecommend.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<?
    
include("./include/admin_include_header.php");
    
//include("category/common.php");

    
$admin_info admin_member_info();
    if(
$admin_info['psn_auth']=='0' || substr($admin_info['psn_rwed'],0,1)=='0'){
        echo 
"<script>alert('ÇØ´ç Á¢±Ù±ÇÇÑÀÌ ¾ø½À´Ï´Ù.');window.history.go(-1);</script>"; exit;
    }
    
auth_access_log("LIST");
    
    
$cm_nCount 10;
    
$cm_item_nCount 30;          

    function 
pageListing($cur_page$total_page$url) {

        
$retValue "<div class='paging'>";
        if (
$cur_page 1) {
            
$retValue .= "<a href='" $url . ($cur_page-1) ."' class='page'><span class='next'>ÀÌÀü</span></a>";
        } else {
            
$retValue .= "";
            
$retValue .= "";
        }

        
$retValue .= "";

        
$start_page = ( ( (int)( ($cur_page ) / 10 ) ) * 10 ) + 1;

        
$end_page $start_page 9;
        if (
$end_page >= $total_page$end_page $total_page;
            if (
$start_page 1$retValue .= "<a href='" $url . ($start_page-1) . "' class='page'><span class='next10'>ÀÌÀü 10°³</span></a>";

                if (
$total_page 1)
                    for (
$k=$start_page;$k<=$end_page;$k++)
                if (
$cur_page != $k$retValue .= "<a href='$url$k'>$k</a>";
                    else 
$retValue .= "<a href='$url$k' class='on'>$k</a>";

        if (
$total_page $end_page$retValue .= "<a href='" $url . ($end_page+1) . "' class='page'><span class='pro10'>´ÙÀ½ 10°³</span></a>";

        
$retValue .= "";

        if (
$cur_page $total_page) {
            
$retValue .= "<a href='$url. ($cur_page+1) ."' class='page'><span class='pro'>´ÙÀ½</span></a>";

        } else {
            
$retValue .= "";
            
$retValue .= "";
        }

        
$retValue .= "</div>";
        return 
$retValue;
    }

    
$where "";
    if( isset(
$keyword) && $keyword != ""){
        
$where .= " and {$st2} like '%{$keyword}%'";
    }
    if( 
$st1 != "" ) {
        
$where .= " and intro_prod = '{$st1}'";
    }
 
    
$total_sql  .=   " select * from mBoard_cus_recommend where 1=1 $where ";
    
    
$result      mysql_query($total_sql) or die (mysql_error());
    
$nTotalCount mysql_num_rows($result);
    
$nPage       ceil($nTotalCount $cm_nCount);

    if (
$pg == ""$pg 1;

    
$nFrom = ($pg 1) * $cm_nCount;
    
$sql    $total_sql "  order by idx desc limit $nFrom$cm_nCount ";
    
$result mysql_query($sql) or die (mysql_error());

    
//echo $total_sql;

?>

<script>
function Search(){
    document.getElementById('search_mode').value = "Y"; 
    searchFrm.submit();
}

$(function(){
    $(".review_side_li:nth-child(15) a").addClass("active");
});
</script>
<link rel='stylesheet' type='text/css' href='./css/new.css'>

<style>
.requestarea th{line-height: 16px;padding: 10px 0px;}
.review_side_ul {left:65px !important;}
.insert_result {cursor: pointer;background: #cdcdcd;font-weight: bold;padding: 10px;border-radius: 5px;}
</style>

<?php include('./include/board_side_bar.php'); ?>

<div class="container">
    <div class="border_contents">
        <div class="admin_table">
            <h3 class="list_ttl">
                ¼Ò°³ À̺¥Æ®
                <span class="list_sub_ttl bgg">ȨÆäÀÌÁö¿¡ µî·ÏµÈ ¼Ò°³ À̺¥Æ®¸¦ È®ÀÎÇϴ ÆäÀÌÁöÀÔ´Ï´Ù.</span>
            </h3>

            <!-- °Ë»ö¹Ú½º -->
            <form name='searchFrm' method=post>
            <input type="hidden" name="search_mode" id="search_mode">  
                <div class="searchArea searchAreaPlus">
                    <span class="searchAreaL"></span>
                    <span class="searchAreaR"></span>
                    <dl class="search_tender requestSearchArea" style="width:520px;">
                        <dd class="relative">
                            <p class="arrow"></p>
                            <select name='st1' class="nonearrow">
                                <option value="" <? if($st1 == ''){ echo "selected"; } ?>>Àüü »óǰÁ¾·ù</option>
                                <option value="õ³â°æ¿µ3cs" <? if($st1 == 'õ³â°æ¿µ3cs'){ echo "selected"; } ?>>õ³â°æ¿µ3cs</option>
                                <option value="õ³â°æ¿µ3" <? if($st1 == 'õ³â°æ¿µ3'){ echo "selected"; } ?>>õ³â°æ¿µ3</option>
                                <option value="õ³â°æ¿µcs" <? if($st1 == 'õ³â°æ¿µcs'){ echo "selected"; } ?>>õ³â°æ¿µcs</option>
                                <option value="õ³â°æ¿µ2" <? if($st1 == 'õ³â°æ¿µ2'){ echo "selected"; } ?>>õ³â°æ¿µ2</option>
                                <option value="õ³â°æ¿µLite" <? if($st1 == 'õ³â°æ¿µLite'){ echo "selected"; } ?>>õ³â°æ¿µLite</option>
                                <option value="Á¦Á¶°æ¿µProCS" <? if($st1 == 'Á¦Á¶°æ¿µProCS'){ echo "selected"; } ?>>Á¦Á¶°æ¿µProCS</option>
                                <option value="Á¦Á¶°æ¿µPro" <? if($st1 == 'Á¦Á¶°æ¿µPro'){ echo "selected"; } ?>>Á¦Á¶°æ¿µPro</option>
                                <option value="ÀÌÁöÅØ½º2" <? if($st1 == 'ÀÌÁöÅØ½º2'){ echo "selected"; } ?>>ÀÌÁöÅØ½º2</option>
                                <option value="ÀÌÁöÅØ½º2CS" <? if($st1 == 'ÀÌÁöÅØ½º2CS'){ echo "selected"; } ?>>ÀÌÁöÅØ½º2CS</option>
                                <option value="ÀÚ»ê°ü¸®Pro" <? if($st1 == 'ÀÚ»ê°ü¸®Pro'){ echo "selected"; } ?>>ÀÚ»ê°ü¸®Pro</option>
                                <option value="±Þ¿©°ü¸®" <? if($st1 == '±Þ¿©°ü¸®'){ echo "selected"; } ?>>±Þ¿©°ü¸®</option>
                            </select>
                        </dd>
                        <dd class="relative">
                            <p class="arrow"></p>
                            <select name='st2' class="nonearrow">
                                <option value="intro_company" <? if($st2 == 'intro_company'){ echo "selected"; } ?>>¼Ò°³¾÷ü »óÈ£¸í</option>
                                <option value="intro_name" <? if($st2 == 'intro_name'){ echo "selected"; } ?>>¼Ò°³¾÷ü ¼º¸í</option>
                                <option value="recom_company" <? if($st2 == 'recom_company'){ echo "selected"; } ?>>¼Ò°³¹ÞÀº¾÷ü »óÈ£¸í</option>
                                <option value="recom_name" <? if($st2 == 'recom_name'){ echo "selected"; } ?>>¼Ò°³¹ÞÀº¾÷ü ¼º¸í</option>
                            </select>
                        </dd>
                        <dd>         
                            <input type='text' name='keyword' class='keyword' size='20' value='<?=$keyword;?>' onKeyDown="javascript:if(event.keyCode == 13) Search();" style="width:143px;height:29px;">
                        </dd>
                        <dd class="searchbtnarea">
                            <a href='javascript:Search();' class="searchBtn bgg">°Ë»ö</a>
                            <input type='hidden' name='mode' value='search'>
                        </dd>
                    </dl><!--search_tender-->
                </div><!-- //searchArea1-->
            </form>
            <!-- //°Ë»ö¹Ú½º -->


            <form name='recomBoardFrm' id="recomBoardFrm">
                <input type='hidden' name='sel_del' value=''>
                <div class="btn1Warp mb5" style="text-align: right; display: inline-block; width: 990px;">
                    <a class="insertbtn2" style="border:1px solid #169292 !important; color:#169292 !important;" id="sel_delete">¼±ÅûèÁ¦</a>
                </div>
                <div class="borderWarp" style="width: 1365px;margin-left:-110px;">
                <table class="borderTable requestarea">
                    <thead>
                        <tr class="bgg">
                            <th style="width:30px;"><input type='checkbox' name='ck_all' class='check_all_class'></th>
                            <th style="width:50px;">±Û¹øÈ£</th>
                            <th style="width:80px;">À¯ÀÔ°æ·Î</th>
                            <th style="width:200px;">¼Ò°³¾÷ü<br/>»óÈ£</th>
                            <th style="width:70px;">¼Ò°³¾÷ü<br/>¼º¸í</th>
                            <th style="width:100px;">¼Ò°³¾÷ü<br/>¿¬¶ôó</th>
                            <th style="width:80px;">¼Ò°³¾÷ü<br/>Á¦Ç°</th>
                            <th style="width:200px;">¼Ò°³¹ÞÀº¾÷ü<br/>»óÈ£</th>
                            <th style="width:80px;">¼Ò°³¹ÞÀº¾÷ü<br/>¼º¸í</th>
                            <th style="width:100px;">¼Ò°³¹ÞÀº¾÷ü<br/>¿¬¶ôó</th>
                            <th style="width:70px;">±¸¸Å¿©ºÎ</th>
                            <th style="width:40px;">󸮻óÅÂ</th>
                            <th style="width:130px;">󸮳»¿ë</th>
                            <th style="width:100px;">µî·Ï½Ã°£</th>
                            <th style="width:70px;">ÀÛ¼º°æ·Î</th>
                            <th style="width:50px;" class="last">»çÀå´ÔÈ®ÀÎ</th>
                        </tr>
                    </thead>

                    <tbody>
                    <?
                     
if($num mysql_num_rows($result)){
                         
$cnt 0;
                         while(
$row mysql_fetch_array($result)) {

                        if(
$row['type'] == "message_event") {
                            
$type_txt "¹®Àڹ߼۠°Ç";
                        } else if(
$row['type'] == "pc_event"){
                            
$type_txt "pcÀÔ·Â";
                        } else {
                            
$type_txt "ȨÆäÀÌÁö";
                        }

                        if(
$row['flg'] == 0) {
                            
$flg_txt "¼Ò°³ÀÚ";
                        } else {
                            
$flg_txt "¼Ò°³¹Þ´ÂÀÚ";
                        }
                    
?>
                        <tr class="content">
                            <td>
                                <input type='checkbox' name='code_idx[]' value='<?php echo $cnt;?>'>
                                <input type='hidden' name='codes[]' value='<?php echo $row['idx'];?>'>
                            </td>
                            <td><?php echo $row['idx'];?></td>
                            <td><?php echo $type_txt?></td>
                            <td><?php echo $row['intro_company'];?></td>
                            <td><?php echo $row['intro_name'];?></td>
                            <td><?php echo $row['intro_tel'];?></td>
                            <td><?php echo $row['intro_prod'];?></td>
                            <td><?php echo $row['recom_company'];?></td>
                            <td><?php echo $row['recom_name'];?></td>
                            <td><?php echo $row['recom_tel'];?></td>
                            <td><?php echo $row['recom_result'];?></td>
                            <td>
                                <select name='state' style="width:130px;text-align:center;height:24px;">
                                    <option value='¹ÌÈ®ÀÎ' <?php if($row['state'] == ""){ echo "selected"; }?>>¹ÌÈ®ÀÎ</option>
                                    <option value='±¸¸Å´ë±â' <?php if($row['state'] == "±¸¸Å´ë±â"){ echo "selected"; }?>>±¸¸Å´ë±â</option>
                                    <option value='¹ß¼Û¿¹Á¤' <?php if($row['state'] == "¹ß¼Û¿¹Á¤"){ echo "selected"; }?>>¹ß¼Û¿¹Á¤</option>
                                    <option value='»çÀºÇ°¹è¼Û¿Ï·á' <?php if($row['state'] == "»çÀºÇ°¹è¼Û¿Ï·á"){ echo "selected"; }?>>»çÀºÇ°¹è¼Û¿Ï·á</option>
                                    <option value='ó¸®Áß' <?php if($row['state'] == "ó¸®Áß"){ echo "selected"; }?>>ó¸®Áß</option>
                                    <option value='󸮺Ұ¡' <?php if($row['state'] == "󸮺Ұ¡"){ echo "selected"; }?>>󸮺Ұ¡</option>
                                </select>
                            </td>
                            <td>
                                <?php
                                    
if($row['result'] == "") {
                                        echo 
"<span class='insert_result' id='".$row['idx']."'>µî·ÏÇϱâ</span>";
                                    } else {
                                        echo 
"<span class='insert_result' id='".$row['idx']."'>¼öÁ¤/È®ÀÎÇϱâ</span>";
                                    }
                                
?>
                            </td>
                            <td><?php echo $row['reg_date'];?></td>
                            <td><?php echo $flg_txt;?></td>
                            <td class="last">
                                <input type="checkbox" name="ceo_chk" class="ceo_chk" value="<?php echo $row['ceo_chk']; ?><?php if($row['ceo_chk'] == '1'){ echo "checked"; } ?> style="width:25px;height:25px;vertical-align: middle;">
                            </td>
                        </tr>
                    </tbody>

                    <? 
                        $cnt
++;
                            } 
                        } else {  
                    
?>
                            <tr>
                                <td colspan="10">µ¥ÀÌÅͰ¡ ¾ø½À´Ï´Ù.</td>
                            </tr>
<? ?>
                        </table><!-- //borderTable -->
                        </div><!-- //borderWarp -->
                    </form>

                    <? echo pageListing($pg$nPage"m_cusrecommend.php?menu=4&sub=16&st1=$st1&st2=$st2&keyword=$keyword&pg=")?>
                    <?//print_r($_REQUEST)?>

                    <iframe name="changeIframe" width="0" height="0"></iframe>

                </div><!-- //admin_table -->

                <p class="navi">°ü¸®ÀÚ¸ðµå > ¼­ºñ½º°Ô½ÃÆÇ > ¼Ò°³À̺¥Æ®</p>

                <div class="footer">
                    <?    include("./include/admin_include_footer.php"); ?>
                </div><!-- //footer -->
            </div><!-- //border_contents -->
        </div><!-- //container -->
    </div><!-- //wrap -->
</body>
</html>

<script>
$(function(){
    $(".check_all_class").click(function(){ // Àüü¼±ÅàÀüü¼±ÅÃ ÇØÁ¦
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $("select[name='state']").change(function(){
        var v = $(this).val();
        if(confirm('󸮻󟦠'+v+'À¸·Î º¯°æÇϽðڽÀ´Ï±î?')){
            var idx = $(this).closest("tr").find("input[name='codes[]']").val();
            var url = "m_cusrecommend_process.php?mode=ch_state&state="+v+"&idx="+idx;
            $.get(url,function(rtn){
                //alert(rtn);
                if(rtn=='ok'){
                    document.location.reload();
                } else {
                    alert(rtn);
                }
            });
        }
    });

    $("#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='recomBoardFrm']").serialize();
            $("#recomBoardFrm").prop("action","m_cusrecommend_process.php");
            $("#recomBoardFrm").submit();
        }
    });

    $(".ceo_chk").change(function(){
        $v = $(this).val();
        $vv = $(this).closest("tr").find(".ceo_chk");
        var checkflg = "0";
        if($vv.is(":checked")){
            checkflg = "1";
        }
        $uid = $(this).closest("tr").find("input[name='codes[]']").val();
        $url = "m_cusrecommend_process.php?mode=ch_chk&chk_flg="+checkflg+"&uid="+$uid;
        $.get($url,function(rtn){
            if(rtn=='ok'){
                document.location.reload();
            } else {
                alert(rtn);
            }
        });
    });

    $(".insert_result").click(function(){ // Ã³¸®³»¿ë µî·Ï/¼öÁ¤Çϱâ
        var val = $(this).attr("id");

        $.get("m_cusrecommend.inc.php?idx="+val,function(rtn){
            $("#modal_result_box").html(rtn).dialog({
                resizable: true, height:450, width:800, modal: true, title:"󸮳»¿ë ÀÔ·ÂÇϱâ",
                open: function(){
                    $("input[name='idx']").val(val);
                },
                buttons: {
                    µî·Ï: function() {
                        var form_data = $("form[name='result_form']").serialize();

                        $.ajax({type:"post", url:"m_cusrecommend_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();
                                if(v_mode_ok!='Y'){
                                    alert(v_msg);
                                } else {
                                    document.location.reload();
                                }
                            },
                            error:function(rtn,status,error){    alert(error);    }
                        });
                    },
                    ´Ý±â: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });
    });
});
</script>

<div id="modal_result_box" title="°Å·¡Ã³¼öÁ¤" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;">
</div>