class FormResource (View source)

Class to manage forms for the module resource

\remarks Utilisation: $formresource = new FormResource($db) \remarks $formplace->proprietes=1 ou chaine ou tableau de valeurs

Properties

DoliDB $db
array<string, string> $substit
array<string, mixed> $param
string $error

Methods

__construct(DoliDB $db)

Constructor

select_resource_list(int|int[] $selected = 0, string $htmlname = 'fk_resource', $filter = '', int<0, 1> $showempty = 0, $showtype = 0, $forcecombo = 0, $event = [], $filterkey = '', $outputmode = 0, $limit = 20, $morecss = 'minwidth100', $multiple = false)

Output html form to select a resource

select_types_resource($selected = '', string $htmlname = 'type_resource', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $usejscombo = 0, $morecss = 'minwidth100')

Return html list of tickets type

select_ziptown($selected = '', string $htmlname = 'zipcode', $fields = array(), $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')

Return a select list with zip codes and their town

select_state(int $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300')

Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

select_resource_list(int|int[] $selected = 0, string $htmlname = 'fk_resource', $filter = '', int<0, 1> $showempty = 0, $showtype = 0, $forcecombo = 0, $event = [], $filterkey = '', $outputmode = 0, $limit = 20, $morecss = 'minwidth100', $multiple = false)

Output html form to select a resource

Parameters

int|int[] $selected

Preselected resource id

string $htmlname

Name of field in form @param string $filter Optional filters criteria (example: 's.rowid <> x')

$filter
int<0, 1> $showempty

Add an empty field @param int<0,1> $showtype Show third party type in combo list (customer, prospect or supplier) @param int<0,1> $forcecombo Force to use combo box @param array<array{method:string,url:string,htmlname:string,params:array<string,string>}> $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @param string $filterkey Filter on key value @param int<0,2> $outputmode 0=HTML select string, 1=Array, 2=without form tag @param int $limit Limit number of answers, 0 for no limit @param string $morecss More css @param bool $multiple add [] in the name of element and add 'multiple' attribute @return string|array<array{key:int,value:int,label:string}> HTML string with

$showtype
$forcecombo
$event
$filterkey
$outputmode
$limit
$morecss
$multiple

select_types_resource($selected = '', string $htmlname = 'type_resource', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $usejscombo = 0, $morecss = 'minwidth100')

Return html list of tickets type

@param string $selected Id du type pre-selectionne

Parameters

$selected
string $htmlname

Nom de la zone select @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) @param int<0,3> $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code @param int<0,1> $empty 1=peut etre vide, 0 sinon @param int<0,1> $noadmininfo 0=Add admin info, 1=Disable admin info @param int $maxlength Max length of label @param int<0,1> $usejscombo 1=Use jscombo, 0=No js combo @param string $morecss Add more css @return void

$filtertype
$format
$empty
$noadmininfo
$maxlength
$usejscombo
$morecss

select_ziptown($selected = '', string $htmlname = 'zipcode', $fields = array(), $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')

Return a select list with zip codes and their town

@param string $selected Preselected value

Parameters

$selected
string $htmlname

HTML select name @param string[] $fields Array with key of fields to refresh after selection @param int $fieldsize Field size @param int<0,1> $disableautocomplete 1 To disable ajax autocomplete features (browser autocomplete may still occurs) @param string $moreattrib Add more attribute on HTML input field @param string $morecss More css @return string

$fields
$fieldsize
$disableautocomplete
$moreattrib
$morecss

select_state(int $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300')

Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.

In the case of an all-country list, the display breaks on the country. The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). Thus the links with the departments are done on a department independently of its name.

Parameters

int $selected

Code state preselected (mus be state id) @param int $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show @param string $htmlname Id of department. If '', we want only the string with

$country_codeid
$htmlname
$morecss