82 lines
2.1 KiB
PHP
82 lines
2.1 KiB
PHP
<?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());
|
|
$appList = $menuCollection->getAppList($maestroID, $playerID, $appGroup, $language);
|
|
$activeAppList = $menuCollection->getActiveAppList($maestroID, $playerID, $appGroup, $language);
|
|
$highestRecordList = $menuCollection->getHighestRecordList($maestroID, $playerID, $appList);
|
|
|
|
$jsonBuilder->setData("appGroupName", $menuCollection->getAppGroupName($appGroup));
|
|
$jsonBuilder->setData("languageName", $menuCollection->getLanguageName($language));
|
|
|
|
$jsonBuilder->setData("appGroup", $appGroup);
|
|
|
|
$appData["appList"] = $appList;
|
|
$appData["activeAppList"] = $activeAppList;
|
|
$appData["highestRecordList"] = $highestRecordList;
|
|
// $jsonBuilder->setData("appList", $appList);
|
|
// $jsonBuilder->setData("activeAppList", $activeAppList);
|
|
// $jsonBuilder->setData("highestRecordList", $highestRecordList);
|
|
$jsonBuilder->setData("appData", $appData);
|
|
|
|
$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;
|
|
}
|
|
*/
|
|
|
|
?>
|