From 94b07d13365e9cde68839fa40fb9af8143593789 Mon Sep 17 00:00:00 2001 From: doudoudzj Date: Thu, 27 Jun 2019 20:07:13 +0800 Subject: [PATCH] update --- admin/controllers/news.php | 33 ++++----------- admin/controllers/news_add.php | 39 +++++++++++++++++ admin/controllers/news_details.php | 28 +++++++++++++ admin/controllers/tickets.php | 8 +++- admin/controllers/tickets_details.php | 60 +++++++++++++++++++++++++++ admin/views/news.php | 22 +++++----- admin/views/news_add.php | 37 +++++++++++------ admin/views/news_details.php | 31 ++++++++++++++ admin/views/tickets.php | 6 +-- admin/views/tickets_details.php | 41 ++++++++++++++++++ clientarea/views/header.php | 2 +- clientarea/views/tickets.php | 4 +- clientarea/views/tickets_add.php | 6 ++- clientarea/views/tickets_details.php | 5 ++- data/demo.sql | 9 ++++ library/language/en-US/language.php | 2 + library/language/ko/language.php | 2 + library/language/zh-CN/language.php | 2 + library/language/zh-HK/language.php | 2 + library/language/zh-SG/language.php | 2 + library/language/zh-TW/language.php | 2 + 21 files changed, 286 insertions(+), 57 deletions(-) create mode 100644 admin/controllers/news_details.php create mode 100644 admin/controllers/tickets_details.php create mode 100644 admin/views/news_details.php create mode 100644 admin/views/tickets_details.php diff --git a/admin/controllers/news.php b/admin/controllers/news.php index 66579bc..1c75fe1 100644 --- a/admin/controllers/news.php +++ b/admin/controllers/news.php @@ -7,31 +7,16 @@ if (!defined('IN_SYS')) { } -$tickets = [ +$news = [ "total" => 10, "pages" => 4, "page" => 1, - "list" => [ - [ - "date" => "Saturday, August 11th, 2018 (04:50)", - "department" => "Saturday, August 11th, 2018 (04:50)", - "subject" => "Invoice Payment Confirmation", - "status" => "", - "lastupdated" => "" - ], - [ - "date" => "Friday, August 10th, 2018 (12:00)", - "department" => "Friday, August 10th, 2018 (12:00)", - "subject" => "Customer Invoice", - "status" => "", - "lastupdated" => "" - ], - [ - "date" => "Tuesday, April 3rd, 2018 (00:51)", - "department" => "Tuesday, April 3rd, 2018 (00:51)", - "subject" => "Your password has been reset", - "status" => "", - "lastupdated" => "" - ] - ] + "list" => [] ]; + +$status_types = [ + "关闭", + "打开" +]; + +$news["list"] = $dbpdo->select_and("news"); diff --git a/admin/controllers/news_add.php b/admin/controllers/news_add.php index 92fd841..4d3304b 100644 --- a/admin/controllers/news_add.php +++ b/admin/controllers/news_add.php @@ -5,3 +5,42 @@ if (!defined('IN_SYS')) { header("Location: ../../admin.php"); exit; } + +$err = getMsg("errors"); +$data = getMsg("form_data"); + +$status_types = [ + "关闭", + "打开" +]; + +if (isset($_POST["do_add_news"])) { + $title = filter_input(INPUT_POST, "title", FILTER_SANITIZE_STRING); + $status = filter_input(INPUT_POST, "status", FILTER_SANITIZE_STRING); + $content = filter_input(INPUT_POST, "content", FILTER_SANITIZE_STRING); + $errors = array(); + + $data = [ + "title" => $title, + "status" => $status, + "content" => $content + ]; + if (!count($errors)) { + $data["date"] = time(); + $data["lastupdated"] = ""; + $res = $dbpdo->add("news", $data); + print_r($res); + if ($res) { + setMsg("msg_notify", "Add News successfully.", "success"); + redirect("admin", "news_details", ["id" => $res]); + } else { + setMsg("form_data", $data); + setMsg("msg_notify", "Add News failed.", "warning"); + redirect("admin", "news_add"); + } + } else { + setMsg("form_data", $data); + setMsg("errors", $errors); + redirect("admin", "news"); + } +} diff --git a/admin/controllers/news_details.php b/admin/controllers/news_details.php new file mode 100644 index 0000000..3aeadc0 --- /dev/null +++ b/admin/controllers/news_details.php @@ -0,0 +1,28 @@ +find_and('news', ["id" => $news_id]); +if ($res) { + $data = $res; +} else { + setMsg("msg_notify", "The News Not found.", "warning"); + redirect("admin", "news"); +} diff --git a/admin/controllers/tickets.php b/admin/controllers/tickets.php index 2f96631..351f00a 100644 --- a/admin/controllers/tickets.php +++ b/admin/controllers/tickets.php @@ -15,6 +15,12 @@ $tickets = [ "page" => 1, "list" => [], ]; - +$ticket_types = [ + "技术支持", "销售财务", "管理员信箱" +]; +$status_types = [ + "关闭", + "打开" +]; // $tickets["list"] = $dbpdo->select('SELECT * FROM `tickets` WHERE `user_id` = ?', [$user->id]); $tickets["list"] = $dbpdo->select_and("tickets"); diff --git a/admin/controllers/tickets_details.php b/admin/controllers/tickets_details.php new file mode 100644 index 0000000..b9838c6 --- /dev/null +++ b/admin/controllers/tickets_details.php @@ -0,0 +1,60 @@ + $tickets_id, + "comment" => $comment + ]; + if (!count($errors)) { + $data["date"] = time(); + $data["user_type"] = "admin"; + 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"); + } else { + setMsg("msg_notify", "Add Comment failed.", "warning"); + } + redirect("admin", "tickets_details", ["id" => $res]); + } else { + setMsg("msg_notify", "The Tickets Not found.", "warning"); + redirect("admin", "tickets"); + } + } else { + setMsg("form_data", $data); + 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/news.php b/admin/views/news.php index 5376d1e..facf0d7 100644 --- a/admin/views/news.php +++ b/admin/views/news.php @@ -14,7 +14,7 @@ if (!defined('IN_SYS')) {
- Add +
@@ -23,21 +23,19 @@ if (!defined('IN_SYS')) { Date - Department - Subject + Title Status - Last Updated + - $value) { ?> + $value) { ?> - - - - - + + + + Details @@ -50,7 +48,7 @@ if (!defined('IN_SYS')) {
diff --git a/admin/views/news_add.php b/admin/views/news_add.php index a61d830..d26e5bf 100644 --- a/admin/views/news_add.php +++ b/admin/views/news_add.php @@ -13,21 +13,34 @@ if (!defined('IN_SYS')) {
News Add - +
+ +
- - - +
+ + + +
+
+ + + +
+
+ + + +
+
+ +
diff --git a/admin/views/news_details.php b/admin/views/news_details.php new file mode 100644 index 0000000..8dadbc6 --- /dev/null +++ b/admin/views/news_details.php @@ -0,0 +1,31 @@ + + +
+
+
+ +
+
+ News Details +
+ + +
+
+
+

Status:

+

Date:

+

Title:

+

Content:

+
+ +
+
+
+
\ No newline at end of file diff --git a/admin/views/tickets.php b/admin/views/tickets.php index c1a0792..945cf9e 100644 --- a/admin/views/tickets.php +++ b/admin/views/tickets.php @@ -31,10 +31,10 @@ if (!defined('IN_SYS')) { $value) { ?> - - + + - + Details diff --git a/admin/views/tickets_details.php b/admin/views/tickets_details.php new file mode 100644 index 0000000..e54a1b9 --- /dev/null +++ b/admin/views/tickets_details.php @@ -0,0 +1,41 @@ + + +
+
+
+ +
+
+ Tickets Details +
+ +
+
+
+

Type:

+

Status:

+

Subject:

+

Content:

+
+
+ + + +
+
+ + +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/clientarea/views/header.php b/clientarea/views/header.php index dcad309..632f318 100644 --- a/clientarea/views/header.php +++ b/clientarea/views/header.php @@ -6,7 +6,7 @@ if (!defined('IN_SYS')) { } ?> - + diff --git a/clientarea/views/tickets.php b/clientarea/views/tickets.php index be7fe76..2cc7b5e 100644 --- a/clientarea/views/tickets.php +++ b/clientarea/views/tickets.php @@ -13,7 +13,9 @@ if (!defined('IN_SYS')) {
Support Tickets - Add Ticket +
+ +
diff --git a/clientarea/views/tickets_add.php b/clientarea/views/tickets_add.php index 43e3951..32d8271 100644 --- a/clientarea/views/tickets_add.php +++ b/clientarea/views/tickets_add.php @@ -13,7 +13,9 @@ if (!defined('IN_SYS')) {
Tickets Add - Tickets List +
+ +
@@ -37,7 +39,7 @@ if (!defined('IN_SYS')) {
- +
diff --git a/clientarea/views/tickets_details.php b/clientarea/views/tickets_details.php index 92c350d..5f68a83 100644 --- a/clientarea/views/tickets_details.php +++ b/clientarea/views/tickets_details.php @@ -13,7 +13,10 @@ if (!defined('IN_SYS')) {
Tickets Details - Tickets List +
+ + +

Type:

diff --git a/data/demo.sql b/data/demo.sql index a30a963..8c133c9 100644 --- a/data/demo.sql +++ b/data/demo.sql @@ -55,3 +55,12 @@ CREATE TABLE IF NOT EXISTS `tickets_comment`( PRIMARY KEY(`id`) ) ENGINE = MyISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT = 100; +CREATE TABLE IF NOT EXISTS `news`( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `date` VARCHAR(255) NOT NULL, + `title` VARCHAR(255) NOT NULL, + `content` VARCHAR(5000) NOT NULL, + `status` TINYINT(4) NOT NULL, + `lastupdated` VARCHAR(255) NOT NULL, + PRIMARY KEY(`id`) +) ENGINE = MyISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT = 100; diff --git a/library/language/en-US/language.php b/library/language/en-US/language.php index aec1187..701c573 100644 --- a/library/language/en-US/language.php +++ b/library/language/en-US/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => 'About', 'aboutus' => 'About', 'clientarea' => 'Client Area', + 'add' => 'Add', + 'list' => 'List' ]; diff --git a/library/language/ko/language.php b/library/language/ko/language.php index 3ffe66e..b7f45ce 100644 --- a/library/language/ko/language.php +++ b/library/language/ko/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => '정보', 'aboutus' => '회사 소개', 'clientarea' => '고객센터', + 'add' => '더하다', + 'list' => '명부' ]; diff --git a/library/language/zh-CN/language.php b/library/language/zh-CN/language.php index afd25db..ce2a3b6 100644 --- a/library/language/zh-CN/language.php +++ b/library/language/zh-CN/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => '关于', 'aboutus' => '关于我们', 'clientarea' => '客户中心', + 'add' => '新增', + 'list' => '列表' ]; diff --git a/library/language/zh-HK/language.php b/library/language/zh-HK/language.php index 22342ae..8572a4e 100644 --- a/library/language/zh-HK/language.php +++ b/library/language/zh-HK/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => '關於', 'aboutus' => '關於我們', 'clientarea' => '客戶中心', + 'add' => '新增', + 'list' => '列表' ]; diff --git a/library/language/zh-SG/language.php b/library/language/zh-SG/language.php index 60bc987..63c0d2e 100644 --- a/library/language/zh-SG/language.php +++ b/library/language/zh-SG/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => '关于', 'aboutus' => '关于我们', 'clientarea' => '客户中心', + 'add' => '新增', + 'list' => '列表' ]; diff --git a/library/language/zh-TW/language.php b/library/language/zh-TW/language.php index 22342ae..8572a4e 100644 --- a/library/language/zh-TW/language.php +++ b/library/language/zh-TW/language.php @@ -64,4 +64,6 @@ $LANG = [ 'about' => '關於', 'aboutus' => '關於我們', 'clientarea' => '客戶中心', + 'add' => '新增', + 'list' => '列表' ];