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


PHP AuditEvent::getTailDistinctEventsByEventName方法代码示例

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


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

示例1: testGetTailDistinctEventsByEventName

 public function testGetTailDistinctEventsByEventName()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $account1 = new Account();
     $account1->name = 'Dooble1';
     $this->assertTrue($account1->save());
     $account2 = new Account();
     $account2->name = 'Dooble2';
     $this->assertTrue($account2->save());
     $account3 = new Account();
     $account3->name = 'Dooble3';
     $account3->owner = User::getByUsername('jimmy');
     $this->assertTrue($account3->save());
     $auditEvents = AuditEvent::getTailDistinctEventsByEventName('Item Viewed', Yii::app()->user->userModel, 5);
     $this->assertEquals(0, count($auditEvents));
     //Now create some audit entries for the Item Viewed event.
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($account1), 'AccountsModule'), $account1);
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($account2), 'AccountsModule'), $account2);
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($account1), 'AccountsModule'), $account1);
     //Switch users to add an audit event.
     Yii::app()->user->userModel = User::getByUsername('jimmy');
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($account3), 'AccountsModule'), $account3);
     Yii::app()->user->userModel = User::getByUsername('super');
     $auditEvents = AuditEvent::getTailDistinctEventsByEventName('Item Viewed', Yii::app()->user->userModel, 5);
     $this->assertEquals(2, count($auditEvents));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:AuditingTest.php

示例2: getRecentlyViewedAuditEventsByUser

 /**
  * Given a user and a count, get a tail of recent audit events for that user limited by the count.
  * @param User $user
  */
 protected static function getRecentlyViewedAuditEventsByUser(User $user, $count)
 {
     assert('is_int($count)');
     return AuditEvent::getTailDistinctEventsByEventName('Item Viewed', $user, $count);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:9,代码来源:AuditEventsRecentlyViewedUtil.php


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