From 9c7a67c561cfb7818885b51e89645dd01407661f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Sat, 4 Aug 2018 06:06:05 +0900 Subject: [PATCH] Add: upgrade maestro account type --- src/web/admin/admin_register_list.html | 6 +- src/web/admin/admin_upgrade_list.html | 193 +++++++++++++++++- src/web/module/maestro_upgrade.html | 2 +- ...o_list.php => maestro_registered_list.php} | 0 src/web/server/admin/maestro_upgrade_list.php | 87 ++++++++ src/web/server/admin/upgrade_maestro.php | 64 ++++++ ...aestro.php => request_upgrade_maestro.php} | 0 7 files changed, 347 insertions(+), 5 deletions(-) rename src/web/server/admin/{registered_maestro_list.php => maestro_registered_list.php} (100%) create mode 100644 src/web/server/admin/maestro_upgrade_list.php create mode 100644 src/web/server/admin/upgrade_maestro.php rename src/web/server/maestro/{upgrade_maestro.php => request_upgrade_maestro.php} (100%) diff --git a/src/web/admin/admin_register_list.html b/src/web/admin/admin_register_list.html index f56cfa0..a695b94 100644 --- a/src/web/admin/admin_register_list.html +++ b/src/web/admin/admin_register_list.html @@ -23,7 +23,7 @@ let maestroName = $("#search_name").val(); if(maestroName.length === 0) { - $("#error_message").text("학생 이름을 입력하세요."); + $("#error_message").text("마에스트로 아이디를 입력하세요."); $("#search_name").focus(); } @@ -32,7 +32,7 @@ function loadMaestroList(maestroName) { sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); - "./../server/admin/registered_maestro_list.php", + "./../server/admin/maestro_registered_list.php", "maestro_name=" + maestroName, (jsonData) => { @@ -125,7 +125,7 @@

검색

- 마에스트로 이름 + 마에스트로 아이디

diff --git a/src/web/admin/admin_upgrade_list.html b/src/web/admin/admin_upgrade_list.html index bc3b7b2..913fe6f 100644 --- a/src/web/admin/admin_upgrade_list.html +++ b/src/web/admin/admin_upgrade_list.html @@ -7,14 +7,190 @@ + + @@ -28,6 +204,21 @@
+
+ +

검색

+ + 마에스트로 아이디 +
+
+
+ + + 검색 결과 +
+
+
+
diff --git a/src/web/module/maestro_upgrade.html b/src/web/module/maestro_upgrade.html index a13baa5..09358ba 100644 --- a/src/web/module/maestro_upgrade.html +++ b/src/web/module/maestro_upgrade.html @@ -88,7 +88,7 @@ function upgradeMaestroInfo(accountType) { let newAccountType = accountType; sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); - "./../server/maestro/upgrade_maestro.php", + "./../server/maestro/request_upgrade_maestro.php", "maestro_id=" + maestroID + "®istered_account_type=" + registeredAccountType + "&new_account_type=" + newAccountType, (jsonData) => { diff --git a/src/web/server/admin/registered_maestro_list.php b/src/web/server/admin/maestro_registered_list.php similarity index 100% rename from src/web/server/admin/registered_maestro_list.php rename to src/web/server/admin/maestro_registered_list.php diff --git a/src/web/server/admin/maestro_upgrade_list.php b/src/web/server/admin/maestro_upgrade_list.php new file mode 100644 index 0000000..2c6f080 --- /dev/null +++ b/src/web/server/admin/maestro_upgrade_list.php @@ -0,0 +1,87 @@ +prepare($query); + // $stmt->bind_param("iii", $maestroID, $startNo, $endNo); + // $stmt->bind_param("ii", $maestroName, $startNo); + $stmt->execute(); + $stmt->bind_result($maestroUpgradeID, $maestroID, $maestroName, $registeredAccountType, $requestedAccountType, $requestedDateTime, $status); + + $maestroUpgradeList = array(); + while($stmt->fetch()) { + $maestro["maestroUpgradeID"] = $maestroUpgradeID; + $maestro["maestroID"] = $maestroID; + $maestro["maestroName"] = $maestroName; + $maestro["registeredAccountType"] = $registeredAccountType; + $maestro["requestedAccountType"] = $requestedAccountType; + $maestro["requestedDateTime"] = $requestedDateTime; + $maestro["status"] = $status; + array_push($maestroUpgradeList, $maestro); + } + + return $maestroUpgradeList; +} + +function get_maestro_update_list_by_name($searchMaestroName) { + global $db_conn; + + $query = " + SELECT U.MaestroUpgradeID, U.MaestroID, M.Name, U.RegisteredAccountType, U.RequestedAccountType, U.RequestedDateTime, U.Status + FROM moty_maestro_upgrade U, moty_maestro M + WHERE M.Name LIKE CONCAT('%', ?, '%') AND U.MaestroID = M.MaestroID + ORDER BY U.MaestroUpgradeID DESC + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("s", $searchMaestroName); + $stmt->execute(); + $stmt->bind_result($maestroUpgradeID, $maestroID, $maestroName, $registeredAccountType, $requestedAccountType, $requestedDateTime, $status); + + $maestroUpgradeList = array(); + while($stmt->fetch()) { + $maestro["maestroUpgradeID"] = $maestroUpgradeID; + $maestro["maestroID"] = $maestroID; + $maestro["maestroName"] = $maestroName; + $maestro["registeredAccountType"] = $registeredAccountType; + $maestro["requestedAccountType"] = $requestedAccountType; + $maestro["requestedDateTime"] = $requestedDateTime; + $maestro["status"] = $status; + array_push($maestroUpgradeList, $maestro); + } + + return $maestroUpgradeList; +} + +?> \ No newline at end of file diff --git a/src/web/server/admin/upgrade_maestro.php b/src/web/server/admin/upgrade_maestro.php new file mode 100644 index 0000000..3bbd86f --- /dev/null +++ b/src/web/server/admin/upgrade_maestro.php @@ -0,0 +1,64 @@ +prepare($query); + $stmt->bind_param("ii", $newAccountType, $maestroID); + $stmt->execute(); +} + +function change_upgrade_request_status_to_close($maestroID) { + global $db_conn; + + $query = " + UPDATE moty_maestro_upgrade + SET Status = 2 + WHERE MaestroID = ? AND Status = 1; + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("i", $maestroID); + $stmt->execute(); +} + +function change_upgrade_request_status_to_applied($maestroUpgradeID) { + global $db_conn; + + $query = " + UPDATE moty_maestro_upgrade + SET Status = 3 + WHERE MaestroUpgradeID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("i", $maestroUpgradeID); + $stmt->execute(); +} + +?> \ No newline at end of file diff --git a/src/web/server/maestro/upgrade_maestro.php b/src/web/server/maestro/request_upgrade_maestro.php similarity index 100% rename from src/web/server/maestro/upgrade_maestro.php rename to src/web/server/maestro/request_upgrade_maestro.php