dbnt.co.kr2023/zadm/basic/popup.php

204 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_popup->get_popup_list($argu,$total);
break;
case "INSERT_FORM":
$_row['p_use'] = "Y";
$_row["p_main"] = "Y";
break;
case "MODIFY_FORM":
$_row = $data = $Obj_popup->get_popup_view($argu['p_idx']);
foreach($_row as $key => $value){
$_row[$key] = trim($value);
}
break;
case "INSERT_ACTION":
if($Obj_popup->set_popup_insert($argu)){
go_url("?mode=LIST_FORM&".$default_querystring,"등록 되었습니다");
exit;
}
break;
case "MODIFY_ACTION":
if($Obj_popup->set_popup_modify($argu)){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"수정 되었습니다");
exit;
}
break;
case "DELETE_ACTION":
if($Obj_popup->set_popup_delete($argu['p_idx'])){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"삭제 되었습니다");
exit;
}
break;
case "LIST_DELETE_ACTION2":
$Obj_popup->set_popu_delete_list($argu);
go_url("?".$default_querystring."&mode=LIST_FORM&p={$argu['p']}","삭제 되었습니다.");
exit;
break;
}
$_gubun = ($argu["gubun"] == "en") ? " (영문)" : "";
?>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">팝업관리<?=$_gubun?></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="table-responsive">
<table class="table table-striped table-bordered table-hover">
<colgroup>
<col width="5%" />
<col width="*" />
<col width="19%" />
<col width="19%" />
</colgroup>
<thead>
<tr>
<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']}&p_idx=".$_list[$i]["p_idx"];
$_use = ($_list[$i]["p_use"] == "Y") ? " <button class=\"btn btn-success btn-xs tooltips\">Publish</button>" : " <button class=\"btn btn-bricky btn-xs tooltips\" >Unpublish</button>";
?>
<tr>
<td><?=($total - $Obj_popup->_LIST_NUM * ($argu[p] - 1) - $i)?></td>
<td><a href="<?=$_list_link?>"><?=$_list[$i]['p_title']?></a></td>
<td><?=$_use?></td>
<td><?=$_list[$i]["p_regdate"]?></td>
</tr>
<?
}
}else{ // 리스트가 없을경우
?>
<tr>
<td colspan="4">등록된 내용이 없습니다</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_popup->_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="<?=$_w_mode?>">
<input type="hidden" name="pagecode" value="<?=$argu['pagecode']?>">
<input type="hidden" name="subpage" value="<?=$argu['subpage']?>">
<input type="hidden" name="p_gubun" value="<?=$argu['gubun']?>">
<input type="hidden" name="p_idx" value="<?=$argu['p_idx']?>">
<div class="form-group">
<label>제목</label>
<input type="text" class="form-control {label:'제목',required:true}" id="p_title" name="p_title" placeholder="제목" value="<?=$_row["p_title"]?>">
</div>
<div class="form-group">
<label>팝업사이즈 가로</label>
<input type="text" class="form-control {label:'팝업사이즈 가로',required:true,numeric:true}" id="p_width" name="p_width" placeholder="가로" value="<?=$_row["p_width"]?>" maxlength="4">
</div>
<div class="form-group">
<label>팝업사이즈 세로</label>
<input type="text" class="form-control {label:'팝업사이즈 세로',required:true,numeric:true}" id="p_height" name="p_height" placeholder="세로" value="<?=$_row["p_height"]?>" maxlength="4">
</div>
<div class="form-group">
<label>팝업위치 LEFT</label>
<input type="text" class="form-control {label:'LEFT',required:true,numeric:true}" id="p_left" name="p_left" placeholder="LEFT" value="<?=$_row["p_left"]?>" maxlength="4">
</div>
<div class="form-group">
<label>팝업위치 TOP</label>
<input type="text" class="form-control {label:'TOP',required:true,numeric:true}" id="p_top" name="p_top" placeholder="TOP" value="<?=$_row["p_top"]?>" maxlength="4">
</div>
<div class="form-group">
<label>사용여부</label>
<?
foreach($_BOARD_CONFIG_CODE[2] as $key => $value){
$_checked=($key==$_row['p_use']) ? " checked" : "";
?>
<div class="radio">
<label>
<input type="radio" name="p_use" value="<?=$key?>"<?=$_checked?>> <?=$value?>
</label>
</div>
<?}?>
</div>
<div class="form-group">
<label>내용</label>
<textarea type="textarea" class="summernote {label:'내용',required:true}" name="p_content" id="p_content" style="width:100%; height:280px; display:none;"><?=txtParse($_row['p_content'],2)?></textarea>
</div>
<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');">목록</a></button>
<?
if($argu['mode'] == "MODIFY_FORM"){
?>
<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']?>&p_idx=<?=$_row['p_idx']?>');}">삭제</button>
<?
}
?>
</form>
<?
}
?>
</div>
<!-- /.panel-body -->
</div>
</div>
</div>