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


PHP Conversation::getUnreadCountByUser方法代码示例

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


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

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

示例2: getUnreadCountTabMenuContentForCurrentUser

 /**
  * For the current user, render a string of how many unread conversations exist for the user.
  * @return string
  */
 public static function getUnreadCountTabMenuContentForCurrentUser()
 {
     return Conversation::getUnreadCountByUser(Yii::app()->user->userModel);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:ConversationsUtil.php


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