当前位置: 首页>>代码示例>>PHP>>正文


PHP Conversation::save方法代码示例

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


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

示例1: 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

示例2: 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 = 'super@zurmo.org';
     $steven->primaryEmail->emailAddress = 'steven@zurmo.org';
     $jack->primaryEmail->emailAddress = 'jack@zurmo.org';
     $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

示例3: 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

示例4: testGetCommentsByRelatedModelTypeIdAndPageSize

 /**
  * Using conversation to test this method.
  */
 public function testGetCommentsByRelatedModelTypeIdAndPageSize()
 {
     $super = Yii::app()->user->userModel;
     $comment1 = new Comment();
     $comment1->description = 'Comment 1';
     $comment2 = new Comment();
     $comment2->description = 'Comment 2';
     $comment3 = new Comment();
     $comment3->description = 'Comment 3';
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'My test subject';
     $conversation->description = 'My test description';
     $this->assertTrue($conversation->save());
     $conversation->comments->add($comment1);
     $conversation->comments->add($comment2);
     $conversation->comments->add($comment3);
     $this->assertTrue($conversation->save());
     $commentsData = Comment::getCommentsByRelatedModelTypeIdAndPageSize('Conversation', $conversation->id, 5);
     $this->assertEquals(3, count($commentsData));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:24,代码来源:CommentTest.php

示例5: testSearchByType

 public function testSearchByType()
 {
     $super = User::getByUsername('super');
     $steven = User::getByUsername('steven');
     Yii::app()->user->userModel = $super;
     $conversationModel = new Conversation(false);
     $searchAttributes = array();
     $conversation = new Conversation();
     $conversation->owner = $steven;
     $conversation->subject = 'My test subject';
     $conversation->description = 'My test description';
     $this->assertTrue($conversation->save());
     $conversationId = $conversation->id;
     //Super dont have created conversations
     $metadataAdapter = new ConversationsSearchDataProviderMetadataAdapter($conversationModel, $super->id, $searchAttributes, ConversationsSearchDataProviderMetadataAdapter::LIST_TYPE_CREATED);
     $searchAttributeData = $metadataAdapter->getAdaptedMetadata();
     $dataProvider = new RedBeanModelDataProvider('Conversation', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
     $this->assertEquals(0, count($data));
     //Super dont participate in any conversations
     $metadataAdapter = new ConversationsSearchDataProviderMetadataAdapter($conversationModel, $super->id, $searchAttributes, ConversationsSearchDataProviderMetadataAdapter::LIST_TYPE_PARTICIPANT);
     $searchAttributeData = $metadataAdapter->getAdaptedMetadata();
     $dataProvider = new RedBeanModelDataProvider('Conversation', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
     $this->assertEquals(0, count($data));
     //Super dont participate in any closed conversations
     $metadataAdapter = new ConversationsSearchDataProviderMetadataAdapter($conversationModel, $super->id, $searchAttributes, ConversationsSearchDataProviderMetadataAdapter::LIST_TYPE_CLOSED);
     $searchAttributeData = $metadataAdapter->getAdaptedMetadata();
     $dataProvider = new RedBeanModelDataProvider('Conversation', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
     $this->assertEquals(0, count($data));
     //Super participate in one conversation
     $conversation = Conversation::getById($conversationId);
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $super;
     $conversation->conversationParticipants->add($conversationParticipant);
     $this->assertTrue($conversation->save());
     $metadataAdapter = new ConversationsSearchDataProviderMetadataAdapter($conversationModel, $super->id, $searchAttributes, ConversationsSearchDataProviderMetadataAdapter::LIST_TYPE_PARTICIPANT);
     $searchAttributeData = $metadataAdapter->getAdaptedMetadata();
     $dataProvider = new RedBeanModelDataProvider('Conversation', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
     $this->assertEquals(1, count($data));
     //Super participate in a closed conversation
     $conversation = Conversation::getById($conversationId);
     $conversation->isClosed = true;
     $this->assertTrue($conversation->save());
     $metadataAdapter = new ConversationsSearchDataProviderMetadataAdapter($conversationModel, $super->id, $searchAttributes, ConversationsSearchDataProviderMetadataAdapter::LIST_TYPE_CLOSED);
     $searchAttributeData = $metadataAdapter->getAdaptedMetadata();
     $dataProvider = new RedBeanModelDataProvider('Conversation', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
     $this->assertEquals(1, count($data));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:52,代码来源:ConversationsSearchWithDataProviderTest.php

示例6: testAddParicipantAndHaveParticipantRemoveSelf

 public function testAddParicipantAndHaveParticipantRemoveSelf()
 {
     return;
     //Turn on once issue is fixed with SECURITY_OPTIMIZED and this bug.
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $fileModel = ZurmoTestHelper::createFileModel();
     $accounts = Account::getByName('anAccount');
     $steven = UserTestHelper::createBasicUser('steven');
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'My test subject';
     $conversation->description = 'My test description';
     $this->assertTrue($conversation->save());
     $sally = UserTestHelper::createBasicUser('sally');
     $conversation->addPermissions($sally, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $conversation->save();
     //Log in as sally, and remove her permission
     Yii::app()->user->userModel = $sally;
     //Breaks because SecurableItem 2 spots using SECURITY_OPTIMIZATION == false, think it is the first spot
     //todo: fix.
     $conversation->removePermissions(Yii::app()->user->userModel, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER, Permission::ALLOW);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:ConversationPermissionTest.php

示例7: create

 public function create($recipient = null)
 {
     $user = Confide::user();
     $users = array();
     $userModels = null;
     if ($user->isStaff()) {
         $userModels = DB::table('doctor_patient')->where('doctor_patient.staff_id', '=', $user->id)->join('user', 'doctor_patient.user_id', '=', 'user.id')->select('user.id', 'first_name', 'last_name')->get();
         $users[''] = "-- Select a Patient --";
     } else {
         $userModels = DB::table('doctor_patient')->where('doctor_patient.user_id', '=', $user->id)->join('user', 'doctor_patient.staff_id', '=', 'user.id')->select('user.id', 'first_name', 'last_name')->get();
         $users[''] = "-- Select a Doctor --";
     }
     // Create users array
     foreach ($userModels as $userModel) {
         if ($user->isStaff()) {
             $users[$userModel->id] = $userModel->first_name . " " . $userModel->last_name;
         } else {
             $users[$userModel->id] = "Dr. " . $userModel->first_name . " " . $userModel->last_name;
         }
     }
     if (Request::isMethod('GET')) {
         return View::make('home/conversation/create', compact('user', 'users', 'recipient'));
     } elseif (Request::isMethod('POST')) {
         $messages = array();
         $validator = Validator::make(Input::all(), array('user_id' => 'required', 'subject' => 'required', 'message' => 'required'), array('user_id.required' => 'You must select a recipient.', 'subject.required' => 'You must include a subject.', 'messages.required' => 'You must include a message.'));
         // Get other errors
         if ($validator->fails()) {
             $messageBag = $validator->messages();
             foreach ($messageBag->all(':message<br>') as $message) {
                 $messages[] = $message;
             }
         }
         if (empty($messages)) {
             // Create a new Appointment with the given data
             $conversation = new Conversation();
             $conversation->fill(Input::all());
             $conversation->sender = $user->id;
             $conversation->receiver = Input::get('user_id');
             $conversation->save();
             return Redirect::route('conversation.show.all');
         } else {
             // Flash data to session vars to repopulate form later
             Input::flash();
             // Compile error messages
             $messages = implode($messages);
             return Redirect::route('conversation.create')->with(array('message' => 'Error:<br>' . $messages, 'message_type' => 'error'));
         }
     }
 }
开发者ID:carlosqueiroz,项目名称:medical-management-system,代码行数:49,代码来源:ConversationController.php

示例8: 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

示例9: 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());
     //No message was sent because Steven and Jack don't have primary email address
     CommentsUtil::sendNotificationOnNewComment($conversation, $comment, $super, array($steven, $jack));
     $this->assertEquals(0, Yii::app()->emailHelper->getQueuedCount());
     $this->assertEquals(0, Yii::app()->emailHelper->getSentCount());
     $super->primaryEmail->emailAddress = 'super@zurmo.org';
     $steven->primaryEmail->emailAddress = 'steven@zurmo.org';
     $jack->primaryEmail->emailAddress = 'jack@zurmo.org';
     $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, $super, 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);
     //One email message was sent to Super but not to Steven
     UserConfigurationFormAdapter::setValue($steven, true, 'turnOffEmailNotifications');
     CommentsUtil::sendNotificationOnNewComment($conversation, $comment, $jack, 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));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:43,代码来源:CommentsUtilTest.php

示例10: testGetUnreadConversationCount

 /**
  * @depends testResolveConversationParticipantsForExplicitModelPermissions
  */
 public function testGetUnreadConversationCount()
 {
     $super = User::getByUsername('super');
     $mary = User::getByUsername('mary');
     $count = Conversation::getUnreadCountByUser($super);
     $account2 = AccountTestHelper::createAccountByNameForOwner('anAccount2', $super);
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'My test subject2';
     $conversation->description = 'My test description2';
     $conversation->conversationItems->add($account2);
     $this->assertTrue($conversation->save());
     //when super adds a comment, it should remain same count
     $comment = new Comment();
     $comment->description = 'This is my first comment';
     $conversation->comments->add($comment);
     $this->assertTrue($conversation->save());
     $count = Conversation::getUnreadCountByUser($super);
     $this->assertEquals(1, $count);
     //Add mary as a participant
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($conversation);
     $postData = array();
     $postData['itemIds'] = $super->getClassId('Item') . ',' . $mary->getClassId('Item');
     // Not Coding Standard
     ConversationParticipantsUtil::resolveConversationHasManyParticipantsFromPost($conversation, $postData, $explicitReadWriteModelPermissions);
     $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($conversation, $explicitReadWriteModelPermissions);
     $this->assertTrue($success);
     $conversation->save();
     //when mary adds a comment, super's count should go up (assumming count was previously 0)
     Yii::app()->user->userModel = $mary;
     $comment = new Comment();
     $comment->description = 'This is mary\'s first comment';
     $conversation->comments->add($comment);
     $this->assertTrue($conversation->save());
     Yii::app()->user->userModel = $super;
     $count = Conversation::getUnreadCountByUser($super);
     $this->assertEquals(2, $count);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:41,代码来源:ConversationTest.php

示例11: testResolveEmailInvitesByPeople

 /**
  * @depends testResolveConversationParticipants
  */
 public function testResolveEmailInvitesByPeople()
 {
     $this->assertEquals(0, Notification::getCount());
     $this->assertEquals(0, EmailMessage::getCount());
     $super = Yii::app()->user->userModel;
     $super->primaryEmail->emailAddress = 'super@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($super, 'ConversationInvites');
     $jack = User::getByUsername('jack');
     $jack->primaryEmail->emailAddress = 'jack@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($jack, 'ConversationInvites', true, false);
     $steven = User::getByUsername('steven');
     $steven->primaryEmail->emailAddress = 'steven@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($steven, 'ConversationInvites', false, true);
     $mary = User::getByUsername('mary');
     $mary->primaryEmail->emailAddress = 'mary@zurmo.com';
     NotificationTestHelper::setNotificationSettingsForUser($mary, 'ConversationInvites', false, false);
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'Test Resolve Conversation Participants';
     $conversation->description = 'This is for testing conversation participants.';
     $this->assertTrue($conversation->save());
     ConversationParticipantsUtil::resolveEmailInvitesByPeople($conversation, array($super, $jack, $steven, $mary));
     $this->assertEquals(2, Notification::getCount());
     $notifications = Notification::getAll();
     $this->assertContains('<h2 class="h2">Join the Conversation</h2>Clark Kent would like you to join a conversation <strong>"Test Resolve Conversation Participants"</strong><br/>', $notifications[0]->notificationMessage->htmlContent);
     $this->assertContains('Clark Kent would like you to join a conversation "Test Resolve Conversation Participants"', $notifications[0]->notificationMessage->textContent);
     $this->assertEquals(2, EmailMessage::getCount());
     $emailMessages = EmailMessage::getAll();
     $this->assertContains('<h2 class="h2">Join the Conversation</h2>Clark Kent would like you to join a conversation <strong>"Test Resolve Conversation Participants"</strong><br/>', $emailMessages[0]->content->htmlContent);
     $this->assertContains('Powered By <a href="http://www.zurmo.com">Zurmo</a>', $emailMessages[0]->content->htmlContent);
     $this->assertContains('Clark Kent would like you to join a conversation "Test Resolve Conversation Participants"', $emailMessages[0]->content->textContent);
     $this->assertContains('Manage your email preferences', $emailMessages[0]->content->textContent);
     $this->assertEquals('You have been invited to participate in a conversation', $emailMessages[0]->subject);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:37,代码来源:ConversationParticipantsUtilTest.php

示例12: testResolveConversationParticipants

 /**
  * @depends testIsUserAParticipant
  */
 public function testResolveConversationParticipants()
 {
     $super = Yii::app()->user->userModel;
     $jack = UserTestHelper::createBasicUser('jack');
     $steven = User::getByUsername('steven');
     $conversation = new Conversation();
     $conversation->owner = Yii::app()->user->userModel;
     $conversation->subject = 'Test Resolve Conversation Participants';
     $conversation->description = 'This is for testing conversation participants.';
     $this->assertTrue($conversation->save());
     $participants = ConversationParticipantsUtil::getConversationParticipants($conversation);
     $this->assertEquals(0, count($participants));
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $jack;
     $conversation->conversationParticipants->add($conversationParticipant);
     $this->assertEquals(0, count($participants));
     $participants = ConversationParticipantsUtil::getConversationParticipants($conversation);
     $this->assertEquals(1, count($participants));
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $steven;
     $conversation->conversationParticipants->add($conversationParticipant);
     $participants = ConversationParticipantsUtil::getConversationParticipants($conversation);
     $this->assertEquals(2, count($participants));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:27,代码来源:ConversationParticipantsUtilTest.php

示例13: testMarkReadUnreadMassActionByModel

 public function testMarkReadUnreadMassActionByModel()
 {
     $super = User::getByUsername('super');
     //Conversation model
     $conversation = new Conversation();
     $conversation->owner = $super;
     $conversation->subject = 'My test conversation subject';
     $conversation->description = 'My test conversation description';
     $this->assertTrue($conversation->save());
     $conversationId = $conversation->id;
     $this->assertTrue((bool) ConversationsUtil::hasUserReadConversationLatest($conversation, $super));
     //Mark conversation as unread
     $selectedIds = $conversationId;
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->setGetArray(array('ajax' => 'list-view', 'modelClassName' => 'Conversation', 'MashableInboxForm' => array('massAction' => 'markUnread', 'selectedIds' => $selectedIds)));
     $content = $this->runControllerWithNoExceptionsAndGetContent('mashableInbox/default/list');
     $conversation = Conversation::getById($conversationId);
     $this->assertFalse((bool) ConversationsUtil::hasUserReadConversationLatest($conversation, $super));
     //Mark conversation as read
     $this->setGetArray(array('ajax' => 'list-view', 'modelClassName' => 'Conversation', 'MashableInboxForm' => array('massAction' => 'markRead', 'selectedIds' => $selectedIds)));
     $content = $this->runControllerWithNoExceptionsAndGetContent('mashableInbox/default/list');
     $conversation = Conversation::getById($conversationId);
     $this->assertTrue((bool) ConversationsUtil::hasUserReadConversationLatest($conversation, $super));
     //Mission model
     $mission = new Mission();
     $mission->owner = $super;
     $mission->description = 'My test mission description';
     $mission->status = Mission::STATUS_AVAILABLE;
     $this->assertTrue($mission->save());
     $missionId = $mission->id;
     $this->assertTrue((bool) MissionsUtil::hasUserReadMissionLatest($mission, $super));
     //Mark mission as unread
     $selectedIds = $missionId;
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->setGetArray(array('ajax' => 'list-view', 'modelClassName' => 'Mission', 'MashableInboxForm' => array('massAction' => 'markUnread', 'selectedIds' => $selectedIds)));
     $content = $this->runControllerWithNoExceptionsAndGetContent('mashableInbox/default/list');
     $mission = Mission::getById($missionId);
     $this->assertFalse((bool) MissionsUtil::hasUserReadMissionLatest($mission, $super));
     //Mark mission as read
     $this->setGetArray(array('ajax' => 'list-view', 'modelClassName' => 'Mission', 'MashableInboxForm' => array('massAction' => 'markRead', 'selectedIds' => $selectedIds)));
     $content = $this->runControllerWithNoExceptionsAndGetContent('mashableInbox/default/list');
     $mission = Mission::getById($missionId);
     $this->assertTrue((bool) MissionsUtil::hasUserReadMissionLatest($mission, $super));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:44,代码来源:MashableInboxUserWalkthroughTest.php

示例14: createNewConversation

 public function createNewConversation()
 {
     $user = Auth::user();
     $input = Input::all();
     // get the lastest conversation ID
     $conversation = new Conversation();
     $conversation->name = "Untitled Conversation";
     $conversation->lastest_message = "The room has been created !";
     $conversation->leader_id = $user['id'];
     // save to database
     $conversation->save();
     // return to the browser
     return json_encode($conversation->id);
 }
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:14,代码来源:GroupMessageController.php

示例15: createAndSaveNewConversationForUser

 protected function createAndSaveNewConversationForUser(User $owner, User $participant)
 {
     foreach (Conversation::getAll() as $conversation) {
         $conversation->delete();
     }
     $conversation = new Conversation();
     $conversation->owner = $owner;
     $conversation->subject = 'My test conversation subject';
     $conversation->description = 'My test conversation description';
     $conversationParticipant = new ConversationParticipant();
     $conversationParticipant->person = $participant;
     $conversation->conversationParticipants->add($conversationParticipant);
     $this->assertTrue($conversation->save());
     return $conversation;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:ConversationsMashableInboxRulesTest.php


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