333 lines
11 KiB
PHP
333 lines
11 KiB
PHP
<?
|
|
if (!$argu['p']) $argu['p'] = 1;
|
|
if(empty($argu['mode'])) $argu['mode'] = "LIST_FORM";
|
|
|
|
$default_querystring = "pagecode=".$argu["pagecode"]."&subpage=".$argu["subpage"]."&h_gubun=".$argu["h_gubun"]."&division=".$argu["division"];
|
|
|
|
|
|
switch ($argu['mode']) {
|
|
case "LIST_FORM":
|
|
$_list = $Obj_history->get_history_list($argu,$total);
|
|
|
|
break;
|
|
case "INSERT_FORM":
|
|
$_row['h_year'] = date("Y");
|
|
break;
|
|
case "MODIFY_FORM":
|
|
$_row = $data = $Obj_history->get_history_view($argu['h_no']);
|
|
foreach($_row as $key => $value){
|
|
$_row[$key] = trim($value);
|
|
}
|
|
$_list = $Obj_history->get_histroy_detail($argu['h_no']);
|
|
|
|
break;
|
|
case "INSERT_ACTION":
|
|
if($Obj_history->set_history_insert($argu)){
|
|
go_url("?mode=LIST_FORM&".$default_querystring,"등록 되었습니다");
|
|
exit;
|
|
}
|
|
break;
|
|
case "MODIFY_ACTION":
|
|
if($Obj_history->set_history_modify($argu)){
|
|
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"수정 되었습니다");
|
|
exit;
|
|
}
|
|
break;
|
|
case "DELETE_ACTION":
|
|
if($Obj_history->set_history_delete($argu['h_no'])){
|
|
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"삭제 되었습니다");
|
|
exit;
|
|
}
|
|
break;
|
|
case "LIST_DELETE_ACTION2":
|
|
$Obj_history->set_history_delete_list($argu);
|
|
go_url("?".$default_querystring."&mode=LIST_FORM&p={$argu['p']}","삭제 되었습니다.");
|
|
exit;
|
|
break;
|
|
}
|
|
|
|
if($argu["h_gubun"] == "en"){
|
|
$_title = "(영문)";
|
|
}
|
|
else{
|
|
$_title = "(국문)";
|
|
}
|
|
$_title1 = ($argu["division"] == "") ? "연혁" : "설비셋업 및 이설";
|
|
?>
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<h1 class="page-header"><?=$_title1?> 관리 <?=$_title?></h1>
|
|
</div>
|
|
<!-- /.col-lg-12 -->
|
|
</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="h_gubun" value="<?=$argu['h_gubun']?>">
|
|
<input type="hidden" name="divisoin" value="<?=$argu['divisoin']?>">
|
|
<input type="hidden" name="p" value="1">
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<div class="form-group">
|
|
<select class="form-control" name="h_year">
|
|
<option value="">-Year-</option>
|
|
<?
|
|
for($y=2018;$y<=(date("Y")+2);$y++){
|
|
$_select = ($argu["h_year"] == $y) ? " selected" : "";
|
|
?>
|
|
<option value="<?=$y?>"<?=$_select?>><?=$y?></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="10%" />
|
|
<?if($argu["division"] == "H"){?><col width="10%" /><?}?>
|
|
<col width="*" />
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>Year</th>
|
|
<?if($argu["division"] == "H"){?><th>Month</th><?}?>
|
|
<th>Content</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?
|
|
if(count($_list) > 0){ // 리스트가 있을경우
|
|
for($i=0;$i<count($_list);$i++){
|
|
|
|
$_d_list = $Obj_history -> get_histroy_detail($_list[$i]["h_no"]);
|
|
|
|
$_contents = "";
|
|
for($j=0;$j<count($_d_list);$j++){
|
|
$_contents = $_contents.$_d_list[$j]["h_content"]."<br>";
|
|
}
|
|
|
|
$_list_link=$_SERVER["PHP_SELF"]."?mode=MODIFY_FORM&h_no=".$_list[$i]['h_no']."&".$default_querystring;
|
|
|
|
?>
|
|
<tr>
|
|
<td><a href="<?=$_list_link?>"><?=$_list[$i]["h_year"]?></a></td>
|
|
<?if($argu["division"] == "H"){?><td><?=$_list[$i]['h_month_m']?></td><?}?>
|
|
<td><?=$_contents?></td>
|
|
</tr>
|
|
<?
|
|
}
|
|
}else{ // 리스트가 없을경우
|
|
?>
|
|
<tr>
|
|
<td colspan="<?if($argu["division"] == "H"){?>3<?}else{?>2<?}?>">등록된 내용이 없습니다</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","/&p=(\d+)/","/&p=/i"),"",$_SERVER["QUERY_STRING"]),$Obj_history -> _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"];
|
|
?>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
$("#add_btn").click(function(){
|
|
addRow();
|
|
});
|
|
});
|
|
|
|
function addRow(){
|
|
var html;
|
|
var html = "<div class=\"form-group input-group\">\n";
|
|
var html = html + "<span class=\"input-group-btn\">\n";
|
|
var html = html + "<button class=\"btn btn-default\" type=\"button\" name=\"add_btn\" id=\"add_btn\" onclick=\"addRow()\">+</button>\n";
|
|
var html = html + "<button class=\"btn btn-default\" type=\"button\" name=\"del_btn\" onClick=\"javascript:delRow(this);\">-</button>\n";
|
|
var html = html + "</span>\n";
|
|
var html = html + "<input type=\"text\" class=\"form-control {label:'Contents',required:true}\" name=\"h_content[]\">\n";
|
|
var html = html + "</div>\n";
|
|
|
|
$("#list_detail").append(html);
|
|
}
|
|
|
|
function delRow(object){
|
|
var index = $("#list_detail .input-group [name=del_btn]").index(object);
|
|
|
|
$("#list_detail .input-group").eq(index).remove();
|
|
}
|
|
|
|
function delRow_data(object, idx){
|
|
var del_confirm = confirm("데이터가 삭제 됩니다.\n선택하신 데이터를 삭제 하세겠습니까?");
|
|
|
|
if(del_confirm == true){
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "./basic/delRow_data.php",
|
|
data:{
|
|
'hl_no':idx
|
|
},
|
|
error:function(data,error) {
|
|
//alert(error);
|
|
},
|
|
success: function(data) {
|
|
if(data == "true"){
|
|
var index = $("#list_detail .input-group [name=del_btn]").index(object);
|
|
|
|
$("#list_detail .input-group").eq(index).remove();
|
|
}
|
|
else{
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
</script>
|
|
<form role="form" name="f" method="post" enctype="multipart/form-data" action="<?=$_SERVER["PHP_SELF"]?>">
|
|
<input type="hidden" name="pagecode" value="<?=$argu["pagecode"]?>">
|
|
<input type="hidden" name="subpage" value="<?=$argu["subpage"]?>">
|
|
<input type="hidden" name="mode" value="<?=$_w_mode?>">
|
|
<input type="hidden" name="p" value="<?=$argu["p"]?>">
|
|
<input type="hidden" name="h_no" value="<?=$_row["h_no"]?>">
|
|
<input type="hidden" name="h_gubun" value="<?=$argu['h_gubun']?>">
|
|
<input type="hidden" name="division" value="<?=$argu['division']?>">
|
|
<div class="form-group">
|
|
<label for="user_pwd">Year</label>
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<select name="h_year" class="form-control {label:'Year',required:true}">
|
|
<option value="">-Year-</option>
|
|
<?
|
|
for($y=2018;$y<=(date("Y")+2);$y++){
|
|
$_select = ($_row["h_year"] == $y) ? " selected" : "";
|
|
?>
|
|
<option value="<?=$y?>"<?=$_select?>><?=$y?></option>
|
|
<?
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<?if($argu["division"] == "H"){?>
|
|
<div class="col-sm-2">
|
|
<select name="h_month" class="form-control {label:'Month',required:true}">
|
|
<option value="">-Month-</option>
|
|
<?
|
|
for($m=1;$m<13;$m++){
|
|
$_select = ($_row["h_month"] == $m) ? " selected" : "";
|
|
?>
|
|
<option value="<?=$m?>"<?=$_select?>><?=$m?></option>
|
|
<?
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<?
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="user_pwd">Contents</label>
|
|
<div id="list_detail">
|
|
<?
|
|
if($argu['mode'] == "MODIFY_FORM"){
|
|
if(count($_list)>0){
|
|
for($i=0; $i < count($_list); $i++){
|
|
?>
|
|
<div class="form-group input-group">
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-default" type="button" name="add_btn" id="add_btn" onclick="addRow()">+</button>
|
|
<button class="btn btn-default" type="button" name="del_btn" onClick="javascript:delRow_data(this, <?=$_list[$i]["hl_no"]?>);">-</button>
|
|
</span>
|
|
<input type="text" class="form-control {label:'Contents',required:true}" name="h_content[]" value="<?=htmlspecialchars($_list[$i]["h_content"])?>">
|
|
<input type="hidden" name="hl_no[]" value="<?=$_list[$i]["hl_no"]?>">
|
|
</div>
|
|
<?
|
|
}
|
|
}
|
|
}
|
|
else{
|
|
?>
|
|
<div class="form-group input-group">
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-default" type="button" name="add_btn" id="add_btn" onclick="addRow()">+</button>
|
|
<button class="btn btn-default" type="button" name="del_btn" onClick="javascript:delRow(this);">-</button>
|
|
</span>
|
|
<input type="text" class="form-control {label:'Contents',required:true}" name="h_content[]">
|
|
</div>
|
|
<?
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?
|
|
if($argu['mode'] == "MODIFY_FORM"){
|
|
?>
|
|
<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']?>&h_no=<?=$_row['h_no']?>');}">삭제</button>
|
|
<?
|
|
}
|
|
else{
|
|
?>
|
|
<button type="submit" class="btn btn-outline btn-success">등록</button>
|
|
<?
|
|
}
|
|
?>
|
|
<button type="button" class="btn btn-outline btn-info" onclick="go_url('<?=$_SEVER["PHP_SELF"]?>?<?=$default_querystring?>&mode=LIST_FORM');">목록</button>
|
|
</form>
|
|
<?
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.col-lg-12 -->
|
|
</div>
|