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