Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
cts.eemo.co.kr
/
public_html
/
src
/
web
/
view
/
farmData
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/cts.eemo.co.kr/public_html/src/web/view/farmData/prod_list.php
<?php use CTS\CTS; $pageTitle="prod"; $arrFileType = DOC::arrayFileType(); $file_type = empty($_REQUEST['file_type']) ? "" : $_REQUEST['file_type']; $file_typeName = $arrFileType[$file_type]; $prod_farm = empty($_REQUEST['prod_farm']) ? "" : $_REQUEST['prod_farm']; $prod_flock = empty($_REQUEST['prod_flock']) ? "" : $_REQUEST['prod_flock']; $prod_date = empty($_REQUEST['prod_date']) ? "" : $_REQUEST['prod_date']; /* page 처리 */ $page = $_GET['page'] ? $_GET['page'] : 1; $onePage = 10; $currentLimit = ($onePage * $page) - $onePage; $sqlLimit = ' limit ' . $currentLimit . ', ' . $onePage; $sql = DOC::prodList($prod_farm, $prod_flock, $prod_date); // 리스트 쿼리 가져오기 $rs = \DB::query($sql.$sqlLimit); $rsCnt = \DB::query($sql); $cnt = count($rsCnt); list($paging, $pageRecord) = CTS::createPaging($cnt, $page); ?> <style> .tableWidth { width: 70%; } </style> <!-- search --> <div class=""> <div class="columns columns-right btn-group float-left"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modals-default">등록하기</button> </div> <form id="frm_process" action="<?=$pageTitle?>_list.php?file_type=<?=$file_type?>&page=<?=$page?>" method="post" > <div class="columns columns-right btn-group float-right"> <div class="search pr-1 "> <input class="form-control" onkeyup="enterkey()" value="<?=$prod_farm;?>" id="prod_farm" name="prod_farm" type="text" placeholder="농가명"> </div> <div class="search pr-1 "> <input class="form-control" onkeyup="enterkey()" value="<?=$prod_flock;?>" id="prod_flock" name="prod_flock" type="text" placeholder="계군코드"> </div> <div class="search pr-1 "> <input class="form-control" onkeyup="enterkey()" value="<?=$prod_date;?>" id="prod_date" name="prod_date" type="text" placeholder="날짜"> </div> <div class="pr-1 float-right"> <button id="farmSearchList" class="btn btn-secondary " type="submit" name="paginationSwitch" title="Hide/Show pagination"> 검색 </button> </div> </div> </form> <br /> <br /> </div> <div class="card clear_float"> <table class="table card-table "> <colgroup> <col width="15%"/> <col width="15%"/> <col width="15%"/> <col width="15%"/> <col width="15%"/> <col width="20%"/> <col width="10%"/> </colgroup> <thead class="thead-light"> <tr class="bg-warning text-center"> <th class="text-dark" scope="col" nowrap><?=('순번');?></th> <th class="text-dark" scope="col" nowrap><?=('구분');?></th> <th class="text-dark" scope="col" nowrap><?=('계군코드');?></th> <th class="text-dark" scope="col" nowrap ><?=('농가명');?></th> <th class="text-dark" scope="col" nowrap ><?=('입추일자');?></th> <th class="text-dark" scope="col" nowrap ><?=('수정');?><?=('삭제');?></th> <th class="text-dark" scope="col" nowrap><?=('다운로드');?></th> </tr> </thead> <tbody> <?php $i= 0; if(count($rs) == 0 ) { echo " <td colspan=12 class='text-center'> 검색 결과가 없습니다</td>"; } foreach($rs as $key => $value) : $i++; ?> <tr class="box-a text-center" id="<?="a".$value['prod_idx']?>"> <th ><a href="prod_view_a.php?file_type=<?=$file_type?>&idx=<?=$value['prod_idx']?>&dfarm_name=<?=$value['prod_feed_farm']?>" class="text-dark"><div><?=$i;?></div></a></th> <td ><a href="prod_view_a.php?file_type=<?=$file_type?>&idx=<?=$value['prod_idx']?>&dfarm_name=<?=$value['prod_feed_farm']?>" class="text-dark"><div><?=$value['prod_type'] ?></div></a></td> <td ><a href="prod_view_a.php?file_type=<?=$file_type?>&idx=<?=$value['prod_idx']?>&dfarm_name=<?=$value['prod_feed_farm']?>" class="text-dark"><div><?=$value['prod_flock'] ?></div></a></td> <td ><a href="prod_view_a.php?file_type=<?=$file_type?>&idx=<?=$value['prod_idx']?>&dfarm_name=<?=$value['prod_feed_farm']?>" class="text-dark"><div><?=$value['prod_farm'] ?></div></a></td> <td ><a href="prod_view_a.php?file_type=<?=$file_type?>&idx=<?=$value['prod_idx']?>&dfarm_name=<?=$value['prod_feed_farm']?>" class="text-dark"><div><?=substr($value['prod_date'],0,10) ?></div></a></td> <td style='cursor:pointer' ><button class="btn btn-outline-light ml-3" onclick="changeContent('<?=$value['prod_idx']?>')"><span class="badge-pill badge-success" >정보수정</span></a></button> <button id="addModalData" class="btn btn-outline-light mr-3" data-toggle="modal" data-target="#modals-update" data-id="<?=$value['prod_idx']?>" ><span class="badge-pill badge-warning" >파일변경</span></button></td> <td style='cursor:pointer' ><button class="btn btn-outline-light" onclick="viewContent('<?=$value['prod_dir']?>','<?=$value['prod_file'].'.'.$value['prod_ext']?>')"><span class="badge-pill badge-info" >다운로드</span></a></button></td> </tr> <tr class="box-b d-none text-center" id="<?="b".$value['prod_idx']?>"> <!-- 히든 데이터 넘기는곳 --> <input type="hidden" id="t_page<?=$value['prod_idx']?>" value="<?=$page?>" /> <input type="hidden" id="t_pageTitle<?=$value['prod_idx']?>" value="<?=$pageTitle?>" /> <input type="hidden" id="t_file_type<?=$value['prod_idx']?>" value="<?=$file_type?>" /> <input type="hidden" id="t_process_type<?=$value['prod_idx']?>" value="u_<?=$pageTitle?>" /> <th ><?=$i;?></th> <td> <div class=""> <select class="form-control" style="text-align-last: center;" id="t_prod_type<?=$value['prod_idx']?>"> <option value="PS" <?=$value['prod_type']=='PS' ? 'selected': '' ?>>PS</option> <option value="GPS" <?=$value['prod_type']=='GPS' ? 'selected': '' ?>>GPS</option> </select> </div> </td> <td ><input type="text" class="form-control text-center" id="t_prod_flock<?=$value['prod_idx']?>" value="<?=$value['prod_flock'] ?>"></td> <td ><input type="text" class="form-control text-center" id="t_prod_farm<?=$value['prod_idx']?>" value="<?=$value['prod_farm'] ?>"></td> <td ><input type="text" class="form-control text-center" id="t_prod_date<?=$value['prod_idx']?>" value="<?=substr($value['prod_date'],0,10) ?>" readonly></td> <!-- <td ><input type="text" class="form-control text-center" name="prod_date" value="<?=$value['prod_date'] ?>"></td> --> <td style='cursor:pointer' ><button class="btn btn-warning mr-3" onclick="titleUpdate('<?=$value['prod_idx']?>');"><span class="badge-pill badge-warning" >확인</span></button> <button class="btn btn-danger ml-3" type="button" onclick="cancelUpdate('<?=$value['prod_idx']?>')"><span class="badge-pill badge-danger" >취소</span></a></button></td> <td></td> </tr> <?php endforeach; ?> </tbody> </table> </div> <!-- 페이지 처리 --> <nav class="mt-2"> <?php CTS::printPageNavigator($pageRecord)?> </nav> <!-- 입력 모달 --> <div class="modal fade" id="modals-default" style="display: none;" aria-modal="true"> <!-- 히든 데이터 넘기는곳 --> <input type="hidden" id="p_page" value="<?=$page?>" /> <input type="hidden" id="p_pageTitle" value="<?=$pageTitle?>" /> <input type="hidden" id="p_file_type" value="<?=$file_type?>" /> <input type="hidden" id="p_process_type" value="i_<?=$pageTitle?>" /> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title"> <span class="font-weight-light"></span> <br> <small class="text-muted">컨텐츠 입력하기</small> </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button> </div> <div class="modal-body"> <div class="form-row mt-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">신규 파일</span> </div> <label class="custom-file"> <input type="file" name="p_uploadFile" id="p_uploadFile" class="custom-file-input" onchange="sendFile('', this);"> <span class="custom-file-label" id="uploadFilename_view"></span> </label> </div> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal">닫기</button> <button class="btn btn-primary" onclick="insertProd();">저장</button> </div> </div> </div> </div> <!-- 입력 모달 끝 --> <!-- 수정 모달 --> <div class="modal fade" id="modals-update" style="display: none;" aria-modal="true"> <!-- 히든 데이터 넘기는곳 --> <input type="hidden" id="u_page" value="<?=$page?>" /> <input type="hidden" id="u_pageTitle" value="<?=$pageTitle?>" /> <input type="hidden" id="u_file_type" value="<?=$file_type?>" /> <input type="hidden" id="u_process_type" value="uf_<?=$pageTitle?>" /> <input type="hidden" id="u_prod_idx" /> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title"> <span class="font-weight-light"></span> <br> <small class="text-muted">컨텐츠 입력하기</small> </h5> <button class="close" data-dismiss="modal" aria-label="Close">×</button> </div> <div class="modal-body"> <div class="form-row mt-3"> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">수정 파일</span> </div> <label class="custom-file"> <input type="file" name="u_file" id="u_file" class="custom-file-input" onchange="sendUpdateFile('', this);"> <span class="custom-file-label" id="filename_update"></span> </label> </div> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal">닫기</button> <button class="btn btn-primary" onclick="updateContent();" >수정</button> </div> </div> </div> </div> <!-- 수정 모달 끝 --> <script> // 파일 이름 전달 function sendFile(idx, obj) { if ($(obj).val() != "" && $(obj).val() != null) { var arrFileTmp = $(obj).val().split('\\'); var fileTmp = arrFileTmp[arrFileTmp.length - 1]; //console.log($(obj).val()); //console.log(fileTmp); $('#uploadFilename_view' + idx).text(fileTmp); } } // 파일 이름 전달 function sendUpdateFile(idx, obj) { if ($(obj).val() != "" && $(obj).val() != null) { var arrFileTmp = $(obj).val().split('\\'); var fileTmp = arrFileTmp[arrFileTmp.length - 1]; //console.log($(obj).val()); //console.log(fileTmp); $('#filename_update' + idx).text(fileTmp); } } // insert Prod function insertProd() { var data = new FormData(); data.append("uploadFile", $("input[id=p_uploadFile]")[0].files[0]); data.append("process_type", $('#p_process_type').val()); data.append("page", $('#p_page').val()); data.append("pageTitle", $('#p_pageTitle').val()); data.append("file_type", $('#p_file_type').val()); $.ajax({ data: data, type: 'post', url: "farmDataProcess.php", enctype: "multipart/form-data", sync: false, cache: false, contentType: false, processData: false, dataType: 'json', success: function(response) { eval(response['alert']); eval(response['link']); } }); } // update prod info function titleUpdate(prod_idx) { var data = new FormData(); data.append("process_type", $('#t_process_type'+prod_idx).val()); data.append("page", $('#t_page'+prod_idx).val()); data.append("pageTitle", $('#t_pageTitle'+prod_idx).val()); data.append("file_type", $('#t_file_type'+prod_idx).val()); data.append("prod_idx", prod_idx); data.append("prod_type", $('#t_prod_type'+prod_idx).val()); data.append("prod_flock", $('#t_prod_flock'+prod_idx).val()); data.append("prod_farm", $('#t_prod_farm'+prod_idx).val()); data.append("prod_date", $('#t_prod_date'+prod_idx).val()); $.ajax({ data: data, type: 'post', url: "farmDataProcess.php", sync: false, cache: false, contentType: false, processData: false, dataType: 'json', success: function(response) { eval(response['alert']); eval(response['link']); } }); }; // add data modal $(document).on('click', '#addModalData', function() { var addData = $(this).data('id'); $('#u_prod_idx').val(addData); }); // update prod file function updateContent() { var data = new FormData(); data.append("uploadFile", $("input[id=u_file]")[0].files[0]); data.append("process_type", $('#u_process_type').val()); data.append("page", $('#u_page').val()); data.append("pageTitle", $('#u_pageTitle').val()); data.append("file_type", $('#u_file_type').val()); data.append("prod_idx", $('#u_prod_idx').val()); $.ajax({ data: data, type: 'post', url: "farmDataProcess.php", enctype: "multipart/form-data", sync: false, cache: false, contentType: false, processData: false, dataType: 'json', success: function(response) { eval(response['alert']); eval(response['link']); } }); } // change content function changeContent(file_idx) { $('.box-a').show(); $('.box-b').addClass("d-none"); $('#a'+file_idx).hide(); $('#b'+file_idx).removeClass("d-none"); } // cancel update function cancelUpdate(file_idx) { $('#a'+file_idx).show(); $('#b'+file_idx).addClass("d-none"); } function viewContent(fileDiretory, fileName) { document.location.href = "file_download.php?fileDiretory=" + fileDiretory + "&fileName=" + fileName; } </script>