This commit is contained in:
doudoudzj 2019-07-16 19:16:43 +08:00
parent 8354190f96
commit 959e423a8d
5 changed files with 69 additions and 22 deletions

View file

@ -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");
}
}

View file

@ -30,7 +30,11 @@ if (!defined('IN_SYS')) {
</div>
<div class="form-group">
<button type="submit" name="do_comment_tickets" class="btn btn-primary">Add Comment</button>
<?php if ($data['status'] == 1) { ?>
<button type="submit" name="do_close_tickets" class="btn btn-primary">Close Tickets</button>
<?php } else { ?>
<button type="submit" name="do_open_tickets" class="btn btn-primary">Open Tickets</button>
<?php } ?>
</div>
</form>
</div>

View file

@ -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");
}
}

View file

@ -45,6 +45,7 @@ if (!defined('IN_SYS')) {
$('.summernote').summernote({
minHeight: 200,
lang: "<?php echo $lang->language_cached; ?>",
disableDragAndDrop: true,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],

View file

@ -33,7 +33,11 @@ if (!defined('IN_SYS')) {
</div>
<div class="form-group">
<button type="submit" name="do_comment_tickets" class="btn btn-primary">Add Comment</button>
<?php if ($data['status'] == 1) { ?>
<button type="submit" name="do_close_tickets" class="btn btn-primary">Close Tickets</button>
<?php } else { ?>
<button type="submit" name="do_open_tickets" class="btn btn-primary">Open Tickets</button>
<?php } ?>
</div>
</form>
</div>