Fix: revised php code to maestro search
This commit is contained in:
@@ -69,9 +69,9 @@ class PlayerList {
|
||||
$(this.listRows[i].playerID).empty();
|
||||
|
||||
if(i < jsonData.length) {
|
||||
$(this.listRows[i].playerID).append(jsonData[i]["PlayerID"]);
|
||||
$(this.listRows[i].playerName).val(jsonData[i]["Name"]);
|
||||
$(this.listRows[i].enterCode).val(jsonData[i]["EnterCode"]);
|
||||
$(this.listRows[i].playerID).append(jsonData[i]["playerID"]);
|
||||
$(this.listRows[i].playerName).val(jsonData[i]["playerName"]);
|
||||
$(this.listRows[i].enterCode).val(jsonData[i]["enterCode"]);
|
||||
|
||||
this.enableItem(this.listRows[i]);
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,28 @@
|
||||
setupAddPlayerList() {
|
||||
let self = this;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/registered_player_count.php",
|
||||
"maestro_id=" + maestroID,
|
||||
|
||||
(jsonData) => {
|
||||
self.playerCount = jsonData["playerCount"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
|
||||
self.loadAddPlayerListPage(self.activePageNo);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/registered_player_count.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -31,25 +53,25 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
self.playerCount = replyJSON["Count"];
|
||||
self.playerCount = jsonData["Count"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
|
||||
@@ -57,6 +79,7 @@
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
loadAddPlayerListPage(pageNo) {
|
||||
@@ -67,6 +90,24 @@
|
||||
let startNo = pageIndex * 10;
|
||||
let endNo = pageIndex * 10 + 9;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/registered_player_list.php",
|
||||
"maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
(jsonData) => {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/registered_player_list.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -80,31 +121,32 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(replyJSON["PlayerList"]);
|
||||
// updatePlayerListPage(replyJSON["PlayerList"]);
|
||||
self.list.updatePlayerList(replyJSON["PlayerList"]);
|
||||
// console.log(jsonData["PlayerList"]);
|
||||
// updatePlayerListPage(jsonData["PlayerList"]);
|
||||
self.list.updatePlayerList(jsonData["PlayerList"]);
|
||||
|
||||
self.playerCount = replyJSON["PlayerList"].length;
|
||||
self.playerCount = jsonData["PlayerList"].length;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +158,26 @@
|
||||
let startNo = pageIndex * 10;
|
||||
let endNo = pageIndex * 10 + 9;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/registered_player_list.php",
|
||||
"maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
(jsonData) => {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/registered_player_list.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -129,28 +191,28 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(replyJSON["PlayerList"]);
|
||||
self.list.updatePlayerList(replyJSON["PlayerList"]);
|
||||
// console.log(jsonData["PlayerList"]);
|
||||
self.list.updatePlayerList(jsonData["PlayerList"]);
|
||||
|
||||
self.playerCount = replyJSON["PlayerList"].length;
|
||||
self.playerCount = jsonData["PlayerList"].length;
|
||||
// console.log(self.playerCount);
|
||||
// self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
// self.activePageNo = 1;
|
||||
@@ -158,6 +220,7 @@
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +228,27 @@
|
||||
setupSearchPlayerList(playerName) {
|
||||
let self = this;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/search_player_count.php",
|
||||
"maestro_id=" + maestroID + "&player_name=" + playerName,
|
||||
|
||||
(jsonData) => {
|
||||
self.playerCount = jsonData["playerCount"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
|
||||
self.updateSearchPlayerListPage(playerName, 1);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/search_player_count.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -178,31 +262,32 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
self.playerCount = replyJSON["Count"];
|
||||
self.playerCount = jsonData["Count"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
|
||||
self.updateSearchPlayerListPage(playerName, 1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
updateSearchPlayerListPage(playerName, pageNo) {
|
||||
@@ -213,6 +298,26 @@
|
||||
let startNo = pageIndex * 10;
|
||||
let endNo = pageIndex * 10 + 9;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/search_player_list.php",
|
||||
"maestro_id=" + maestroID + "&player_name=" + playerName + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
(jsonData) => {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/search_player_list.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -226,34 +331,35 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(replyJSON["PlayerList"]);
|
||||
self.list.updatePlayerList(replyJSON["PlayerList"]);
|
||||
// console.log(jsonData["PlayerList"]);
|
||||
self.list.updatePlayerList(jsonData["PlayerList"]);
|
||||
|
||||
self.playerCount = replyJSON["PlayerList"].length;
|
||||
self.playerCount = jsonData["PlayerList"].length;
|
||||
// self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
// self.activePageNo = 1;
|
||||
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -303,6 +409,29 @@
|
||||
let playerEnterCode = enterCode.val();
|
||||
// console.log(playerEnterCode);
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/edit_player.php",
|
||||
"maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode,
|
||||
|
||||
(jsonData) => {
|
||||
if(clickedObjectID === "add_player_list") {
|
||||
self.setupAddPlayerList();
|
||||
} else if(clickedObjectID === "search_player_list") {
|
||||
let playerName = $("#search_name").val();
|
||||
self.setupSearchPlayerList(playerName);
|
||||
}
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/edit_player.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -316,21 +445,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,6 +472,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
deletePlayer(inputButton) {
|
||||
@@ -356,6 +486,29 @@
|
||||
if(playerID === null || playerID === "")
|
||||
return;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/delete_player.php",
|
||||
"maestro_id=" + maestroID + "&player_id=" + playerID,
|
||||
|
||||
(jsonData) => {
|
||||
if(clickedObjectID === "add_player_list") {
|
||||
self.setupAddPlayerList();
|
||||
} else if(clickedObjectID === "search_player_list") {
|
||||
let playerName = $("#search_name").val();
|
||||
self.setupSearchPlayerList(playerName);
|
||||
}
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/delete_player.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -369,21 +522,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(jsonData);
|
||||
|
||||
if(replyJSON === null) {
|
||||
if(jsonData === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
if(jsonData["ERROR"] !== undefined || jsonData["RESULT"] === undefined) {
|
||||
console.log(jsonData["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
if(jsonData["RESULT"] === "fail") {
|
||||
console.log(jsonData["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -396,6 +549,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
getClickedObjectID(clickedObject) {
|
||||
@@ -405,7 +559,4 @@
|
||||
|
||||
return tagDivID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,63 +1,43 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
addPlayerListManager = new PlayerListManager(
|
||||
$("#add_player_list"),
|
||||
$("#add_player_list_navigator > #page_no_area")
|
||||
);
|
||||
// addPlayerListNavigator = new PlayerListNavigator($("#add_player_list_navigator > #page_no_area"));
|
||||
// addPlayerList = new PlayerList($("#add_player_list"), addPlayerListNavigator);
|
||||
|
||||
// addPlayerList.loadPlayerListPage(1);
|
||||
addPlayerListManager.setupAddPlayerList();
|
||||
});
|
||||
|
||||
function addPlayer() {
|
||||
// let maestroID = sessionStorage.getItem("maestroID");
|
||||
let playerName = $("#add_player_name").val();
|
||||
let enterCode = $("#add_player_enter_code").val();
|
||||
|
||||
if(playerName.length === 0) {
|
||||
$("#add_player_notice").val("학생 이름을 입력하세요.");
|
||||
$("#add_player_name").focus();
|
||||
return;
|
||||
} else if(enterCode.length === 0) {
|
||||
$("#add_player_notice").val("엔터 코드를 입력하세요.");
|
||||
$("#add_player_enter_code").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/player/add_player.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&enter_code=" + enterCode);
|
||||
xhr.onload = function() {
|
||||
if(xhr.readyState === 4 && xhr.status === 200) {
|
||||
// console.log(xhr.responseText);
|
||||
// console.log(xhr.responseText.length);
|
||||
if(xhr.responseText.length === 0 || xhr.responseText === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
|
||||
if(replyJSON === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
return;
|
||||
}
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/add_player.php",
|
||||
"maestro_id=" + maestroID + "&player_name=" + playerName + "&enter_code=" + enterCode,
|
||||
|
||||
(jsonData) => {
|
||||
addPlayerListManager.updateAddPlayerListPage(1);
|
||||
},
|
||||
|
||||
(errorMessage) => {
|
||||
if($("#error_message").length) {
|
||||
$("#error_message").text(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -72,7 +52,7 @@ function addPlayer() {
|
||||
<div>
|
||||
학생 이름 <input type="text" name="name" id="add_player_name"><br/>
|
||||
입장 코드 <input type="text" name="entercode" id="add_player_enter_code">
|
||||
<input type="submit" name="추가" onClick="addPlayer()">
|
||||
<input type='button' value="추가"" onClick="addPlayer()" >
|
||||
</div>
|
||||
|
||||
<textarea id="add_player_notice">
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#section_add_player").load("./../module/maestro_section_add_player.html");
|
||||
$("#search_player").load("./../module/maestro_section_search.html");
|
||||
$("#mouse_app_list").load("./../module/maestro_section_mouse_app.html");
|
||||
$("#typing_app_list").load("./../module/maestro_section_typing_app.html");
|
||||
|
||||
// loadPlayerList();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
searchPlayerListManager = new PlayerListManager(
|
||||
$("#search_player_list"),
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerName = $_POST["player_name"];
|
||||
$enterCode = $_POST["enter_code"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
send_error_code("생년월일이 숫자가 아닙니다. : ".$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
send_error_code("6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : ".$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$result = hasPlayerName($maestroID, $playerName, $enterCode);
|
||||
if($result !== null) {
|
||||
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
// $db_conn->close();
|
||||
set_error_message("이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -27,15 +29,13 @@ addPlayer($maestroID, $playerName, $enterCode);
|
||||
|
||||
$result = hasPlayerName($maestroID, $playerName, $enterCode);
|
||||
if($result === null) {
|
||||
send_result_message($replyJSON, "fail");
|
||||
exit;
|
||||
} else {
|
||||
send_result_message($replyJSON, "success");
|
||||
set_error_message("학생 등록에 실패했습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
// echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
// $db_conn->close();
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function hasPlayerName($maestroID, $playerName, $enterCode) {
|
||||
@@ -43,7 +43,7 @@ function hasPlayerName($maestroID, $playerName, $enterCode) {
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->bind_param("iss", $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
@@ -58,7 +58,7 @@ function addPlayer($maestroID, $playerName, $enterCode) {
|
||||
|
||||
$query = "INSERT INTO moty_player (MaestroID, Name, EnterCode) VALUES (?, ?, ?)";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->bind_param("iss", $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,31 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerID = $_POST["player_id"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
deletePlayer($maestroID, $playerID);
|
||||
|
||||
$result = hasPlayerID($maestroID, $playerID);
|
||||
if($result === true) {
|
||||
send_result_message($replyJSON, "학생 계정 삭제 실패");
|
||||
set_error_message("학생 계정 삭제 실패");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = hasPlayerRecord($maestroID, $playerID);
|
||||
if($result === true) {
|
||||
send_result_message($replyJSON, "학생 플레이 기록 삭제 실패");
|
||||
set_error_message("학생 플레이 기록 삭제 실패");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "success";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function deletePlayer($maestroID, $playerID) {
|
||||
@@ -39,7 +33,7 @@ function deletePlayer($maestroID, $playerID) {
|
||||
|
||||
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
@@ -49,7 +43,7 @@ function deletePlayer($maestroID, $playerID) {
|
||||
|
||||
$query = "DELETE FROM moty_player WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
@@ -63,7 +57,7 @@ function hasPlayerID($maestroID, $playerID) {
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
@@ -81,7 +75,7 @@ function hasPlayerRecord($maestroID, $playerID) {
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_best_record WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerID = $_POST["player_id"];
|
||||
@@ -7,20 +10,19 @@ $playerName = $_POST["player_name"];
|
||||
$enterCode = $_POST["enter_code"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
send_error_code("생년월일이 숫자가 아닙니다. : ".$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
send_error_code("6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : ".$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$result = hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode);
|
||||
if($result > 0) {
|
||||
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
// $db_conn->close();
|
||||
set_error_message("이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -28,20 +30,21 @@ editPlayer($maestroID, $playerID, $playerName, $enterCode);
|
||||
|
||||
$result = hasPlayerName($maestroID, $playerName, $enterCode);
|
||||
if($result === null) {
|
||||
send_result_message($replyJSON, "fail");
|
||||
set_error_message("학생 등록에 실패했습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "success";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
|
||||
$stmt->bind_param("iiss", $maestroID, $playerID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerCount);
|
||||
// while($stmt->fetch())
|
||||
@@ -56,7 +59,7 @@ function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
|
||||
|
||||
$query = "UPDATE moty_player SET Name=?, EnterCode=? WHERE MaestroID=? AND PlayerID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ssii', $playerName, $enterCode, $maestroID, $playerID);
|
||||
$stmt->bind_param("ssii", $playerName, $enterCode, $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
@@ -65,7 +68,7 @@ function hasPlayerName($maestroID, $playerName, $enterCode) {
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
|
||||
$stmt->bind_param("iss", $maestroID, $playerName, $enterCode);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID);
|
||||
// while($stmt->fetch())
|
||||
|
||||
@@ -1,30 +1,22 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$result = getPlayerCount($maestroID);
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
|
||||
|
||||
$playerCount = getPlayerCount($maestroID);
|
||||
if($result === null) {
|
||||
send_error_message($replyJSON, "등록된 학생이 없습니다.");
|
||||
// $db_conn->close();
|
||||
set_error_message("등록된 학생이 없습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["Count"] = $result;
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
set_data("playerCount", $playerCount);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function getPlayerCount($maestroID) {
|
||||
@@ -32,7 +24,7 @@ function getPlayerCount($maestroID) {
|
||||
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestroID);
|
||||
$stmt->bind_param("i", $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerCount);
|
||||
$stmt->fetch();
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$startNo = $_POST["start_no"];
|
||||
$endNo = $_POST["end_no"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = get_player_list_page($maestroID, $startNo, $endNo);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "오늘의 랭킹 기록 없음");
|
||||
$db_conn->close();
|
||||
$playerList = get_player_list_page($maestroID, $startNo, $endNo);
|
||||
if(strlen($playerList) === 0) {
|
||||
set_error_message("오늘의 랭킹 기록 없음");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
set_data("playerList", $playerList);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function get_player_list_page($maestroID, $startNo, $endNo) {
|
||||
@@ -30,21 +31,20 @@ function get_player_list_page($maestroID, $startNo, $endNo) {
|
||||
LIMIT ?, 10;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('ii', $maestroID, $startNo);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param("ii", $maestroID, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID, $name, $enterCode);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['PlayerID'] = $playerID;
|
||||
$player['Name'] = $name;
|
||||
$player['EnterCode'] = $enterCode;
|
||||
$player["playerID"] = $playerID;
|
||||
$player["playerName"] = $name;
|
||||
$player["enterCode"] = $enterCode;
|
||||
array_push($playerList, $player);
|
||||
}
|
||||
|
||||
$return_array['PlayerList'] = $playerList;
|
||||
return $return_array;
|
||||
return $playerList;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,39 +1,30 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerName = $_POST["player_name"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$result = getPlayerCount($maestroID, $playerName);
|
||||
if($result === null) {
|
||||
send_error_message($replyJSON, "등록된 학생이 없습니다.");
|
||||
// $db_conn->close();
|
||||
$playerCount = getPlayerCount($maestroID, $playerName);
|
||||
if($playerCount === null) {
|
||||
set_error_message("등록된 학생이 없습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["Count"] = $result;
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
set_data("playerCount", $playerCount);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
function getPlayerCount($maestroID, $playerName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('is', $maestroID, $playerName);
|
||||
$stmt->bind_param("is", $maestroID, $playerName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerCount);
|
||||
$stmt->fetch();
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerName = $_POST["player_name"];
|
||||
$startNo = $_POST["start_no"];
|
||||
$endNo = $_POST["end_no"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = get_player_list_page($maestroID, $playerName, $startNo, $endNo);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "해당 이름으로 등록된 학생 없음");
|
||||
$db_conn->close();
|
||||
$playerList = get_player_list_page($maestroID, $playerName, $startNo, $endNo);
|
||||
if($playerList.length === 0) {
|
||||
set_error_message("해당 이름으로 등록된 학생 없음");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
set_data("playerList", $playerList);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
|
||||
@@ -31,21 +32,20 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
|
||||
LIMIT ?, 10;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('isi', $maestroID, $playerName, $startNo);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param("isi", $maestroID, $playerName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID, $name, $enterCode);
|
||||
|
||||
$playerList = array();
|
||||
while($stmt->fetch()) {
|
||||
$player['PlayerID'] = $playerID;
|
||||
$player['Name'] = $name;
|
||||
$player['EnterCode'] = $enterCode;
|
||||
$player["playerID"] = $playerID;
|
||||
$player["playerName"] = $name;
|
||||
$player["enterCode"] = $enterCode;
|
||||
array_push($playerList, $player);
|
||||
}
|
||||
|
||||
$return_array['PlayerList'] = $playerList;
|
||||
return $return_array;
|
||||
return $playerList;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user