SimpleAlert
extends Alert
in package
The SimpleAlert class is a type of alert that allows the developer to create alerts with pre-defined titles, messages, icons, and permissions.
Tags
Table of Contents
Constants
- PRIORITY_HIGH = '_high'
- High priority
- PRIORITY_LOW = '_low'
- Low/Simple priority
- PRIORITY_NORMAL = '_normal'
- Normal priority
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- The magic __get method.
- __set() : mixed
- The magic __set method.
- delete() : mixed
- Delete this alert from the database.
- get_icon() : string
- Return the alert icon URL (if any)
- get_message() : string
- Return the alert message
- get_prefname() : string
- Get the name of the preference that this alert will be stored as.
- get_title() : string
- Return the alert title.
- load_all() : mixed
- Load all known alerts from the database.
- load_by_name() : Alert
- Given an alert preference name, load it from the database.
- load_my_alerts() : array<string|int, Alert>
- Load all alerts that are suitable for the specified user id.
- save() : mixed
- Save an alert object to the database.
- decode_object() : Alert
- Decode a serialized object read from the database.
- encode_object() : string
- Encode an alert into a format suitable for storing
- get_fixed_prefname() : mixed
- is_for() : bool
- Givent he admin_uid, check if the specified uid has at least one of the permissions specified in the perms array.
Constants
PRIORITY_HIGH
High priority
public
mixed
PRIORITY_HIGH
= '_high'
PRIORITY_LOW
Low/Simple priority
public
mixed
PRIORITY_LOW
= '_low'
PRIORITY_NORMAL
Normal priority
public
mixed
PRIORITY_NORMAL
= '_normal'
Methods
__construct()
Constructor
public
__construct([array<string|int, string> $perms = null ]) : mixed
Parameters
- $perms : array<string|int, string> = null
-
An array of permission names. Or null.
__get()
The magic __get method.
public
__get(string $key) : mixed
Get a property from this object, or from the base class.
Parameters
- $key : string
Tags
__set()
The magic __set method.
public
__set(string $key, mixed $val) : mixed
Set a property for this object, or for the base Alert class.
Parameters
- $key : string
- $val : mixed
delete()
Delete this alert from the database.
public
delete() : mixed
get_icon()
Return the alert icon URL (if any)
public
get_icon() : string
Return values
stringget_message()
Return the alert message
public
get_message() : string
Return values
stringget_prefname()
Get the name of the preference that this alert will be stored as.
public
get_prefname([string $name = null ]) : string
Parameters
- $name : string = null
-
optionaly provide a name for the alert. If not specified the current alert name will be used.
Return values
stringget_title()
Return the alert title.
public
get_title() : string
Return values
stringload_all()
Load all known alerts from the database.
public
static load_all() : mixed
return Alert[]
load_by_name()
Given an alert preference name, load it from the database.
public
static load_by_name(string $name[, mixed $throw = true ]) : Alert
Parameters
- $name : string
-
The preference name
- $throw : mixed = true
Tags
Return values
Alertload_my_alerts()
Load all alerts that are suitable for the specified user id.
public
static load_my_alerts([int|null $uid = null ]) : array<string|int, Alert>
Parameters
- $uid : int|null = null
-
The admin userid to test for. If no uid is specified, the currently logged in admin user id is used.
Return values
array<string|int, Alert>save()
Save an alert object to the database.
public
save() : mixed
Tags
decode_object()
Decode a serialized object read from the database.
protected
static decode_object(string $serialized) : Alert
Parameters
- $serialized : string
-
A serialized array, containing an optional module name that must be loaded and the serialized alert object.
Return values
Alertencode_object()
Encode an alert into a format suitable for storing
protected
static encode_object(Alert $obj) : string
Parameters
- $obj : Alert
-
The object to be ecoded.
Return values
string —A serialized array, containing an optional module name that must be loaded, and the serrialized alert object.
get_fixed_prefname()
protected
static get_fixed_prefname(mixed $name) : mixed
Parameters
- $name : mixed
is_for()
Givent he admin_uid, check if the specified uid has at least one of the permissions specified in the perms array.
protected
is_for(int $admin_uid) : bool
Parameters
- $admin_uid : int