Abstract Class humhub\modules\notification\targets\BaseTarget

Inheritancehumhub\modules\notification\targets\BaseTarget » yii\base\BaseObject
Subclasseshumhub\modules\notification\targets\MailTarget, humhub\modules\notification\targets\MobileTarget, humhub\modules\notification\targets\WebTarget

A BaseTarget is used to handle new Basenotifications. A BaseTarget may send nofication information to external services in specific formats or use specific protocols.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
acknowledge() Used to acknowledge the seding/processing of the given $notification. humhub\modules\notification\targets\BaseTarget
getId() Static access to the target id. humhub\modules\notification\targets\BaseTarget
getRenderer() humhub\modules\notification\targets\BaseTarget
getSettingKey() Returns the setting key for this target of the given $category. humhub\modules\notification\targets\BaseTarget
getTitle() humhub\modules\notification\targets\BaseTarget
handle() Used to handle a BaseNotification for a given $user. humhub\modules\notification\targets\BaseTarget
init() humhub\modules\notification\targets\BaseTarget
isAcknowledged() humhub\modules\notification\targets\BaseTarget
isActive() Some BaseTargets may need to be activated first or require a certain permission in order to be used. humhub\modules\notification\targets\BaseTarget
isCategoryEnabled() Returns the enabled setting of this target for the given $category. humhub\modules\notification\targets\BaseTarget
isEditable() Checks if the settings for this target are editable. humhub\modules\notification\targets\BaseTarget
isEnabled() Checks if the given $notification is enabled for this target. humhub\modules\notification\targets\BaseTarget
send() Used to process a $notification for the given $user. humhub\modules\notification\targets\BaseTarget
sendBulk() Used for handling the given $notification for multiple $users. humhub\modules\notification\targets\BaseTarget

Property Details

$acknowledgeFlag public property
public string $acknowledgeFlag null
$defaultSetting public property
public boolean $defaultSetting false
$id public property
public string $id null
$renderer public property
$title public property
public string $title null

Method Details

acknowledge() public method

Used to acknowledge the seding/processing of the given $notification.

public void acknowledge ( humhub\modules\notification\components\BaseNotification $notification, $state true )
$notification humhub\modules\notification\components\BaseNotification

Notification to be acknowledged

$state boolean

True if successful otherwise false

getId() public static method

Static access to the target id.

public static string getId ( )
getRenderer() public method

public humhub\components\rendering\Renderer getRenderer ( )
return humhub\components\rendering\Renderer

Default renderer for this target.

getSettingKey() public method

Returns the setting key for this target of the given $category.

public string getSettingKey ( $category )
$category humhub\modules\notification\components\NotificationCategory
getTitle() public abstract method

public abstract string getTitle ( )
return string

Human readable title for views.

handle() public abstract method

Used to handle a BaseNotification for a given $user.

The BaseTarget can handle the notification for example by pushing a Job to a Queue or directly handling the notification.

public abstract void handle ( humhub\modules\notification\components\BaseNotification $notification, humhub\modules\user\models\User $user )
$notification humhub\modules\notification\components\BaseNotification
$user
init() public method

public void init ( )
isAcknowledged() public method

public boolean isAcknowledged ( humhub\modules\notification\components\BaseNotification $notification )
$notification
return boolean

Check if the given $notification has already been processed.

isActive() public method

Some BaseTargets may need to be activated first or require a certain permission in order to be used.

This function checks if this target is active for the given user. If no user is given this function will determine if the target is globaly active or deactivated.

If a subclass does not overwrite this function it will be activated for all users by default.

public void isActive ( humhub\modules\user\models\User $user null )
$user humhub\modules\user\models\User
isCategoryEnabled() public method

Returns the enabled setting of this target for the given $category.

public boolean isCategoryEnabled ( humhub\modules\notification\components\NotificationCategory $category, humhub\modules\user\models\User $user null )
$category humhub\modules\notification\components\NotificationCategory
$user humhub\modules\user\models\User
isEditable() public method

Checks if the settings for this target are editable.

public boolean isEditable ( humhub\modules\user\models\User $user null )
$user
isEnabled() public method

Checks if the given $notification is enabled for this target.

If the $notification is not part of a NotificationCategory the $defaultSetting of this BaseTarget is returned.

If this BaseTarget is not active for the given $user, this function will return false.

See also:

public boolean isEnabled ( humhub\modules\notification\components\BaseNotification $notification, humhub\modules\user\models\User $user null )
$notification humhub\modules\notification\components\BaseNotification
$user humhub\modules\user\models\User
send() public method

Used to process a $notification for the given $user.

By default the $noification will be marked as acknowledged before processing. The processing is triggerd by calling $this->handle. If the processing fails the acknowledged mark will be set to false.

public void send ( humhub\modules\notification\components\BaseNotification $notification, humhub\modules\user\models\User $user )
$notification humhub\modules\notification\components\BaseNotification
$user
sendBulk() public method

Used for handling the given $notification for multiple $users.

public void sendBulk ( humhub\modules\notification\components\BaseNotification $notification, $users )
$notification humhub\modules\notification\components\BaseNotification
$users humhub\modules\user\models\User[]