Add: license maestro password, score list
This commit is contained in:
@@ -462,6 +462,57 @@ DBConnectManager.prototype.updateLicenseLeftTime = function(maestroID, playerID,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBConnectManager.prototype.requestLicenseMaestroPassword = function(maestroID, onSucceededListener, onFailedListener) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", this.phpPath + "server/license_timer/get_license_maestro_password.php", true);
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
|
if(replyJSON != null)
|
||||||
|
onSucceededListener(replyJSON);
|
||||||
|
else
|
||||||
|
onFailedListener(replyJSON);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send("MaestroID=" + maestroID);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBConnectManager.prototype.updateLicenseMaestroPassword = function(maestroID, password, onSucceededListener, onFailedListener) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", this.phpPath + "server/license_timer/update_license_maestro_password.php", true);
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
|
if(replyJSON != null)
|
||||||
|
onSucceededListener(replyJSON);
|
||||||
|
else
|
||||||
|
onFailedListener(replyJSON);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send("MaestroID=" + maestroID + "&Password=" + password);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBConnectManager.prototype.requestLicenseScore = function(maestroID, playerID, onSucceededListener, onFailedListener) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", this.phpPath + "server/license_timer/get_license_score.php", true);
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
|
if(replyJSON != null)
|
||||||
|
onSucceededListener(replyJSON);
|
||||||
|
else
|
||||||
|
onFailedListener(replyJSON);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send("MaestroID=" + maestroID + "&PlayerID=" + playerID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DBConnectManager.prototype.loadTempPlayerHistory = function(historyRecordManager) {
|
DBConnectManager.prototype.loadTempPlayerHistory = function(historyRecordManager) {
|
||||||
|
|||||||
+136
-59
@@ -1,13 +1,34 @@
|
|||||||
function Chart() {
|
function Chart(licenseDataManager) {
|
||||||
this.dbConnectManager = new DBConnectManager();
|
this.dbConnectManager = new DBConnectManager();
|
||||||
|
this.licenseDataManager = licenseDataManager;
|
||||||
|
|
||||||
this.chartGraphics = game.add.graphics(0, 0);
|
this.chartGraphics = game.add.graphics(0, 0);
|
||||||
this.printChartTitle();
|
this.printChartTitle();
|
||||||
this.printChartBaseLine();
|
this.printChartBaseLine();
|
||||||
|
|
||||||
this.records = [];
|
this.recordTexts = [];
|
||||||
for(var i = 0; i < 7; i++)
|
for(var i = 0; i < Chart.PAGE_MAX_RECORD_COUNT; i++)
|
||||||
this.records.push(new ChartRecord(i));
|
this.recordTexts.push(new ChartRecordText(i));
|
||||||
|
|
||||||
|
this.scoreList = null;
|
||||||
|
this.loadScoreFromServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Chart.prototype.updateScoreList = function(jsonData) {
|
||||||
|
// console.log(jsonData);
|
||||||
|
|
||||||
|
var jsonScoreList = jsonData.scoreList;
|
||||||
|
this.scoreList = [];
|
||||||
|
for(var i = 0; i < jsonScoreList.length; i++) {
|
||||||
|
this.scoreList.push(
|
||||||
|
new ChartRecordData(
|
||||||
|
jsonScoreList[i].SubjectName,
|
||||||
|
jsonScoreList[i].Score,
|
||||||
|
jsonScoreList[i].ScoreDateTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Chart.prototype.printChartTitle = function() {
|
Chart.prototype.printChartTitle = function() {
|
||||||
@@ -30,43 +51,16 @@ Chart.prototype.printChartBaseLine = function() {
|
|||||||
this.chartGraphics.lineStyle(1, 0x888888, 1);
|
this.chartGraphics.lineStyle(1, 0x888888, 1);
|
||||||
this.chartGraphics.moveTo(
|
this.chartGraphics.moveTo(
|
||||||
Chart.CHART_LINE_START_X,
|
Chart.CHART_LINE_START_X,
|
||||||
ChartRecord.getPosY(i) + ChartRecord.RECORD_HEIGHT
|
ChartRecordText.getPosY(i) + ChartRecordText.RECORD_HEIGHT
|
||||||
);
|
);
|
||||||
this.chartGraphics.lineTo(
|
this.chartGraphics.lineTo(
|
||||||
game.world.width - Chart.CHART_LINE_START_X,
|
game.world.width - Chart.CHART_LINE_START_X,
|
||||||
ChartRecord.getPosY(i) + ChartRecord.RECORD_HEIGHT
|
ChartRecordText.getPosY(i) + ChartRecordText.RECORD_HEIGHT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
|
|
||||||
var reverseIndex = (Chart.CHART_COUNT - 1) - index;
|
|
||||||
var posX = Chart.CHART_LINE_START_X + Chart.CHART_GRAPH_OFFSET_X + reverseIndex * Chart.CHART_GAP_PX;
|
|
||||||
var posY = Chart.CHART_LINE_Y;
|
|
||||||
|
|
||||||
this.drawText(
|
|
||||||
posX, posY + Chart.CHART_DATE_OFFSET_Y,
|
|
||||||
date === "-" ? "-" : StringUtil.printMonthDay(date)
|
|
||||||
);
|
|
||||||
|
|
||||||
if(bestRecord === "")
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.drawText(
|
|
||||||
posX, posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y,
|
|
||||||
// StringUtil.getRecordTextWithoutUnit(bestRecord) + StringUtil.getScoreUnit(sessionStorageManager.playingAppID)
|
|
||||||
RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID())
|
|
||||||
);
|
|
||||||
|
|
||||||
// chart
|
|
||||||
this.chartGraphics.lineStyle(50, 0xdddddd, 1);
|
|
||||||
this.chartGraphics.moveTo(posX, posY);
|
|
||||||
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (bestRecord - min) / (max - min) ));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Chart.drawText = function(posX, posY, text, fontStyle) {
|
Chart.drawText = function(posX, posY, text, fontStyle) {
|
||||||
var textObject = game.add.text(
|
var textObject = game.add.text(
|
||||||
posX, posY,
|
posX, posY,
|
||||||
@@ -79,18 +73,88 @@ Chart.drawText = function(posX, posY, text, fontStyle) {
|
|||||||
return textObject;
|
return textObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Chart.prototype.printPage = function(pageNo) {
|
||||||
|
var startScoreListIndex = 0;
|
||||||
|
var endScoreListIndex = Chart.PAGE_MAX_RECORD_COUNT - 1;
|
||||||
|
|
||||||
|
for(var i = 0; i < Chart.PAGE_MAX_RECORD_COUNT; i++) {
|
||||||
|
var scoreListIndex = startScoreListIndex + i;
|
||||||
|
if(startScoreListIndex + i < this.scoreList.length)
|
||||||
|
this.printChartRecord(i, scoreListIndex);
|
||||||
|
else
|
||||||
|
this.printChartRecord(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Chart.prototype.printChartRecord = function(chartRecordIndex, scoreListIndex) {
|
||||||
|
// console.log(chartRecordIndex);
|
||||||
|
// console.log(this.recordTexts.length);
|
||||||
|
// console.log(this.scoreList);
|
||||||
|
|
||||||
|
if(scoreListIndex == null) {
|
||||||
|
this.recordTexts[chartRecordIndex].printDate("-");
|
||||||
|
this.recordTexts[chartRecordIndex].printScore("-");
|
||||||
|
this.recordTexts[chartRecordIndex].printGrade("-");
|
||||||
|
this.recordTexts[chartRecordIndex].printSubject("-");
|
||||||
|
} else {
|
||||||
|
this.recordTexts[chartRecordIndex].printDate(StringUtil.printMonthDay(this.scoreList[scoreListIndex].date));
|
||||||
|
|
||||||
|
var scoreValue = RecordUtil.getRecordValueWithUnit(this.scoreList[scoreListIndex].score, 101);
|
||||||
|
this.recordTexts[chartRecordIndex].printScore(scoreValue);
|
||||||
|
|
||||||
|
var gradeValue = "-";
|
||||||
|
var subjectData = this.licenseDataManager.getSubjectDataByName(this.scoreList[scoreListIndex].subject);
|
||||||
|
if(subjectData != null)
|
||||||
|
gradeValue = subjectData.getGrade(this.scoreList[scoreListIndex].score);
|
||||||
|
this.recordTexts[chartRecordIndex].printGrade(gradeValue);
|
||||||
|
|
||||||
|
this.recordTexts[chartRecordIndex].printSubject(this.scoreList[scoreListIndex].subject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Chart.prototype.printContents = function() {
|
Chart.prototype.printContents = function() {
|
||||||
|
if(this.scoreList == null || this.scoreList.length == 0) {
|
||||||
|
for(var i = 0; i < this.recordTexts.length; i++) {
|
||||||
|
this.recordTexts[i].printDate("-");
|
||||||
|
this.recordTexts[i].printScore("-");
|
||||||
|
this.recordTexts[i].printGrade("-");
|
||||||
|
this.recordTexts[i].printSubject("-");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isDebugMode()) {
|
if(isDebugMode()) {
|
||||||
for(var i = 0; i < this.records.length; i++) {
|
for(var i = 0; i < this.recordTexts.length; i++) {
|
||||||
this.records[i].printDate("12월 10일");
|
this.recordTexts[i].printDate("12월 10일");
|
||||||
this.records[i].printScore(360);
|
this.recordTexts[i].printScore(360);
|
||||||
this.records[i].printGrade("B");
|
this.recordTexts[i].printGrade("B");
|
||||||
this.records[i].printSubject("ITQ 파워포인트");
|
this.recordTexts[i].printSubject("ITQ 파워포인트");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Chart.CHART_COUNT = 7;
|
|
||||||
|
Chart.prototype.loadScoreFromServer = function() {
|
||||||
|
this.dbConnectManager.requestLicenseScore(
|
||||||
|
sessionStorageManager.getMaestroID(),
|
||||||
|
sessionStorageManager.getPlayerID(),
|
||||||
|
(function(replyJson) {
|
||||||
|
// console.log(replyJson);
|
||||||
|
|
||||||
|
this.updateScoreList(replyJson);
|
||||||
|
this.printPage(0);
|
||||||
|
}).bind(this),
|
||||||
|
|
||||||
|
(function(replyJson) {
|
||||||
|
console.log(replyJson);
|
||||||
|
|
||||||
|
this.updateScoreList(null);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chart.CHART_LINE_START_X = 230;
|
Chart.CHART_LINE_START_X = 230;
|
||||||
Chart.CHART_LINE_Y = 370;
|
Chart.CHART_LINE_Y = 370;
|
||||||
@@ -107,8 +171,21 @@ Chart.SCORE_POS_X = Chart.DATE_POS_X + 120;
|
|||||||
Chart.GRADE_POS_X = Chart.DATE_POS_X + 200;
|
Chart.GRADE_POS_X = Chart.DATE_POS_X + 200;
|
||||||
Chart.SUBJECT_POS_X = Chart.DATE_POS_X + 360;
|
Chart.SUBJECT_POS_X = Chart.DATE_POS_X + 360;
|
||||||
|
|
||||||
|
Chart.PAGE_MAX_RECORD_COUNT = 7;
|
||||||
|
|
||||||
function ChartRecord(indexRow) {
|
|
||||||
|
|
||||||
|
function ChartRecordData(subject, score, date) {
|
||||||
|
this.subject = subject;
|
||||||
|
this.score = score;
|
||||||
|
this.date = date;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ChartRecordText(indexRow) {
|
||||||
this.date = new DateData(indexRow);
|
this.date = new DateData(indexRow);
|
||||||
this.score = new ScoreData(indexRow);
|
this.score = new ScoreData(indexRow);
|
||||||
this.grade = new GradeData(indexRow);
|
this.grade = new GradeData(indexRow);
|
||||||
@@ -118,23 +195,23 @@ function ChartRecord(indexRow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChartRecord.prototype.printDate = function(date) {
|
ChartRecordText.prototype.printDate = function(date) {
|
||||||
this.date.text = date;
|
this.date.text = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.prototype.printScore = function(score) {
|
ChartRecordText.prototype.printScore = function(score) {
|
||||||
this.score.text = RecordUtil.getRecordValueWithUnit(score, 101); //sessionStorageManager.getPlayingAppID());
|
this.score.text = score; //RecordUtil.getRecordValueWithUnit(score, 101); //sessionStorageManager.getPlayingAppID());
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.prototype.printGrade = function(grade) {
|
ChartRecordText.prototype.printGrade = function(grade) {
|
||||||
this.grade.text = grade;
|
this.grade.text = grade;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.prototype.printSubject = function(subject) {
|
ChartRecordText.prototype.printSubject = function(subject) {
|
||||||
this.subject.text = subject;
|
this.subject.text = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.getPosX = function(columnName) {
|
ChartRecordText.getPosX = function(columnName) {
|
||||||
var posX = Chart.CHART_LINE_START_X;
|
var posX = Chart.CHART_LINE_START_X;
|
||||||
switch(columnName) {
|
switch(columnName) {
|
||||||
case "date":
|
case "date":
|
||||||
@@ -157,23 +234,23 @@ ChartRecord.getPosX = function(columnName) {
|
|||||||
return posX;
|
return posX;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.getPosY = function(rowIndex) {
|
ChartRecordText.getPosY = function(rowIndex) {
|
||||||
var offsetY = 30;
|
var offsetY = 30;
|
||||||
return Chart.CHART_LINE_Y + offsetY + ChartRecord.GAP_RECORD_Y * rowIndex;
|
return Chart.CHART_LINE_Y + offsetY + ChartRecordText.GAP_RECORD_Y * rowIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.getDefaultFontStyle = function() {
|
ChartRecordText.getDefaultFontStyle = function() {
|
||||||
return { font: "26px Arial", fill: "#ffc", align: "center" };
|
return { font: "26px Arial", fill: "#ffc", align: "center" };
|
||||||
}
|
}
|
||||||
|
|
||||||
ChartRecord.GAP_RECORD_Y = 40;
|
ChartRecordText.GAP_RECORD_Y = 40;
|
||||||
ChartRecord.RECORD_HEIGHT = 16;
|
ChartRecordText.RECORD_HEIGHT = 16;
|
||||||
|
|
||||||
|
|
||||||
function DateData(index) {
|
function DateData(index) {
|
||||||
this.dateText = Chart.drawText(
|
this.dateText = Chart.drawText(
|
||||||
ChartRecord.getPosX("date"), ChartRecord.getPosY(index),
|
ChartRecordText.getPosX("date"), ChartRecordText.getPosY(index),
|
||||||
"-", ChartRecord.getDefaultFontStyle()
|
"-", ChartRecordText.getDefaultFontStyle()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.dateText;
|
return this.dateText;
|
||||||
@@ -181,8 +258,8 @@ function DateData(index) {
|
|||||||
|
|
||||||
function ScoreData(index) {
|
function ScoreData(index) {
|
||||||
this.scoreText = Chart.drawText(
|
this.scoreText = Chart.drawText(
|
||||||
ChartRecord.getPosX("score"), ChartRecord.getPosY(index),
|
ChartRecordText.getPosX("score"), ChartRecordText.getPosY(index),
|
||||||
"-", ChartRecord.getDefaultFontStyle()
|
"-", ChartRecordText.getDefaultFontStyle()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.scoreText;
|
return this.scoreText;
|
||||||
@@ -190,8 +267,8 @@ function ScoreData(index) {
|
|||||||
|
|
||||||
function GradeData(index) {
|
function GradeData(index) {
|
||||||
this.gradeText = Chart.drawText(
|
this.gradeText = Chart.drawText(
|
||||||
ChartRecord.getPosX("grade"), ChartRecord.getPosY(index),
|
ChartRecordText.getPosX("grade"), ChartRecordText.getPosY(index),
|
||||||
"-", ChartRecord.getDefaultFontStyle()
|
"-", ChartRecordText.getDefaultFontStyle()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.gradeText;
|
return this.gradeText;
|
||||||
@@ -199,8 +276,8 @@ function GradeData(index) {
|
|||||||
|
|
||||||
function SubjectData(index) {
|
function SubjectData(index) {
|
||||||
this.subjectText = Chart.drawText(
|
this.subjectText = Chart.drawText(
|
||||||
ChartRecord.getPosX("subject"), ChartRecord.getPosY(index),
|
ChartRecordText.getPosX("subject"), ChartRecordText.getPosY(index),
|
||||||
"-", ChartRecord.getDefaultFontStyle()
|
"-", ChartRecordText.getDefaultFontStyle()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.subjectText;
|
return this.subjectText;
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ var LicenseTimer = {
|
|||||||
|
|
||||||
// this.fullscreenButton = new FullscreenButton();
|
// this.fullscreenButton = new FullscreenButton();
|
||||||
|
|
||||||
|
this.licenseDataManager = new LicenseDataManager();
|
||||||
this.timer = new Timer();
|
this.timer = new Timer();
|
||||||
this.chart = new Chart();
|
this.chart = new Chart(this.licenseDataManager);
|
||||||
this.chart.printContents();
|
|
||||||
|
|
||||||
this.inputScore = new InputScore(this.timer, this.chart);
|
this.inputScore = new InputScore(this.licenseDataManager, this.timer, this.chart);
|
||||||
},
|
},
|
||||||
|
|
||||||
back: function() {
|
back: function() {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
function InputScore(timer, chart) {
|
function InputScore(licenseDataManager, timer, chart) {
|
||||||
|
this.licenseDataManager = licenseDataManager;
|
||||||
this.timer = timer;
|
this.timer = timer;
|
||||||
this.chart = chart;
|
this.chart = chart;
|
||||||
this.licenseDataManager = new LicenseDataManager();
|
|
||||||
|
this.dbConnectManager = new DBConnectManager();
|
||||||
|
|
||||||
this.initVariables();
|
this.initVariables();
|
||||||
|
|
||||||
@@ -69,6 +71,8 @@ function InputScore(timer, chart) {
|
|||||||
this.makeSubjectPanel();
|
this.makeSubjectPanel();
|
||||||
this.setVisibleCompanyPanel(false);
|
this.setVisibleCompanyPanel(false);
|
||||||
this.setVisibleSubjectPanel(false, "");
|
this.setVisibleSubjectPanel(false, "");
|
||||||
|
|
||||||
|
this.loadMaestroPasswordFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
InputScore.prototype.initVariables = function() {
|
InputScore.prototype.initVariables = function() {
|
||||||
@@ -79,6 +83,8 @@ InputScore.prototype.initVariables = function() {
|
|||||||
|
|
||||||
this.companyButtonList = [];
|
this.companyButtonList = [];
|
||||||
this.licenseSubjectButtonList = [];
|
this.licenseSubjectButtonList = [];
|
||||||
|
|
||||||
|
this.maestroPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) {
|
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) {
|
||||||
@@ -297,7 +303,20 @@ InputScore.prototype.onClickSendToServerButton = function() {
|
|||||||
console.log(this.passwordText.value);
|
console.log(this.passwordText.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InputScore.prototype.loadMaestroPasswordFromServer = function() {
|
||||||
|
this.dbConnectManager.requestLicenseMaestroPassword(
|
||||||
|
sessionStorageManager.getMaestroID(),
|
||||||
|
(function(replyJson) {
|
||||||
|
// console.log(replyJson);
|
||||||
|
this.maestroPassword = replyJson.maestroPassword;
|
||||||
|
}).bind(this),
|
||||||
|
|
||||||
|
(function(replyJson) {
|
||||||
|
// console.log(replyJson);
|
||||||
|
this.maestroPassword = InputScore.DEFAULT_MAESTRO_PASSWORD;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
InputScore.INPUT_SCORE_GROUP_OFFSET_Y = 70;
|
InputScore.INPUT_SCORE_GROUP_OFFSET_Y = 70;
|
||||||
|
|
||||||
@@ -306,4 +325,6 @@ InputScore.SUBJECT_BUTTON_WIDTH = 260;
|
|||||||
|
|
||||||
InputScore.BUTTON_GAP_WIDTH = 10;
|
InputScore.BUTTON_GAP_WIDTH = 10;
|
||||||
InputScore.BUTTON_GAP_HEIGHT = 64;
|
InputScore.BUTTON_GAP_HEIGHT = 64;
|
||||||
InputScore.SUBJECT_BUTTON_MAX_COUNT = 6;
|
InputScore.SUBJECT_BUTTON_MAX_COUNT = 6;
|
||||||
|
|
||||||
|
InputScore.DEFAULT_MAESTRO_PASSWORD = "1111";
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
$maestro_id = $_POST["MaestroID"];
|
||||||
|
// echo $maestro_id;
|
||||||
|
|
||||||
|
include "./../lib/send_reply_json.php";
|
||||||
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
|
|
||||||
|
$default_password = "1111";
|
||||||
|
|
||||||
|
// get license_time data
|
||||||
|
$password = get_maestro_password($maestro_id);
|
||||||
|
if($password == null) {
|
||||||
|
$password = $default_password;
|
||||||
|
insert_maestro_password($maestro_id, $default_password);
|
||||||
|
}
|
||||||
|
|
||||||
|
// send license_time data back to client
|
||||||
|
set_data("maestroPassword", $password);
|
||||||
|
send_result_success();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_maestro_password($maestro_id) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT Password
|
||||||
|
FROM license_maestro_password
|
||||||
|
WHERE MaestroID = ?
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("i", $maestro_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($password);
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $password;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insert_maestro_password($maestro_id, $password) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
INSERT INTO license_maestro_password (MaestroID, Password)
|
||||||
|
VALUES (?, ?);
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $maestro_id, $password);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
$maestro_id = $_POST["MaestroID"];
|
||||||
|
$player_id = $_POST["PlayerID"];
|
||||||
|
// echo $maestro_id." / ".$player_id;
|
||||||
|
|
||||||
|
include "./../lib/send_reply_json.php";
|
||||||
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
|
// get license_time data
|
||||||
|
$score_list = get_score_list($maestro_id, $player_id);
|
||||||
|
|
||||||
|
// send license_time data back to client
|
||||||
|
set_data("scoreList", $score_list);
|
||||||
|
send_result_success();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_score_list($maestro_id, $player_id) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT SubjectName, Score, ScoreDateTime
|
||||||
|
FROM license_score
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ?
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $maestro_id, $player_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($subject_name, $score, $score_date_time);
|
||||||
|
|
||||||
|
$score_list = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$score_data["SubjectName"] = $subject_name;
|
||||||
|
$score_data["Score"] = $score;
|
||||||
|
$score_data["ScoreDateTime"] = $score_date_time;
|
||||||
|
array_push($score_list, $score_data);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $score_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
$maestro_id = $_POST["MaestroID"];
|
||||||
|
$password = $_POST["Password"];
|
||||||
|
// echo $maestro_id."/".$password;
|
||||||
|
|
||||||
|
include "./../lib/send_reply_json.php";
|
||||||
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
update_maestro_password($maestro_id, $password);
|
||||||
|
|
||||||
|
send_result_success();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function update_maestro_password($maestro_id, $password) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
UPDATE license_maestro_password
|
||||||
|
SET Password = ?
|
||||||
|
WHERE MaestroID = ?
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('ii', $password, $maestro_id);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -20,4 +20,12 @@ CREATE TABLE license_score (
|
|||||||
|
|
||||||
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
|
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
|
||||||
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID)
|
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE license_maestro_password (
|
||||||
|
LicenseMaestroPasswordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
MaestroID INT UNSIGNED NOT NULL,
|
||||||
|
Password INT UNSIGNED NOT NULL,
|
||||||
|
|
||||||
|
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID)
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user