Files
cm-web-legacy/application/views/adm/pageset/grace/homekeyword.php
2020-06-10 06:19:03 +09:00

119 lines
6.5 KiB
PHP
Executable File

<!DOCTYPE html>
<html lang="ko">
<head>
<?php $this->load->view('adm/layout/head')?>
</head>
<body>
<!-- start wrapper -->
<div class="wrapper">
<!-- start nav -->
<?php $this->load->view('adm/layout/nav')?>
<!-- end nav -->
<!-- start content_wrapper -->
<div class="content_wrapper">
<!-- start header -->
<?php $this->load->view('adm/layout/header')?>
<!-- end header -->
<div class="contents">
<h3 style="font-size:17px;font-weight:bold;color:#aaa">페이지설정 > 은혜충전 홈 크맵키워드</h3>
<!-- 여기까지 레이아웃 상단입니다 -->
<div class="box">
<div class="box-table">
<form method="post" action="" enctype="multipart/form-data" class="cm-pageset-form">
<input type="hidden" name="redirect" value="<?php echo $this->input->server('HTTP_REFERER')?>">
<table class="table table-bordered">
<thead>
<tbody>
<tr>
<th>검색</th>
<td>
<select name="category" class="form-control" style="width:200px">
<option value="">카테고리</option>
<?php foreach($lifeCategories as $category) { echo '<option value="'.$category->idx.'" '.(param('category') == $category->idx ? 'selected':'').'>'. $category->category_name. '</option>';}?>
</select>
<select name="editor" class="form-control" style="width:200px">
<option value="">에디터</option>
<?php foreach($graceEditors as $editor) { echo '<option value="'.$editor->editorId.'" '.(param('editor') == $editor->editorId ? 'selected':'').'>'. $editor->editorName. '</option>';}?>
</select>
<select name="limit" class="form-control" style="width:100px">
<option value="">검색결과수</option>
<option value="5" selected>5</option>
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
</select>
<input type="text" name="keyword" class="form-control" style="width:200px">
<a class="btn btn-info btn-sm cm-pageset-searchbtn">검색</a>
<div class="cm-search-result" style="margin-top:3px">
</div>
</td>
</tr>
</thead>
<tbody>
<tr>
<th>아이디</th>
<td>
<input type="text" name="postid" class="form-control" value="<?php if(isset($post)) echo $post->idx?>">
</td>
</tr>
<tr>
<th>제목</th>
<td>
<input type="text" name="title" class="form-control" value="<?php if(isset($post)) echo $post->title?>">
</td>
</tr>
<tr>
<th>메인이미지</th>
<td>
<img src="<?php if(isset($post)) echo imgSrc($post->main_img)?>" width="150" name="main_img">
</td>
</tr>
</tbody>
</table>
<div style="text-align:center">
<a class="btn btn-danger" href="<?php echo $this->input->server('HTTP_REFERER')?>">취소</a>
<button type="submit" class="btn btn-success">저장</button>
</div>
</form>
</div>
</div>
<!-- 여기부터 레이아웃 하단입니다 -->
</div>
</div>
<!-- end content_wrapper -->
</div>
<!-- end wrapper -->
<?php $this->load->view('adm/layout/footer')?>
<script src="/assets/adm/js/tinymce/tinymce.min.js"></script>
<script>
var result;
$(function(){
$('.cm-pageset-searchbtn').on('click', function(e){
var frm = $('.cm-pageset-form')[0]
var params = {category: frm.category.value,
editor: frm.editor.value,
term:frm.keyword.value, pageset: 1, limit: frm.limit.value}
$.get('/adm/content', params, function(res){
result = res.data.rows
var resultBox = $('.cm-search-result').empty();
for(var i=0; i<result.length; i++) {
resultBox.append('<a class="btn btn-sm form-control cm-result-item" style="margin-bottom:3px" tabindex="'+i+'">'+result[i].title+'</a>')
}
$('.cm-result-item').on('click', function(){
var item = result[$(this).attr('tabindex')]
var frm = $('.cm-pageset-form')[0]
frm.postid.value = item.idx
frm.title.value = item.title
frm.main_img.src = item.mainImg
console.log(item)
})
}, 'json')
})
})
</script>
</body>
</html>