Add: getTypingAppList, getTypingActiveAppList
This commit is contained in:
@@ -56,7 +56,10 @@ class MenuCollection extends DBMethodContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAppData($maestroID, $playerID, $appGroup, $language)
|
|
||||||
|
|
||||||
|
// app list
|
||||||
|
public function getAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
{
|
{
|
||||||
switch($appGroup) {
|
switch($appGroup) {
|
||||||
case 0: // typing finger position
|
case 0: // typing finger position
|
||||||
@@ -97,21 +100,19 @@ class MenuCollection extends DBMethodContainer
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
|
SELECT A.AppID, A.KoreanName
|
||||||
FROM app AS A
|
FROM app AS A
|
||||||
WHERE A.AppType=?";
|
WHERE A.AppType=? AND A.Status=1";
|
||||||
$stmt = $this->mysqli->prepare($query);
|
$stmt = $this->mysqli->prepare($query);
|
||||||
$stmt->bind_param("i", $this->getTypingAppType($appGroup, $language));
|
$stmt->bind_param("i", $this->getTypingAppType($appGroup, $language));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($app_id, $app_name, $korean_name, $app_type);
|
$stmt->bind_result($appID, $koreanName);
|
||||||
|
|
||||||
$resultArray = array();
|
$resultArray = array();
|
||||||
while($stmt->fetch()) {
|
while($stmt->fetch()) {
|
||||||
$rowArray = array();
|
$rowArray = array();
|
||||||
$rowArray["AppID"] = $app_id;
|
$rowArray["appID"] = $appID;
|
||||||
$rowArray["AppName"] = $app_name;
|
$rowArray["koreanName"] = $koreanName;
|
||||||
$rowArray["KoreanName"] = $korean_name;
|
|
||||||
$rowArray["AppType"] = $app_type;
|
|
||||||
array_push($resultArray, $rowArray);
|
array_push($resultArray, $rowArray);
|
||||||
}
|
}
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
@@ -121,31 +122,47 @@ class MenuCollection extends DBMethodContainer
|
|||||||
|
|
||||||
public function getMouseAppList($maestroID, $playerID, $appGroup, $language)
|
public function getMouseAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
{
|
{
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypingExamWritingList($maestroID, $playerID, $appGroup, $language)
|
public function getTypingExamWritingList($maestroID, $playerID, $appGroup, $language)
|
||||||
{
|
{
|
||||||
$writer = "system";
|
}
|
||||||
$languageName = $this->getLanguageName($language);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// active app list
|
||||||
|
public function getActiveAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
switch($appGroup) {
|
||||||
|
case 0: // typing finger position
|
||||||
|
case 1: // typing practice
|
||||||
|
case 3: // typing play
|
||||||
|
return $this->getTypingActiveAppList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// return $this->getTypingExamWritingList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // mouse play
|
||||||
|
// return $this->getMouseActiveAppList($maestroID, $playerID, $appGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypingActiveAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
$query = "
|
$query = "
|
||||||
SELECT WritingID, Language, Name, Filename, LetterCount
|
SELECT A.AppID
|
||||||
FROM writing
|
FROM app AS A
|
||||||
WHERE Writer = ? AND Language = ?";
|
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = ? AND AA.MaestroID=?";
|
||||||
$stmt = $this->mysqli->prepare($query);
|
$stmt = $this->mysqli->prepare($query);
|
||||||
$stmt->bind_param("ss", $writer, $languageName);
|
$stmt->bind_param("ii", $this->getTypingAppType($appGroup, $language), $maestroID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($writingID, $language, $name, $filename, $letterCount);
|
$stmt->bind_result($appID);
|
||||||
|
|
||||||
$resultArray = array();
|
$resultArray = array();
|
||||||
while($stmt->fetch()) {
|
while($stmt->fetch()) {
|
||||||
$rowArray = array();
|
$rowArray = array();
|
||||||
$rowArray["writingID"] = $writingID;
|
$rowArray["appID"] = $appID;
|
||||||
$rowArray["language"] = $language;
|
|
||||||
$rowArray["name"] = $name;
|
|
||||||
$rowArray["filename"] = $filename;
|
|
||||||
$rowArray["letterCount"] = $letterCount;
|
|
||||||
array_push($resultArray, $rowArray);
|
array_push($resultArray, $rowArray);
|
||||||
}
|
}
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
@@ -153,6 +170,44 @@ class MenuCollection extends DBMethodContainer
|
|||||||
return $resultArray;
|
return $resultArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMouseActiveAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// highest record list
|
||||||
|
public function getHighestRecordList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
switch($appGroup) {
|
||||||
|
case 0: // typing finger position
|
||||||
|
case 1: // typing practice
|
||||||
|
case 3: // typing play
|
||||||
|
return $this->getTypingHighestRecordList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// return $this->getTypingExamHighestRecordWritingList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
|
case 4: // mouse play
|
||||||
|
// return $this->getMouseHighestRecordList($maestroID, $playerID, $appGroup);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypingHighestRecordList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypingExamHighestRecordWritingList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public function getSystemWritingList()
|
public function getSystemWritingList()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,13 +26,17 @@ include "./../db/db_method_container.php";
|
|||||||
include "./../db/menu_collection.php";
|
include "./../db/menu_collection.php";
|
||||||
|
|
||||||
$menuCollection = new MenuCollection($dbConnector->getMysqli());
|
$menuCollection = new MenuCollection($dbConnector->getMysqli());
|
||||||
$appData = $menuCollection->getAppData($maestroID, $playerID, $appGroup, $language);
|
$appList = $menuCollection->getAppList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
$activeAppList = $menuCollection->getActiveAppList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
$highestRecordList = $menuCollection->getHighestRecordList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
$jsonBuilder->setData("appGroupName", $menuCollection->getAppGroupName($appGroup));
|
$jsonBuilder->setData("appGroupName", $menuCollection->getAppGroupName($appGroup));
|
||||||
$jsonBuilder->setData("languageName", $menuCollection->getLanguageName($language));
|
$jsonBuilder->setData("languageName", $menuCollection->getLanguageName($language));
|
||||||
|
|
||||||
$jsonBuilder->setData("appGroup", $appGroup);
|
$jsonBuilder->setData("appGroup", $appGroup);
|
||||||
$jsonBuilder->setData("appData", $appData);
|
$jsonBuilder->setData("appList", $appList);
|
||||||
|
$jsonBuilder->setData("activeAppList", $activeAppList);
|
||||||
|
$jsonBuilder->setData("highestRecordList", $highestRecordList);
|
||||||
|
|
||||||
$jsonBuilder->sendResultSuccess();
|
$jsonBuilder->sendResultSuccess();
|
||||||
|
|
||||||
|
|||||||
+30
-6
@@ -4,8 +4,6 @@
|
|||||||
QUnit.test( "AppList", function( assert ) {
|
QUnit.test( "AppList", function( assert ) {
|
||||||
var MAESTRO_ID = 3; // 삼화초
|
var MAESTRO_ID = 3; // 삼화초
|
||||||
var PLAYER_ID = 35; // 박지상
|
var PLAYER_ID = 35; // 박지상
|
||||||
var APP_GROUP = 0; // finger position
|
|
||||||
var LANGUAGE = 0; // Korean
|
|
||||||
|
|
||||||
var dbService = new DBService();
|
var dbService = new DBService();
|
||||||
dbService.setMaestroID(MAESTRO_ID);
|
dbService.setMaestroID(MAESTRO_ID);
|
||||||
@@ -13,12 +11,16 @@ QUnit.test( "AppList", function( assert ) {
|
|||||||
|
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
var appGroup = 0; // finger position
|
||||||
|
var language = 1; // English
|
||||||
dbService.requestMainMenuAppData(
|
dbService.requestMainMenuAppData(
|
||||||
APP_GROUP,
|
appGroup,
|
||||||
LANGUAGE,
|
language,
|
||||||
(function(jsonData) {
|
(function(jsonData) {
|
||||||
assert.equal(jsonData.appGroup, 0, "appGroup");
|
assert.equal(jsonData.appGroup, appGroup, "appGroup : finger position, English");
|
||||||
assert.equal(jsonData.appData, null, "appData");
|
assert.equal(jsonData.appList.length, 7, "appList");
|
||||||
|
assert.equal(jsonData.activeAppList.length, 5, "activeAppList");
|
||||||
|
assert.equal(jsonData.highestRecordList, null, "highestRecordList");
|
||||||
done();
|
done();
|
||||||
}).bind(this),
|
}).bind(this),
|
||||||
(function(jsonData) {
|
(function(jsonData) {
|
||||||
@@ -27,6 +29,28 @@ QUnit.test( "AppList", function( assert ) {
|
|||||||
}).bind(this)
|
}).bind(this)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var done2 = assert.async();
|
||||||
|
setTimeout(function() {
|
||||||
|
var appGroup = 1; // typing practice
|
||||||
|
var language = 0; // Korean
|
||||||
|
dbService.requestMainMenuAppData(
|
||||||
|
appGroup,
|
||||||
|
language,
|
||||||
|
(function(jsonData) {
|
||||||
|
assert.equal(jsonData.appGroup, appGroup, "appGroup : typing practice, Korean");
|
||||||
|
assert.equal(jsonData.appList.length, 10, "appList");
|
||||||
|
assert.equal(jsonData.activeAppList.length, 10, "activeAppList");
|
||||||
|
assert.equal(jsonData.highestRecordList, null, "highestRecordList");
|
||||||
|
done2();
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) {
|
||||||
|
console.log(replyJSON);
|
||||||
|
done2();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user