연감 출력 개선
This commit is contained in:
+12
-18
@@ -101,12 +101,19 @@ if ($month <= 0) {
|
|||||||
<?=WebUtil::printJS('js/common.js')?>
|
<?=WebUtil::printJS('js/common.js')?>
|
||||||
<?=WebUtil::printJS("js/map/theme_{$mapTheme}.js")?>
|
<?=WebUtil::printJS("js/map/theme_{$mapTheme}.js")?>
|
||||||
<?=WebUtil::printJS('js/map.js')?>
|
<?=WebUtil::printJS('js/map.js')?>
|
||||||
|
<?=WebUtil::printJS('js/history.js')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
<?=WebUtil::printCSS('css/common.css')?>
|
||||||
<?=WebUtil::printCSS('css/map.css')?>
|
<?=WebUtil::printCSS('css/map.css')?>
|
||||||
|
<script>
|
||||||
|
var startYear = <?=$s_year?>;
|
||||||
|
var startMonth = <?=$s_month?>;
|
||||||
|
var lastYear = <?=$e_year?>;
|
||||||
|
var lastMonth = <?=$e_month?>;
|
||||||
|
var selectYear = <?=$year?>;
|
||||||
|
var selectMonth = <?=$month?>;
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -116,22 +123,9 @@ if ($month <= 0) {
|
|||||||
<form name=form1 method=post>
|
<form name=form1 method=post>
|
||||||
년월 선택 :
|
년월 선택 :
|
||||||
<input type=submit name=btn value="◀◀ 이전달">
|
<input type=submit name=btn value="◀◀ 이전달">
|
||||||
<select name=yearmonth size=1>
|
<select id='yearmonth' name=yearmonth size=1>
|
||||||
<?php
|
<option selected='selected'><?=$year?>년 <?=$month?>월</option>
|
||||||
$dates = $db->queryAllLists('SELECT year, month FROM history WHERE server_id = %s ORDER BY year ASC, month ASC', $serverID);
|
<option><?=$e_year?>년 12월</option>
|
||||||
foreach($dates as [$hYear, $hMonth]){
|
|
||||||
$value = "".$hYear.StringUtil::padStringAlignRight($hMonth, 2, "0");
|
|
||||||
if ($hYear == $year && $hMonth == $month) {
|
|
||||||
echo "
|
|
||||||
<option selected value={$value}>{$hYear}년 {$hMonth}월</option>";
|
|
||||||
} else {
|
|
||||||
echo "
|
|
||||||
<option value={$value}>{$hYear}년 {$hMonth}월</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$history = $db->queryFirstRow('SELECT log,genlog,nation,power,gen,city FROM history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month);
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
<input type=submit name=btn value='조회하기'>
|
<input type=submit name=btn value='조회하기'>
|
||||||
<input type=submit name=btn value="다음달 ▶▶">
|
<input type=submit name=btn value="다음달 ▶▶">
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
jQuery(function($){
|
||||||
|
|
||||||
|
|
||||||
|
var currYear = startYear;
|
||||||
|
var currMonth = startMonth;
|
||||||
|
|
||||||
|
var $yearMonth = $('#yearmonth');
|
||||||
|
var $elements = $();
|
||||||
|
|
||||||
|
var endDate = lastYear * 12 + lastMonth - 1;
|
||||||
|
var currDate = startYear * 12 + startMonth - 1;
|
||||||
|
while(currDate <= endDate){
|
||||||
|
|
||||||
|
var target = currYear*100 + currMonth;
|
||||||
|
var sel = '';
|
||||||
|
if(currYear == selectYear && currMonth == selectMonth){
|
||||||
|
sel = 'selected="selected"';
|
||||||
|
}
|
||||||
|
var option = $('<option value="{0}" {1} >{2}년 {3}월</option>'.format(target, sel, currYear, currMonth));
|
||||||
|
$elements = $elements.add(option);
|
||||||
|
|
||||||
|
currMonth += 1;
|
||||||
|
if(currMonth > 12){
|
||||||
|
currYear += 1;
|
||||||
|
currMonth -= 12;
|
||||||
|
}
|
||||||
|
currDate += 1;
|
||||||
|
}
|
||||||
|
$yearMonth.empty();
|
||||||
|
$yearMonth.append($elements);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user