PHP Class BookStack\Services\ActivityService

显示文件 Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$activity
$permissionService
$user

Public Methods

Method Description
__construct ( Activity $activity, PermissionService $permissionService ) ActivityService constructor.
add ( Entity $entity, $activityKey, integer $bookId, boolean $extra = false ) Add activity data to database.
addMessage ( $activityKey, integer $bookId, boolean | false $extra = false ) Adds a activity history with a message & without binding to a entity.
entityActivity ( Entity $entity, integer $count = 20, integer $page ) : array Gets the latest activity for an entity, Filtering out similar items to prevent a message activity list.
latest ( integer $count = 20, integer $page ) : array Gets the latest activity.
removeEntity ( Entity $entity ) : mixed Removes the entity attachment from each of its activities and instead uses the 'extra' field with the entities name.
userActivity ( $user, integer $count = 20, integer $page ) : array Get latest activity for a user, Filtering out similar items.

Protected Methods

Method Description
filterSimilar ( Activity[] $activities ) : array Filters out similar activity.
setNotification ( $activityKey ) Flashes a notification message to the session if an appropriate message is available.

Method Details

__construct() public method

ActivityService constructor.
public __construct ( Activity $activity, PermissionService $permissionService )
$activity BookStack\Activity
$permissionService PermissionService

add() public method

Add activity data to database.
public add ( Entity $entity, $activityKey, integer $bookId, boolean $extra = false )
$entity BookStack\Entity
$activityKey
$bookId integer
$extra boolean

addMessage() public method

Adds a activity history with a message & without binding to a entity.
public addMessage ( $activityKey, integer $bookId, boolean | false $extra = false )
$activityKey
$bookId integer
$extra boolean | false

entityActivity() public method

Gets the latest activity for an entity, Filtering out similar items to prevent a message activity list.
public entityActivity ( Entity $entity, integer $count = 20, integer $page ) : array
$entity BookStack\Entity
$count integer
$page integer
return array

filterSimilar() protected method

Filters out similar activity.
protected filterSimilar ( Activity[] $activities ) : array
$activities BookStack\Activity[]
return array

latest() public method

Gets the latest activity.
public latest ( integer $count = 20, integer $page ) : array
$count integer
$page integer
return array

removeEntity() public method

Used when an entity is deleted.
public removeEntity ( Entity $entity ) : mixed
$entity BookStack\Entity
return mixed

setNotification() protected method

Flashes a notification message to the session if an appropriate message is available.
protected setNotification ( $activityKey )
$activityKey

userActivity() public method

Get latest activity for a user, Filtering out similar items.
public userActivity ( $user, integer $count = 20, integer $page ) : array
$user
$count integer
$page integer
return array

Property Details

$activity protected_oe property

protected $activity

$permissionService protected_oe property

protected $permissionService

$user protected_oe property

protected $user