1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php $page_settings = array( 'formid' => 'Approval', // for permission 'section' => 'Master', // parent/page title 'subsection' => 'App Notification', // page title 'domain' => 'app_notification', // table/model name 'access' => 'GNr', // for permission ); require_once "check_login.php";
if ($_REQUEST["action"] == "ADD") {
$message = "";
if (empty($_POST["to_cmsloginid"])) { $message .= "請選擇用戶。" . "\\n\\n"; }
if (empty($_POST["title"])) { $message .= "請輸入通知標題。" . "\\n\\n"; }
if (empty($_POST["content"])) { $message .= "請輸入通知內容。" . "\\n\\n"; } if (!empty($message)) { echo "<script>alert('" . $message . "'); history.back();</script>"; exit; }
$notification_title = $_POST["title"]; $notification_body = $_POST["content"]; $app_notification_id = create_app_notification($notification_title, $notification_body, "SENT", "admin");
if (!empty($app_notification_id)) { foreach ($_POST["to_cmsloginid"] as $_cmsloginid) { $token = explode("|", $_cmsloginid); $cmsloginid = $token[0]; $name = $token[1];
$response = send_app_notification($app_notification_id, $cmsloginid, $name, $notification_title, $notification_body); } }
header("Location: " . $page_settings["domain"] . "_index.php?msg=1"); }
|