PHP Functions: Eventbox
Use eventbox-related functions by including /_framework/functions/x_eventbox.php
.
Dependencies
- PHP 7.1-7.4
- PHP 8.0-8.4
PHP-Modules
session
: The code uses PHP sessionssession_start()
and$_SESSION
to store the Eventbox Messages.
Function | Description | Explanation |
---|---|---|
x_eventBoxPrep($text, $type = "x", $precookie = "", $morecss = "", $buttontext = "X", $imgok = false, $imgfail = false, $imgwarn = false, $imgelse = false) |
Prepares an event box with specified text, style, and optional images, saving it to a session variable for later display. | The function creates an event box with a message ($text ) and a specific type ($type ), such as "success", "warning", or "error". It can include an image depending on the type. The event box's HTML and CSS are generated, including a close button ($buttontext ). The generated content is stored in a session variable ($_SESSION ) using the prefix $precookie . The box styling can be customized with the $morecss parameter. |
x_eventBoxShow($precookie = "") |
Displays the prepared event box by echoing the stored session variable, then clears the session variable. | The function checks if the event box should be skipped (using a session variable). If not, it echoes the HTML stored in the session variable created by x_eventBoxPrep() , then unsets (deletes) the session variable to prevent repeated display. The $precookie parameter allows handling of multiple event boxes with different prefixes. |
x_eventBoxSet($precookie = "") |
Checks if an event box has been prepared and is stored in the session. | The function checks if a session variable for an event box exists, returning true if it does and false otherwise. This can be used to determine if an event box has already been prepared. The $precookie parameter allows for checking different prefixed session variables. |
x_eventBoxSkip($precookie = "") |
Sets a session variable to skip displaying the event box. | The function sets a session variable that prevents the event box from being displayed. This is useful if the event box should be temporarily skipped without clearing its content. The $precookie parameter allows this behavior to be controlled for specific prefixed event boxes. |