ÿØÿà JFIF ` ` ÿþ
Server : Apache System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : tkt_travelbus ( 1137) PHP Version : 7.0.0p1 Disable Function : mysql_pconnect Directory : /tkt_travelbus/www/toadmin/good/ |
Upload File : |
<?php include "../include/top.html"; include "_common.php"; $lang = $_GET['lang']; if ($lang == 'ko') { $lang_txt = '여행대장 '; }else if ($lang == 'en') { $lang_txt = 'TK영어 '; }else if ($lang == 'cn') { $lang_txt = 'TK간체 '; }else if ($lang == 'hk') { $lang_txt = 'TK번체 '; } $mainViewSectionID = (int) $_GET['mainViewSectionID']; //데이터 불러오기 $sql = "SELECT * FROM mainViewSection WHERE mainViewSectionID = {$mainViewSectionID} LIMIT 1"; $mainSectionData = db_fetch($sql); $imgPath = "good"; if($mainSectionData['hotelSection'] == 'Y'){ $imgPath = "hotel"; } //해당 상품 불러오기 $sql = "SELECT * FROM mainViewSectionGoods WHERE mainViewSectionID = {$mainViewSectionID} ORDER BY seq ASC"; $res = db_query($sql); $mainViewGoodList = array(); // $arr = good_list(" and g_uid='{$row['g_uid']}' "); $gUidList = ""; while ($row = db_fetch_array($res)) { $g_uid = $row['g_uid']; if($mainSectionData['hotelSection'] == 'N'){ $sql= "SELECT g_title,g_image1 FROM good WHERE g_uid = {$g_uid}"; $goodData = db_fetch($sql); $row['g_title'] = $goodData['g_title']; $row['image'] = $goodData['g_image1']; }else{ //호텔상품이면 $sql= "SELECT hotel_nm, img1 FROM TB_HOTEL WHERE hseq = {$g_uid}"; $goodData = db_fetch($sql); $row['g_title'] = $goodData['hotel_nm']; $row['image'] = $goodData['img1']; } array_push($mainViewGoodList, $row); } // p($mainViewGoodList); ?> <style> #sortable li{clear:both;float:left;margin-bottom:5px;cursor:pointer} #sortable li .seqArea, #sortable li .gUidArea,#sortable li .titleArea, #sortable li .imageArea, #sortable li .delArea{float:left;border-right:1px solid #ccc;padding:17px} #sortable li div:nth-last-child(1){border-right:none} #sortable li .seqArea{width:30px;text-align:center;} #sortable li .gUidArea{width:60px;text-align:center} #sortable li .imageArea{text-align:left;padding:0px} #sortable li .imageArea img {width:75px;} #sortable li .titleArea{width:600px;text-align:left} #sortable li .delArea{width:30px;text-align:center} #liLabel{clear:both;float:left;_width:300px;background:#000;border:1px solid #ccc;margin-bottom:7px} #liLabel div{float:left;border-right:1px solid #ccc;padding:10px;text-align:center;color:#fff;font-weight:bold} #liLabel div:nth-last-child(1){border-right:none} #liLabel #seqLabel{width:44px} #liLabel #guidLabel{width:74px} #liLabel #imageLabel{width:55px} #liLabel #titleLabel{width:614px} #liLabel #delLabel{width:44px} #setSequenceMainPageViewGoodsBtn{float:left;border:1px solid #ccc;border-radius:3px;position:relative;top:-14px;display:none} </style> <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js" ></script> <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" ></script> <div class="contents_wrap"> <div class="contents_wrap_in"> <div class="title"> 메인페이지 노출 <span class="arrow">></span> <strong><?= $lang_txt ?></strong> <span class="arrow">></span> <strong><?=$mainSectionData['title']?></strong> </div> <div class="contents_detail"> <div id="Content_box"> <p style="clear:both;float:left;width:100%;margin:11px 0">상품노출수량 : <?=$mainSectionData['onePageCnt']?>개</p> <input type="button" id="setSequenceMainPageViewGoodsBtn" value="순서 적용" /> <section> <div id="liLabel"> <div id="seqLabel">순서</div> <div id="guidLabel">상품번호</div> <div id="imageLabel">이미지</div> <div id="titleLabel">상품명(*마우스로 드래그하여 노출상품의 순서를 변경)</div> <div id="delLabel">삭제</div> </div> <ul id="sortable"> <?php foreach($mainViewGoodList as $item){ ?> <li id="mainViewSection<?=$item['mainViewSectionGoodsID']?>" mainViewSectionGoodsID="<?=$item['mainViewSectionGoodsID']?>" class="goodArea ui-state-default"> <div class="seqArea"><?=$item['seq']?></div> <div class="gUidArea"><?=$item['g_uid']?></div> <div class="imageArea"> <img src="/FileData/<?=$imgPath?>_thum/<?=$item['image']?>" alt="" /> </div> <div class="titleArea"><?=$item['g_title']?></div> <div class="delArea" mainViewSectionGoodsID="<?=$item['mainViewSectionGoodsID']?>"> DEL </div> </li> <?php } ?> </ul> </section> </div> </div> </div> </div> <script> $(window).load(function() { $("#sortable").sortable(); $("#sortable").disableSelection(); $('#setSequenceMainPageViewGoodsBtn').click(function(){ setSequenceMainPageSectionGoods(); }) $('.goodArea').mouseup(function(){ setTimeout(function(){ setSequenceMainPageSectionGoods(); },200) }) $('.delArea').click(function(){ mainViewSectionGoodsID = $(this).attr('mainViewSectionGoodsID'); console.log('mainViewSectionGoodsID is ' + mainViewSectionGoodsID); $.ajax({ type: "POST", url: "/toadmin/ajaxData/", data: {mode: 'setMainViewDel', mainViewSectionGoodsID}, dataType: 'json', async: false, success: function (data) { console.log(JSON.stringify(data)); if (data.result == true) { $('#mainViewSection'+mainViewSectionGoodsID).remove(); iziToast.show({ timeout: 2000, color: 'green', title: '메인노출상품 삭제', message: "완료되었습니다.", }); setTimeout(function(){ setSeqOnlyView(); },100); } else { iziToast.show({ timeout: 2000, color: 'red', title: '메인노출상품 삭제', message: "실패하였습니다.", }); } }, error: function (e) { iziToast.show({ timeout: 2000, color: 'red', title: '메인노출상품 삭제', message: "실패하였습니다.", }); } }); }) }); function setSeqOnlyView(){ for (i = 0; i < document.getElementById('sortable').getElementsByClassName('goodArea').length; i++) { seqNum = i + 1; document.getElementById('sortable').getElementsByClassName('goodArea')[i].getElementsByClassName('seqArea')[0].innerText = seqNum; } } function setSequenceMainPageSectionGoods() { document.getElementById('sortable').getElementsByClassName('goodArea').length; sendData = ""; for (i = 0; i < document.getElementById('sortable').getElementsByClassName('goodArea').length; i++) { sequence = i + 1; // console.log(document.getElementById('sortable').getElementsByClassName('goodArea')[i].getElementsByClassName('titleArea')[0].innerText); if (!sendData) { sendData = document.getElementById('sortable').getElementsByClassName('goodArea')[i].getAttribute('mainviewsectiongoodsid') + '-' + sequence } else { sendData += ',' + document.getElementById('sortable').getElementsByClassName('goodArea')[i].getAttribute('mainviewsectiongoodsid') + '-' + sequence } // console.log(document.getElementById('sortable').getElementsByClassName('goodArea')[i].getAttribute('mainviewsectiongoodsid')); } console.log(sendData); // return false; $.ajax({ type: "POST", url: "/toadmin/ajaxData/", data: {mode: 'setSeqMainViewGoods', seqData: sendData}, dataType: 'json', async: false, success: function (data) { console.log(JSON.stringify(data)); if (data.result == true) { iziToast.show({ timeout: 2000, color: 'green', title: '노출순서변경', message: "적용되었습니다.", }); setTimeout(function() { setSeqOnlyView(); },100); } else { iziToast.show({ timeout: 2000, color: 'red', title: '노출순서변경', message: "실패하였습니다.", }); } }, error: function (e) { console.log('error'); } }); } </script> <? include "../include/footer.html"; ?>