퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가
This commit is contained in:
258
manager/vip/vip_gr_edit.php
Normal file
258
manager/vip/vip_gr_edit.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
?>
|
||||
<style>
|
||||
.user_lv{
|
||||
display: inline-block;
|
||||
margin: 0 20px 0 0;
|
||||
|
||||
}
|
||||
.reg_team{
|
||||
display: inline-block;
|
||||
margin: 0 20px 0 0;
|
||||
}
|
||||
.gender{
|
||||
display: inline-block;
|
||||
}
|
||||
.searchform{
|
||||
margin: 5px 5px 20px 0;
|
||||
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$table = $fg['vip_category_table'];
|
||||
$recnum = $_GET['recnum'] ? $_GET['recnum'] : 15;
|
||||
$pagenum = 20;
|
||||
$sqlnumrows = mysqli_query($conn, "SELECT * FROM {$table}");
|
||||
$record_count = mysqli_num_rows($sqlnumrows);
|
||||
$page_count = ceil($record_count / $recnum);
|
||||
$prev_page = $p - $pagenum < 1 ? 1 : $p - $pagenum;
|
||||
$next_page = $p + $pagenum > $page_count ? $page_count : $p + $pagenum;
|
||||
$query = mysqli_query($conn, "SELECT * FROM {$table} ORDER BY gr_id ASC LIMIT ".(($p - 1) * $recnum).",".$recnum);
|
||||
$R = array();
|
||||
while($row=mysqli_fetch_array($query)) { // 전체 배열에 저장
|
||||
array_push($R, $row);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div class="text-left">
|
||||
전체 그룹 수 : <b><?php echo $record_count; ?></b>
|
||||
</div>
|
||||
<div class="text-center" style="width:700px;">
|
||||
<table class="table table-striped">
|
||||
<colgroup>
|
||||
<col width="100px">
|
||||
<col width="300px">
|
||||
<col width="200px">
|
||||
<col width="200px">
|
||||
<col width="100px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">고유번호</th>
|
||||
<th class="text-center">구분 명</th>
|
||||
<th class="text-center">유효기간</th>
|
||||
<th class="text-center">활성화</th>
|
||||
<th class="text-center">권한</th>
|
||||
<th class="text-center">수정/세부정보</th>
|
||||
<th class="text-center">삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for($i=0; $i < count($R); $i++):?>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo $R[$i]['gr_id']?></td>
|
||||
<td class="text-center"><?php echo $R[$i]['gr_name']?></td>
|
||||
<td class="text-center"><?php echo $R[$i]['gr_date']?></td>
|
||||
<td class="text-center"><?php
|
||||
echo $R[$i]['gr_lv']
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center"><?php echo (($R[$i]['gr_used'] == 1)?"활성":"비활성");?></td>
|
||||
<td class="text-center">
|
||||
<!-- 수정 버튼 -->
|
||||
<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#modify_modal_<?php echo $R[$i]['gr_id']?>">수정/세부정보</button>
|
||||
<div id="modify_modal_<?php echo $R[$i]['gr_id']?>" class="modal fade text-center ">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="modify">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">정보 수정</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<div class="form-group">
|
||||
<label for="gr_id">고유번호</label>
|
||||
<input type="text" class="form-control" id="gr_id" name="gr_id" readonly value="<?php echo $R[$i]['gr_id']?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gr_lv">권한</label>
|
||||
<input type="text" class="form-control" id="gr_lv" name="gr_lv" value="<?php echo $R[$i]['gr_lv']?>">
|
||||
<input type="radio" id="gr_lv" name="gr_lv" value="1" <?php echo(($R[$i]['gr_lv'] == 1)?"checked":"") ?> ><label>1</label>
|
||||
<input type="radio" id="gr_lv" name="gr_lv" value="2" <?php echo(($R[$i]['gr_lv'] == 2)?"checked":"") ?> ><label>2</label>
|
||||
<input type="radio" id="gr_lv" name="gr_lv" value="3" <?php echo(($R[$i]['gr_lv'] == 3)?"checked":"") ?> ><label>3</label>
|
||||
<input type="radio" id="gr_lv" name="gr_lv" value="4" <?php echo(($R[$i]['gr_lv'] == 4)?"checked":"") ?> ><label>4</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gr_used">그룹명</label>
|
||||
<input type="text" class="form-control" id="gr_used" name="gr_used" value="<?php echo $R[$i]['gr_used']?>">
|
||||
<input type="radio" id="gr_used" name="gr_used" value="1" <?php echo(($R[$i]['gr_used'] == 1)?"checked":"") ?> ><label>활성</label>
|
||||
<input type="radio" id="gr_used" name="gr_used" value="0" <?php echo(($R[$i]['gr_used'] == 0)?"checked":"") ?> ><label>비활성</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gr_date">유효기간</label>
|
||||
<input type="text" class="form-control" id="gr_date" name="gr_date" value="<?php echo $R[$i]['gr_date']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">수정</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?php if ($_SESSION['user_lv'] = "4"){ ?>
|
||||
<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?php echo $R[$i]['gr_id']?>')" role="button">삭제</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endfor ?>
|
||||
</tbody>
|
||||
|
||||
<!-- 추가버튼 위치 -->
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="9" class="text-right">
|
||||
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#add_modal">추가</button>
|
||||
<!-- 추가 버튼을 누르면 출력한다. -->
|
||||
<div id="add_modal" class="modal fade text-center"">
|
||||
<div class="modal-dialog" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<form class="signup">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">그룹 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<div class="form-group">
|
||||
<label for="gr_name">그룹명</label>
|
||||
<input type="text" class="form-control" id="gr_name" name="gr_name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gr_date">유효기간 설정</label>
|
||||
<input type="date" class="form-control" id="gr_date" name="gr_date" value="9999-12-31">
|
||||
<br> 평생 이용의 경우 기본값으로 지정
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<!-- 페이지 번호 -->
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<li>
|
||||
<a href="list.php?page=<?php echo $page?>&p=<?php echo $prev_page?>" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$start_page = floor(($p - 1) / $pagenum) * $pagenum + 1;
|
||||
$end_page = $start_page + ($pagenum - 1);
|
||||
if($end_page > $page_count) $end_page = $page_count;
|
||||
?>
|
||||
<?php for($i=$start_page; $i<=$end_page; $i++):?>
|
||||
<li<?php if($i==$p):?> class="active"<?php endif?>>
|
||||
<a href="list.php?page=<?php echo $page?>&p=<?php echo $i?>"><?php echo $i?></a>
|
||||
</li>
|
||||
<?php endfor ?>
|
||||
<li>
|
||||
<a href="list.php?page=<?php echo $page?>&p=<?php echo $next_page?>" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!-- 스크립트 부분 -->
|
||||
<script type="text/javascript">
|
||||
function deleteItem(gr_id)
|
||||
{
|
||||
if(confirm("정말 삭제하시겠습니까?"))
|
||||
{
|
||||
var formData = {
|
||||
gr_id: gr_id
|
||||
}
|
||||
$.post("proc/gr_delete.php", formData, function(data)
|
||||
{
|
||||
alert("삭제되었습니다.");
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function()
|
||||
{
|
||||
// 추가
|
||||
$(".signup").on("submit", function()
|
||||
{
|
||||
var f = $(this).get(0);
|
||||
|
||||
// 등록 프로세스
|
||||
var formData = $(this).serialize();
|
||||
$.post("proc/gr_signup.php", formData, function(json)
|
||||
{
|
||||
if(json != undefined && json.isSuccess)
|
||||
{
|
||||
location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("등록중 에러가 발생하였습니다.");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
// 수정
|
||||
$(".modify").on("submit", function()
|
||||
{
|
||||
var f = $(this).get(0);
|
||||
|
||||
// 등록 프로세스
|
||||
var formData = $(this).serialize();
|
||||
$.post("proc/gr_modify.php", formData, function(json)
|
||||
{
|
||||
console.log(json);
|
||||
if(json != undefined && json.isSuccess)
|
||||
{
|
||||
location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("수정중 에러가 발생하였습니다.");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php include_once FG_MANAGER_PATH."/tail.php";
|
||||
Reference in New Issue
Block a user