Skip to end of metadata
Go to start of metadata

$html = LBLog::get_notifications_html($package, $name, $type);

 

Returns HTML that shows all notifications of the specific package, and/or name and type. The HTML includes buttons to delete the notifications.

LoxBerry 1.0.3

This function is available starting with LoxBerry V1.0.3. If you use that function, set this minimum version in your plugin.cfg.

This function is not exported. Use LBLog::get_notifications_html to call it.


The $package is the owner of the notification. To show the notification bullet on the plugins page, this needs to be $lbpplugindir.

Inside the package, you can group your notifications by $name. For example, your plugin uses a cronjob and a daemon. Use "cronjob" and "daemon" as names to differentiate these notifications.

This is an example of an info notification. The button on the right deletes the notification.

Parameter

ParameterRequiredBeschreibung
$package
This is, where the message belongs to. In a plugin, always use the variable $lbpplugindir or constant LBPPLUGINDIR.
$name
The notification group, this notification belongs to. If you omit this parameter, all notifications of all groups are returned.
$type

undef = all

'all' = all

'error' = errors only

'info' = info only

Case sensitivity

The content of package and name is case-sensitive. If you set the NAME => "Daemon", you have to query "Daemon" in get_notifications and get_notifications_html.

Usage

require_once "loxberry_log.php";

# Request all notifications of the plugin of type error 
$html = LBLog::get_notifications_html( LBPPLUGINDIR, null, "error");
echo $html;

# Show all info messages of name 'daemon'
$html = LBLog::get_notifications_html( LBPPLUGINDIR, "daemon");
echo $html;

  • No labels