Fix: revised php code to maestro search
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user