From 959e423a8d9d96890f2cf03746f96ee710fd699e Mon Sep 17 00:00:00 2001 From: doudoudzj Date: Tue, 16 Jul 2019 19:16:43 +0800 Subject: [PATCH] update --- admin/controllers/tickets_details.php | 38 +++++++++++++------ admin/views/tickets_details.php | 4 ++ clientarea/controllers/tickets_details.php | 44 +++++++++++++++++----- clientarea/views/footer.php | 1 + clientarea/views/tickets_details.php | 4 ++ 5 files changed, 69 insertions(+), 22 deletions(-) diff --git a/admin/controllers/tickets_details.php b/admin/controllers/tickets_details.php index 2fd646e..4472e11 100644 --- a/admin/controllers/tickets_details.php +++ b/admin/controllers/tickets_details.php @@ -21,7 +21,29 @@ if (empty($_GET["id"])) { } $tickets_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING); -if (isset($_POST["do_comment_tickets"])) { +$res = $dbpdo->find_and('tickets', ["id" => $tickets_id]); +if ($res) { + $data = $res; +} else { + setMsg("msg_notify", "The Tickets Not Found.", "warning"); + redirect("admin", "tickets"); +} + +if (isset($_POST["do_close_tickets"])) { + if ($dbpdo->update('tickets', ["status" => 0, "lastupdated" => time()], "`id`={$tickets_id}")) { + setMsg("msg_notify", "The Tickets Closed Successfully."); + } else { + setMsg("msg_notify", "The Tickets Close Failed.", "warning"); + } + redirect("admin", "tickets_details", ["id" => $tickets_id]); +} elseif (isset($_POST["do_open_tickets"])) { + if ($dbpdo->update('tickets', ["status" => 1, "lastupdated" => time()], "`id`={$tickets_id}")) { + setMsg("msg_notify", "The Tickets Opened Successfully."); + } else { + setMsg("msg_notify", "The Tickets Open Failed.", "warning"); + } + redirect("admin", "tickets_details", ["id" => $tickets_id]); +} elseif (isset($_POST["do_comment_tickets"])) { $comment = filter_input(INPUT_POST, "comment", FILTER_SANITIZE_SPECIAL_CHARS); $errors = array(); @@ -35,13 +57,13 @@ if (isset($_POST["do_comment_tickets"])) { if ($dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id])) { if ($dbpdo->add("tickets_comment", $data)) { $dbpdo->update("tickets", ["lastupdated" => $data["date"]]); - setMsg("msg_notify", "Add Comment successfully.", "success"); + setMsg("msg_notify", "Add Comment Successfully.", "success"); } else { - setMsg("msg_notify", "Add Comment failed.", "warning"); + setMsg("msg_notify", "Add Comment Failed.", "warning"); } redirect("admin", "tickets_details", ["id" => $res]); } else { - setMsg("msg_notify", "The Tickets Not found.", "warning"); + setMsg("msg_notify", "The Tickets Not Found.", "warning"); redirect("admin", "tickets"); } } else { @@ -49,12 +71,4 @@ if (isset($_POST["do_comment_tickets"])) { setMsg("errors", $errors); redirect("admin", "tickets_details", ["id" => $res]); } -} else { - $res = $dbpdo->find_and('tickets', ["id" => $tickets_id]); - if ($res) { - $data = $res; - } else { - setMsg("msg_notify", "The Tickets Not found.", "warning"); - redirect("admin", "tickets"); - } } diff --git a/admin/views/tickets_details.php b/admin/views/tickets_details.php index d6826ca..ffebc08 100644 --- a/admin/views/tickets_details.php +++ b/admin/views/tickets_details.php @@ -30,7 +30,11 @@ if (!defined('IN_SYS')) {
+ + + +
diff --git a/clientarea/controllers/tickets_details.php b/clientarea/controllers/tickets_details.php index 94e6656..cf053f0 100644 --- a/clientarea/controllers/tickets_details.php +++ b/clientarea/controllers/tickets_details.php @@ -26,7 +26,39 @@ if (empty($_GET["id"])) { } $tickets_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING); -if (isset($_POST["do_comment_tickets"])) { +$res = $dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id]); +if ($res) { + $data = $res; +} else { + setMsg("msg_notify", "The Tickets Not Found.", "warning"); + redirect("clientarea", "tickets"); +} + +if (isset($_POST["do_close_tickets"])) { + if ($dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id])) { + if ($dbpdo->update('tickets', ["status" => 0, "lastupdated" => time()], "`id`={$tickets_id}")) { + setMsg("msg_notify", "The Tickets Closed Successfully."); + } else { + setMsg("msg_notify", "The Tickets Close Failed.", "warning"); + } + redirect("clientarea", "tickets_details", ["id" => $tickets_id]); + } else { + setMsg("msg_notify", "The Tickets Not Found.", "warning"); + redirect("clientarea", "tickets"); + } +} elseif (isset($_POST["do_open_tickets"])) { + if ($dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id])) { + if ($dbpdo->update('tickets', ["status" => 1, "lastupdated" => time()], "`id`={$tickets_id}")) { + setMsg("msg_notify", "The Tickets Opened Successfully."); + } else { + setMsg("msg_notify", "The Tickets Open Failed.", "warning"); + } + redirect("clientarea", "tickets_details", ["id" => $tickets_id]); + } else { + setMsg("msg_notify", "The Tickets Not Found.", "warning"); + redirect("clientarea", "tickets"); + } +} elseif (isset($_POST["do_comment_tickets"])) { $comment = filter_input(INPUT_POST, "comment", FILTER_SANITIZE_SPECIAL_CHARS); $errors = array(); @@ -46,7 +78,7 @@ if (isset($_POST["do_comment_tickets"])) { } redirect("clientarea", "tickets_details", ["id" => $res]); } else { - setMsg("msg_notify", "The Tickets Not found.", "warning"); + setMsg("msg_notify", "The Tickets Not Found.", "warning"); redirect("clientarea", "tickets"); } } else { @@ -54,12 +86,4 @@ if (isset($_POST["do_comment_tickets"])) { setMsg("errors", $errors); redirect("clientarea", "tickets_details", ["id" => $res]); } -} else { - $res = $dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id]); - if ($res) { - $data = $res; - } else { - setMsg("msg_notify", "The Tickets Not found.", "warning"); - redirect("clientarea", "tickets"); - } } diff --git a/clientarea/views/footer.php b/clientarea/views/footer.php index a326937..72bd867 100644 --- a/clientarea/views/footer.php +++ b/clientarea/views/footer.php @@ -45,6 +45,7 @@ if (!defined('IN_SYS')) { $('.summernote').summernote({ minHeight: 200, lang: "language_cached; ?>", + disableDragAndDrop: true, toolbar: [ ['style', ['style']], ['font', ['bold', 'underline', 'clear']], diff --git a/clientarea/views/tickets_details.php b/clientarea/views/tickets_details.php index 4a6cb21..e1971d0 100644 --- a/clientarea/views/tickets_details.php +++ b/clientarea/views/tickets_details.php @@ -33,7 +33,11 @@ if (!defined('IN_SYS')) {
+ + + +