public function sendMessageToTheGroup() { $user = Auth::user(); $input = Input::all(); //print_r(json_decode($input['userList'])); $conversationMessage = new ConversationMessage(); $conversationMessage->message = $input['message']; $conversationMessage->sender_id = $user['id']; $conversationMessage->member = $input['userList']; // add user to the group $userListArray = json_decode($input['userList']); $apicontroller = new APIController(); $conversationMessage->conversation_id = $input['conversationID']; $conversationMessage->save(); foreach ($userListArray as $key => $value) { # code... if ($user->id != $value->id) { // send notification to the other members among the group $notificationCheck = GroupNotificationStatus::where('conversation_id', '=', $input['conversationID'])->where('user_id', '=', $value->id)->get(); if ($notificationCheck[0]->status == "1") { $apicontroller->addNotification($value->id, 'newgroupmessage', $input['conversationID'], $input['message']); } } // end codition check } // end loop }
public function getConversationMessageObject() { if (!isset($this->message)) { $db = Loader::db(); $cnvMessageID = $db->GetOne('select cnvMessageID from btCoreConversationMessage where bID = ?', array($this->bID)); $this->message = ConversationMessage::getByID($cnvMessageID); } return $this->message; }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Core\Conversation\Rating\Type as ConversationRatingType; if (Loader::helper('validation/numbers')->integer($_POST['cnvMessageID']) && $_POST['cnvMessageID'] > 0) { $ratingType = ConversationRatingType::getByHandle($_POST['cnvRatingTypeHandle']); $cnvMessageID = $_POST['cnvMessageID']; $commentRatingUserID = $_POST['commentRatingUserID']; $commentRatingIP = $_POST['commentRatingIP']; $msg = ConversationMessage::getByID($cnvMessageID); $msp = new Permissions($msg); if ($msp->canRateConversationMessage()) { $msg->rateMessage($ratingType, $commentRatingIP, $commentRatingUserID); } }