class Notification

Class Notification

Constants

deprecated TYPE_ACTIVITY

deprecated TYPE_TODO

deprecated TYPE_MESSAGE

deprecated TYPES

deprecated STATUS_READ

RETURN_TYPE_MODEL_COLLECTION

Methods

bulk(array $recipientIds, NotificationMessage $message)

No description

int|null
count_activity()

Count notifications

int|null
count_messages()

Count messages of types $status

int|null
count_todos()

Count todos

bool
email(mixed $email, string $subject, string $text, bool|string $cc = false, bool|string $bcc = false, array|bool $attachment = false, string $input_format = 'plaintext', array $optional = array())

Send an email with notification template

getActivityNotifications(string[] $status = [], int $user_id = null, int $timestamp = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

string
getCountsCacheKey(string $type, null|int $user_id = null)

No description

getMessageNotifications(string[] $status = [], int $user_id = null, int $timestamp = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

getTodoNotifications(int $user_id = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

array
getTodos(array $limitToTypes = [], bool $flat = false)

Returns the todo notification with added features:

  • Lookbook Friend requests
  • Pending workflows

get_notifications(int $user_id, string[] $status = [], int $timestamp = null, array $type_restriction = [], int|int[] $limit = null)

get all notifications

invalidate_counts(int|null $user_id = null)

Invalidate counts

markAllSeen(int $user_id = null)

mark seen notifications by user_id and typ

markReadBy(int $userId, string $token, string $instanceId)

No description

markSeen($notifications, $user_id = null)

No description

markSeenBy(int $userId, string $token, string $instanceId)

No description

mark_read(int $user_id, string $type = NotificationType::ACTIVITY)

mark seen notifications by user_id and typ

bool
messenger(int[]|int $recipient_users, string $subject, string $text, $attachments = [])

Send Messenger-Message

int
remove(mixed $instance_id, string $token, mixed $user_id = false)

Remove an existing notification (by Instance ID and Token) for all users or specific users Using $this->mod->notify()

bool
send(int|int[] $user_ids, string $subject, $text, bool $is_html = false, array $allowed_sending_methods = array('email', 'messenger'), array $attachment = false) deprecated

No description

bool
send_vars(mixed $user_ids, VarsTemplate $vars_object, array $allowed_sending_methods = array('email', 'messenger'), $attachment = false) deprecated

Send with Vars Object

Details

at line 267
bulk(array $recipientIds, NotificationMessage $message)

No description

Parameters

array $recipientIds
NotificationMessage $message

Exceptions

JsonException
ModuleException

at line 628
int|null count_activity()

Count notifications

Return Value

int|null

at line 567
int|null count_messages()

Count messages of types $status

Return Value

int|null

at line 587
int|null count_todos()

Count todos

Return Value

int|null

at line 162
bool email(mixed $email, string $subject, string $text, bool|string $cc = false, bool|string $bcc = false, array|bool $attachment = false, string $input_format = 'plaintext', array $optional = array())

Send an email with notification template

Parameters

mixed $email

email (string or array)

string $subject subject
string $text text
bool|string $cc

or array CC Emails (if string , or ; as separator)

bool|string $bcc

or array BCC Emails (if string , or ; as separator)

array|bool $attachment

Attachment of format: $attachment['binary'],$attachment['name'], $attachment['type'], $attachment['encoding'] = (default) base64, $attachment['embedded'] for embedded images

string $input_format

InputFormat [plaintext|html|fullhtml] Important: it's NOT the target format for the mail content (instead it is swapped)

  • plaintext | will be transformed into HTML with system-template
  • html | plaintext version will be generated with reverse_markdown
  • fullhtml | won't be transformed in any way and will be sent without system-template
array $optional

Return Value

bool success

at line 517
ModelCollection getActivityNotifications(string[] $status = [], int $user_id = null, int $timestamp = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

Parameters

string[] $status
int $user_id
int $timestamp

Return Value

ModelCollection

at line 543
string getCountsCacheKey(string $type, null|int $user_id = null)

No description

Parameters

string $type
null|int $user_id

Return Value

string

at line 502
ModelCollection getMessageNotifications(string[] $status = [], int $user_id = null, int $timestamp = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

Parameters

string[] $status
int $user_id
int $timestamp

Return Value

ModelCollection

at line 530
NotificationCollection getTodoNotifications(int $user_id = null)

This function returns a scoped but unloaded collection. You can apply limit and additional scopes

Parameters

int $user_id

Return Value

NotificationCollection

at line 391
array getTodos(array $limitToTypes = [], bool $flat = false)

Returns the todo notification with added features:

  • Lookbook Friend requests
  • Pending workflows

Parameters

array $limitToTypes
bool $flat

Return Value

array

['contacts' => "Friend Requests", 'workflows' => "Pending workflows", 'notifications' => 'notifications']

at line 484
ModelCollection get_notifications(int $user_id, string[] $status = [], int $timestamp = null, array $type_restriction = [], int|int[] $limit = null)

get all notifications

Parameters

int $user_id
string[] $status
int $timestamp

Will return only notifications which have been updated AFTER this time

array $type_restriction
int|int[] $limit

Return Value

ModelCollection

at line 554
invalidate_counts(int|null $user_id = null)

Invalidate counts

Parameters

int|null $user_id

at line 308
markAllSeen(int $user_id = null)

mark seen notifications by user_id and typ

Parameters

int $user_id

at line 335
markReadBy(int $userId, string $token, string $instanceId)

No description

Parameters

int $userId
string $token
string $instanceId

at line 299
markSeen($notifications, $user_id = null)

No description

Parameters

$notifications
$user_id

at line 349
markSeenBy(int $userId, string $token, string $instanceId)

No description

Parameters

int $userId
string $token
string $instanceId

at line 321
mark_read(int $user_id, string $type = NotificationType::ACTIVITY)

mark seen notifications by user_id and typ

Parameters

int $user_id
string $type self::TYPES

at line 129
bool messenger(int[]|int $recipient_users, string $subject, string $text, $attachments = [])

Send Messenger-Message

Parameters

int[]|int $recipient_users
string $subject
string $text
$attachments

Return Value

bool

at line 286
int remove(mixed $instance_id, string $token, mixed $user_id = false)

Remove an existing notification (by Instance ID and Token) for all users or specific users Using $this->mod->notify()

Parameters

mixed $instance_id Instance-ID
string $token

Token for updates for this Notification

mixed $user_id

User-ID or Array of Users

Return Value

int

Count of deleted notifications

at line 75
bool send(int|int[] $user_ids, string $subject, $text, bool $is_html = false, array $allowed_sending_methods = array('email', 'messenger'), array $attachment = false) deprecated

deprecated Please use NotificationBuilder buildAndPublish removal planned in XELOS 7.x

No description

Parameters

int|int[] $user_ids

or array of int user id to notify

string $subject

of message

$text
bool $is_html

default: false Set to true if passed text contains html

array $allowed_sending_methods

allowed sending methods: email and/or messenger; default array('email', 'messenger')

array $attachment

Attachment of format: $attachment['binary'],$attachment['name'], $attachment['type'], $attachment['encoding'] = (default) base64, $attachment['embedded'] for embedded images

Return Value

bool success

at line 51
bool send_vars(mixed $user_ids, VarsTemplate $vars_object, array $allowed_sending_methods = array('email', 'messenger'), $attachment = false) deprecated

deprecated Please use NotificationBuilder buildAndPublish

Send with Vars Object

Parameters

mixed $user_ids
VarsTemplate $vars_object
array $allowed_sending_methods

allowed sending methods: email and/or messenger; default array('email', 'messenger')

$attachment

Return Value

bool