本文整理汇总了PHP中send_push_notification函数的典型用法代码示例。如果您正苦于以下问题:PHP send_push_notification函数的具体用法?PHP send_push_notification怎么用?PHP send_push_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_push_notification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: work
function work($file_name, $connect)
{
$topic = "myschool";
$reg_ids = "";
$title = $_POST['title'];
$time = date("Y-m-d , H:i:s");
$query = "INSERT INTO `images`(`title`, `image`, `time`) VALUES ('{$title}', '{$file_name}', '{$time}')";
$result = mysqli_query($connect, $query);
if ($result) {
$pid = mysqli_insert_id($connect);
$selectQuery = "SELECT * FROM `images` WHERE `sno` = '{$pid}'";
$selectResult = mysqli_query($connect, $selectQuery);
if ($selectResult) {
if ($row = mysqli_fetch_array($selectResult)) {
$message[] = array("result" => "success", "title" => $title, "image" => $file_name, "date" => $row['time']);
$messages = array('image' => $message);
// TODO uncomment send_push_notification() to send message to devices
//var_dump($messages);
echo "<br><br>" . json_encode($messages) . "<br><br><br> Add more images if you want.<br>";
send_push_notification($reg_ids, json_encode($messages), $topic);
}
}
} else {
echo "<br>Error";
}
}
示例2: work
function work($file_name, $connect)
{
$name = $_POST['name'];
$fb_url = "";
$tweet_url = "";
if (isset($_POST['url_fb'])) {
$fb_url = $_POST['url_fb'];
}
if (isset($_POST['url_tweet'])) {
$tweet_url = $_POST['url_tweet'];
}
$time = date("Y-m-d , H:i:s");
$query = "INSERT INTO `contributors`(`name`, `fb_url`, `tweet_url`, `image`) VALUES ('{$name}', '{$fb_url}', '{$tweet_url}', '{$file_name}')";
echo $query;
$result = mysqli_query($connect, $query);
if ($result) {
$pid = mysqli_insert_id($connect);
$selectQuery = "SELECT * FROM `contributors` WHERE `pid` = '{$pid}'";
$selectResult = mysqli_query($connect, $selectQuery);
var_dump($selectResult);
if ($selectResult) {
if ($row = mysqli_fetch_array($selectResult)) {
$message[] = array("name" => $name, "url_fb" => $fb_url, "url_tweet" => $tweet_url, "image" => $file_name);
$messages = array('people' => $message);
// TODO uncomment send_push_notification() to send message to devices
var_dump($messages);
echo "<br>" . json_encode($messages);
send_push_notification(json_encode($messages));
}
}
} else {
echo "<br>Error";
}
}
示例3: recipient_box_save
function recipient_box_save($post_id)
{
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!wp_verify_nonce($_POST['recipient_box_content_nonce'], plugin_basename(__FILE__))) {
return;
}
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return;
}
} else {
if (!current_user_can('edit_post', $post_id)) {
return;
}
}
$recipient = $_POST['recipient'];
update_post_meta($post_id, 'recipient', $recipient);
$notified = get_post_meta($post_id, 'notified');
if (empty($notified)) {
update_post_meta($post_id, 'notified', "1");
$pushMessage = get_the_title($post_id);
$reg_ids = users_gcm_ids($recipient);
$message = array("chat" => $pushMessage, "user" => "admin");
send_push_notification($reg_ids, $message);
}
}
示例4: work
function work($file_name, $connect)
{
$topic = "myschool";
$reg_ids = "";
$title = $_POST['title'];
$name = $_POST['name'];
$description = $_POST['message'];
$url = "";
if (isset($_POST['url'])) {
$url = $_POST['url'];
}
$time = date("Y-m-d , H:i:s");
$query = "INSERT INTO `posts`(`title`, `description`, `name`, `image`, `url`, `time`) VALUES ('{$title}', '{$description}', '{$name}', '{$file_name}', '{$url}', '{$time}')";
$result = mysqli_query($connect, $query);
if ($result) {
$pid = mysqli_insert_id($connect);
$selectQuery = "SELECT * FROM `posts` WHERE `pid` = '{$pid}'";
$selectResult = mysqli_query($connect, $selectQuery);
if ($selectResult) {
if ($row = mysqli_fetch_array($selectResult)) {
$message[] = array("message" => $description, "name" => $name, "title" => $title, "image" => $file_name, "date" => $row['time'], "url" => $url);
$messages = array('post' => $message);
// TODO uncomment send_push_notification() to send message to devices
//var_dump($messages);
//echo "<br>".json_encode($messages);
echo send_push_notification($reg_ids, json_encode($messages), $topic);
}
}
} else {
echo json_encode(array('result' => "failure", 'response' => "Something went wrong."));
}
}
示例5: send_message
function send_message($user_id, $message, $recipient)
{
$post_id = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => $user_id, 'post_title' => $message, 'post_status' => 'draft', 'post_type' => 'message'));
update_post_meta($post_id, 'recipient', $recipient);
update_post_meta($post_id, 'author', $user_id);
//send gcm notification
$user = get_user_by('id', $user_id);
$gcm = array("chat" => $message, "user" => $user->user_login);
$reg_id = users_gcm_ids($recipient);
send_push_notification($reg_id, $gcm);
}
示例6: SendNotificationToNextAttacker
function SendNotificationToNextAttacker($clanID)
{
$db = new BaseDB();
$sql = "\n SELECT p.GameName, gcmu.gcm_regid\n FROM dbo.OurParticipant AS op INNER JOIN\n dbo.Player AS p ON op.PlayerID = p.PlayerID INNER JOIN\n dbo.gcm_users AS gcmu ON p.GameName = gcmu.game_name\n WHERE op.NextAttacker = 1 AND ClanID = {$clanID}\n ";
$result = $db->dbQuery($sql);
while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_BOTH)) {
$registatoin_ids[0] = $record['gcm_regid'];
$msg = array("data" => "cal" . $record['GameName'] . " it is your turn to attack!");
send_push_notification($registatoin_ids, $msg);
}
$db->Free($result);
$db->close();
}
示例7: send_feedback_after_comment
function send_feedback_after_comment($comment_id)
{
$comment = get_comment($comment_id);
$author_uname = $comment->comment_author;
$raw_message = $comment->comment_content;
//get author of original post
$post_id = $comment->comment_post_ID;
$post = get_post($post_id);
$author_id = $post->post_author;
//get comment author gravatar
$author = get_user_by('login', $author_uname);
$author_email = $author->user_email;
$gravatar = get_gravatar_url($author_email);
$message = array("feedback" => $raw_message, "author" => $author_uname, "icon_url" => $gravatar);
send_push_notification(users_gcm_ids($author_id), $message);
}
示例8: array
<?php
require_once 'loader.php';
$gcmRegID = $_POST["regId"];
// GCM Registration ID got from device
$pushMessage = $_POST["message"];
if (isset($gcmRegID) && isset($pushMessage)) {
$registatoin_ids = array($gcmRegID);
$result = send_push_notification($gcmRegID, $pushMessage);
echo $result;
}
示例9: send_notification
function send_notification($data)
{
/*
$notify['senderId'] = ;
$notify['receiverId'] = ;
$notify['nType'] = ;
$notify['nTitle'] = ;
$notify['nMessage'] = ;
*/
$type = $data['nType'];
switch ($type) {
case 'BUYING-CLUB-ADD':
$data['nMessage'] = "Hi, <br /> You Have added in my newly created Buying Club <strong>[" . $data['nTitle'] . "]</strong> by " . $data['adminName'] . ".<br />Group Leader email id is " . $data['adminEmail'] . ".<br />Group Leader contact number is " . $data['adminContactNo'] . ".";
$data['isEmail'] = true;
if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') {
$data['isMobMessage'] = true;
} else {
$data['isMobMessage'] = true;
}
$data['createDate'] = date('Y-m-d H:i:s');
break;
case 'BUYING-CLUB-MODIFY':
$data['nMessage'] = "Hi, <br> Buying Club <strong>[" . $data['nTitle'] . "]</strong> has been modified.";
$data['isEmail'] = true;
if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') {
$data['isMobMessage'] = true;
} else {
$data['isMobMessage'] = true;
}
$data['createDate'] = date('Y-m-d H:i:s');
break;
case 'BUYING-CLUB-MODIFY-NEW':
$data['nMessage'] = "Hi, <br> You Have added in my Buying Club <strong>[" . $data['nTitle'] . "]</strong>.<br />My name is " . $data['adminName'] . ".<br />My email id is " . $data['adminEmail'] . ".<br />My contact number is " . $data['adminContactNo'] . ".";
$data['isEmail'] = true;
if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') {
$data['isMobMessage'] = true;
} else {
$data['isMobMessage'] = true;
}
$data['createDate'] = date('Y-m-d H:i:s');
break;
case 'BUYING-CLUB-MODIFY-DELETE':
$data['nMessage'] = "Hi, <br> You are not part of this Buying Club <strong>[" . $data['nTitle'] . "]</strong>";
$data['isEmail'] = true;
if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') {
$data['isMobMessage'] = true;
} else {
$data['isMobMessage'] = true;
}
$data['createDate'] = date('Y-m-d H:i:s');
break;
case '':
}
$data['isRead'] = 0;
$data['status'] = 1;
if ($data['isMobMessage']) {
$smsData['nMessage'] = str_replace('<br />', '', $data['nMessage']);
$smsData['nMessage'] = str_replace('<br>', '', $smsData['nMessage']);
$smsData['nMessage'] = str_replace('<br/>', '', $smsData['nMessage']);
$smsData['nMessage'] = str_replace('<strong>', '', $smsData['nMessage']);
$smsData['nMessage'] = str_replace('</strong>', '', $smsData['nMessage']);
$smsData['receiverMobileNumber'] = $data['receiverMobileNumber'];
if (array_key_exists('senderId', $smsData)) {
$smsData['senderId'] = $data['senderId'];
} else {
$smsData['senderId'] = 0;
}
if (array_key_exists('receiverId', $smsData)) {
$smsData['receiverId'] = $data['receiverId'];
} else {
$smsData['receiverId'] = 0;
}
if (array_key_exists('senderMobileNumber', $smsData)) {
$smsData['senderMobileNumber'] = $data['senderMobileNumber'];
} else {
$smsData['senderMobileNumber'] = 0;
}
$smsData['nType'] = $data['nType'];
send_sms_notification($smsData);
if (array_key_exists('receiverId', $smsData)) {
send_push_notification($smsData);
}
}
if ($data['isEmail']) {
//Send Email message
unset($data['isEmail']);
}
unset($data['adminName']);
unset($data['isMobMessage']);
unset($data['adminEmail']);
unset($data['adminContactNo']);
unset($data['receiverMobileNumber']);
unset($data['senderMobileNumber']);
if (array_key_exists('orderId', $data)) {
unset($data['orderId']);
}
$this->user->notification_add($data);
}
示例10: sendpushnotificationsAction
public function sendpushnotificationsAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$title = $this->_request->getParam('title');
$reg = 'APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ';
$title = str_replace("_", " ", $title);
$regID = array($reg);
// $message="You have registerted successfully";
$message = array("userID" => $this->sessUserInfo->id, "msg" => $title . " is ready to download", "email" => $this->sessUserInfo->user_email);
send_push_notification($regID, $message);
$this->_flashMessenger->addMessage('<div class="div-success">Notification sent successfully</div>');
$this->_redirect('user/index/issuesavailable/');
}
示例11: getIMEIUserName
// $regID = $_REQUEST['data4'];
$UserName = getIMEIUserName($sendToIMEI);
// $ReceiverName=getIMEIUserName($imei);
$message = $UserName . "^" . $sendToIMEI . "^" . $message;
$imeiArray = explode('::', $imei);
if (strcmp($imeiArray[0], "All") == 0) {
$resultUsers = getAllUsersData($imeiArray[1]);
} else {
$resultUsers = getIMEIUser($imeiArray[0]);
}
if ($resultUsers != false) {
$NumOfUsers = mysql_num_rows($resultUsers);
} else {
$NumOfUsers = 0;
}
if ($NumOfUsers > 0) {
while ($rowUsers = mysql_fetch_array($resultUsers)) {
$gcmRegID = $rowUsers["gcm_regid"];
// GCM Registration ID got from device
$pushMessage = $message;
if (isset($gcmRegID) && isset($pushMessage)) {
$registration_ids = array($gcmRegID);
$messageSend = array("message" => $pushMessage);
$result = send_push_notification($registration_ids, $messageSend);
echo $result;
//echo "Message sent.";
}
}
} else {
print "";
}
示例12: activeAction
//.........这里部分代码省略.........
$tempDatInsert['transaction_id'] = $getdata->id;
$tempDatInsert['book_name'] = $titleBrand;
$tempDatInsert['add_date'] = date('Y-m-d H:i:s');
$tempDatInsert['group_id'] = $this->userdata[0]['group_id'];
$tempDatInsert['order_id'] = $row_subdata['order_id'];
$tempDatInsert['payment_status'] = '1';
$tempDatInsert['converted_price'] = $row_subdata['subscription_price'];
$tempDatInsert['subscription_type'] = $row_subdata['subscription_type'];
$tempDatInsert['subscription_store'] = $row_subdata['country'];
$tempDatInsert['subscription_language'] = $row_subdata['language'];
$tempDatInsert['subscription_name'] = $row_subdata['subscription_name'];
$creditHistoryObj->insert($tempDatInsert);
$formDataTransApproved = array("orderId" => $row_subdata['order_id'], "transactionType" => $getdata->transactionType, "pan" => $getdata->pan, "purchaseAmount" => $getdata->purchaseAmount, "tranDateTime" => $getdata->tranDateTime, "responseCode" => $getdata->responseCode, "responseDescription" => $getdata->responseDescription, "orderStatus" => $getdata->orderStatus, "approvalCode" => $getdata->approvalCode, "merchantTranId" => $getdata->merchantTranId, "orderDescription" => $getdata->orderDescription, "approvalCodeScr" => $getdata->approvalCodeScr, "currency" => $getdata->currency, "brand" => $getdata->brand, "card_holder_name" => $getdata->card_holder_name, "ThreeDSStatus" => $getdata->ThreeDSStatus, "threeDsVerification" => $getdata->threeDsVerification, "transaction_xml" => $getdata->transaction_xml);
$inserted_id = $transactionHistoryObj->insert($formDataTransApproved);
$insert_user_sub_details_array = array("order_id" => $row_subdata['order_id'], "product_id" => $id, "publisher_id" => $row_subdata['publisher_id'], "author_id" => $row_subdata['author_id'], "group_id" => $this->userdata[0]['group_id'], "user_id" => $row_subdata['user_id'], "subscription_type" => $row_subdata['subscription_type'], "subscription_name" => $row_subdata['subscription_name'], "subscription_price" => $row_subdata['subscription_price'], "country" => $row_subdata['country'], "language" => $row_subdata['language'], "publication_id" => $row_subdata['publication_id'], "company_id" => $this->userdata[0]['parent_id'], "active_date" => date('Y-m-d H:i:s'));
$this->usersubscriptions->insert($insert_user_sub_details_array);
$sql1 = "update pclive_products set best_seller=best_seller+1 where id='" . $id . "'";
$result1 = $this->modelBooks->getAdapter()->query($sql1);
}
$publicationdetails = $this->modelPublications->fetchAll('id=' . $id . '');
$product_price = $modelPrice->fetchAll('product_id="' . $id . '" and country_id=226 and language_id=1');
$getproductimage = $modelImage->fetchAll('product_id="' . $publicationdetails[0]['id'] . '"');
$publisher_info_array = $this->modelPublications->getPublisherInfo($publicationdetails[0]['publisher_id']);
$author_info_array = $this->modelPublications->getAuthorInfo($publicationdetails[0]['author_id']);
$getBrandInfo = $modelCategory->getBrandInfo($publicationdetails[0]['title']);
if (!empty($getBrandInfo)) {
$titleBrand = $getBrandInfo['brand'];
} else {
$titleBrand = $publicationdetails[0]['title'];
}
$fullname = $this->userdata[0]['first_name'] . ' ' . $this->userdata[0]['last_name'];
$description_full = stripslashes($bookuploaddata[0]['message_body']);
$description_full = nl2br($description_full);
$description = str_replace("{name}", $fullname, $description_full);
$description = str_replace("{title}", $titleBrand, $description);
if (count($this->usersubscriptionsdata) > 0) {
$description = str_replace("{price}", "N/A", $description);
} else {
if (isset($product_price[0]['price']) && $product_price[0]['price'] != '') {
$description = str_replace("{price}", "₦" . $product_price[0]['price'], $description);
}
}
if (count($getproductimage) > 0) {
$linkdata = 'http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/catalogue/detail/id/' . $publicationdetails[0]['id'] . '/store/226/lang/1';
} else {
$linkdata = "javascript:void(0);";
}
$description = str_replace("{link}", $linkdata, $description);
if (count($getproductimage) > 0) {
$imagedata = 'http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/public/uploads/users/' . $getproductimage[0]['image_name_thumb'] . '';
} else {
$imagedata = "";
}
$description = str_replace("{image}", $imagedata, $description);
$publishername = $publisher_info_array['first_name'] . " " . $publisher_info_array['last_name'];
$authorname = $author_info_array['first_name'] . " " . $author_info_array['last_name'];
$description = str_replace("{publisher}", $publishername, $description);
$description = str_replace("{desc}", $publicationdetails[0]['description'], $description);
$description = str_replace("{author}", $authorname, $description);
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail();
$mail->addTo($this->userdata[0]['user_email']);
$mail->setSubject(stripslashes($bookuploaddata[0]['title']));
$mail->setBodyHtml($description);
$mail->setFrom(SETFROM, SETNAME);
//$mail->send();
/*$reg='APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ';
$title = str_replace("_"," ",$title);
$regID = array($reg);
// $message="You have registerted successfully";
$message = array("userID" =>$row_userids['id'],"msg" =>$bookuploaddata[0]['title']." is ready to download","email" =>$row_userids['user_email']);
send_push_notification($regID, $message);*/
if (isset($publicationdetails[0]['file_name']) && $publicationdetails[0]['file_name'] != '' && count($getproductimage) > 0 && count($product_price) > 0) {
$get_registeration_id = mysql_query("select * from pclive_deviceID where user_publisher_id='" . $this->userdata[0]['id'] . "' and reg_id!=''");
$res_registeration_id = mysql_fetch_array($get_registeration_id);
$reg = $res_registeration_id['reg_id'];
$regID = array($reg);
// $message="You have registerted successfully";
$message = array("userID" => $this->userdata[0]['id'], "msg" => "publication is ready to download", "email" => $this->userdata[0]['user_email']);
if ($res_registration_id['os_type'] == 0) {
send_push_notification($regID, $message);
} else {
send_push_notification_ios($regID, $row_userids['user_email'], $this->userdata[0]['id'], "publication is ready to download");
}
}
}
}
}
}
$this->_flashMessenger->addMessage('<div class="div-success">Product activated successfully</div>');
} else {
$this->_flashMessenger->addMessage('<div class="div-error">Sorry!, unable to activate product</div>');
}
}
$this->_redirect('admin/publications/');
}
示例13: send_msg
public static function send_msg($_chats)
{
//require("opendb.php");
require_once "function.php";
require_once "user.php";
ChatsManager::addNewChats($_chats);
$_gcmid = array(UserManager::getGcmIdById($_chats->recipient));
return send_push_notification($_gcmid, $message = array("price" => $_chats->msg));
//else echo 0;
//require("closedb.php");
}
示例14: ApnsPHP_Push
} else {
$push = new ApnsPHP_Push(ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $config['apns_pem_file_production']);
}
$push->setRootCertificationAuthority('entrust_root_certification_authority.pem');
$push->connect();
// push to all devices
$dbhandle = sqlite_open('tokens.db', 0666, $error);
if (!$dbhandle) {
die($error);
}
$query = "SELECT * FROM tokens";
$result = sqlite_query($dbhandle, $query);
$rows = sqlite_num_rows($result);
for ($i = 0; $i < $rows; $i++) {
$row = sqlite_fetch_array($result, SQLITE_NUM);
$message = send_push_notification($row[1], $_GET['msg']);
$push->add($message);
$push->send();
print 'sending ..' . $i . "\n";
}
sqlite_close($dbhandle);
// Disconnect from the Apple Push Notification Service
$push->disconnect();
// Examine the error message container
$aErrorQueue = $push->getErrors();
if (!empty($aErrorQueue)) {
var_dump($aErrorQueue);
}
function send_push_notification($token, $msg)
{
// Instantiate a new Message with a single recipient
示例15: decline_buying_club_order_invite_post
//.........这里部分代码省略.........
}
if (empty($order)) {
$this->response(array('error' => 'Please provide valid order index to accept the invitation!'), 400);
return FALSE;
}
$group = $this->user->get_group_by_id($order->groupId);
$prod_price_info = $this->product->get_products_price_details_by_id($order->productPriceId);
$a = $this->_get_available_order_quantity($orderId);
$availQty = $prod_price_info->qty - $a[0]->productQty;
$orderInfo = unserialize(base64_decode($order->orderInfo));
if (!$availQty) {
$this->response(array('error' => 'Order already completed by other members of this Buying Club.'), 400);
return FALSE;
}
if (!$this->user->user_exists_on_group($userId, $order->groupId)) {
$this->response(array('error' => 'You can not process this order because you are not member of this Buying Club.'), 400);
return FALSE;
}
if ($order->parrentOrderID == 0) {
$me = $user;
foreach ($group->users as $key => $usr) {
$mail_template_data = array();
if ($me->userId != $usr->userId) {
$data['senderId'] = $userId;
$data['receiverId'] = $usr->userId;
$data['nType'] = 'BUYING-CLUB-ORDER-DECLINE';
$data['nTitle'] = 'Buying Club order [TIDIIT-OD-' . $order->orderId . '] cancel by <b>' . $me->firstName . ' ' . $me->lastName . '</b>';
$mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID'] = $order->orderId;
$mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ADMIN_NAME'] = $me->firstName . ' ' . $me->lastName;
$data['nMessage'] = "Hi, <br> Sorry! I can not process this Buying Club order right now.<br>";
$data['nMessage'] .= "";
$data['nMessage'] .= "Thanks <br> Tidiit Team.";
$data['isRead'] = 0;
$data['status'] = 1;
$data['createDate'] = date('Y-m-d H:i:s');
$data['appSource'] = $deviceType;
//Send Email message
$recv_email = $usr->email;
$sender_email = $me->email;
$mail_template_view_data = load_default_resources();
$mail_template_view_data['group_order_decline'] = $mail_template_data;
global_tidiit_mail($recv_email, "Buying Club order decline at Tidiit Inc Ltd", $mail_template_view_data, 'group_order_decline', $usr->firstName . ' ' . $usr->lastName);
$notificationId = $this->user->notification_add($data);
$push_not_data['receiverId'] = $group->admin->userId;
$push_not_data['nType'] = "BUYING-CLUB-ORDER-DECLINE";
$push_not_data['nTitle'] = 'New Buying Club Order Invitation';
$push_not_data['appSource'] = $deviceType;
//$push_not_data['orderId'] = $orderId;
$push_not_data['nMessage'] = 'You have invited to Buying Club[' . $group->groupTitle . '] by ' . $group->admin->firstName . ' ' . $group->admin->lastName . '.More details about this notifiaction,Check ' . $defaultResources['MainSiteBaseURL'];
send_normal_push_notification($push_not_data);
}
}
$data['receiverId'] = $group->admin->userId;
unset($data['nMessage']);
$mail_template_view_data = load_default_resources();
$defaultResources = $mail_template_view_data;
$mail_template_data = array();
$data['senderId'] = $userId;
$data['nType'] = 'BUYING-CLUB-ORDER-DECLINE';
$data['nTitle'] = 'Buying Club order [TIDIIT-OD-' . $order->orderId . '] cancel by <b>' . $me->firstName . ' ' . $me->lastName . '</b>';
$mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID'] = $order->orderId;
$mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ADMIN_NAME'] = $me->firstName . ' ' . $me->lastName;
$data['nMessage'] = "Hi, <br> Sorry! I can not process this order right now.<br>";
$data['nMessage'] .= "<a href='" . $defaultResources['MainSiteBaseURL'] . "shopping/group-re-order-process/" . base64_encode($orderId * 226201) . "' class='btn btn-warning btn-lg'>Re-order now</a><br><br>";
$mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID1'] = $orderId;
$data['nMessage'] .= "Thanks <br> Tidiit Team.";
$data['isRead'] = 0;
$data['status'] = 1;
$data['orderId'] = $orderId;
$data['productId'] = $productId;
$data['productPriceId'] = $productPriceId;
$data['createDate'] = date('Y-m-d H:i:s');
$data['appSource'] = $deviceType;
//Send Email message
$recv_email = $group->admin->email;
$sender_email = $me->email;
$mail_template_view_data = load_default_resources();
$mail_template_view_data['group_order_decline'] = $mail_template_data;
global_tidiit_mail($recv_email, "Buying Club order decline at Tidiit Inc Ltd", $mail_template_view_data, 'group_order_decline_admin', $group->admin->firstName . ' ' . $group->admin->lastName);
$notificationId = $this->user->notification_add($data);
$declient_data = array();
$declient_data['acceptDeclineState'] = 2;
$this->user->notification_edit($declient_data, $notificationId);
$this->order->update(array('reOrder' => 1, 'cancelOrderUserId' => $userId), $orderId);
/// sendin SMS to Leader
$smsMsg = 'Buying Club[' . $group->groupTitle . '] member[' . $usr->firstName . ' ' . $usr->lastName . '] has decline the invitation Tidiit order TIDIIT-OD-' . $order->orderId . '.';
$sms_data = array('nMessage' => $smsMsg, 'receiverMobileNumber' => $orderInfo['group']->admin->mobile, 'senderId' => '', 'receiverId' => $orderInfo["group"]->admin->userId, 'senderMobileNumber' => '', 'nType' => $data['nType']);
send_sms_notification($sms_data);
$push_not_data['receiverId'] = $group->admin->userId;
$push_not_data['nType'] = "BUYING-CLUB-ORDER-DECLINE";
$push_not_data['nTitle'] = 'New Buying Club Order Invitation';
$push_not_data['appSource'] = $deviceType;
$push_not_data['notificationId'] = $notificationId;
$push_not_data['nMessage'] = 'You have invited to Buying Club[' . $group->groupTitle . '] by ' . $group->admin->firstName . ' ' . $group->admin->lastName . '.More details about this notifiaction,Check ' . $defaultResources['MainSiteBaseURL'];
send_push_notification($push_not_data);
}
$result = array();
$result['message'] = 'Sorry for Buying Club order cancelation!';
success_response_after_post_get($result);
}