class Generator (View source)

HTML Generator

Methods

static string
showCopyToClipboard(string $text)

Displays a button to copy content to clipboard

static string
linkToVarDocumentation(string $name, bool $useMariaDB = false, string|null $text = null)

Get a link to variable documentation

static string
showHint(string $message)

Returns HTML code for a tooltip

static string
getDbLink(string $database)

returns html code for db link to default db page

static string
getIcon(string $icon, string $alternate = '', bool $forceText = false, bool $menuIcon = false, string $controlParam = 'ActionLinksMode')

Returns an HTML IMG tag for a particular icon from a theme, which may be an actual file or an icon from a sprite.

static string
getServerSSL()

Returns information about SSL status for current connection

static string
getDefaultFunctionForField(string $trueType, bool $firstTimestamp, string|null $defaultValue, string $extra, bool $isNull, string $key, string $type, bool $insertMode)

Returns default function for a particular column.

static string
getFunctionsForField(string $defaultFunction, mixed $foreignField = null)

Creates a dropdown box with MySQL functions for a particular column.

static string
getNavigationLink(string $link, string $text, string $icon, string $linkId = '')

Renders a single link for the top of the navigation panel

static array
getStartAndNumberOfRowsFieldsetData(string $sqlQuery)

No description

static string
getMessage(Message|string $message, string|null $sqlQuery = null, MessageType $type = MessageType::Notice)

Prepare the message and the query usually the message is the result of the query executed

static string
showPHPDocumentation(string $target)

Displays a link to the PHP documentation

static string
showDocumentationLink(string $link, string $target = 'documentation', bool $bbcode = false, bool $disableTabIndex = false)

Displays a link to the documentation as an icon

static string|null
mysqlDie(string $serverMessage = '', string $sqlQuery = '', bool $isModifyLink = true, string $backUrl = '', bool $exit = true)

Displays a MySQL error message in the main panel when $exit is true.

static string
getImage(string $image, string $alternate = '', array $attributes = [])

Returns an HTML IMG tag for a particular image from a theme

static string
linkOrButton(string $urlPath, array|null $urlParams, string $message, string|array $tagParams = [], string $target = '', bool $respectUrlLengthLimit = true)

Displays a link, or a link with code to trigger POST request.

static string
getListNavigator(int $count, int $pos, array $urlParams, string $script, string $frame, int $maxCount, string $name = 'pos', array $classes = [])

Prepare navigation for a list

static string
formatSql(string $sqlQuery, bool $truncate = false)

format sql strings

static string
getSupportedDatatypes(string $selected)

This function processes the datatypes supported by the DB, as specified in Types->getColumns() and returns an HTML snippet that creates a drop-down list.

Details

static string showCopyToClipboard(string $text)

Displays a button to copy content to clipboard

Parameters

string $text

Text to copy to clipboard

Return Value

string

the html link

static string linkToVarDocumentation(string $name, bool $useMariaDB = false, string|null $text = null)

Get a link to variable documentation

Parameters

string $name

The variable name

bool $useMariaDB

Use only MariaDB documentation

string|null $text

(optional) The text for the link

Return Value

string

link or empty string

static string showHint(string $message)

Returns HTML code for a tooltip

Parameters

string $message

the message for the tooltip

Return Value

string

returns html code for db link to default db page

Parameters

string $database database

Return Value

string

html link to default db page

static string getIcon(string $icon, string $alternate = '', bool $forceText = false, bool $menuIcon = false, string $controlParam = 'ActionLinksMode')

Returns an HTML IMG tag for a particular icon from a theme, which may be an actual file or an icon from a sprite.

This function takes into account the ActionLinksMode configuration setting and wraps the image tag in a span tag.

Parameters

string $icon

name of icon file

string $alternate

alternate text

bool $forceText

whether to force alternate text to be displayed

bool $menuIcon

whether this icon is for the menu bar or not

string $controlParam

which directive controls the display

Return Value

string

an html snippet

static string getServerSSL()

Returns information about SSL status for current connection

Return Value

string

static string getDefaultFunctionForField(string $trueType, bool $firstTimestamp, string|null $defaultValue, string $extra, bool $isNull, string $key, string $type, bool $insertMode)

Returns default function for a particular column.

Parameters

string $trueType
bool $firstTimestamp
string|null $defaultValue
string $extra
bool $isNull
string $key
string $type
bool $insertMode

Return Value

string

An HTML snippet of a dropdown list with function names appropriate for the requested column.

static string getFunctionsForField(string $defaultFunction, mixed $foreignField = null)

Creates a dropdown box with MySQL functions for a particular column.

Parameters

string $defaultFunction
mixed $foreignField

Return Value

string

An HTML snippet of a dropdown list with function names appropriate for the requested column.

Renders a single link for the top of the navigation panel

Parameters

string $link

The url for the link

string $text

The text to display and use for title attributes

string $icon

The filename of the icon to show

string $linkId

Value to use for the ID attribute

Return Value

string

HTML code for one link

static array getStartAndNumberOfRowsFieldsetData(string $sqlQuery)

No description

Parameters

string $sqlQuery

Return Value

array

static string getMessage(Message|string $message, string|null $sqlQuery = null, MessageType $type = MessageType::Notice)

Prepare the message and the query usually the message is the result of the query executed

Parameters

Message|string $message

the message to display

string|null $sqlQuery

the query to display

MessageType $type

Return Value

string

Exceptions

Throwable
LoaderError
RuntimeError
SyntaxError

static string showPHPDocumentation(string $target)

Displays a link to the PHP documentation

Parameters

string $target

anchor in documentation

Return Value

string

the html link

Displays a link to the documentation as an icon

Parameters

string $link

documentation link

string $target

optional link target

bool $bbcode

optional flag indicating whether to output bbcode

bool $disableTabIndex

optional flag indicating that a negative tabindex should be set on the link

Return Value

string

the html link

static string|null mysqlDie(string $serverMessage = '', string $sqlQuery = '', bool $isModifyLink = true, string $backUrl = '', bool $exit = true)

Displays a MySQL error message in the main panel when $exit is true.

Returns the error message otherwise.

Parameters

string $serverMessage

Server's error message.

string $sqlQuery

The SQL query that failed.

bool $isModifyLink

Whether to show a "modify" link or not.

string $backUrl

URL for the "back" link (full path is not required).

bool $exit

Whether execution should be stopped or the error message should be returned.

Return Value

string|null

static string getImage(string $image, string $alternate = '', array $attributes = [])

Returns an HTML IMG tag for a particular image from a theme

The image name should match CSS class defined in icons.css.php

Parameters

string $image

The name of the file to get

string $alternate

Used to set 'alt' and 'title' attributes of the image

array $attributes

An associative array of other attributes

Return Value

string

an html IMG tag

static string linkOrButton(string $urlPath, array|null $urlParams, string $message, string|array $tagParams = [], string $target = '', bool $respectUrlLengthLimit = true)

Displays a link, or a link with code to trigger POST request.

POST is used in following cases:

  • URL is too long
  • URL components are over Suhosin limits
  • There is SQL query in the parameters

Parameters

string $urlPath

the URL

array|null $urlParams

URL parameters

string $message

the link message

string|array $tagParams

string: js confirmation; array: additional tag params (f.e. style="")

string $target target
bool $respectUrlLengthLimit

Return Value

string

the results to be echoed or saved in an array

static string getListNavigator(int $count, int $pos, array $urlParams, string $script, string $frame, int $maxCount, string $name = 'pos', array $classes = [])

Prepare navigation for a list

use $pos from $_url_params

Parameters

int $count

number of elements in the list

int $pos

current position in the list

array $urlParams

url parameters

string $script

script name for form target

string $frame

target frame

int $maxCount

maximum number of elements to display from the list

string $name

the name for the request parameter

array $classes

additional classes for the container

Return Value

string

the html content

static string formatSql(string $sqlQuery, bool $truncate = false)

format sql strings

Parameters

string $sqlQuery

raw SQL string

bool $truncate

truncate the query if it is too long

Return Value

string

the formatted sql

static string getSupportedDatatypes(string $selected)

This function processes the datatypes supported by the DB, as specified in Types->getColumns() and returns an HTML snippet that creates a drop-down list.

Parameters

string $selected

The value to mark as selected in HTML mode

Return Value

string