HelPHP

Notification
in package

Tags
class

Notification

The notification class, is used by the notification module to send notifications messages to a user, a group of user, or administrator.

it can get various level 1 to 3 and different types :

  • 1 a simple notification visible in notification module display
  • 2 a popup modal dialog for more urgent ones.
  • 3 a totaly invisible one that carrying some js code to execute. this one is for maintenance or user UI debug or for emergencies (like forced logout due to urgent maintenance)

Table of Contents

Methods

__construct()  : mixed
check()  : int
Check if the same notification exist.
create()  : mixed
Create a notification
delete()  : mixed
Delete a notification

Methods

check()

Check if the same notification exist.

public static check(string $name, string $description, string $action, mixed $id_user[, mixed $must_inc = false ]) : int
Parameters
$name : string

Notification's name.

$description : string

Notification's description.

$action : string

Notification's action.

$id_user : mixed
$must_inc : mixed = false
Return values
int

Indicates the number of this notification.

create()

Create a notification

public static create(string $name, string $description[, int $level = 1 ][, string $type = '' ][, string $target = '' ][, string $action = '' ][, string $action_name = '' ][, bool $must_inc = true ][, bool $force_new = false ]) : mixed
Parameters
$name : string

Notification's name

$description : string

Notification's description

$level : int = 1

Notification's level 1 (normal), 2 (warning), 3 (alert). Defaults to 1.

$type : string = ''

Type of target to send the notification, the value of this field determine what is the parameter $target '1' user id given as target '2' group name given as target '3' all users '4' admin users '11' same as 1 but in a popup modale box '12' same as 2 but in a popup modale box '13' same as 3 but in a popup modale box '21' same as 1 but it's an hidden js call contained in action field or description field. '22' same as 2 but it's an hidden js call contained in action field or description field. '23' same as 3 but it's an hidden js call contained in action field or description field.

$target : string = ''

The target that will receive the notification, may be an user id or a group name

$action : string = ''

Optional. Will be applied when the notification is received. Defaults to ''.

$action_name : string = ''

Optional. Complete the previous parameter. Defaults to ''.

$must_inc : bool = true

Optional. Tell to increment or not the occurence of a same notification. Defaults to true.

$force_new : bool = false

Optional. Force the creation of a new notification

delete()

Delete a notification

public static delete(string $name, string $description, string $action, string $action_name) : mixed
Parameters
$name : string

Notification's name

$description : string

Notification's description

$action : string

Notification's action

$action_name : string

Notification's action_name


        
On this page

Search results