Add: getTypingAppList (incompleted)
This commit is contained in:
@@ -4,7 +4,7 @@ class MenuCollection extends DBMethodContainer
|
|||||||
|
|
||||||
public function getAppGroupName($appGroupCode)
|
public function getAppGroupName($appGroupCode)
|
||||||
{
|
{
|
||||||
switch($appGroupCode) {
|
switch(intval($appGroupCode)) {
|
||||||
case 0:
|
case 0:
|
||||||
return "finger position";
|
return "finger position";
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class MenuCollection extends DBMethodContainer
|
|||||||
|
|
||||||
public function getLanguageName($language)
|
public function getLanguageName($language)
|
||||||
{
|
{
|
||||||
switch($language) {
|
switch(intval($language)) {
|
||||||
case 0:
|
case 0:
|
||||||
return "Korean";
|
return "Korean";
|
||||||
|
|
||||||
@@ -33,6 +33,126 @@ class MenuCollection extends DBMethodContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTypingAppType($appGroupCode, $language)
|
||||||
|
{
|
||||||
|
switch(intval($appGroupCode)) {
|
||||||
|
case 0: // typing finger position"
|
||||||
|
if(intval($language) === 0) // Korean
|
||||||
|
return 1;
|
||||||
|
else // English
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
case 1: // typing practice
|
||||||
|
if(intval($language) === 0) // Korean
|
||||||
|
return 11;
|
||||||
|
else // English
|
||||||
|
return 12;
|
||||||
|
|
||||||
|
case 3: // typing play
|
||||||
|
if(intval($language) === 0) // Korean
|
||||||
|
return 51;
|
||||||
|
else // English
|
||||||
|
return 52;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAppData($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
switch($appGroup) {
|
||||||
|
case 0: // typing finger position
|
||||||
|
case 1: // typing practice
|
||||||
|
case 3: // typing play
|
||||||
|
return $this->getTypingAppList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// return $this->getTypingExamWritingList($maestroID, $playerID, $appGroup, $language);
|
||||||
|
|
||||||
|
case 4: // mouse play
|
||||||
|
// return $this->getMouseAppList($maestroID, $playerID, $appGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypingAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
$query = "
|
||||||
|
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
|
||||||
|
FROM app AS A
|
||||||
|
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = ? AND AA.MaestroID=?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $this->getTypingAppType($appGroup, $language), $maestroID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($app_id, $app_name, $korean_name, $app_type);
|
||||||
|
|
||||||
|
$resultArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rowArray = array();
|
||||||
|
$rowArray["AppID"] = $app_id;
|
||||||
|
$rowArray["AppName"] = $app_name;
|
||||||
|
$rowArray["KoreanName"] = $korean_name;
|
||||||
|
$rowArray["AppType"] = $app_type;
|
||||||
|
array_push($resultArray, $rowArray);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
*/
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
|
||||||
|
FROM app AS A
|
||||||
|
WHERE A.AppType=?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("i", $this->getTypingAppType($appGroup, $language));
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($app_id, $app_name, $korean_name, $app_type);
|
||||||
|
|
||||||
|
$resultArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rowArray = array();
|
||||||
|
$rowArray["AppID"] = $app_id;
|
||||||
|
$rowArray["AppName"] = $app_name;
|
||||||
|
$rowArray["KoreanName"] = $korean_name;
|
||||||
|
$rowArray["AppType"] = $app_type;
|
||||||
|
array_push($resultArray, $rowArray);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $resultArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMouseAppList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypingExamWritingList($maestroID, $playerID, $appGroup, $language)
|
||||||
|
{
|
||||||
|
$writer = "system";
|
||||||
|
$languageName = $this->getLanguageName($language);
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT WritingID, Language, Name, Filename, LetterCount
|
||||||
|
FROM writing
|
||||||
|
WHERE Writer = ? AND Language = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("ss", $writer, $languageName);
|
||||||
|
$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 getSystemWritingList()
|
public function getSystemWritingList()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ 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());
|
||||||
// $systemWritingArray = $menuCollection->getSystemWritingList();
|
$appData = $menuCollection->getAppData($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));
|
||||||
|
|||||||
+31
@@ -1,3 +1,34 @@
|
|||||||
|
//////////////////////////////////////////////////
|
||||||
|
// app list DB
|
||||||
|
|
||||||
|
QUnit.test( "AppList", function( assert ) {
|
||||||
|
var MAESTRO_ID = 3; // 삼화초
|
||||||
|
var PLAYER_ID = 35; // 박지상
|
||||||
|
var APP_GROUP = 0; // finger position
|
||||||
|
var LANGUAGE = 0; // Korean
|
||||||
|
|
||||||
|
var dbService = new DBService();
|
||||||
|
dbService.setMaestroID(MAESTRO_ID);
|
||||||
|
dbService.setPlayerID(PLAYER_ID);
|
||||||
|
|
||||||
|
var done = assert.async();
|
||||||
|
setTimeout(function() {
|
||||||
|
dbService.requestMainMenuAppData(
|
||||||
|
APP_GROUP,
|
||||||
|
LANGUAGE,
|
||||||
|
(function(jsonData) {
|
||||||
|
assert.equal(jsonData.appGroup, 0, "appGroup");
|
||||||
|
assert.equal(jsonData.appData, null, "appData");
|
||||||
|
done();
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) {
|
||||||
|
console.log(replyJSON);
|
||||||
|
done();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// typing exam highest record DB
|
// typing exam highest record DB
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user