Add: test and practice

This commit is contained in:
2018-06-07 17:40:52 +09:00
parent 72853fe9fd
commit 63bc872ee6
19 changed files with 432 additions and 71 deletions
+46
View File
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>메뉴</title>
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/lib/session_storage_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/round_rect_button.js"></script>
<script src="../../game/lib/back_button.js"></script>
<script src="../../game/lib/fullscreen_button.js"></script>
<script src="../../game/lib/app_button.js"></script>
<script src="../../game/lib/typing_practice_button.js"></script>
<script src="../../game/lib/screen_bottom.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<!-- source files -->
<script src="../../game/menu/menu_typing_test.js"></script>
<script src="../../game/menu/main_menu_typing_test.js"></script>
<style>
body{
padding: 0;
margin: 0;
}
canvas{
margin: 0 auto;
}
</style>
</head>
<body>
<div id="MenuApp" style="text-align:center;" />
</body>
</html>
+19 -1
View File
@@ -10,6 +10,7 @@ include "./../setup/connect_db.php";
$replyJSON = array();
$replyJSON["MouseAppList"] = get_mouse_app_list($maestro_id);
$replyJSON["TypingPracticeAppCount"] = get_typing_practice_app_count($maestro_id);
$replyJSON["TypingTestAppCount"] = get_typing_test_app_count($maestro_id);
$replyJSON["TypingAppList"] = get_typing_app_list($maestro_id);
$db_conn->close();
@@ -55,7 +56,24 @@ function get_typing_practice_app_count($maestro_id) {
$query = "
SELECT COUNT(*)
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType < 50 AND AA.MaestroID=?";
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType <= 2 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($typing_practice_app_count);
$stmt->fetch();
$stmt->close();
return $typing_practice_app_count;
}
function get_typing_test_app_count($maestro_id) {
global $db_conn;
$query = "
SELECT COUNT(*)
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType > 10 AND A.AppType <= 12 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -8,8 +8,8 @@ $maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php";
$replyJSON["Korean"] = get_active_typing_practice_app_list($maestro_id, 10);
$replyJSON["English"] = get_active_typing_practice_app_list($maestro_id, 20);
$replyJSON["Korean"] = get_active_typing_practice_app_list($maestro_id, 1);
$replyJSON["English"] = get_active_typing_practice_app_list($maestro_id, 2);
$db_conn->close();
if($replyJSON.length === 0) {
@@ -29,7 +29,8 @@ function get_active_typing_practice_app_list($maestro_id, $type) {
$query = "
SELECT A.AppID, A.AppName, A.KoreanName
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppType < 50 AND A.AppID = AA.AppID AND AA.MaestroID = ? AND A.AppType = ?
INNER JOIN moty_active_app AS AA
ON A.AppID = AA.AppID AND AA.MaestroID = ? AND A.AppType = ?
ORDER BY A.AppID ASC";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestro_id, $type);
@@ -0,0 +1,52 @@
<?php
header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php";
$replyJSON["Korean"] = get_active_typing_practice_app_list($maestro_id, 11);
$replyJSON["English"] = get_active_typing_practice_app_list($maestro_id, 12);
$db_conn->close();
if($replyJSON.length === 0) {
send_error_message($replyJSON, "앱 목록 가져오기 실패");
$db_conn->close();
exit;
}
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
function get_active_typing_practice_app_list($maestro_id, $type) {
global $db_conn;
$query = "
SELECT A.AppID, A.AppName, A.KoreanName
FROM moty_app AS A
INNER JOIN moty_active_app AS AA
ON A.AppID = AA.AppID AND AA.MaestroID = ? AND A.AppType = ?
ORDER BY A.AppID ASC";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestro_id, $type);
$stmt->execute();
$stmt->bind_result($app_id, $app_name, $korean_name);
$return_array = array();
while($stmt->fetch()) {
$row_array['AppID'] = $app_id;
$row_array['AppName'] = $app_name;
$row_array['KoreanName'] = $korean_name;
array_push($return_array, $row_array);
}
$stmt->close();
return $return_array;
}
?>