dbnt.co.kr2023/zadm/contact/contact.php

209 lines
8.0 KiB
PHP

<?
$_adminpage = true;
if (!$argu['p']) $argu['p'] = 1;
if(empty($argu['mode'])) $argu['mode'] = "LIST_FORM";
$default_querystring = "pagecode=".$argu["pagecode"]."&subpage=".$argu["subpage"]."&gubun=".$argu["gubun"];
switch ($argu['mode']) {
case "LIST_FORM":
$_list = $Obj_contact->get_list($argu,$total);
break;
case "INSERT_FORM":
break;
case "MODIFY_FORM":
$_row = $data = $Obj_contact->get_view($argu['id']);
break;
case "INSERT_ACTION":
break;
case "MODIFY_ACTION":
if($Obj_contact->set_modify($argu)){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"수정 되었습니다");
exit;
}
break;
case "DELETE_ACTION":
if($Obj_contact->set_delete($argu)){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"삭제 되었습니다");
exit;
}
break;
}
?>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">문의관리</h1>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<?
/***********************************
===== 리스트 폼일경우 =====
***********************************/
if ($argu['mode'] == "LIST_FORM") {
?>
<form role="form" name="f" method="get" action="<?=$_SERVER["PHP_SELF"]?>">
<input type="hidden" name="mode" id="mode" value="LIST_FORM">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<input type="hidden" name="gubun" value="<?=$argu["gubun"]?>">
<div class="row">
<!-- <div class="col-sm-2">
<div class="form-group">
<select class="form-control" name="s_case">
<option value="er_name"<?if( $argu['s_case'] == "er_name") echo" selected";?>>지역명</option>
</select>
</div>
</div> -->
<div class="col-sm-3">
<div class="form-group input-group">
<input type="text" class="form-control" name="s_string" value="<?=htmlspecialchars($argu['s_string'])?>">
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<colgroup>
<col width="5%" />
<col width="15%" />
<col width="15%" />
<col width="15%" />
<col width="15%" />
<col width="15%" />
</colgroup>
<thead>
<tr>
<th>번호</th>
<th>이름</th>
<th>연락처</th>
<th>이메일</th>
<th>상태</th>
<th>등록일</th>
</tr>
</thead>
<tbody>
<?
if(count($_list) > 0){ // 리스트가 있을경우
for($i=0;$i<count($_list);$i++){
$_list_link="?".$default_querystring."&mode=MODIFY_FORM&p={$argu['p']}&id=".$_list[$i]["id"];
//$_status = ($_list[$i]["status"] == "N")? "<button class=\"btn btn-default\" type=\"button\">신청중</button> " : "<button class=\"btn\" type=\"button\" style=\"background-color:#cacaca;color:#ffffff\">완료</button> ";
if($_list[$i]["status"] == "I"){
$_status = "진행중";
}
else if($_list[$i]["status"] == "Y"){
$_status = "계약완료";
}
else if($_list[$i]["status"] == "C"){
$_status = "진행취소";
}
else{
$_status = "미확인";
}
?>
<tr>
<td><?=number_format($total - $Obj_contact->_LIST_NUM * ($argu[p] - 1) - $i)?></td>
<td><a href="<?=$_list_link?>"><?=$_list[$i]["name"]?></a></td>
<td><a href="<?=$_list_link?>"><?=$_list[$i]['phone']?></a></td>
<td><a href="<?=$_list_link?>"><?=$_list[$i]["email"]?></a></td>
<td><?=$_status?> </td>
<td><?=$_list[$i]['regdate']?></td>
</tr>
<?
}
}else{ // 리스트가 없을경우
?>
<tr>
<td colspan="6">등록된 내용이 없습니다</td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="row">
<div class="col-sm-6">
<!-- <button type="button" class="btn btn-outline btn-primary" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=INSERT_FORM');">등록</button> -->
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers">
<ul class="pagination">
<?=page_index_admin($total,$argu['p'],preg_replace(array("/^p=(\d+)/","/&p=(\d+)/","/&p=/i","/&amp;p=(\d+)/","/&amp;p=/i"),"",$_SERVER["QUERY_STRING"]),$Obj_contact->_LIST_NUM,$scale=10,BOARD_FIRST_IMG,BOARD_LAST_IMG,BOARD_PREV_IMG,BOARD_NEXT_IMG);?>
</ul>
</div>
</div>
</div>
</form>
<?
}
/***********************************
===== 등록/수정 폼일경우 =====
***********************************/
elseif ($argu['mode'] == "INSERT_FORM" || $argu['mode'] == "MODIFY_FORM") {
$_w_mode=($argu['mode'] == "INSERT_FORM") ? "INSERT_ACTION" : "MODIFY_ACTION";
$argu["p"]=($argu['mode'] == "INSERT_FORM") ? 1 : $argu["p"];
?>
<form name="f" method="post" enctype="multipart/form-data" style="margin:0;" >
<input type="hidden" name="mode" value="MODIFY_ACTION">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<input type="hidden" name="id" value="<?=$_row["id"]?>">
<div class="form-group">
<label for="status" >상태</label>
<select title="선택" name="status" style="width:100%; height:30px; border:1px solid #e1e1e1;;">
<?
foreach($_CODE["9"] as $key => $value){
$_selected = ($key == $_row["status"]) ? " selected" : "";
?>
<option value="<?=$key?>"<?=$_selected?>><?=$value?></option>
<?
}
?>
</select>
</div>
<div class="form-group">
<label for="name" >이름</label>
<input type="text" class="form-control {label:'이름',required:true}" id="name" name="name" placeholder="이름" value="<?=htmlspecialchars($_row['name'])?>">
</div>
<div class="form-group">
<label for="phone" >연락처</label>
<input type="text" class="form-control {label:'연락처',required:true}" id="phone" name="phone" placeholder="연락처" value="<?=$_row['phone']?>">
</div>
<div class="form-group">
<label for="phone" >이메일</label>
<input type="text" class="form-control {label:'이메일',required:true}" id="email" name="email" placeholder="이메일" value="<?=$_row['email']?>">
</div>
<div class="form-group">
<label for="content" >문의내용</label>
<textarea class="form-control" name="content" id="content" style="width:100%; height:200px;"><?=$_row["content"]?></textarea>
</div>
<button type="submit" class="btn btn-outline btn-success">확인</button>
<button type="button" class="btn btn-outline btn-danger" onclick="if(confirm('삭제 하시겠습니까?')){go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=DELETE_ACTION&p=<?=$argu['p']?>&id=<?=$_row['id']?>');}">삭제</button>
<button type="button" class="btn btn-outline btn-info" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=LIST_FORM');">목록</button>
</form>
<?
}
?>
</div>
<!-- /.panel-body -->
</div>
</div>
</div>