Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
ltms.eemo.co.kr
/
public_html
/
super
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//home/ltms.eemo.co.kr/public_html/super/farm_cctv_main_process_bk.php
<?php /* DB 연결을 위한 세팅 */ include_once("inc_header.php"); switch ($_REQUEST['type']) { case 'view': viewCnt(); break; default: # code... break; } function viewCnt() { // 트랜젝션 시작 mysql_query("SET AUTOCOMMIT=0;"); mysql_query("START TRANSACTION"); $viewCnt = $_REQUEST['viewCnt']; $farm_no = $_REQUEST['farm_no']; $contract_no = $_REQUEST['contract_no']; $sqlQuery = "UPDATE farm_cctv_setting SET view_count = $viewCnt"; $sqlRes = mysql_query($sqlQuery); mysql_query("COMMIT"); // 화면 세팅 $tmpQuery = "SELECT * FROM farm_cctv_setting LIMIT 1"; $objSet = mysql_fetch_object(mysql_query($tmpQuery)); $fullSet = $objSet->is_full; $viewSet = $objSet->view_count; ?> <?php for ($i=1; $i < 17; $i++) { ?> <div class="videoBox" style="order:<?=$i?>; overflow:hidden;"> <!-- 비디오 박스 text 들 --> <?php // 데이터를 담을 배열 변수 $arrData = array(); // // 현재 사육중 인지 아닌지 판단 후 .. 농장번호, 동번호를 추출 ( 채널로 비교하는 것이 중요 채널이 업데이트 되면 함께 그 위치에 뿌려준다) $qryChannel = mysql_query("SELECT * FROM farm_ipcamera FI, farm_contract FC WHERE 1 AND FI.farm_no = FC.farm_no AND FC.`no`= $contract_no AND FC.ltms_status = 5 AND FI.farm_no = $farm_no AND FI.ch_no = $i"); // 객체에 담는다 $objChannelInfo = mysql_fetch_object($qryChannel); // 채널이 존제 하지 않을 경우 빈객체 처리 if(empty($objChannelInfo)) { // 비어있으면 아무런 처리도 하지 않는다. }else if($objChannelInfo->dong_no == 0){ // object | 동 정보를 가져오기 $qryFarm = mysql_query("SELECT * FROM farm WHERE `no` = $farm_no "); $objFarm = mysql_fetch_object($qryFarm); echo "<div class='textBoxs'>"; for ($x=0; $x < 25; $x++) { if($x==2) { echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px'>$objFarm->farm_name</div></div>"; }else if($x==3) { echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px'>입구</div></div>"; }else { echo "<div class='textBox' style='order:$x; visibility: hidden;'><div class='textB'>$x</div></div>"; } } echo "</div>"; }else{ // array | 온습도|센서 정보 가져오기 $qryIot = mysql_query("SELECT * FROM iot_raw WHERE 1 AND farm_no = $objChannelInfo->farm_no AND dong_no = $objChannelInfo->dong_no AND SUBSTRING(jtime,1,16) = SUBSTRING(NOW(),1,16) GROUP BY sensor_code "); $arrIot = array(); while($rs = mysql_fetch_array($qryIot)){ $arrIot[] = $rs; } // object | 동 정보를 가져오기 $qryDong = mysql_query("SELECT * FROM farm_dong_info FDI, farm F WHERE 1 AND F.`no` = FDI.farm_no AND FDI.`no`= $objChannelInfo->dong_no "); $objDong = mysql_fetch_object($qryDong); // object | 입추 정보 p::승인 완료 = 1 $qryIpchu = mysql_query("SELECT * FROM farm_ipchu_confirm_log WHERE 1 AND farm_no = $objChannelInfo->farm_no AND dong_no = $objChannelInfo->dong_no AND is_auth = 1 ORDER BY `no` DESC LIMIT 1"); $objIpchu = mysql_fetch_object($qryIpchu); // object | 도태|폐사 정보를 가져오기 p::현재 날짜와 같은 날 정보만 $qryDP = mysql_query("SELECT * FROM farm_dote_input_log WHERE 1 AND farm_no = $objChannelInfo->farm_no AND dong_no = $objChannelInfo->dong_no AND jdate = CURRENT_DATE ORDER BY jdate DESC LIMIT 1"); $objDP = mysql_fetch_object($qryDP); // $tmpIotQuery = mysql_query("select * from iot_raw where farm_no = $farm_no and dong_no = $dong_no order by jtime desc limit 1"); // $objIotInfo = mysql_fetch_object($tmpIotQuery); // $tmpFarmQuery = mysql_query("select * from farm F, farm_dong_info FDI where F.no = FDI.farm_no and F.no = $farm_no and FDI.no = $tepNum "); // $objFarmInfo = mysql_fetch_object($tmpFarmQuery); // $tmpDoteQuery = mysql_query("select * from farm_dote_input_log where dong_no = $tepNum order by regdate DESC"); // $objDoteInfo = mysql_fetch_object($tmpDoteQuery); // $tmpIpchuQuery = mysql_query("select * from farm_ipchu_confirm_log where farm_no = $farm_no and dong_no = $tepNum order by regdate DESC"); // $objIpchuInfo = mysql_fetch_object($tmpIpchuQuery); // $dote = $tepNum == 0 ? "" : "도태 : $objDP->dote"; // $pesa = $tepNum == 0 ? "" : "폐사 : $objDP->pesa"; // $susu = $tepNum == 0 ? "" : "입추 : $objIpchu->susu"; ?> <div class="textBoxs"> <?php for ($x=0; $x < 25; $x++) { //if($x==0 || $x==4 || $x==20 || $x==24 ) { if($x==0) { $tempA = $arrIot[0]['temp']; $humiA = $arrIot[0]['humi']; echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px' >$tempA"."˚ / $humiA%</div></div>"; }else if($x==4) { $tempB = $arrIot[1]['temp']; $humiB = $arrIot[1]['humi']; echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px' >$tempA"."˚ / $humiA%</div></div>"; }else if($x==2) { echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px'>$objDong->farm_name</div></div>"; }else if($x==3) { echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px'>$objDong->dong_name</div></div>"; }else if($x==9) { echo "<div class='textBox use_text text-right' style='order:$x;'>"; echo "<div class='text-info' style='text-shadow: 1px 1px 1px'>입추 : $objIpchu->susu</div><br />"; echo "<div class='text-warning' style='text-shadow: 1px 1px 1px'>도태 : $objDP->dote</div><br />"; echo "<div class='text-danger' style='text-shadow: 1px 1px 1px'>폐사 : $objDP->pesa</div>"; echo "</div>"; }else if($x==15) { echo "<div class='textBox use_text' style='order:$x;'><div>정전(FAN)</div></div>"; }else if($x==19) { echo "<div class='textBox use_text' style='order:$x;'><div>정전(HEATER)</div></div>"; }else if($x==20) { $tempA = $arrIot[2]['temp']; $humiA = $arrIot[2]['humi']; echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px' >$tempA"."˚ / $humiA%</div></div>"; }else if($x==24) { $tempA = $arrIot[3]['temp']; $humiA = $arrIot[3]['humi']; echo "<div class='textBox use_text' style='order:$x;'><div style='text-shadow: 1px 1px 1px' >$tempA"."˚ / $humiA%</div></div>"; }else { echo "<div class='textBox' style='order:$x; visibility: hidden;'><div class='textB'>$x</div></div>"; } } // 채널이 있을 경우 처리 완료 ?> </div> <!-- End textBoxs --> <?php }?> <? // 채널에 맞는 비디오 출력 $objVideo = mysql_fetch_object(mysql_query("SELECT * FROM farm_ipcamera WHERE farm_no= $farm_no AND ch_no = $i")) ?> <video id="video<?=$i?>" draggable="true" droppable="true" ondragstart="drag(event);" ondrop="drop(event);" ondragover="allowDrop(event);" class="video-js videos " muted data-setup="{}" autoplay preload="auto"> <source src="<?=$objVideo->hls_url?>" type="application/x-mpegURL"> </video> </div> <?php }?> <!-- <i class="fa arrow-up fa_angle_double"></i> --> <i class="fa fa-arrow-up fa_angle_double" aria-hidden="true"></i> <!-- rightMenu --> <div class="right_menu"> <ul class="nav nav-pills nav-stacked p-1"> <li class="nav-item"> <a href="#play" class="nav-link active " data-toggle="tab">재생</a> </li> <!-- 저장영상은 웹에서 실행 필요없음 --> <!-- <li class="nav-item"> <a href="#record" class="nav-link" data-toggle="tab">저장영상</a> </li> --> <li class="nav-item"> <a href="#setting" class="nav-link" data-toggle="tab">설정</a> </li> </ul> <div class="tab-content p-2"> <div class="tab-pane fade show active text-white" id="play"> <div class="m-2"> <p class="m-0">전체화면</p> <button class="btn btn-outline-light w-25 m-1 fullScreen"> <i class="fa fa-window-maximize" aria-hidden="true"></i> </button> </div> <div class="m-2"> <p class="m-0">화면분할</p> <button class="btn btn-outline-light view-count videoNo1">1</button> <button class="btn btn-outline-light view-count videoNo4">4</button> <button class="btn btn-outline-light view-count videoNo9">9</button> <button class="btn btn-outline-light view-count videoNo16">16</button> <button class="btn btn-outline-light view-count videoNo25">25</button> <button class="btn btn-outline-light view-count videoNo36">36</button> </div> <div class="m-2"> <p class="m-0">자동회전</p> <div class="switchBox"> <input type="checkbox" class="js-switch-small switchery-small sw_spin" /> </div> </div> <div class="m-2"> <p class="m-0">텍스트</p> <input type="checkbox" class="js-switch-small switchery-small sw_text" checked /> </div> </div><!-- End 재생메뉴--> <div class="tab-pane fade text-white" id="setting"> <div class="m-2"> <p class="m-0">농장</p> <div class="chkBoxs"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_temp" checked> <label class="custom-control-label" for="chk_temp">온도</label> </div> <!-- <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="chk_humi" checked> <label class="custom-control-label" for="chk_humi">습도</label> </div> --> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_pos" checked> <label class="custom-control-label" for="chk_pos">위치</label> </div> </div> </div> <div class="m-2"> <p class="m-0">사육관리항목</p> <div class="chkBoxs"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_day"> <label class="custom-control-label" for="chk_day">일령</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_count" checked> <label class="custom-control-label" for="chk_count">현재수수</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_died" checked> <label class="custom-control-label" for="chk_died">도태/폐사</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_grow"> <label class="custom-control-label" for="chk_grow">육성률</label> </div> </div> </div> <div class="m-2"> <p class="m-0">IOT항목</p> <div class="chkBoxs"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_th"> <label class="custom-control-label" for="chk_th">온습도</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_power"> <label class="custom-control-label" for="chk_power">전원</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_fan"> <label class="custom-control-label" for="chk_fan">정전(FAN)</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_heater"> <label class="custom-control-label" for="chk_heater">정전(HEATER)</label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input chk_check" id="chk_weight"> <label class="custom-control-label" for="chk_weight">체중</label> </div> </div> </div> </div><!-- End 설정 메뉴 --> </div><!-- End Tab --> </div><!-- End RightMenu --> <script> var videos = document.getElementsByTagName('video'); var videosArr = new Array(); // setTimeout(() => { for (var i = 1; i < videos.length; i++) { videosArr[i] = videojs('video'+i); } // }, 2000); // setInterval(() => { // var url="http://ltms.eemo.co.kr/super/farm_cctv_main.php?farm_code=34351059&jong_type=1&pbreedtype=CC&contract_no=36"; // if (url.statusCode === '404'){ // window.location.reload(); // } // }, 10000); /* 에러 받아오기 */ // if(videosArr[i].networkState() == 3 ) { // // console.log(videos[i].parentNode.parentNode); // // videos[i].parentNode.parentNode.setAttribute("style", // // "visibility : hidden; position: relative !important; float:left; width: 50%; height: 50%;"); // } // // videos[i].onerror = function() { // // this.parentNode.setAttribute("style", "visibility:hidden;"); // // }; // } // }, 3000); //전체화면 $(".fullScreen").on('click', function() { if(IsFullScreenCurrently()) GoOutFullscreen(); else GoInFullscreen($("#videos-contents").get(0)); }); function GoInFullscreen(element) { if(element.requestFullscreen){ element.requestFullscreen(); } else if(element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if(element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); } else if(element.msRequestFullscreen) { element.msRequestFullscreen(); } } /* Get out of full screen */ function GoOutFullscreen() { if(document.exitFullscreen) { document.exitFullscreen(); } else if(document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if(document.webkitExitFullscreen) { document.webkitExitFullscreen(); } else if(document.msExitFullscreen) { document.msExitFullscreen(); } } /* Is currently in full screen or not */ function IsFullScreenCurrently() { var full_screen_element = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || null; // If no element is in full-screen if(full_screen_element === null) return false; else return true; } /* 드래그 엔 드롭 기능 */ function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text/plain", ev.target.id); } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text/plain"); var parent = $("#"+data).parent() var videobox = parent.parent(); var one = videobox.css('order'); var test1 = ev.target.id; var parent1 = $("#"+test1).parent(); var videobox1 = parent1.parent(); var two = videobox1.css('order'); setTimeout(() => { videobox1.css('order', one); videobox.css('order', two); }, 500); } // 분할화면 <?php switch ($viewSet) { case 1: ?> $('.videoBox').css({ 'position': 'relative', 'width':'100%', 'height':'100%', 'font-size': '23px' }); <? break; case 4: ?> $('.videoBox').css({ 'position': 'relative', 'width':'50%', 'height':'50%', 'font-size': '18px' }); <? break; case 9: ?> $('.videoBox').css({ 'position': 'relative', 'width':'33.33%', 'height':'33.33%', 'font-size': '15px' }); <? break; case 16: ?> $('.videoBox').css({ 'position': 'relative', 'width':'25%', 'height':'25%', 'font-size': '12px' }); <? break; case 25: ?> $('.videoBox').css({ 'position': 'relative', 'width':'20%', 'height':'20%', 'font-size': '9px' }); <? break; case 36: ?> $('.videoBox').css({ 'position': 'relative', 'width':'16.66%', 'height':'16.66%', 'font-size': '9px' }); <? break; default: ?> <? break; } ?> $('.videoNo1').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'100%', 'height':'100%', 'font-size': '23px' }); }); $('.videoNo4').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'50%', 'height':'50%', 'font-size': '18px' }); }); $('.videoNo9').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'33.33%', 'height':'33.33%', 'font-size': '15px' }); }); $('.videoNo16').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'25%', 'height':'25%', 'font-size': '12px' }); }); $('.videoNo25').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'20%', 'height':'20%', 'font-size': '9px' }); }); $('.videoNo36').click(function (e) { $('.videoBox').css({ 'position': 'relative', 'width':'16.66%', 'height':'16.66%', 'font-size': '9px' }); }); // 자동 페이지 이동 var isStop = false; function stop() { isStop = true; } var startInterval; // 스위치 자동회전 박스 var sw_spin = document.querySelector('.sw_spin'); var switchery = new Switchery(sw_spin, { color: '#1AB394', size: 'small'}); sw_spin.addEventListener('change', function() { if(sw_spin.checked){ isStop = false; startInterval = setInterval(function interval() { if(!isStop){ var videos = $('.videoBox'); for (let index = 0; index < videos.length; index++) { if(videos.eq(index).css('order') == 0) { videos.eq(index).css('order',videos.length); }else { var num = Number(videos.eq(index).css('order')) - 1; videos.eq(index).css('order',num); } } }else { clearInterval(startInterval); } },3000); } else { stop(); } }); /* 스위치 텍스트 박스 */ var sw_text = document.querySelector('.sw_text'); var switchery = new Switchery(sw_text, { color: '#1AB394', size: 'small'}); sw_text.addEventListener('change', function() { if(sw_text.checked){ $('.use_text').css('visibility', 'visible'); $('.chk_check').prop("checked",true); } else { $('.use_text').css('visibility', 'hidden'); var chk = $('.chk_check'); $('.chk_check').prop("checked",false); } }); /* 세팅 체크박스 */ $('#chk_temp').change(function (e) { if(this.checked){ let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==1 || textBox.eq(index).css('order')==5 || textBox.eq(index).css('order')==21 || textBox.eq(index).css('order')==0 ) { textBox.eq(index-1).eq(0).css('visibility', 'visible'); } } }else { let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==1 || textBox.eq(index).css('order')==5 || textBox.eq(index).css('order')==21 || textBox.eq(index).css('order')==0 ) { textBox.eq(index-1).eq(0).css('visibility', 'hidden'); } } } e.preventDefault(); }); $('#chk_pos').change(function (e) { if(this.checked){ let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==3|| textBox.eq(index).css('order')==4 ) { textBox.eq(index-1).css('visibility', 'visible'); } } }else { let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==3 || textBox.eq(index).css('order')==4 ) { textBox.eq(index-1).css('visibility', 'hidden'); } } } e.preventDefault(); }); $('#chk_died').change(function (e) { if(this.checked){ let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==10|| textBox.eq(index).css('order')==15 ) { textBox.eq(index-1).css('visibility', 'visible'); } } }else { let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==10|| textBox.eq(index).css('order')==15 ) { textBox.eq(index-1).css('visibility', 'hidden'); } } } e.preventDefault(); }); /* 입추 */ $('#chk_count').change(function (e) { if(this.checked){ let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==6 ) { textBox.eq(index-1).css('visibility', 'visible'); } } }else { let textBox = $('.textBox'); for (let index = 0; index < textBox.length; index++) { if(textBox.eq(index).css('order')==6) { textBox.eq(index-1).css('visibility', 'hidden'); } } } e.preventDefault(); }); /* 메뉴바 */ $('.fa_angle_double').click(function (e) { if($('.right_menu').css("display") === 'none') { $('.right_menu').slideToggle(); $('.fa_angle_double').removeClass('fa-arrow-down'); $('.fa_angle_double').addClass('fa-arrow-up'); }else { $('.right_menu').slideToggle(); $('.fa_angle_double').removeClass('fa-arrow-up'); $('.fa_angle_double').addClass('fa-arrow-down'); } }); $('.view-count').click(function (e) { for (var i = 1; i < videos.length; i++) { videosArr[i] = videojs('video'+i); videosArr[i].dispose(); } var viewCnt = $(this).text(); var data = new FormData(); var farm_no = <?=$farm_no?>; var contract_no = <?=$contract_no?>; data.append("viewCnt", viewCnt); data.append("farm_no", farm_no); data.append("contract_no", contract_no); data.append("type", "view"); $.ajax({ type: "POST", url: "farm_cctv_main_process_bk.php", data: data, dataType: "html", cache: false, contentType: false, processData: false, success: function (response) { $('#videos-contents').html(""); $('#videos-contents').html(response); } }); }); function lotations() { for (var i = 1; i < videos.length; i++) { videosArr[i] = videojs('video'+i); videosArr[i].dispose(); } var viewCnt = $(this).text(); var farm_no = <?=$farm_no?>; var contract_no = <?=$contract_no?>; var data = new FormData(); data.append("viewCnt", viewCnt); data.append("farm_no", farm_no); data.append("contract_no", contract_no); data.append("type", "view"); $.ajax({ type: "POST", url: "farm_cctv_main_process_bk.php", data: data, dataType: "html", cache: false, contentType: false, processData: false, success: function (response) { $('#videos-contents').html(""); $('#videos-contents').html(response); } }); } </script> <? } ?>