• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Conversation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Conversation的典型用法代码示例。如果您正苦于以下问题:PHP Conversation类的具体用法?PHP Conversation怎么用?PHP Conversation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Conversation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: showAction

 public function showAction()
 {
     $this->logger->entering();
     $this->logger->info('Loading conversation');
     $conversations = new Conversation();
     $conversation = $conversations->find($this->_getParam('id'))->current();
     $this->logger->info('Loading Item');
     $item = $conversation->findParentItem();
     $this->logger->info('Ensure authorized to view');
     if ($this->session->user_id != $conversation->user_id && $this->session->user_id != $item->owner_id) {
         $this->flash->notice = "Invalid Action";
         $this->_redirect('/');
     }
     $this->logger->info('Loading Messages');
     $messageRows = $conversation->findMessage();
     foreach ($messageRows as $messageRow) {
         $message = $messageRow->toArray();
         $message['user'] = $messageRow->findParentUser()->toArray();
         $messages[] = $message;
     }
     $this->logger->info('Loading View');
     $this->view->assign(array('conversation' => $conversation, 'messages' => $messages, 'item' => $item));
     $this->logger->info('Rendering view');
     $this->render();
     $this->logger->exiting();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:26,代码来源:ConversationsController.php


示例2: ConversationsToHTML

 public function ConversationsToHTML()
 {
     global $conversationsInfos;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         echo "Database bağlantı hatası";
     } else {
         $query = "SELECT * FROM conversations WHERE (user1=\"" . $conversationsInfos["Pour Qui"] . "\" OR user2=\"" . $conversationsInfos["Pour Qui"] . "\") ORDER BY lastDate DESC ";
         $results = $connection->query($query);
         if ($results->num_rows == 0) {
             echo "<div style=\"margin:2%;background-color:#e6e6e6;color:#6e6e6e;font-size:18px;font-family: Verdana,Geneva,sans-serif;\">";
             echo "Henüz mesajlaşmamışsınz.";
             echo "</div>";
         } else {
             while ($curResult = $results->fetch_assoc()) {
                 if ($curResult["user1"] == $conversationsInfos["Pour Qui"]) {
                     $other = $curResult["user2"];
                 } else {
                     $other = $curResult["user1"];
                 }
                 $ary = array($other, $conversationsInfos["Pour Qui"], $conversationsInfos["Pour Qui"]);
                 $myConversation = new Conversation($ary);
                 $myConversation->ConversationToHTML();
             }
         }
         $connection->close();
     }
 }
开发者ID:oguzeroglu,项目名称:serinhikaye.com,代码行数:30,代码来源:Conversations.class.php


示例3: create

 /**
  * @param array $values
  * @return \HorseStories\Models\Conversations\Conversation
  */
 public function create($values)
 {
     $conversation = new Conversation();
     $conversation->subject = $values['subject'];
     $conversation->save();
     return $conversation;
 }
开发者ID:studiocaro,项目名称:HorseStories,代码行数:11,代码来源:ConversationCreator.php


示例4: testFetchWithParticipant

 public function testFetchWithParticipant()
 {
     $usersConvsIds = array(1, 2, 3, 4, 5);
     $conversation = new Conversation();
     $conversation->criteriaWithParticipants(1);
     $result = $conversation->findAll();
     foreach ($result as $key => $conv) {
         $this->assertTrue(in_array($conv->id, $usersConvsIds));
     }
 }
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:10,代码来源:ConversationTest.php


