Fix: search button
This commit is contained in:
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/*
|
$("#player_name_list").keydown(function(key) {
|
||||||
$("#entercode").keydown(function(key) {
|
|
||||||
if(key.keyCode == 13) {
|
if(key.keyCode == 13) {
|
||||||
editPassword();
|
requestPlayerRecordListAll();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
initDatePicker();
|
initDatePicker();
|
||||||
loadAppList();
|
loadAppList();
|
||||||
@@ -36,52 +34,38 @@ function initDatePicker() {
|
|||||||
|
|
||||||
function setDatePickersForWeeks(weeks) {
|
function setDatePickersForWeeks(weeks) {
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var tyyyy = today.getFullYear();
|
updateDatePickerIn("#end_datepicker", today);;
|
||||||
var tmm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var tdd = String(today.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
var startDay = new Date();
|
var startDay = new Date();
|
||||||
startDay.setDate(startDay.getDate() - 7 * weeks);
|
startDay.setDate(startDay.getDate() - 7 * weeks);
|
||||||
var syyyy = startDay.getFullYear();
|
updateDatePickerIn("#start_datepicker", startDay);;
|
||||||
var smm = String(startDay.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var sdd = String(startDay.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
$('#start_datepicker').datepicker('update', syyyy + "-" + smm + "-" + sdd);
|
|
||||||
$('#end_datepicker').datepicker('update', tyyyy + "-" + tmm + "-" + tdd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDatePickersForMonths(months) {
|
function setDatePickersForMonths(months) {
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var tyyyy = today.getFullYear();
|
updateDatePickerIn("#end_datepicker", today);;
|
||||||
var tmm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var tdd = String(today.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
var startDay = new Date();
|
var startDay = new Date();
|
||||||
startDay.setMonth(startDay.getMonth() - months);
|
startDay.setMonth(startDay.getMonth() - months);
|
||||||
var syyyy = startDay.getFullYear();
|
updateDatePickerIn("#start_datepicker", startDay);;
|
||||||
var smm = String(startDay.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var sdd = String(startDay.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
$('#start_datepicker').datepicker('update', syyyy + "-" + smm + "-" + sdd);
|
|
||||||
$('#end_datepicker').datepicker('update', tyyyy + "-" + tmm + "-" + tdd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDatePickersForYears(years) {
|
function setDatePickersForYears(years) {
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var tyyyy = today.getFullYear();
|
updateDatePickerIn("#end_datepicker", today);;
|
||||||
var tmm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var tdd = String(today.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
var startDay = new Date();
|
var startDay = new Date();
|
||||||
startDay.setFullYear(startDay.getFullYear() - years);
|
startDay.setFullYear(startDay.getFullYear() - years);
|
||||||
var syyyy = startDay.getFullYear();
|
updateDatePickerIn("#start_datepicker", startDay);;
|
||||||
var smm = String(startDay.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
||||||
var sdd = String(startDay.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
$('#start_datepicker').datepicker('update', syyyy + "-" + smm + "-" + sdd);
|
|
||||||
$('#end_datepicker').datepicker('update', tyyyy + "-" + tmm + "-" + tdd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateDatePickerIn(inputID, date) {
|
||||||
|
var yyyy = date.getFullYear();
|
||||||
|
var mm = String(date.getMonth() + 1).padStart(2, '0'); //January is 0!
|
||||||
|
var dd = String(date.getDate()).padStart(2, '0');
|
||||||
|
|
||||||
|
$(inputID).datepicker('update', yyyy + "-" + mm + "-" + dd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function copyToClipboard() {
|
function copyToClipboard() {
|
||||||
@@ -286,9 +270,7 @@ function showRecordCount(jsonData) {
|
|||||||
$("#record_count").empty();
|
$("#record_count").empty();
|
||||||
|
|
||||||
var count = jsonData["RecordList"].length;
|
var count = jsonData["RecordList"].length;
|
||||||
$("#record_count").append(
|
$("#record_count").append('총 ' + count + '개 검색');
|
||||||
'<span class="text-info">표시 : ' + count + '개 / 총 : ' + count + '개</span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,11 +300,11 @@ function showNoResultContent() {
|
|||||||
function addRecordListItem($date, $time, $name, $subject, $record) {
|
function addRecordListItem($date, $time, $name, $subject, $record) {
|
||||||
$("#record_table_content").append('\
|
$("#record_table_content").append('\
|
||||||
<tr>\
|
<tr>\
|
||||||
<th scope="row">' + $date + '</th>\
|
<th scope="row" class="text-center">' + $date + '</th>\
|
||||||
<td>' + $time + '</td>\
|
<td class="text-center">' + $time + '</td>\
|
||||||
<td>' + $name + '</td>\
|
<td class="text-center">' + $name + '</td>\
|
||||||
<td>' + $subject + '</td>\
|
<td class="text-center">' + $subject + '</td>\
|
||||||
<td>' + $record + '</td>\
|
<td class="text-right">' + $record + '</td>\
|
||||||
</tr>\
|
</tr>\
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
@@ -445,7 +427,7 @@ function addRecordListItem($date, $time, $name, $subject, $record) {
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<!-- <button type="button" class="btn btn-primary" onClick="requestPlayerRecordList();">검색 (50개까지 보기)</button> -->
|
<!-- <button type="button" class="btn btn-primary" onClick="requestPlayerRecordList();">검색 (50개까지 보기)</button> -->
|
||||||
<button type="button" id="search_all" class="btn btn-primary" onClick="requestPlayerRecordListAll();">검색 실행</button>
|
<button type="button" id="search_all" class="btn btn-primary col-sm-3" onClick="requestPlayerRecordListAll();">검색 실행</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -457,11 +439,14 @@ function addRecordListItem($date, $time, $name, $subject, $record) {
|
|||||||
|
|
||||||
<div class="row justify-content-between mb-2">
|
<div class="row justify-content-between mb-2">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button type="button" class="btn btn-primary" onClick="copyToClipboard();">표 내용을 클립보드에 복사</button>
|
<button type="button" class="btn btn-primary" onClick="copyToClipboard();">
|
||||||
|
<span class="oi oi-clipboard" title="icon clipboard" aria-hidden="true"></span>
|
||||||
|
표 내용을 클립보드에 복사
|
||||||
|
</button>
|
||||||
<span class="badge badge-pill badge-info" onClick='showModal("recordPopupModal", "recordPopupContent", "search_record_copy_result_to_clipboard");' style="cursor: pointer;">?</span>
|
<span class="badge badge-pill badge-info" onClick='showModal("recordPopupModal", "recordPopupContent", "search_record_copy_result_to_clipboard");' style="cursor: pointer;">?</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="record_count" class="col-auto">
|
<div class="col-auto">
|
||||||
<span>표시 : 0개 / 총 : 0개</span>
|
<span id="record_count" class="text-info"></span>
|
||||||
<!-- <button type="button" class="btn btn-primary" disabled>표 내용을 엑셀 파일로 다운로드</button> -->
|
<!-- <button type="button" class="btn btn-primary" disabled>표 내용을 엑셀 파일로 다운로드</button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -469,21 +454,17 @@ function addRecordListItem($date, $time, $name, $subject, $record) {
|
|||||||
<table class="table table-striped" id="dataTable">
|
<table class="table table-striped" id="dataTable">
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">날짜</th>
|
<th scope="col" class="text-center">날짜</th>
|
||||||
<th scope="col">시간</th>
|
<th scope="col" class="text-center">시간</th>
|
||||||
<th scope="col">이름</th>
|
<th scope="col" class="text-center">이름</th>
|
||||||
<th scope="col">과목</th>
|
<th scope="col" class="text-center">과목</th>
|
||||||
<th scope="col">점수</th>
|
<th scope="col" class="text-center">점수</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="record_table_content">
|
<tbody id="record_table_content">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">2019-03-27</th>
|
<th scope="row" class="table-warning text-center" colspan="5">데이터가 없습니다.</th>
|
||||||
<td>17:30</td>
|
|
||||||
<td>박지상</td>
|
|
||||||
<td>한글 타자 연습</td>
|
|
||||||
<td>574</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ $subject_statement = makeSubjectSentence($app_id);
|
|||||||
// echo "subject : ".$subject_statement."\n";
|
// echo "subject : ".$subject_statement."\n";
|
||||||
$where_statement = make_where_statement($date_statement, $player_name_statement, $subject_statement);
|
$where_statement = make_where_statement($date_statement, $player_name_statement, $subject_statement);
|
||||||
|
|
||||||
$recordCount = get_player_record_count($maestro_id, $where_statement, $limit_count);
|
|
||||||
$recordTotalCount = get_player_record_total_count($maestro_id, $where_statement);
|
$recordTotalCount = get_player_record_total_count($maestro_id, $where_statement);
|
||||||
$replyJSON = get_player_record_list($maestro_id, $where_statement, $limit_count);
|
$replyJSON = get_player_record_list($maestro_id, $where_statement, $limit_count);
|
||||||
if($replyJSON.length === 0) {
|
if($replyJSON.length === 0) {
|
||||||
@@ -37,7 +36,7 @@ if($replyJSON.length === 0) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_data("RecordCount", $recordCount);
|
set_data("RecordTotalCount", $recordTotalCount);
|
||||||
set_data("RecordList", $replyJSON);
|
set_data("RecordList", $replyJSON);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
@@ -113,6 +112,7 @@ function make_where_statement($date_statement, $player_name_statement, $subject_
|
|||||||
return $where_statement;
|
return $where_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
|||||||
|
|
||||||
return $record_count;
|
return $record_count;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function get_player_record_total_count($maestro_id, $where_statement) {
|
function get_player_record_total_count($maestro_id, $where_statement) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
@@ -168,7 +169,7 @@ function get_player_record_list($maestro_id, $where_statement, $limit_count) {
|
|||||||
P.Name AS Name, A.KoreanName AS Subject, BR.BestRecord AS Record
|
P.Name AS Name, A.KoreanName AS Subject, BR.BestRecord AS Record
|
||||||
FROM best_record BR, player P, App A
|
FROM best_record BR, player P, App A
|
||||||
WHERE BR.MaestroID = ? AND ".$where_statement."
|
WHERE BR.MaestroID = ? AND ".$where_statement."
|
||||||
ORDER BY BR.RecordDateTime ASC
|
ORDER BY BR.RecordDateTime DESC
|
||||||
";
|
";
|
||||||
|
|
||||||
if($limit_count > 0)
|
if($limit_count > 0)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ $subject_statement = makeSubjectSentence($app_id);
|
|||||||
// echo "subject : ".$subject_statement."\n";
|
// echo "subject : ".$subject_statement."\n";
|
||||||
$where_statement = make_where_statement($date_statement, $player_name_statement, $subject_statement);
|
$where_statement = make_where_statement($date_statement, $player_name_statement, $subject_statement);
|
||||||
|
|
||||||
$recordCount = get_player_record_count($maestro_id, $where_statement, $limit_count);
|
|
||||||
$recordTotalCount = get_player_record_total_count($maestro_id, $where_statement);
|
$recordTotalCount = get_player_record_total_count($maestro_id, $where_statement);
|
||||||
$replyJSON = get_player_record_list($maestro_id, $where_statement, $limit_count);
|
$replyJSON = get_player_record_list($maestro_id, $where_statement, $limit_count);
|
||||||
if($replyJSON.length === 0) {
|
if($replyJSON.length === 0) {
|
||||||
@@ -37,7 +36,7 @@ if($replyJSON.length === 0) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_data("RecordCount", $recordCount);
|
set_data("RecordTotalCount", $recordTotalCount);
|
||||||
set_data("RecordList", $replyJSON);
|
set_data("RecordList", $replyJSON);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
@@ -115,6 +114,7 @@ function make_where_statement($date_statement, $player_name_statement, $subject_
|
|||||||
return $where_statement;
|
return $where_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
@@ -139,6 +139,7 @@ function get_player_record_count($maestro_id, $where_statement, $limit_count) {
|
|||||||
|
|
||||||
return $record_count;
|
return $record_count;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function get_player_record_total_count($maestro_id, $where_statement) {
|
function get_player_record_total_count($maestro_id, $where_statement) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
@@ -170,7 +171,7 @@ function get_player_record_list($maestro_id, $where_statement, $limit_count) {
|
|||||||
P.Name AS Name, LS.SubjectName AS Subject, LS.Score AS Record
|
P.Name AS Name, LS.SubjectName AS Subject, LS.Score AS Record
|
||||||
FROM license_score LS, player P
|
FROM license_score LS, player P
|
||||||
WHERE LS.MaestroID = ? AND ".$where_statement."
|
WHERE LS.MaestroID = ? AND ".$where_statement."
|
||||||
ORDER BY LS.ScoreDateTime ASC
|
ORDER BY LS.ScoreDateTime DESC
|
||||||
";
|
";
|
||||||
|
|
||||||
if($limit_count > 0)
|
if($limit_count > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user