dbnt.co.kr2023/zadm/portfolio/category.php

211 lines
7.9 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"]."&category=".$argu["category"];
switch ($argu['mode']) {
case "LIST_FORM":
$_list = $Obj_portfolio->get_category_list($argu,$total);
break;
case "INSERT_FORM":
$_row['published'] = "Y";
break;
case "MODIFY_FORM":
$_row = $data = $Obj_portfolio->get_category_view($argu['id']);
break;
case "INSERT_ACTION":
if($Obj_portfolio->set_category_insert($argu)){
go_url("?mode=LIST_FORM&".$default_querystring,"등록 되었습니다");
exit;
}
break;
case "MODIFY_ACTION":
if($Obj_portfolio->set_category_modify($argu)){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"수정 되었습니다");
exit;
}
break;
case "DELETE_ACTION":
if($Obj_portfolio->set_category_delete($argu["id"])){
go_url("?mode=LIST_FORM&p={$argu['p']}&".$default_querystring,"삭제 되었습니다");
exit;
}
break;
}
?>
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">카테고리관리 </h3>
</div>
</div>
<!-- /.row -->
<div class="row">
<?
/***********************************
===== 리스트 폼일경우 =====
***********************************/
if ($argu['mode'] == "LIST_FORM") {
?>
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<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']?>">
<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 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>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<colgroup>
<col width="5%" />
<col width="*" />
<col width="19%" />
</colgroup>
<thead>
<tr>
<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"];
$_published = ($_list[$i]["published"] == "Y") ? " <button class=\"btn btn-success btn-xs tooltips\">Publish</button>" : " <button class=\"btn btn-bricky btn-xs tooltips\" >Unpublish</button>";
?>
<tr>
<td><?=number_format($total - $Obj_portfolio->_LIST_NUM * ($argu[p] - 1) - $i)?></td>
<td><a href="<?=$_list_link?>"><?=$_list[$i]["title"]." ".$_list[$i]["title_sub"]?> </a></td>
<td class="center"><?=$_published?></td>
</tr>
<?
}
}else{ // 리스트가 없을경우
?>
<tr>
<td colspan="3">등록된 내용이 없습니다</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_portfolio->_LIST_NUM,$scale=10,BOARD_FIRST_IMG,BOARD_LAST_IMG,BOARD_PREV_IMG,BOARD_NEXT_IMG);?>
</ul>
</div>
</div>
</div>
</form>
</div>
<!-- /.panel-body -->
</div>
</div>
<?
}
/***********************************
===== 등록/수정 폼일경우 =====
***********************************/
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"];
?>
<div class="col-lg-12">
<!-- Nav tabs -->
<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="id" value="<?=$argu['id']?>">
<input type="hidden" name="category" value="<?=$argu['category']?>">
<ul class="nav nav-tabs">
<li class="active"><a href="#product_info" data-toggle="tab">카테고리정보</a></li>
<li class="pull-right">
<button type="submit" class="btn btn-outline btn-success"><i class="glyphicon glyphicon-floppy-save"></i>저장</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']?>&id=<?=$_row['id']?>');}">삭제</button>
<?
}
?>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="product_info">
<div class="col-lg-6">
<div class="form-group">
<label for="title" >카테고리명</label>
<input type="text" class="form-control {label:'카테고리명',required:true}" id="title" name="title" placeholder="카테고리명" value="<?=$_row["title"]?>">
</div>
<!-- <div class="form-group">
<label for="title_sub" >카테고리명 (서브)</label>
<input type="text" class="form-control {label:'카테고리명 (서브)',required:true}" id="title_sub" name="title_sub" placeholder="카테고리명 (서브)" value="<?=$_row["title_sub"]?>">
</div> -->
<div class="form-group">
<label>진열</label>
<label class="checkbox-inline">
<input type="checkbox" name="published" value="Y"<?if($_row["published"] == "Y") echo " checked";?>>사용여부
</label>
</div>
</div>
<div class="col-lg-6">
</div>
</div>
<div class="tab-pane fade" id="product_design">
</div>
</div>
</form>
</div>
<?
}
?>
</div>