Alternative syntax of addNotification function.
Syntax
createNotification( $params)
Arguments
params
array with parameters. Corresponds to respective parameters of addNotification function.
$params["message"] - message
$params["title"] - notification title
$params["icon"] - icon
$params["url"] - URL
$params["expire"] - expiration datetime or time in minutes
$permissions
Optional, null by default. Can be one of the following:
- not specified or null - all users will see this notification
- array with keys "user" and optional value "provider"
$permissions["user"] - username. Only this user will see the notification.
$permissions["provider"] - when the user is a database user, whose username and password are stored in a database table, this parameter must be empty. When the user is logged via from Active Directory, OpenID, Google etc, then put the two-letter security provider code here. You can find it on the 'Security screen' under the provider settings dialog.
- array with key "group"
$permissions["group"] - only members of this group will see the notification
- array with keys "table" and "page"
$permissions["table"] - name of the table, custom view, report or chart name.
$permissions["page"] - page name like "list", "list1" etc.
When this type of permissions is specified, only those users who have access to the specified page will see the notification.
$params["provider"] - security provider
Return value
No return value
Example
This example shows how to add a notification for all users when a new record added to the Categories table. This code needs to be added to AfterAdd event of the Categories table.
createNotification( array( "message" => "New category added: ".$values["CategoryName"] , "title" => "New category", "icon" => "fa-envelope") );
See also: