Files
2020-06-10 06:19:03 +09:00

352 lines
9.7 KiB
PHP
Executable File

<link rel="stylesheet" href="<?=DIR_CSS?>/jquery-ui.min.css" />
<script src="<?=DIR_JS?>/jquery-ui.min.js"></script>
<?
$menu_code = '65';
require_once (APPPATH.'views/skin/admin/_content_comm.php');
$arr_display_status = array();
foreach ($display_status_result as $val) {
$arr_display_status[$val['display_status']] = $val['cnt'];
}
$use_count = 0; $reservation_count = 0;
if(isset($arr_display_status[1])==true) $use_count = $arr_display_status[1];
if(isset($arr_display_status[0])==true) $reservation_count = $arr_display_status[0];
?>
<form name="input_form" id="input_form" method="post" action="/admin/etc_section/weather_list/6" enctype="multipart/form-data">
<input type="hidden" id="idx" name="idx">
<input type="hidden" id="mode" name="mode">
<input type="hidden" id="search_display_status" name="search_display_status">
<div class="common_table clearfix type01">
<div class="searh_area">
<select name="search_type" id="search_type">
<option value="" <? if($search_type==''){ echo 'selected';}?>>선택</option>
<option value="continent" <? if($search_type=='continent'){ echo 'selected';}?>>대륙</option>
<option value="country" <? if($search_type=='country'){ echo 'selected';}?>>나라</option>
<option value="weather_content" <? if($search_type=='weather_content'){ echo 'selected';}?>>날씨코멘트</option>
<option value="reg_date" <? if($search_type=='reg_date'){ echo 'selected';}?>>등록일시</option>
<option value="news_title" <? if($search_type=='news_title'){ echo 'selected';}?>>관련뉴스</option>
</select>
<input type="text" name="search_keyword" id="search_keyword" value="<?=$search_keyword?>" onkeypress="if( event.keyCode==13 ){check_search();}">
<a href="javascript:check_search();" class="btn"><i class="fa moving_all fa-search" style="margin-left:8px;"></i></a>
</div>
</div>
<div class="common_table">
<span><a href="javascript:click_search()"><b>Total:</b> <?=number_format($total_count);?></a></span>
<span style="margin-left: 10px"><a href="javascript:click_search('1')" class="text_blue"><b>출력중:</b> <?=number_format($use_count);?></a></span>
<span style="margin-left: 10px"><a href="javascript:click_search('0')" class="text_red"><b>예약중:</b> <?=number_format($reservation_count);?></a></span>
<table>
<thead>
<tr>
<th><input type="checkbox" name="allcheck" id="allcheck"></th>
<th>번호</th>
<th>순위</th>
<th>대륙</th>
<th>나라</th>
<th>날씨</th>
<th>코멘트</th>
<th>등록일시</br>(예약일)</th>
<th>관련뉴스</th>
<th>출력상태</th>
<th>관리</th>
</tr>
</thead>
<tbody>
<?
if(count($list)==0) {
?>
<tr>
<td colspan="11">등록된 내용이 없습니다.</td>
</tr>
<?
} else {
$i=1;
$dataNumber = ($total_count + $limit)-($page*$limit);
foreach($list as $val) {
$idx = $val['idx'];
$rank = $val['rank'];
$continent = $val['continent'];
$country = $val['country'];
$weather_icon = $val['weather_icon'];
$weather_content= $val['weather_content'];
$display_date = $val['display_date'];
$display_status = $val['display_status'];
$reg_date = $val['reg_date'];
$news_title = $val['news_title'];
$news_idx = $val['news_idx'];
$display_date_txt = '';
if($display_status == '0') {
$display_date_txt = '</br><span class="text_green">('.$display_date.')</span>';
}
$arr_news_title = explode("||||", $news_title);
if(count($arr_news_title) > 1) $news_title = $arr_news_title[0].' 외 '.(count($arr_news_title)-1).'개';
?>
<tr>
<td><input type="checkbox" name="is_del[]" value="<?=$idx?>"></td>
<td><?=$dataNumber?></td>
<td><?=$rank?></td>
<td><?=$continent?></td>
<td><?=$country?></td>
<td><img src="<?=$weather_icon?>" width="50"></td>
<td><?=$weather_content?></td>
<td><?=$reg_date?><?=$display_date_txt?></td>
<td><a href="/web/news/news_view/<?=$news_idx?>" target="_blank"><?=$news_title?></a></td>
<td>
<? if($display_status == '0') {?>
<select name="display_status_<?=$idx?>" id="display_status_<?=$idx?>" onchange="change_display_status(this);">
<option value="1" <? if($display_status=='1') { echo 'selected';}?>>출력</option>
<option value="0" <? if($display_status=='0') { echo 'selected';}?>>예약</option>
</select>
<? } else if($display_status == '1') {
echo '<span class="text_blue">출력</span>';
} else {
echo '';
}
?>
</td>
<td class="tool_btn">
<a href="javascript:weather_edit('<?=$idx?>')"><i class="fa fa-pencil"></i>수정</a>
<a href="javascript:weather_del_proc('<?=$idx?>')"><i class="fa fa-close"></i>삭제</a>
</td>
</tr>
<?
$i++;
$dataNumber--;
}
}
?>
</tbody>
</table>
<div class="write_btn">
<a href="javascript:weather_icon_add();">날씨아이콘등록</a>
<a href="javascript:weather_arr_del_proc();">삭제</a>
<a href="javascript:weather_list_reg();">송출관리</a>
<a href="javascript:weather_add();">영적기상도등록</a>
</div>
<div class="pasing_wrap">
<?=$pagination?>
</div>
<div id="icon_reg_layer" style="display:none">
<div class="black_board" style="display:block"></div>
<div class="pop_con common_table moving_all" style="display:block;top:100px;">
<a href="javascript:commonLayerClose('icon_reg_layer')" class="pop_close">x</a>
<h2>날씨아이콘</h2>
<table>
<tr style="height:50px">
<th>아이콘리스트</th>
<td class="tl">
<div class="icon_list" style="overflow-y: scroll; height:150px;">
<? foreach ($weather_icon_list as $val) {?>
<a href="javascript:;" class="por">
<img src="<?=$val['weather_icon']?>" alt=""/>
</a>
<? }?>
</div>
</td>
</tr>
<tr>
<th>아이콘첨부</th>
<td class="tl">
<input type="file" name="weather_icon" id="weather_icon" class="input00" size="30" >
</td>
</tr>
</table>
<div class="write_btn tc">
<a href="javascript:weather_icon_add_proc()">신규등록</a>
<a href="javascript:commonLayerClose('icon_reg_layer')">취소하기</a>
</div>
</div>
</div>
</form>
<script type="text/javascript">
function check_search(){
if($("#search_type").val()=="" && $("#search_keyword").val()!=""){
alert("검색할 항목을 선택해주세요.");
return false;
}
if($("#search_type").val()=='reg_date') {
if(check_date($("#search_keyword").val())==false) {
alert("날짜를 정확히 입력해주세요. (YYYY-MM-DD)");
return false;
}
}
$("#input_form").submit();
}
// 날짜체크
function check_date(val){
var regexp= /^\d{4}-\d{2}-\d{2}$/;
if( !regexp.test(val) ) {
return false;
}
return true;
}
function click_search(status){
$("#search_display_status").val(status);
$("#input_form").submit();
}
// 송출관리
function weather_list_reg(){
$("#mode").val('add');
$("#input_form").attr("action", "/admin/etc_section/weather_list_reg/6");
$("#input_form").submit();
}
// add
function weather_add(){
$("#mode").val('add');
$("#input_form").attr("action", "/admin/etc_section/weather_reg/6");
$("#input_form").submit();
}
// edit
function weather_edit(idx){
$("#idx").val(idx);
$("#mode").val('edit');
$("#input_form").attr("action", "/admin/etc_section/weather_reg/6");
$("#input_form").submit();
}
// 삭제
function weather_del_proc(idx) {
if(confirm("글이 삭제됩니다. 삭제하시겠습니까?") == true) { //확인
$("#idx").val(idx);
$("#input_form").attr("action", "/admin/etc_section/weather_reg_del_proc");
$("#input_form").submit();
} else { //취소
return;
}
}
// 복수 삭제
function weather_arr_del_proc() {
if($("input:checkbox[name='is_del[]']").is(":checked") == false) {
alert("삭제할 내용이 없습니다.");
return false;
}
if(confirm("글이 삭제됩니다. 삭제하시겠습니까?") == true) { //확인
$("#input_form").attr("action", "/admin/etc_section/weather_reg_arr_del_proc");
$("#input_form").submit();
} else { //취소
return;
}
}
// 날씨아이콘등록
function weather_icon_add(){
commonLayerOpen('icon_reg_layer');
}
function weather_icon_add_proc(){
var weather_icon = $("#weather_icon").val();
if(weather_icon=='') {
alert("아이콘을 등록해주세요.");
return false;
}
$("#input_form").attr("action", "/admin/etc_section/weather_icon_add_proc");
$("#input_form").submit();
}
// checkbox all checked/unchecked
$(function(){
$("#allcheck").click(function(){
if($("#allcheck").prop("checked")) {
$("input:checkbox[name='is_del[]']").prop('checked', true); // 전체선택하기
} else {
$("input:checkbox[name='is_del[]']").prop("checked", false);
}
})
})
function change_display_status(t){
var val = t.value;
var select_id = t.id;
var idx = select_id.replace("display_status_", "");
var form_data = {
"display_status" : val,
"idx" : idx
};
$.ajax({
url: '/admin/etc_section/weather_display_status_update',
sync: false,
type: 'POST',
dataType: 'json',
data: form_data,
success: function (rtn_json) {
if(rtn_json.result_code!='0000') {
alert("저장에 실패했습니다.");
return false;
} else {
window.location.reload(true);
}
},
error: function (rtnHtml) {
return false;
}
});
}
</script>