Add: menu_list.php
This commit is contained in:
@@ -376,9 +376,9 @@ DBService.prototype.parseJSONtoRankingRecord = function(type, jsonData) {
|
|||||||
|
|
||||||
|
|
||||||
// menu
|
// menu
|
||||||
DBService.prototype.requestMainMenuAppData = function(onSucceededListener, onFailedListener) {
|
DBService.prototype.requestMainMenuAppData = function(appGroup, language, onSucceededListener, onFailedListener) {
|
||||||
var xhr = this.makeXhr(
|
var xhr = this.makeXhr(
|
||||||
"php/writing/player_list.php",
|
"php/menu/menu_list.php",
|
||||||
(function() { // onreadystatechange
|
(function() { // onreadystatechange
|
||||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
var replyJSON = JSON.parse(xhr.responseText);
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
@@ -390,6 +390,11 @@ DBService.prototype.requestMainMenuAppData = function(onSucceededListener, onFai
|
|||||||
}
|
}
|
||||||
}).bind(this)
|
}).bind(this)
|
||||||
);
|
);
|
||||||
xhr.send("maestroID=" + this.maestroID + "&playerID=" + this.playerID);
|
xhr.send(
|
||||||
|
"maestroID=" + this.maestroID
|
||||||
|
+ "&playerID=" + this.playerID
|
||||||
|
+ "&appGroup=" + appGroup
|
||||||
|
+ "&language=" + language
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ MainMenu.prototype.create = function() {
|
|||||||
|
|
||||||
this.appGroupTabLayout = null;
|
this.appGroupTabLayout = null;
|
||||||
this.languageTabLayout = null;
|
this.languageTabLayout = null;
|
||||||
|
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
|
||||||
|
this.selectedLanguage = MainMenu.LANGUAGE_KOREAN;
|
||||||
// this.animalRecordList.printScore(AnimalList.TYPE_PRACTICE);
|
// this.animalRecordList.printScore(AnimalList.TYPE_PRACTICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +86,9 @@ MainMenu.prototype.fontLoaded = function() {
|
|||||||
|
|
||||||
// bottom UI
|
// bottom UI
|
||||||
this.makeAnimalRecordList();
|
this.makeAnimalRecordList();
|
||||||
this.animalRecordList.hide();
|
|
||||||
this.makeLanguageTab();
|
this.makeLanguageTab();
|
||||||
this.languageTabLayout.hide();
|
// this.animalRecordList.hide();
|
||||||
|
// this.languageTabLayout.hide();
|
||||||
|
|
||||||
this.backButton.applyLoadedFont();
|
this.backButton.applyLoadedFont();
|
||||||
this.settingButton.applyLoadedFont();
|
this.settingButton.applyLoadedFont();
|
||||||
@@ -134,6 +137,8 @@ MainMenu.prototype.loadAllowEditEnterCode = function(screenTopUI) {
|
|||||||
|
|
||||||
MainMenu.prototype.loadAppData = function() {
|
MainMenu.prototype.loadAppData = function() {
|
||||||
this.dbService.requestMainMenuAppData(
|
this.dbService.requestMainMenuAppData(
|
||||||
|
this.selectedAppGroup,
|
||||||
|
this.selectedLanguage,
|
||||||
(function(replyJSON) {
|
(function(replyJSON) {
|
||||||
// this.updateAppGroupTab(replyJSON.appGroupData);
|
// this.updateAppGroupTab(replyJSON.appGroupData);
|
||||||
// this.updateAppButtons(replyJSON.appGroup, replyJSON.appData);
|
// this.updateAppButtons(replyJSON.appGroup, replyJSON.appData);
|
||||||
@@ -195,32 +200,67 @@ MainMenu.prototype.makeButtons = function() {
|
|||||||
MainMenu.prototype.makeAppGroupTab = function() {
|
MainMenu.prototype.makeAppGroupTab = function() {
|
||||||
this.appGroupTabLayout = new TabLayout(100, 0, 844, 70);
|
this.appGroupTabLayout = new TabLayout(100, 0, 844, 70);
|
||||||
|
|
||||||
var typingFingerGroupTab = new AppGroupTab( (function() { console.log("typing finger position"); }).bind(this) );
|
var typingFingerGroupTab = new AppGroupTab(
|
||||||
|
(function() {
|
||||||
|
console.log("typing finger position");
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
|
||||||
|
this.animalRecordList.show();
|
||||||
|
this.languageTabLayout.show();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
typingFingerGroupTab.reserveIcon("keyboard");
|
typingFingerGroupTab.reserveIcon("keyboard");
|
||||||
typingFingerGroupTab.reserveSubText("손가락 위치");
|
typingFingerGroupTab.reserveSubText("손가락 위치");
|
||||||
this.appGroupTabLayout.add(typingFingerGroupTab);
|
this.appGroupTabLayout.add(typingFingerGroupTab);
|
||||||
|
|
||||||
var typingPracticeGroupTab = new AppGroupTab( (function() { console.log("typing practice"); }).bind(this) );
|
var typingPracticeGroupTab = new AppGroupTab(
|
||||||
|
(function() {
|
||||||
|
console.log("typing practice");
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_PRACTICE;
|
||||||
|
this.animalRecordList.show();
|
||||||
|
this.languageTabLayout.show();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
typingPracticeGroupTab.reserveIcon("keyboard");
|
typingPracticeGroupTab.reserveIcon("keyboard");
|
||||||
typingPracticeGroupTab.reserveSubText("연습");
|
typingPracticeGroupTab.reserveSubText("연습");
|
||||||
this.appGroupTabLayout.add(typingPracticeGroupTab);
|
this.appGroupTabLayout.add(typingPracticeGroupTab);
|
||||||
|
|
||||||
var typingTestGroupTab = new AppGroupTab( (function() { console.log("typing exam"); }).bind(this) );
|
var typingTestGroupTab = new AppGroupTab(
|
||||||
|
(function() {
|
||||||
|
console.log("typing test");
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_TEST;
|
||||||
|
this.animalRecordList.show();
|
||||||
|
this.languageTabLayout.show();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
typingTestGroupTab.reserveIcon("keyboard");
|
typingTestGroupTab.reserveIcon("keyboard");
|
||||||
typingTestGroupTab.reserveSubText("시험");
|
typingTestGroupTab.reserveSubText("시험");
|
||||||
this.appGroupTabLayout.add(typingTestGroupTab);
|
this.appGroupTabLayout.add(typingTestGroupTab);
|
||||||
|
|
||||||
// var typingPlayGroupTab = new AppGroupTab( (function() { console.log("typing exam"); }).bind(this) );
|
// var typingPlayGroupTab = new AppGroupTab( (function() { console.log("typing test"); }).bind(this) );
|
||||||
var typingPlayGroupTab = new AppGroupTab(
|
var typingPlayGroupTab = new AppGroupTab(
|
||||||
(function() { console.log("typing exam"); this.animalRecordList.show(); this.languageTabLayout.show(); }).bind(this)
|
(function() { console.log("typing play"); }).bind(this)
|
||||||
|
);
|
||||||
|
var typingPlayGroupTab = new AppGroupTab(
|
||||||
|
(function() {
|
||||||
|
console.log("typing play");
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_TYPING_PLAY;
|
||||||
|
this.animalRecordList.show();
|
||||||
|
this.languageTabLayout.show();
|
||||||
|
}).bind(this)
|
||||||
);
|
);
|
||||||
typingPlayGroupTab.reserveIcon("keyboard");
|
typingPlayGroupTab.reserveIcon("keyboard");
|
||||||
typingPlayGroupTab.reserveSubText("놀이");
|
typingPlayGroupTab.reserveSubText("놀이");
|
||||||
this.appGroupTabLayout.add(typingPlayGroupTab);
|
this.appGroupTabLayout.add(typingPlayGroupTab);
|
||||||
|
|
||||||
// var mousePlayGroupTab = new AppGroupTab( (function() { console.log("mouse exam"); }).bind(this) );
|
// var mousePlayGroupTab = new AppGroupTab( (function() { console.log("mouse play"); }).bind(this) );
|
||||||
var mousePlayGroupTab = new AppGroupTab(
|
var mousePlayGroupTab = new AppGroupTab(
|
||||||
(function() { console.log("mouse exam"); this.animalRecordList.hide(); this.languageTabLayout.hide(); }).bind(this)
|
(function() { console.log("mouse play"); this.animalRecordList.hide(); this.languageTabLayout.hide(); }).bind(this)
|
||||||
|
);
|
||||||
|
var typingFingerGroupTab = new AppGroupTab(
|
||||||
|
(function() {
|
||||||
|
console.log("typing finger position");
|
||||||
|
this.selectedAppGroup = MainMenu.APP_GROUP_FINGER_POSITION;
|
||||||
|
}).bind(this)
|
||||||
);
|
);
|
||||||
mousePlayGroupTab.reserveIcon("mouse");
|
mousePlayGroupTab.reserveIcon("mouse");
|
||||||
mousePlayGroupTab.reserveSubText("놀이");
|
mousePlayGroupTab.reserveSubText("놀이");
|
||||||
@@ -245,11 +285,21 @@ MainMenu.prototype.makeLanguageTab = function() {
|
|||||||
var languageTabHeight = 48;
|
var languageTabHeight = 48;
|
||||||
this.languageTabLayout = new TabLayout(0, GAME_SCREEN_SIZE.y - languageTabHeight, GAME_SCREEN_SIZE.x, languageTabHeight);
|
this.languageTabLayout = new TabLayout(0, GAME_SCREEN_SIZE.y - languageTabHeight, GAME_SCREEN_SIZE.x, languageTabHeight);
|
||||||
|
|
||||||
var koreanTab = new LanguageTab( (function() { console.log("Language : Korean"); }).bind(this) );
|
var koreanTab = new LanguageTab(
|
||||||
|
(function() {
|
||||||
|
console.log("Language : Korean");
|
||||||
|
this.selectedLanguage = MainMenu.LANGUAGE_KOREAN;
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
koreanTab.reserveMainText("한글");
|
koreanTab.reserveMainText("한글");
|
||||||
this.languageTabLayout.add(koreanTab);
|
this.languageTabLayout.add(koreanTab);
|
||||||
|
|
||||||
var englishTab = new LanguageTab( (function() { console.log("Language : English"); }).bind(this) );
|
var englishTab = new LanguageTab(
|
||||||
|
(function() {
|
||||||
|
console.log("Language : English");
|
||||||
|
this.selectedLanguage = MainMenu.LANGUAGE_ENGLISH;
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
englishTab.reserveMainText("영어");
|
englishTab.reserveMainText("영어");
|
||||||
this.languageTabLayout.add(englishTab);
|
this.languageTabLayout.add(englishTab);
|
||||||
|
|
||||||
@@ -393,3 +443,12 @@ MainMenu.prototype.loadFailed = function(replyJSON) {
|
|||||||
|
|
||||||
|
|
||||||
MainMenu.MAIN_MENU_HEIGHT = 70;
|
MainMenu.MAIN_MENU_HEIGHT = 70;
|
||||||
|
|
||||||
|
MainMenu.APP_GROUP_FINGER_POSITION = 0;
|
||||||
|
MainMenu.APP_GROUP_TYPING_PRACTICE = 1;
|
||||||
|
MainMenu.APP_GROUP_TYPING_TEST = 2;
|
||||||
|
MainMenu.APP_GROUP_TYPING_PLAY = 3;
|
||||||
|
MainMenu.APP_GROUP_MOUSE_PLAY = 4;
|
||||||
|
|
||||||
|
MainMenu.LANGUAGE_KOREAN = 0;
|
||||||
|
MainMenu.LANGUAGE_ENGLISH = 1;
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
class MenuCollection extends DBMethodContainer
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAppGroupName($appGroupCode)
|
||||||
|
{
|
||||||
|
switch($appGroupCode) {
|
||||||
|
case 0:
|
||||||
|
return "finger position";
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return "typing practice";
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return "typing test";
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return "typing play";
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return "mouse play";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLanguageName($language)
|
||||||
|
{
|
||||||
|
switch($language) {
|
||||||
|
case 0:
|
||||||
|
return "Korean";
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return "English";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function getSystemWritingList()
|
||||||
|
{
|
||||||
|
$writer = "system";
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT WritingID, Language, Name, Filename, LetterCount
|
||||||
|
FROM writing
|
||||||
|
WHERE Writer = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("s", $writer);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($writingID, $language, $name, $filename, $letterCount);
|
||||||
|
|
||||||
|
$resultArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rowArray = array();
|
||||||
|
$rowArray["writingID"] = $writingID;
|
||||||
|
$rowArray["language"] = $language;
|
||||||
|
$rowArray["name"] = $name;
|
||||||
|
$rowArray["filename"] = $filename;
|
||||||
|
$rowArray["letterCount"] = $letterCount;
|
||||||
|
array_push($resultArray, $rowArray);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $resultArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWritingInfo($writingID)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT Name, Filename, Writer, WriterID
|
||||||
|
FROM writing
|
||||||
|
WHERE WritingID = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("i", $writingID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($name, $filename, $writer, $writerID);
|
||||||
|
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
$rowArray = array();
|
||||||
|
$rowArray["name"] = $name;
|
||||||
|
$rowArray["filename"] = $filename;
|
||||||
|
$rowArray["writer"] = $writer;
|
||||||
|
$rowArray["writerID"] = $writerID;
|
||||||
|
|
||||||
|
return $rowArray;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// get parameters from client
|
||||||
|
$maestroID = $_POST["maestroID"];
|
||||||
|
$playerID = $_POST["playerID"];
|
||||||
|
$appGroup = $_POST["appGroup"];
|
||||||
|
$language = $_POST["language"];
|
||||||
|
|
||||||
|
|
||||||
|
include "./../lib/json_builder.php";
|
||||||
|
include "./../lib/connect_db.php";
|
||||||
|
|
||||||
|
$jsonBuilder = new JsonBuilder();
|
||||||
|
$dbConnector = new DBConnector();
|
||||||
|
|
||||||
|
$isConnected = $dbConnector->connectDB();
|
||||||
|
if (!$isConnected) {
|
||||||
|
$jsonBuilder->setErrorMessage("DB connection : failed");
|
||||||
|
$jsonBuilder->sendResultFail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
include "./../db/db_method_container.php";
|
||||||
|
include "./../db/menu_collection.php";
|
||||||
|
|
||||||
|
$menuCollection = new MenuCollection($dbConnector->getMysqli());
|
||||||
|
// $systemWritingArray = $menuCollection->getSystemWritingList();
|
||||||
|
|
||||||
|
$jsonBuilder->setData("appGroup", $menuCollection->getAppGroupName($appGroup));
|
||||||
|
$jsonBuilder->setData("language", $menuCollection->getLanguageName($language));
|
||||||
|
$jsonBuilder->sendResultSuccess();
|
||||||
|
|
||||||
|
/*
|
||||||
|
function activate_app($maestroID, $appID) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
INSERT INTO active_app (MaestroID, AppID)
|
||||||
|
VALUES (?, ?);
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('ii', $maestroID, $appID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result();
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_app_name($appID) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT AppName, KoreanName
|
||||||
|
FROM app
|
||||||
|
WHERE AppID = ?
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param('i', $appID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($appName, $koreanName);
|
||||||
|
$stmt->fetch();
|
||||||
|
|
||||||
|
$result["AppName"] = $appName;
|
||||||
|
$result["KoreanName"] = $koreanName;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
|
|
||||||
// get parameters from client
|
|
||||||
$maestroID = $_POST["maestroID"];
|
|
||||||
$playerID = $_POST["playerID"];
|
|
||||||
|
|
||||||
|
|
||||||
include "./../lib/json_builder.php";
|
|
||||||
include "./../lib/connect_db.php";
|
|
||||||
|
|
||||||
$jsonBuilder = new JsonBuilder();
|
|
||||||
$dbConnector = new DBConnector();
|
|
||||||
|
|
||||||
$isConnected = $dbConnector->connectDB();
|
|
||||||
if (!$isConnected) {
|
|
||||||
$jsonBuilder->setErrorMessage("DB connection : failed");
|
|
||||||
$jsonBuilder->sendResultFail();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
include "./../db/db_method_container.php";
|
|
||||||
include "./../db/writing_collection.php";
|
|
||||||
|
|
||||||
$writingCollection = new WritingCollection($dbConnector->getMysqli());
|
|
||||||
$systemWritingArray = $writingCollection->getSystemWritingList();
|
|
||||||
|
|
||||||
$jsonBuilder->setData("writingArray", $systemWritingArray);
|
|
||||||
$jsonBuilder->sendResultSuccess();
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user