Zum Ende der Metadaten springen
Zum Anfang der Metadaten

$html = LBWeb::loglist_button_html( @params );

 

Returns HTML code for a button to a list of logfiles. This function accepts parameters from LBLog / LoxBerry::Log to show all logfiles of your plugin, and also can filter to a log group name with the NAME parameter.

LoxBerry Compatibility

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

This function only works for logfiles created by the PHP LBLog or the LoxBerry::Log Perl module. It does not work for individual logfiles not created by these modules.

The function returns a string with HTML code that directly can be printed to your webpage.

Without parameter, it prints a button "List all logfiles" that opens a website which lists all logfiles of your plugin.

Using the NAME parameter, you can filter to specific Logfiles with the NAME log group. (e.g. if you created your log with 'name' =>'daemon').

To give parameters to the function, use an array with named parameters. To send an array, inside the brackets of the function parameters loglist_button_html() open and close the array with square brackets []. See the examples below.

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
NAMEx

NAME is the loggroup name used with LoxBerry::Log. If you have created a logfile with LoxBerry::Log::new( name => 'daemon'), use 'NAME' => 'daemon' to open the list filtered by name = daemon.

If you omit the NAME parameter, the list will show all logfiles of your plugin.

PACKAGEx

Package is not required in the case of a plugin. By default, this is (like with LoxBerry::Log) the $lbpplugindir-Variable.

Core-Developers have to use the PACKAGE parameter.

LABELx

By default, LoxBerry labels the button with the language-specific "List all logfiles" phrase.

To change the default label, use the LABEL parameter.

DATA_MINIxBy default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send 'DATA_MINI' => "0".
DATA_ICONxBy default, the function uses LoxBerry's default icon from jQuery Mobile, "action" (data-icon="action"). To change the icon, send the icon name here.

Return value

Returns a string that is the HTML code for the Loglist button. Simply echo the result of the function to your webpage.

Returns undef, if the call failed.

Usage

require_once "loxberry_web.php";

// Shows a button to a list of all logfiles of your plugin
echo LBWeb::loglist_button_html ();

// Show only logfiles LoxBerry::Log of a named group

echo LBWeb::loglist_button_html ( ['NAME' => 'daemon'] );

// Modify the label and the icon of the button:
echo LBWeb::logfile_button_html ( [ 'NAME' => 'daemon', 'LABEL' => 'Open my logfile', 'DATA_ICON' => 'arrow-r' ] );




  • Keine Stichwörter