추석과 구정을 쉬는날로 표기하고 싶은데 가능할까요..?
본문
추석과 설날을 쉬는날로 표기하고 싶은데 도와주세요!!
아래와 같이 2가지 파일이 있는데, 아마도 이곳에서 휴일을 정하는것 같네요.
혹시 매년 추석과 설날 당일만 쉬는날로 표기할 수 있나요?
_sub_holiday.php 파일
<?
include_once("./_common.php");
// 삭제 =================================
if($_POST['mode'] == "del") {
sql_query("delete from cm_holiday where id_no = '".$_POST['id_no']."' ", true);
$msg = array(
"rst" => "OK"
);
echo json_encode($msg);
exit;
}
// 삭제 끝 =================================
include_once(G5_PATH.'/head.sub.php');
include_once('../skin.function.php');
if(!$is_admin) {
exit;
}
switch($_POST['mode']) {
case "new" : // 신규등록
// 신규등록시 이미 동일한 자료가 등록되어 있는지 검사.
$sql = "select
count(*) as cnt
from
cm_holiday
where
mb_id = '".$member['mb_id']."'
and section = '".$_POST['section']."'
and yoil = '".$_POST['yoil']."'
and initial = '".$_POST['initial']."' ";
$rs = sql_fetch($sql, true);
if($rs['cnt']>0) {
alert("이미 동일한 조건으로 정기휴무일 자료가 존재합니다.");
}
$sql = "insert into
cm_holiday
set
mb_id = '".$member['mb_id']."',
section = '".$_POST['section']."',
yoil = '".$_POST['yoil']."',
initial = '".$_POST['initial']."' ";
sql_query($sql, true);
$id_no = sql_insert_id();
break;
case "save" : // 수정
$sql = "update
cm_holiday
set
section = '".$_POST['section']."',
yoil = '".$_POST['yoil']."',
initial = '".$_POST['initial']."'
where
id_no = '".$_POST['id_no']."' ";
sql_query($sql, true);
$id_no = $_POST['id_no'];
break;
}
if($id_no) {
$sql = "select
*
from
cm_holiday
where
id_no = '".$id_no."' ";
$rs = sql_fetch($sql);
}
/* 정기휴무 배열 - skin.function.php 에 선언 */
$sec_txt = implode("|", $HOLIDAY_SECTION); // 정기휴무구분 - 요소의 값
$sec_val = implode("|", array_keys($HOLIDAY_SECTION)); // 정기휴무구분 - 요소의 키
/* 요일 배열 - skin.function.php 에 선언 */
$yo_txt = implode("|", $HOLIDAY_YOIL); // 요일 - 요소의 값
$yo_val = implode("|", array_keys($HOLIDAY_YOIL)); // 요일 - 요소의 키
include_once($board_skin_path.'/_jquery.php');
?>
<script>
$(function() {
/* 달력 끝 */
$(".initial").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy-mm-dd",
showButtonPanel: true,
yearRange: "c-5:c+10",
minDate: "-365",
maxDate: "+365"
});
/* 달력 끝 */
$("#section").on("click", "input", function() {
var sec = $("#section input").index(this);
$("#section label").css({"color":""});
$("#section label").eq(sec).css({"color":"red"});
});
$("#yoil").on("click", "input", function() {
var sec = $("#yoil input").index(this);
$("#yoil label").css({"color":""});
$("#yoil label").eq(sec).css({"color":"red"});
});
var idx = "<?php echo $id_no; ?>";
if(idx) {
var section = "<?php echo $rs['section']; ?>";
var yoil = "<?php echo $rs['yoil']; ?>";
$("#section label").eq(section).css({"color":"red"});
$("#yoil label").eq(yoil).css({"color":"red"});
}
});
</script>
<link rel="stylesheet" href="<?php echo $board_skin_url; ?>/office/office.css">
<div id="holiday_write">
<form name="fmData" method="post">
<input type="hidden" name="mode" value="<?php echo ($id_no)? "save":"new"; ?>" />
<input type="hidden" name="id_no" class="id_no" value="<?php echo $rs['id_no']; ?>" />
<input type="hidden" name="mb_id" class="mb_id" value="<?php echo $member['mb_id']; ?>" />
<table>
<caption>※ 반복되는 휴무일을 설정할 수 있습니다.</caption>
<colgroup>
<col width="15%" />
<col width="85%" />
</colgroup>
<tr>
<th>구분선택</th>
<td>
<div id="section"><?php echo radio($sec_txt, $sec_val , $rs['section'], 'section'); ?></div>
</td>
</tr>
<tr>
<th>요일선택</th>
<td>
<div id="yoil"><?php echo radio($yo_txt, $yo_val , $rs['yoil'], 'yoil'); ?></div>
</td>
</tr>
<tr>
<th>기준일자</th>
<td><input type="text" name="initial" class="initial width80" value="<?php echo $rs['initial']; ?>" readonly required />
<br/>* 가장 최근에 휴무한 날짜를 달력에서 선택해 주세요.
</td>
</tr>
</table>
<ul class="help">
<li>매월 반복 또는 매년 반복은 요일선택과 무관하게 기준일자에 적용되므로 요일은 아무거나 선택하면 됩니다.</li>
<li></li>
</ul>
<div class="button_zone">
<button type="submit" id="btn_submit" class="btn_submit">저장</button>
</div>
</form>
</div>
_sub_holiday_list.php 파일
<?
include_once("./_common.php");
include_once('../skin.function.php');
if(!$is_admin) {
exit;
}
$sql = "select
*
from
cm_holiday
where
mb_id = '".$member['mb_id']."' ";
$result = sql_query($sql, true);
?>
<link rel="stylesheet" href="<?php echo $board_skin_url; ?>/office/office.css">
<script>
$(document).ready(function() {
// 정기휴무일 수정
$("#holiday_list").on("click", ".holiday_edit", function() {
var idx = $(".holiday_edit").index(this);
var id_no = $("input.hs_no").eq(idx).val();
$("#ifm_m").attr("src","./_sub_holiday.php?bo_table="+g5_bo_table+"&id_no="+id_no);
$( '#dialog_m' ).dialog({
title : "정기휴무일 설정",
width : 700,
height : 450,
modal : true,
resizable : false,
buttons: {
"등록":function(){
$("#ifm_m").contents().find("#btn_submit").trigger("click");
},
"닫기":function(){
$(this).dialog("close");
}
},
open:function() { // 팝업시 실행
$(".ui-dialog-buttonpane button:contains('닫기')").css({"background":"#555555", "color":"#eeeeee"});
// 부모창 스크롤 막기
$('html, body').css({'overflow': 'hidden'});
$('#element').on('scroll touchmove mousewheel', function(event) {
event.preventDefault();
event.stopPropagation();
return false;
});
// 부모창 스크롤 막기 끝.
},
close: function () {
// 부모창 스크롤 막기 해제
$('html').css({'overflow': 'scroll'});
holiday_load();
}
});
});
// 정기휴무일 삭제
$("#holiday_list").on("click", ".holiday_del", function() {
var idx = $(".holiday_del").index(this);
var id_no = $("input.hs_no").eq(idx).val();
if(!confirm("한번 삭제한 자료는 복구가 불가능합니다. 정말로 삭제 하시겠습니까?")) {
return false;
};
$.ajax({
type : "POST",
url : "./_sub_holiday.php",
data : {
"id_no":id_no,
"mode":"del"
},
dataType: "json",
async: false,
cache: false,
error : function(error) {
alert("요청한 작업이 실패하였습니다. 오류가 지속적으로 발생할 경우 개발자에게 문의 바랍니다.");
},
success : function(data) {
holiday_load();
},
complete : function() {
//alert("작업완료");
}
});
});
});
</script>
<div id="holiday_list">
<table>
<colgroup>
<col width="8%" />
<col width="25%" />
<col width="26%" />
<col width="25%" />
<col width="8%" />
<col width="8%" />
</colgroup>
<tr>
<th>번호</th>
<th>구분선택</th>
<th>요일선택</th>
<th>기준일자</th>
<th>수정</th>
<th>삭제</th>
</tr>
<?php for($i=0; $row=sql_fetch_array($result); $i++) { ?>
<tr>
<td>
<?php echo ($i+1); ?>
<input type="hidden" name="hs_no" class="hs_no" value="<?php echo $row['id_no']; ?>">
</td>
<td><?php echo $HOLIDAY_SECTION[$row['section']]; ?></td>
<td><?php echo $HOLIDAY_YOIL[$row['yoil']]; ?></td>
<td><?php echo $row['initial']; ?></td>
<td><i class='fa fa-edit hand holiday_edit' aria-hidden='true' title="휴무일 수정"></i></td>
<td><i class='fa fa-trash-o hand holiday_del' aria-hidden='true' title="휴무일 삭제"></i></td>
</tr>
<?php
}
if($i==0) {
echo "<tr class='no_data'><td colspan='6'>자료가 없습니다.</td></tr>";
}
?>
</table>
</div>
답변을 작성하시기 전에 로그인 해주세요.