PHP Class Dropdown, glpi

Inheritance: extends database
Show file Open project: glpi-project/glpi Class Usage Examples

Public Methods

Method Description
addNewCondition ( $condition )
dropdownIcons ( $myname, $value, $store_path, $display = true ) : nothing Make a select box for icons
dropdownUsedItemTypes ( $name, $itemtype_ref, $options = [] ) : nothing Make a select box for device type
getDeviceItemTypes ( ) : array Get the Device list name the user is allowed to edit
getDropdownArrayNames ( $table, $ids ) : array Get values of a dropdown for a list of item
getDropdownName ( $table, $id, $withcomment, $translate = true, $tooltip = true ) : string Get the value of a dropdown
getGlobalSwitch ( $value ) : the Get the label associated with a management type
getLanguageName ( $value )
getStandardDropdownItemTypes ( ) : array Get the dropdown list name the user is allowed to edit
getValueWithUnit ( $value, $unit ) Get value with unit / Automatic management of standar unit (year, month, %, .
getYesNo ( $value ) : string Get Yes No string
import ( $itemtype, $input ) : the Import a dropdown - check if already exists
importExternal ( $itemtype, $value, $entities_id, $external_params = [], $comment = '', $add = true ) : integer Import a value in a dropdown table.
show ( $itemtype, $options = [] ) : boolean Print out an HTML "
showAdvanceDateRestrictionSwitch ( $enabled ) Toggle view in LDAP user import/synchro between no restriction and date restriction
showAllItems ( $myname, $value_type, $value, $entity_restrict, $types = '', $onlyglobal = false, $checkright = false, $itemtypename = 'itemtype' ) : nothing Make a select box for all items
showFromArray ( $name, array $elements, $options = [] ) Dropdown of values in an array
showGMT ( $name, $value = '' ) Dropdown for GMT selection
showGlobalSwitch ( $ID, $attrs = [] ) Dropdown for global item management
showHours ( $name, $options = [] ) : Nothing Print a select with hours
showInteger ( $myname, $value, $min, $max = 100, $step = 1, $toadd = [], $options = [] ) Dropdown integers
showItemType ( $types = '', $options = [] ) : integer show a dropdown to selec a type
showItemTypeList ( $optgroup ) Display a list to select a itemtype with link to search form
showItemTypeMenu ( $title, $optgroup, $value = '' ) Display a menu to select a itemtype which open the search form
showItemTypes ( $name, $types = [], $options = [] ) : nothing Make a select box for device type
showLanguages ( $myname, $options = [] ) Dropdown available languages
showListLimit ( $onchange = '' ) show dropdown to select list limit
showNumber ( $myname, $options = [] ) Dropdown numbers
showOutputFormat ( ) show dropdown for output format
showPrivatePublicSwitch ( $is_private, $entity, $is_recursive ) Private / Public switch for items which may be assign to a user and/or an entity
showSelectItemFromItemtypes ( array $options = [] ) : randomized Make a select box for all items
showTimeStamp ( $myname, $options = [] ) Dropdown integers
showYesNo ( $name, $value, $restrict_to, $params = [] ) : rand Make a select box for a boolean choice (Yes/No) or display a checkbox. Add a 'use_checkbox' = true to the $params array to display a checkbox instead a select box

Method Details

addNewCondition() static public method

static public addNewCondition ( $condition )

dropdownIcons() static public method

Make a select box for icons
static public dropdownIcons ( $myname, $value, $store_path, $display = true ) : nothing
$myname the name of the HTML select
$value the preselected value we want
$store_path path where icons are stored
$display boolean display of get string ? (true by default)
return nothing (print out an HTML select box)

dropdownUsedItemTypes() static public method

Make a select box for device type
static public dropdownUsedItemTypes ( $name, $itemtype_ref, $options = [] ) : nothing
$name name of the select box
$itemtype_ref string itemtype reference where to search in itemtype field
$options array of possible options: - may be value (default value) / field (used field to search itemtype)
return nothing (print out an HTML select box)

getDeviceItemTypes() static public method

Get the Device list name the user is allowed to edit
static public getDeviceItemTypes ( ) : array
return array (group of dropdown) of array (itemtype => localized name)

getDropdownArrayNames() static public method

Get values of a dropdown for a list of item
static public getDropdownArrayNames ( $table, $ids ) : array
$table the dropdown table from witch we want values on the select
$ids array containing the ids to get
return array containing the value of the dropdown or   if not exists

getDropdownName() static public method

Returns the value of the dropdown from $table with ID $id.
static public getDropdownName ( $table, $id, $withcomment, $translate = true, $tooltip = true ) : string
$table the dropdown table from witch we want values on the select
$id id of the element to get
$withcomment give array with name and comment (default 0)
$translate (true by default)
$tooltip boolean (true by default) returns a tooltip, else returns only 'comment'
return string the value of the dropdown or   if not exists

getGlobalSwitch() static public method

Get the label associated with a management type
static public getGlobalSwitch ( $value ) : the
return the label corresponding to it, or ""

getLanguageName() static public method

static public getLanguageName ( $value )
$value

getStandardDropdownItemTypes() static public method

Get the dropdown list name the user is allowed to edit
static public getStandardDropdownItemTypes ( ) : array
return array (group of dropdown) of array (itemtype => localized name)

getValueWithUnit() static public method

..)
static public getValueWithUnit ( $value, $unit )
$value integer number of item
$unit string of unit (maybe year, month, day, hour, % for standard management)

getYesNo() static public method

Get Yes No string
static public getYesNo ( $value ) : string
$value Yes No value
return string

import() static public method

Import a dropdown - check if already exists
static public import ( $itemtype, $input ) : the
$itemtype string name of the class
$input array of value to import
return the ID of the new

importExternal() static public method

This import a new dropdown if it doesn't exist - Play dictionnary if needed
static public importExternal ( $itemtype, $value, $entities_id, $external_params = [], $comment = '', $add = true ) : integer
$itemtype string name of the class
$value string Value of the new dropdown. (need to be addslashes)
$entities_id integer entity in case of specific dropdown (default -1)
$external_params array (need to be addslashes)
$comment (default '') (need to be addslashes)
$add if true, add it if not found. if false, just check if exists (true by default)
return integer : dropdown id.

show() static public method

Print out an HTML "