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/visit_list.php
<?php use CTS\CTS; $pageTitle="visit"; $arrFileType = DOC::arrayFileType(); $file_type = empty($_REQUEST['file_type']) ? "" : $_REQUEST['file_type']; $file_typeName = $arrFileType[$file_type]; $file_name = empty($_REQUEST['file_name']) ? "" : $_REQUEST['file_name']; $file_nameB = empty($_REQUEST['file_nameB']) ? "" : $_REQUEST['file_nameB']; $file_flock = empty($_REQUEST['file_flock']) ? "" : $_REQUEST['file_flock']; $file_nameC = empty($_REQUEST['file_nameC']) ? "" : $_REQUEST['file_nameC']; // $farm = empty($_REQUEST['farm']) ? "" : $_REQUEST['farm']; // $flock = empty($_REQUEST['flock']) ? "" : $_REQUEST['flock']; // $weeks = empty($_REQUEST['weeks']) ? "" : $_REQUEST['weeks']; /* page 처리 */ $page = $_GET['page'] ? $_GET['page'] : 1; $onePage = 10; $currentLimit = ($onePage * $page) - $onePage; $sqlLimit = ' limit ' . $currentLimit . ', ' . $onePage; $sql = DOC::filesList($file_typeName, $file_name, $file_nameB, $file_flock, $file_nameC); // 리스트 쿼리 가져오기 $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="<?=$file_nameB;?>" id="file_nameB" name="file_nameB" type="text" placeholder="농가명"> </div> <div class="search pr-1 "> <input class="form-control" onkeyup="enterkey()" value="<?=$file_flock;?>" id="file_flock" name="file_flock" type="text" placeholder="계군"> </div> <div class="search pr-1 "> <input class="form-control" onkeyup="enterkey()" value="<?=$file_nameC;?>" id="file_nameC" name="file_nameC" type="text" placeholder="주령"> </div> <div class="pr-1"> <input id="division" name="division" type="hidden" value="farmSearch" /> </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="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> </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['file_idx']?>"> <th ><?=$i;?></th> <td ><?=$value['file_nameA'] ?></td> <td ><?=$value['file_nameB'] ?></td> <!-- <td ><?=$value['file_nameC'] ?></td> --> <td style='cursor:pointer' ><button class="btn btn-outline-light mr-3" onclick="changeContent('<?=$value['file_idx']?>');"><span class="badge-pill badge-warning" >수정</span></button> <button class="btn btn-outline-light ml-3" onclick="deleteContent('<?=$value['file_idx']?>')"><span class="badge-pill badge-danger" >삭제</span></a></button></td> <td style='cursor:pointer' ><button class="btn btn-outline-light" onclick="viewContent('<?=$value['file_dir']?>','<?=$value['file_name'].'.'.$value['file_ext']?>')"><span class="badge-pill badge-info" >다운로드</span></a></button></td> </tr> <tr class="box-b d-none text-center" id="<?="b".$value['file_idx']?>"> <!-- 히든 데이터 넘기는곳 --> <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="u_content" /> <input type="hidden" id="u_file_idx" value="<?=$value['file_idx']?>" /> <th ><?=$i;?></th> <td ><input type="text" class="form-control text-center" id="u_file_nameA" value="<?=$value['file_nameA'] ?>"></td> <td ><input type="text" class="form-control text-center" id="u_file_nameB" value="<?=$value['file_nameB'] ?>"></td> <td ><input type="text" class="form-control text-center" id="u_file_nameC" value="<?=$value['file_nameC'] ?>"></td> <td style='cursor:pointer' ><button class="btn btn-warning mr-3" type="submit"><span class="badge-pill badge-warning" >확인</span></button> <button class="btn btn-danger ml-3" type="button" onclick="cancelUpdate('<?=$value['file_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="page" value="<?=$page?>" /> <input type="hidden" id="pageTitle" value="<?=$pageTitle?>" /> <input type="hidden" id="file_type" value="<?=$file_type?>" /> <input type="hidden" id="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" id="uploadFile" class="custom-file-input" onchange="sendFile('', this);"> <span class="custom-file-label" id="filename_view"></span> </label> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">닫기</button> <button type="button" class="btn btn-primary" onclick="insertContent()">저장</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); $('#filename_view' + idx).text(fileTmp); } } // submit 전송 function insertContent() { var data = new FormData(); data.append("uploadFile", $("input[id=uploadFile]")[0].files[0]); data.append("process_type", 'i_content'); data.append("page", $('#page').val()); data.append("pageTitle", $('#pageTitle').val()); data.append("file_type", $('#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']); } }); } // 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"); } // delete content function deleteContent(file_idx) { var delConfirm=confirm('파일 삭제시 복구되지 않습니다.'); if (delConfirm) { document.location.href = "farmDataProcess.php?process_type=d_content&file_idx="+file_idx+"&file_type=<?=$file_type?>&page=<?=$page?>&pageTitle=<?=$pageTitle?>"; }else { return; } } function viewContent(fileDiretory, fileName) { document.location.href = "file_download.php?fileDiretory=" + fileDiretory + "&fileName=" + fileName; } </script>