ActivityPoint
in package
implements
ActivityPoint
Tags
Table of Contents
Interfaces
Constants
- ADDED_COLOR = '#31a24a'
- ALLOW_TYPES = ['activitypoint::phrase.type_all' => self::TYPE_ALL, 'activitypoint::phrase.type_earned' => self::TYPE_EARNED, 'activitypoint::phrase.type_bought' => self::TYPE_BOUGHT, 'activitypoint::phrase.type_sent' => self::TYPE_SENT, 'activitypoint::phrase.type_spent' => self::TYPE_SPENT, 'activitypoint::phrase.type_received' => self::TYPE_RECEIVED, 'activitypoint::phrase.type_retrieved' => self::TYPE_RETRIEVED]
- SUBTRACTED_COLOR = '#f02848'
- TOTAL_POINT_VALUE_NAME = 'total_activity_points'
- TYPE_ALL = 0
- TYPE_BOUGHT = 2
- TYPE_EARNED = 1
- TYPE_RECEIVED = 5
- TYPE_RETRIEVED = 6
- TYPE_SENT = 3
- TYPE_SPENT = 4
Properties
- $settingRepository : PointSettingRepositoryInterface
- $statisticRepository : PointStatisticRepositoryInterface
- $transactionRepository : PointTransactionRepositoryInterface
Methods
- __construct() : mixed
- addPoints() : int
- adjustPoints() : int|null
- convertPointFromPrice() : int
- createTransaction() : PointTransaction
- decreaseUserPointsWithAction() : bool
- getConversionRate() : float
- getMinPointByIds() : int
- getSettingActionsByPackageId() : array<int, mixed>
- getTotalActivityPoints() : int
- getUserPointBalance() : int
- giftPoints() : bool
- installCustomPointSettings() : void
- isAdded() : bool
- isCustomInstalled() : bool
- isPackageAvailableForPurchase() : bool
- isSubtracted() : bool
- proceedPayment() : bool
- updateActivityPoints() : bool
- updateStatistic() : PointStatistic
- updateUserPoints() : int
- addPointForOwnerItem() : void
- checkAdminCanSendPoint() : bool
- getSentPoint() : int
- getTimeByPeriod() : string
Constants
ADDED_COLOR
public
mixed
ADDED_COLOR
= '#31a24a'
ALLOW_TYPES
public
mixed
ALLOW_TYPES
= ['activitypoint::phrase.type_all' => self::TYPE_ALL, 'activitypoint::phrase.type_earned' => self::TYPE_EARNED, 'activitypoint::phrase.type_bought' => self::TYPE_BOUGHT, 'activitypoint::phrase.type_sent' => self::TYPE_SENT, 'activitypoint::phrase.type_spent' => self::TYPE_SPENT, 'activitypoint::phrase.type_received' => self::TYPE_RECEIVED, 'activitypoint::phrase.type_retrieved' => self::TYPE_RETRIEVED]
SUBTRACTED_COLOR
public
mixed
SUBTRACTED_COLOR
= '#f02848'
TOTAL_POINT_VALUE_NAME
public
mixed
TOTAL_POINT_VALUE_NAME
= 'total_activity_points'
TYPE_ALL
public
mixed
TYPE_ALL
= 0
TYPE_BOUGHT
public
mixed
TYPE_BOUGHT
= 2
TYPE_EARNED
public
mixed
TYPE_EARNED
= 1
TYPE_RECEIVED
public
mixed
TYPE_RECEIVED
= 5
TYPE_RETRIEVED
public
mixed
TYPE_RETRIEVED
= 6
TYPE_SENT
public
mixed
TYPE_SENT
= 3
TYPE_SPENT
public
mixed
TYPE_SPENT
= 4
Properties
$settingRepository
private
PointSettingRepositoryInterface
$settingRepository
$statisticRepository
private
PointStatisticRepositoryInterface
$statisticRepository
$transactionRepository
private
PointTransactionRepositoryInterface
$transactionRepository
Methods
__construct()
public
__construct(PointStatisticRepositoryInterface $statisticRepository, PointSettingRepositoryInterface $settingRepository, PointTransactionRepositoryInterface $transactionRepository) : mixed
Parameters
- $statisticRepository : PointStatisticRepositoryInterface
- $settingRepository : PointSettingRepositoryInterface
- $transactionRepository : PointTransactionRepositoryInterface
addPoints()
public
addPoints(User $context, User $owner, int $amount[, int|null $type = null ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
- $context : User
- $owner : User
- $amount : int
- $type : int|null = null
- $extra : array<string|int, mixed> = []
Tags
Return values
intadjustPoints()
public
adjustPoints(User $context, User $user, int $type, int $amount) : int|null
Parameters
Tags
Return values
int|nullconvertPointFromPrice()
public
convertPointFromPrice(string $currency, float $amount) : int
Parameters
- $currency : string
- $amount : float
Tags
Return values
intcreateTransaction()
public
createTransaction(User $user, User $owner, array<string|int, mixed> $data) : PointTransaction
Parameters
Tags
Return values
PointTransactiondecreaseUserPointsWithAction()
public
decreaseUserPointsWithAction(User $user, int $points, string $action, string $actionTypeName[, array<string|int, mixed> $actionParams = [] ]) : bool
Parameters
- $user : User
- $points : int
- $action : string
- $actionTypeName : string
- $actionParams : array<string|int, mixed> = []
Return values
boolgetConversionRate()
public
getConversionRate(string $currency) : float
Parameters
- $currency : string
Tags
Return values
floatgetMinPointByIds()
public
getMinPointByIds(array<string|int, mixed> $userIds) : int
Parameters
- $userIds : array<string|int, mixed>
Return values
intgetSettingActionsByPackageId()
public
getSettingActionsByPackageId(string $packageId) : array<int, mixed>
Parameters
- $packageId : string
Tags
Return values
array<int, mixed>getTotalActivityPoints()
public
getTotalActivityPoints(User $context) : int
Parameters
- $context : User
Tags
Return values
intgetUserPointBalance()
public
getUserPointBalance(User $context) : int
Parameters
- $context : User
Return values
intgiftPoints()
public
giftPoints(User $context, User $owner, int $points) : bool
Parameters
Tags
Return values
boolinstallCustomPointSettings()
public
installCustomPointSettings([array<string|int, mixed> $default = [] ]) : void
Parameters
- $default : array<string|int, mixed> = []
Tags
isAdded()
public
isAdded(int $type) : bool
Parameters
- $type : int
Return values
boolisCustomInstalled()
public
isCustomInstalled(string $packageId) : bool
Parameters
- $packageId : string
Tags
Return values
boolisPackageAvailableForPurchase()
public
isPackageAvailableForPurchase(User $user, PointPackage $package) : bool
Parameters
- $user : User
- $package : PointPackage
Return values
boolisSubtracted()
public
isSubtracted(int $type) : bool
Parameters
- $type : int
Return values
boolproceedPayment()
public
proceedPayment(Order $order) : bool
Parameters
- $order : Order
Tags
Return values
boolupdateActivityPoints()
public
updateActivityPoints(User $context, int $amount) : bool
Parameters
- $context : User
- $amount : int
Tags
Return values
boolupdateStatistic()
public
updateStatistic(User $context, int $type, int $amount) : PointStatistic
Parameters
- $context : User
- $type : int
- $amount : int
Return values
PointStatisticupdateUserPoints()
public
updateUserPoints(User $user, Entity $content, string $action, int $type[, bool $allowMultiTransactionsPerItem = false ]) : int
Parameters
- $user : User
- $content : Entity
- $action : string
- $type : int
- $allowMultiTransactionsPerItem : bool = false
Tags
Return values
intaddPointForOwnerItem()
protected
addPointForOwnerItem(User $user, User $owner, string $packageId, int $amount) : void
Parameters
checkAdminCanSendPoint()
private
checkAdminCanSendPoint(User $context, User $user, int $type, int $amount) : bool
Parameters
Return values
boolgetSentPoint()
private
getSentPoint(int $period) : int
Parameters
- $period : int
Return values
intgetTimeByPeriod()
private
getTimeByPeriod(int $period) : string
Parameters
- $period : int