示例5: testsSendNotificationOnNewComment

 public function testsSendNotificationOnNewComment()
 {
     $super = User::getByUsername('super');
     $steven = User::getByUsername('steven');
     $jack = User::getByUsername('jack');
     $conversation = new Conversation();
     $conversation->owner = Yii::app()->user->userModel;
     $conversation->subject = 'My test subject2';
     $conversation->description = 'My test description2';
     $this->assertTrue($conversation->save());
     $comment = new Comment();
     $comment->description = 'This is the 1st test comment';
     //Confirm no email notifications are sitting in the queue
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     //Confirm there is no inbox notification
     $this->assertEquals(0, Notification::getCount());
     //No message was sent because Steven and Jack don't have primary email address
     CommentsUtil::sendNotificationOnNewComment($conversation, $comment, array($steven, $jack));
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     //Two inbox notifications sent
     $this->assertEquals(2, Notification::getCount());
     $super->primaryEmail->emailAddress = '[email protected]';
     $steven->primaryEmail->emailAddress = '[email protected]';
     $jack->primaryEmail->emailAddress = '[email protected]';
     $this->assertTrue($super->save());
     $this->assertTrue($steven->save());
     $this->assertTrue($jack->save());
     //Two email message were sent one to Steven and one to Jack
     CommentsUtil::sendNotificationOnNewComment($conversation, $comment, array($steven, $jack));
     $this->assertEquals(2, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $emailMessages = EmailMessage::getAll();
     $emailMessage1 = $emailMessages[0];
     $emailMessage2 = $emailMessages[1];
     $this->assertCount(1, $emailMessage1->recipients);
     $this->assertCount(1, $emailMessage2->recipients);
     //Two inbox notifications created
     $this->assertEquals(4, Notification::getCount());
     //One email message was sent to Super but not to Steven
     //One inbox notification to Steven but not to Super
     NotificationTestHelper::setNotificationSettingsForUser($steven, 'ConversationNewComment', true, false);
     NotificationTestHelper::setNotificationSettingsForUser($super, 'ConversationNewComment', false, true);
     CommentsUtil::sendNotificationOnNewComment($conversation, $comment, array($steven, $super));
     $this->assertEquals(3, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $emailMessages = EmailMessage::getAll();
     $emailMessage = $emailMessages[2];
     $this->assertEquals(1, count($emailMessage->recipients));
     $this->assertEquals(5, Notification::getCount());
     $notifications = Notification::getAll();
     $notification = $notifications[4];
     $this->assertEquals(strval($steven), strval($notification->owner));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:55,代码来源:CommentsUtilTest.php


示例6: run

 public function run(User $userToSendTo, $messageLogger)
 {
     $conversation = new Conversation();
     $conversation->owner = Yii::app()->user->userModel;
     $conversation->subject = 'My test subject';
     $conversation->description = 'My test description';
     if (!$conversation->save()) {
         throw new FailedToSaveModelException();
     }
     ConversationParticipantsUtil::sendEmailInviteToParticipant($conversation, $userToSendTo);
     $messageLogger->addInfoMessage('Sending conversation invite message');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:12,代码来源:ConversationsDemoEmailNotifications.php


示例7: store

 /**
  * Store a newly created conversation in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('users' => 'required|array', 'body' => 'required');
     $validator = Validator::make(Input::only('users', 'body'), $rules);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'result' => $validator->messages()]);
     }
     // Create Conversation
     $params = array('created_at' => new DateTime(), 'name' => str_random(30), 'author_id' => Auth::user()->id);
     $conversation = Conversation::create($params);
     $conversation->users()->attach(Input::get('users'));
     $conversation->users()->attach(array(Auth::user()->id));
     // Create Message
     $params = array('conversation_id' => $conversation->id, 'body' => Input::get('body'), 'user_id' => Auth::user()->id, 'created_at' => new DateTime());
     $message = Message::create($params);
     // Create Message Notifications
     $messages_notifications = array();
     foreach (Input::get('users') as $user_id) {
         array_push($messages_notifications, new MessageNotification(array('user_id' => $user_id, 'read' => false, 'conversation_id' => $conversation->id)));
         // Publish Data To Redis
         $data = array('room' => $user_id, 'message' => array('conversation_id' => $conversation->id));
         Event::fire(ChatConversationsEventHandler::EVENT, array(json_encode($data)));
     }
     $message->messages_notifications()->saveMany($messages_notifications);
     return Redirect::route('chat.index', array('conversation', $conversation->name));
 }
开发者ID:thantai574,项目名称:laravel-realtime-chat,代码行数:31,代码来源:ConversationController.php


示例8: onTeamMembershipChange

 /**
  * Called every time a member is added/removed from a team
  *
  * @param TeamAbandonEvent|TeamJoinEvent|TeamKickEvent $event The event
  * @param string $type The type of the event
  */
 public function onTeamMembershipChange(Event $event, $type)
 {
     $query = \Conversation::getQueryBuilder()->forTeam($event->getTeam());
     foreach ($query->getModels() as $conversation) {
         \ConversationEvent::storeEvent($conversation->getId(), $event, $type);
     }
 }
开发者ID:allejo,项目名称:bzion,代码行数:13,代码来源:ConversationSubscriber.php


示例9: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $convId = $this->trimmed('id');
     if (empty($convId)) {
         // TRANS: Client exception thrown when no conversation ID is given.
         throw new ClientException(_('No conversation ID.'));
     }
     $this->conversation = Conversation::staticGet('id', $convId);
     if (empty($this->conversation)) {
         // TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
         $this->clientError(_('No conversation ID found'), 404);
         return false;
     }
     $profile = Profile::current();
     $stream = new ConversationNoticeStream($convId, $profile);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     $this->notices = $notice->fetchAll();
     $originalConversation = new Notice();
     $originalConversation->whereAdd('conversation=' . $convId);
     $originalConversation->limit(1);
     $originalConversation->orderBy('created');
     $originalConversation->find();
     if ($originalConversation->fetch()) {
         $this->originalNotice = $originalConversation;
     }
     return true;
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:35,代码来源:apiconversation.php


示例10: SendEmail

 public function SendEmail()
 {
     /*
      * validate the Inputs sent
      */
     $rules = array('email_cc' => "required_if:email_to,''|required_if:email_bcc,''", 'email_to' => "required_if:email_cc,''|required_if:email_bcc,''", 'email_bcc' => "required_if:email_cc,''|required_if:email_to,''", 'message' => 'required', 'subject' => 'required');
     $messages = array("required_without" => "Please select atleast one recipient", "subject.required" => "Please enter message subject", "message.required" => "Please enter message to send");
     $validator = Validator::make(Input::all(), $rules, $messages);
     $messages = $validator->messages();
     if ($validator->fails()) {
         return Redirect::to(URL::previous())->withErrors($validator)->withInput();
     } else {
         if (Conversation::saveEmail()) {
             Session::flash('_feedback', '<div class="alert alert-info alert-dismissable">
                             <i class="fa fa-info"></i>
                             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b>
                             Email has been successfully queued for sending</div>');
             //Helpers::uploadCampaignFile(Input::file('attachment'), $attachment_ref);
             return Redirect::to(URL::route('conversation'));
         } else {
             Session::flash('_feedback', '<div class="alert alert-info alert-dismissable">
                             <i class="fa fa-info"></i>
                             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b>
                             Error occured, please try again later</div>');
             return Redirect::to(URL::route('conversation'));
         }
     }
 }
开发者ID:centaurustech,项目名称:bmradi,代码行数:28,代码来源:SendEmailController.php


示例11: unserialize

 /**
  * {@inheritdoc}
  */
 public function unserialize($data)
 {
     $data = unserialize($data);
     $conversation = \Conversation::get($data['conversation']);
     $players = \Player::arrayIdToModel($data['players']);
     $teams = \Team::arrayIdToModel($data['teams']);
     $this->__construct($conversation, array_merge($players, $teams));
 }
开发者ID:blast007,项目名称:bzion,代码行数:11,代码来源:ConversationJoinEvent.php


示例12: getChats

 public static function getChats($message_hash, $data)
 {
     if ($data == '') {
         Conversation::updateConversation($message_hash);
     }
     $result = DB::Select("SELECT target_user_id as recipient_id,source_user_id as sender_id,(SELECT CONCAT(firstname,' ', lastname) \n                FROM accounts_dbx WHERE account_id = mradi_messages.source_user_id)  AS sender,CONCAT(firstname,' ', lastname) as recipient,\n                `time_sent`,`mradi_messages`.`message`,(case when time_read is not null then 1 else 0 end)as time_read FROM `mradi_messages` \n                LEFT JOIN `accounts_dbx` ON `accounts_dbx`.`account_id` = `mradi_messages`.`target_user_id`\n                WHERE message_hash = ? AND `mradi_messages`.`status` IN (0,1) order by time_sent asc", array($message_hash));
     return $result;
 }
开发者ID:centaurustech,项目名称:bmradi,代码行数:8,代码来源:Conversation.php


示例13: index

 public function index()
 {
     $this->template->title = "Test Controller";
     Conversation::factory();
     Conversation::last_conversation()->view();
     $this->template->content = Conversation::last_conversation()->flushBuffer();
     $form = new Forge();
     print_r(class_parents($form));
 }
开发者ID:jrschumacher,项目名称:oets,代码行数:9,代码来源:test.php


示例14: create

 /**
  * Factory method for creating a new conversation
  *
  * @return Conversation the new conversation DO
  */
 static function create()
 {
     $conv = new Conversation();
     $conv->created = common_sql_now();
     $id = $conv->insert();
     if (empty($id)) {
         common_log_db_error($conv, 'INSERT', __FILE__);
         return null;
     }
     $orig = clone $conv;
     $orig->uri = common_local_url('conversation', array('id' => $id), null, null, false);
     $result = $orig->update($conv);
     if (empty($result)) {
         common_log_db_error($conv, 'UPDATE', __FILE__);
         return null;
     }
     return $conv;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:23,代码来源:Conversation.php


示例15: forPlayer

 /**
  * Only return messages that are sent from/to a specific player
  *
  * @param  Player $player The player related to the messages
  * @return self
  */
 public function forPlayer($player)
 {
     $this->extras .= '
         LEFT JOIN player_conversations ON player_conversations.conversation=conversations.id
     ';
     $this->column('player_conversations.player')->is($player);
     $this->column('conversations.status')->isOneOf(Conversation::getActiveStatuses());
     return $this;
 }
开发者ID:blast007,项目名称:bzion,代码行数:15,代码来源:ConversationQueryBuilder.php


示例16: index

 /**
  * Display a listing of user conversations.
  *
  * @return Response
  */
 public function index($user_id)
 {
     $conversations_users = ConversationUser::where('user_id', $user_id)->lists('conversation_id');
     $conversations = array();
     if ($conversations_users) {
         $conversations = Conversation::whereIn('id', $conversations_users)->get();
     }
     return Response::json(['success' => true, 'result' => $conversations]);
 }
开发者ID:thantai574,项目名称:laravel-realtime-chat,代码行数:14,代码来源:ConversationUserController.php


示例17: makeAll

 /**
  * @param DemoDataHelper $demoDataHelper
  */
 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("User")');
     assert('$demoDataHelper->isSetRange("Account")');
     $conversations = array();
     foreach (self::getConversationData() as $randomConversationData) {
         $postData = array();
         $conversation = new Conversation();
         $conversation->setScenario('importModel');
         $conversation->owner = $demoDataHelper->getRandomByModelName('User');
         $conversation->createdByUser = $conversation->owner;
         $conversation->conversationItems->add($demoDataHelper->getRandomByModelName('Account'));
         $conversation->subject = $randomConversationData['subject'];
         $conversation->description = $randomConversationData['description'];
         //Add some comments
         foreach ($randomConversationData['comments'] as $commentDescription) {
             $comment = new Comment();
             $comment->setScenario('importModel');
             $comment->createdByUser = $demoDataHelper->getRandomByModelName('User');
             $comment->description = $commentDescription;
             $conversation->comments->add($comment);
             self::addItemIdToPostData($postData, $comment->createdByUser->getClassId('Item'));
         }
         //Add Super user
         $comment = new Comment();
         $comment->description = 'Great idea guys. Keep it coming.';
         $conversation->comments->add($comment);
         self::addItemIdToPostData($postData, Yii::app()->user->userModel->getClassId('Item'));
         $saved = $conversation->save();
         assert('$saved');
         //any user who has made a comment should be added as a participant and resolve permissions
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($conversation);
         ConversationParticipantsUtil::resolveConversationHasManyParticipantsFromPost($conversation, $postData, $explicitReadWriteModelPermissions);
         $saved = $conversation->save();
         assert('$saved');
         $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($conversation, $explicitReadWriteModelPermissions);
         $saved = $conversation->save();
         assert('$success');
         $conversations[] = $conversation->id;
     }
     $demoDataHelper->setRangeByModelName('Conversation', $conversations[0], $conversations[count($conversations) - 1]);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:46,代码来源:ConversationsDemoDataMaker.php


示例18: onTeamMembershipChange

 /**
  * Called every time a member is added/removed from a team
  *
  * @param TeamAbandonEvent|TeamJoinEvent|TeamKickEvent $event The event
  * @param string $type The type of the event
  */
 public function onTeamMembershipChange(Event $event, $type)
 {
     $query = \Conversation::getQueryBuilder()->forTeam($event->getTeam());
     foreach ($query->getModels() as $conversation) {
         \ConversationEvent::storeEvent($conversation->getId(), $event, $type);
         if ($type === 'team.join') {
             $conversation->addMember($event->getPlayer(), $distinct = false);
         }
     }
 }
开发者ID:blast007,项目名称:bzion,代码行数:16,代码来源:ConversationSubscriber.php


示例19: prepare

 /**
  * Initialization.
  *
  * @param array $args Web and URL arguments
  *
  * @return boolean false if id not passed in
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $convId = $this->int('id');
     $this->conv = Conversation::getKV('id', $convId);
     if (!$this->conv instanceof Conversation) {
         throw new ClientException('Could not find specified conversation');
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:17,代码来源:conversation.php


示例20: showAll

 public function showAll()
 {
     $user = Confide::user();
     $conversations = Conversation::where('sender', '=', $user->id)->orWhere('receiver', '=', $user->id)->orderBy('created_at', 'desc')->get();
     foreach ($conversations as $conversation) {
         $conversation->sender = User::find($conversation->sender);
         $conversation->receiver = User::find($conversation->receiver);
     }
     return View::make('home/conversation/show-all', compact('user', 'conversations'));
 }
开发者ID:carlosqueiroz,项目名称:medical-management-system,代码行数:10,代码来源:ConversationController.php



注:本文中的Conversation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Convert类代码示例发布时间:2022-05-23
下一篇:
PHP Controller_Template类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap