class FormAdmin (View source)

Class to generate html code for admin pages

Properties

DoliDB $db
string $error

Methods

__construct($db)

Constructor

select_language($selected = '', string $htmlname = 'lang_id', $showauto = 0, $filter = array(), $showempty = '', $showwarning = 0, $disabled = 0, $morecss = 'minwidth100', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0)

Return html select list with available languages (key='en_US', value='United States' for example)

select_menu($selected, string $htmlname, $dirmenuarray, $moreattrib = '')

Return list of available menus (eldy_backoffice, ...)

select_menu_families($selected, string $htmlname, $dirmenuarray)

Return combo list of available menu families

select_timezone($selected, string $htmlname)

Return a HTML select list of timezones

select_paper_format($selected = '', string $htmlname = 'paperformat_id', $filter = '', $showempty = 0, $forcecombo = 0)

Return html select list with available languages (key='en_US', value='United States' for example)

string
selectTypeOfFields(string $htmlname, string $type, array<string, string[]> $typewecanchangeinto = array())

Function to show the combo select to chose a type of field (varchar, int, email, ...)

Details

__construct($db)

Constructor

@param DoliDB|null $db Database handler

Parameters

$db

select_language($selected = '', string $htmlname = 'lang_id', $showauto = 0, $filter = array(), $showempty = '', $showwarning = 0, $disabled = 0, $morecss = 'minwidth100', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0)

Return html select list with available languages (key='en_US', value='United States' for example)

@param string|string[] $selected Language pre-selected. Can be an array if $multiselect is 1.

Parameters

$selected
string $htmlname

Name of HTML select @param int<0,1> $showauto Show 'auto' choice @param string[] $filter Array of keys to exclude in list (opposite of $onlykeys) @param int<1,1>|string $showempty '1'=Add empty value or 'string to show' @param int<0,1> $showwarning Show a warning if language is not complete @param int<0,1> $disabled Disable edit of select @param string $morecss Add more css styles @param int<0,2> $showcode 1=Add language code into label at beginning, 2=Add language code into label at end @param int<0,1> $forcecombo Force to use combo box (so no ajax beautify effect) @param int<0,1> $multiselect Make the combo a multiselect @param string[] $onlykeys Array of language keys to restrict list with the following keys (opposite of $filter). Example array('fr', 'es', ...) @param int<0,1> $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) @return string Return HTML select string with list of languages

$showauto
$filter
$showempty
$showwarning
$disabled
$morecss
$showcode
$forcecombo
$multiselect
$onlykeys
$mainlangonly

select_menu($selected, string $htmlname, $dirmenuarray, $moreattrib = '')

Return list of available menus (eldy_backoffice, ...)

@param string $selected Preselected menu value

Parameters

$selected
string $htmlname

Name of html select @param string[] $dirmenuarray Array of directories to scan @param string $moreattrib More attributes on html select tag @return integer|void

$dirmenuarray
$moreattrib

select_menu_families($selected, string $htmlname, $dirmenuarray)

Return combo list of available menu families

@param string $selected Menu pre-selected

Parameters

$selected
string $htmlname

Name of html select @param string[] $dirmenuarray Directories to scan @return void

$dirmenuarray

select_timezone($selected, string $htmlname)

Return a HTML select list of timezones

@param string $selected Menu pre-selectionnee

Parameters

$selected
string $htmlname

Nom de la zone select @return void

select_paper_format($selected = '', string $htmlname = 'paperformat_id', $filter = '', $showempty = 0, $forcecombo = 0)

Return html select list with available languages (key='en_US', value='United States' for example)

@param string $selected Paper format pre-selected

Parameters

$selected
string $htmlname

Name of HTML select field @param string $filter Value to filter on code @param int $showempty Add empty value @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) @return string Return HTML output

$filter
$showempty
$forcecombo

string selectTypeOfFields(string $htmlname, string $type, array<string, string[]> $typewecanchangeinto = array())

Function to show the combo select to chose a type of field (varchar, int, email, ...)

Parameters

string $htmlname

Name of HTML select component

string $type

Type preselected

array<string, string[]> $typewecanchangeinto

Array of possible switch combination from 1 type to another one. This will grey not possible combinations.

Return Value

string

The combo HTML select component