PHP Class Html, glpi

Show file Open project: glpi-project/glpi Class Usage Examples

Public Methods

Method Description
addConfirmationOnAction ( $string, $additionalactions = '' ) : nothing Add confirmation on button or link before action
ajaxFooter ( ) Display Ajax Footer for debug
ajaxForm ( $selector, $success = "console.log(html);" ) This function provides a mecanism to send html form by ajax
autocompletionTextField ( CommonDBTM $item, $field, $options = [] ) : nothing Show div with auto completion
back ( ) : nothing Redirection to $_SERVER['HTTP_REFERER'] page
changeProgressBarMessage ( $msg = " " ) : nothing Change the Message under the Progress Bar
changeProgressBarPosition ( $crt, $tot, $msg = "" ) : nothing Change the Progress Bar Position
checkAllAsCheckbox ( $container_id, $rand = '' ) : nothing Display "check All as" checkbox
clean ( $value, $striptags = true, $keep_bad = 2 ) : clean Clean display value deleting html tags
cleanId ( $id ) : String Clean ID used for HTML elements
cleanInputText ( $string ) : clean Clean string for input text field
cleanParametersURL ( $url ) : clean Clean all parameters of an URL. Get a clean URL
cleanPostForTextArea ( $value ) : clean Clean post value for display in textarea
cleanSQLDisplay ( $request ) Clean Display of Request
closeArrowMassives ( $actions, $confirm = [] ) show arrow for massives actions : closing
closeForm ( $display = true ) : String Create a close form part including CSRF token
computeGenericDateTimeSearch ( $val, $force_day = false, $specifictime = '' ) : computed Compute date / datetime value resulting of showGenericDateTimeSearch
convDate ( $time, $format = null ) Convert a date YY-MM-DD to DD-MM-YY for calendar
convDateTime ( $time, $format = null ) Convert a date YY-MM-DD HH:MM to DD-MM-YY HH:MM for display in a html table
createProgressBar ( $msg = " " ) : nothing Create a Dynamic Progress Bar
css ( $url, $options = [] ) : string Creates a link element for CSS stylesheets.
displayAjaxMessageAfterRedirect ( )
displayBackLink ( ) Display a Link to the last page using http_referer if available else use history.back
displayDebugInfos ( $with_session = true, $ajax = false ) Display Debug Information
displayErrorAndDie ( $message, $minimal = false ) : nothing Simple Error message page
displayMenuAll ( $menu = [] ) Display responsive menu
displayMessageAfterRedirect ( ) Display a div containing messages set in session in the previous page
displayNotFoundError ( ) : Nothing Display common message for item not found
displayProgressBar ( $width, $percent, $options = [] ) : nothing Display a simple progress bar
displayRightError ( ) : Nothing Display common message for privileges errors
displayTitle ( $ref_pic_link = "", $ref_pic_text = "", $ref_title = "", $ref_btts = "" ) : nothing Common Title Function
entities_deep ( $value ) : array Recursivly execute htmlentities on an Array
entity_decode_deep ( $value ) : array Recursivly execute html_entity_decode on an Array
file ( $options = [] ) : string Creates an input file field. Send file names in _$name field as array.
fileScript ( $options = [] ) : nothing fileScript : file upload script
footer ( $keepDB = false ) Print footer for every page
formatAttribute ( $key, $value ) : string Formats an individual attribute, and returns the string value of the composed attribute.
formatNumber ( $number, $edit = false, $forcedecimal ) : formatted Convert a number to correct display
generateImageName ( ) : string
getCheckAllAsCheckbox ( $container_id, $rand = '' ) : Get Get "check All as" checkbox
getCheckbox ( array $options ) : the Get a checkbox.
getConfirmationOnActionScript ( $string, $additionalactions = '' ) : confirmation Get confirmation on button or link before action
getCopyrightMessage ( ) : text Get copyright message as HTML (used in footers)
getCriterionForMassiveCheckboxes ( array $options ) : the Get the jquery criterion for massive checkbox update We can filter checkboxes by a container or by a tag. We can also select checkboxes that have a given tag and that are contained inside a container
getGenericDateTimeSearchItems ( $options ) : array Get items to display for showGenericDateTimeSearch
getMassiveActionCheckBox ( $itemtype, $id, array $options = [] ) : get Get the massive action checkbox
getMenuInfos ( ) : string
getOpenMassiveActionsForm ( $name = '' ) : open Get open form for massive action string
getSimpleForm ( $action, $btname, $btlabel, array $fields = [], $btimage = '', $btoption = '', $confirm = '' ) create a minimal form for simple action
glpi_flush ( ) Flush the current displayed items (do not works really fine)
header ( $title, $url = '', $sector = "none", $item = "none", $option = "" ) Print a nice HTML head for every page
header_nocache ( ) Set page not to use the cache
helpFooter ( ) Print footer for help page
helpHeader ( $title, $url = '' ) Print a nice HTML head for help page
hidden ( $fieldName, $options = [] ) : string Creates a hidden input field.
image ( $path, $options = [] ) : string Creates a formatted IMG element.
imagePaste ( $options = [] ) : nothing imagePaste : Show image paste for an item, with TinyMce
includeHeader ( $title = '' ) : nothing Include common HTML headers
initEditorSystem ( $name, $rand = '', $display = true ) : nothing Init the Editor System to a textarea
initImagePasteSystem ( $name, $rand ) : nothing Init the Image paste System for tiny mce
input ( $fieldName, $options = [] ) : string Creates a text input field.
jsAdaptDropdown ( $id, $params = [] ) : String Adapt dropdown to clean JS
jsAjaxDropdown ( $name, $field_id, $url, $params = [] ) : String Create Ajax dropdown to clean JS
jsAlertCallback ( $msg, $title, $okCallback = null ) Summary of jsAlertCallback Is a replacement for Javascript native alert function Beware that native alert is synchronous by nature (will block browser waiting an answer from user, but that this is emulating the alert behaviour by using a callback function when user presses 'Ok' button.
jsConfirmCallback ( $msg, $title, $yesCallback = null, $noCallback = null ) Summary of confirmCallback Is a replacement for Javascript native confirm function Beware that native confirm is synchronous by nature (will block browser waiting an answer from user, but that this is emulating the confirm behaviour by using callbacks functions when user presses 'Yes' or 'No' buttons.
jsDisable ( $id ) : String Get javascript code for disable an item
jsEnable ( $id ) : String Get javascript code for enable an item
jsGetDropdownValue ( $id ) : string Get item value
jsGetElementbyID ( $id ) : String Get javascript code to get item by id
jsHide ( $id ) : String Get javascript code for hide an item
jsSetDropdownValue ( $id, $value ) : string Set dropdown value
jsShow ( $id ) : String Get javascript code for hide an item
link ( $text, $url, $options = [] ) : string Creates an HTML link.
makeTitle ( $string, $num, $tot ) : String Create a title for list, as "List (5 on 35)"
nl2br_deep ( $value ) : array Recursivly execute nl2br on an Array
nullFooter ( ) Print footer for null page
nullHeader ( $title, $url = '' ) Print a nice HTML head with no controls
openArrowMassives ( $formname, $fixed = false, $ontop = false, $onright = false ) show arrow for massives actions : opening
openMassiveActionsForm ( $name = '' ) : nothing Display open form for massive action
parseAttributes ( $options = [] ) : string Returns a space-delimited string with items of the $options array.
popFooter ( ) Print footer for a modal window
popHeader ( $title, $url = '', $iframed = false ) Print a nice HTML head for modal window (nothing to display)
printAjaxPager ( $title, $start, $numrows, $additional_info = '' ) : nothing Print Ajax pager for list in tab panel
printCleanArray ( $tab, $pad, $jsexpand = false ) : nothing Clean Printing of and array in a table ONLY FOR DEBUG
printPager ( $start, $numrows, $target, $parameters, $item_type_output, $item_type_output_param, $additional_info = '' ) : nothing Print pager for search option (first/previous/next/last)
printPagerForm ( $action = "" ) : nothing Display the list_limit combo choice
progressBar ( $id, array $options = [] ) : nothing Manage progresse bars
redefineAlert ( ) In this function, we redefine 'window.alert' javascript function by a jquery-ui dialog equivalent (but prettier).
redefineConfirm ( ) In this function, we redefine 'window.confirm' javascript function by a jquery-ui dialog equivalent (but prettier).
redirect ( $dest ) : nothing Redirection hack
redirectToLogin ( $params = '' ) : nothing Redirection to Login page
resume_name ( $string, $length = 255 ) : cut Resume a name for display
resume_text ( $string, $length = 255 ) : cut Resume text for followup
script ( $url ) : String Returns one or many script tags depending on the number of scripts given.
scriptBlock ( $script ) : string Wrap $script in a script tag.
scriptEnd ( ) : mixed End a Buffered section of Javascript capturing.
scriptStart ( ) Begin a script block that captures output until HtmlHelper::scriptEnd() is called. This capturing block will capture all output between the methods and create a scriptBlock from it.
showCheckbox ( array $options = [] ) : nothing
showCheckboxMatrix ( array $columns, array $rows, array $options = [] ) : random Display choice matrix
showColorField ( $name, $options = [] ) Display Color field
showDateField ( $name, $options = [] ) : rand Display Date form with calendar
showDateFormItem ( $element, $value = '', $maybeempty = true, $can_edit = true, $minDate = '', $maxDate = '', $displayYear = true ) : rand Display Date form with calendar
showDateTimeField ( $name, $options = [] ) : rand Display DateTime form with calendar
showDateTimeFormItem ( $element, $value = '', $time_step, $maybeempty = true, $can_edit = true, $minDate = '', $maxDate = '', $minTime = '', $maxTime = '' ) : rand Display DateTime form with calendar
showGenericDateTimeSearch ( $element, $value = '', $options = [] ) : rand Show generic date search
showMassiveActionCheckBox ( $itemtype, $id, array $options = [] ) : show Show the massive action checkbox
showMassiveActions ( $options = [] ) : nothing Display massive actions
showProfileSelecter ( $target ) : nothing Print the form used to select profile if several are available
showSimpleForm ( $action, $btname, $btlabel, array $fields = [], $btimage = '', $btoption = '', $confirm = '' ) create a minimal form for simple action
showToolTip ( $content, $options = [] ) : nothing Show a tooltip on an item
simpleHeader ( $title, $links = [] ) Print a simple HTML head with links
submit ( $caption, $options = [] ) : string Creates a submit button element. This method will generate input elements that can be used to submit, and reset forms by using $options. Image submits can be created by supplying an image option
timestampToString ( $time, $display_sec = true, $use_days = true ) : string Make a good string from the unix timestamp $sec
weblink_extract ( $value ) : clean Extract url from web link

Method Details

addConfirmationOnAction() static public method

Add confirmation on button or link before action
static public addConfirmationOnAction ( $string, $additionalactions = '' ) : nothing
$string string to display or array of string for using multilines
$additionalactions string additional actions to do on success confirmation (default '')
return nothing

ajaxFooter() static public method

Display Ajax Footer for debug
static public ajaxFooter ( )

ajaxForm() static public method

This function provides a mecanism to send html form by ajax
static public ajaxForm ( $selector, $success = "console.log(html);" )

autocompletionTextField() static public method

Show div with auto completion
static public autocompletionTextField ( CommonDBTM $item, $field, $options = [] ) : nothing
$item CommonDBTM item object used for create dropdown
$field field to search for autocompletion
$options array of possible options: - name : string / name of the select (default is field parameter) - value : integer / preselected value (default value of the item object) - size : integer / size of the text field - entity : integer / restrict to a defined entity (default entity of the object if define) set to -1 not to take into account - user : integer / restrict to a defined user (default -1 : no restriction) - option : string / options to add to text field - display : boolean / if false get string
return nothing (print out an HTML div)

back() static public method

Redirection to $_SERVER['HTTP_REFERER'] page
static public back ( ) : nothing
return nothing

changeProgressBarMessage() static public method

Change the Message under the Progress Bar
static public changeProgressBarMessage ( $msg = " " ) : nothing
$msg message under the bar (default ' ')
return nothing

changeProgressBarPosition() static public method

Change the Progress Bar Position
static public changeProgressBarPosition ( $crt, $tot, $msg = "" ) : nothing
$crt Current Value (less then $max)
$tot Maximum Value
$msg message inside the bar (default is %) (default '')
return nothing

checkAllAsCheckbox() static public method

Display "check All as" checkbox
static public checkAllAsCheckbox ( $container_id, $rand = '' ) : nothing
$container_id string html of the container of checkboxes link to this check all checkbox
$rand string rand value to use (default is auto generated) (default ''))
return nothing / display item

clean() static public method

Clean display value deleting html tags
static public clean ( $value, $striptags = true, $keep_bad = 2 ) : clean
$value string: string value
$striptags bool: strip all html tags
$keep_bad int: 1 : neutralize tag anb content, 2 : remove tag and neutralize content
return clean value

cleanId() static public method

Clean ID used for HTML elements
static public cleanId ( $id ) : String
$id string id of the dom element
return String

cleanInputText() static public method

Clean string for input text field
static public cleanInputText ( $string ) : clean
$string string: input text
return clean string

cleanParametersURL() static public method

Clean all parameters of an URL. Get a clean URL
static public cleanParametersURL ( $url ) : clean
$url string URL
return clean URL

cleanPostForTextArea() static public method

Clean post value for display in textarea
static public cleanPostForTextArea ( $value ) : clean
$value string: string value
return clean value

cleanSQLDisplay() static public method

Clean Display of Request
static public cleanSQLDisplay ( $request )
$request SQL request

closeArrowMassives() static public method

show arrow for massives actions : closing
static public closeArrowMassives ( $actions, $confirm = [] )
$actions array of action : $name -> $label
$confirm array of confirmation string (optional) \deprecated since 0.84

closeForm() static public method

Create a close form part including CSRF token
static public closeForm ( $display = true ) : String
$display boolean Display or return string (default true)
return String

computeGenericDateTimeSearch() static public method

Compute date / datetime value resulting of showGenericDateTimeSearch
See also: showGenericDateTimeSearch
static public computeGenericDateTimeSearch ( $val, $force_day = false, $specifictime = '' ) : computed
$val date / datetime value passed
$force_day boolean force computation in days (false by default)
$specifictime timestamp set specific timestamp (default '')
return computed date / datetime value

convDate() static public method

Convert a date YY-MM-DD to DD-MM-YY for calendar
static public convDate ( $time, $format = null )
$time date date to convert
$format (default null)

convDateTime() static public method

Convert a date YY-MM-DD HH:MM to DD-MM-YY HH:MM for display in a html table
static public convDateTime ( $time, $format = null )
$time datetime datetime to convert @param $format (default null)

createProgressBar() static public method

Create a Dynamic Progress Bar
static public createProgressBar ( $msg = " " ) : nothing
$msg initial message (under the bar) (default ' ')
return nothing

css() static public method

Creates a link element for CSS stylesheets.
static public css ( $url, $options = [] ) : string
$url String of javascript file to include
$options Array of HTML attributes.
return string CSS link tag

displayAjaxMessageAfterRedirect() static public method

displayDebugInfos() static public method

Display Debug Information
static public displayDebugInfos ( $with_session = true, $ajax = false )
$with_session with session information (true by default)

displayErrorAndDie() static public method

Simple Error message page
static public displayErrorAndDie ( $message, $minimal = false ) : nothing
$message string displayed before dying
$minimal set to true do not display app menu (false by default)
return nothing as function kill script

displayMenuAll() static public method

Display responsive menu
Since: 0.90.1
static public displayMenuAll ( $menu = [] )
$menu array of menu items - key : plugin system name - value : array of options * id : html id attribute * default : defaul url * title : displayed label * content : menu sub items, array with theses options : - page : url - title : displayed label - shortcut : keyboard shortcut letter

displayMessageAfterRedirect() static public method

Display a div containing messages set in session in the previous page
static public displayMessageAfterRedirect ( )

displayNotFoundError() static public method

Display common message for item not found
static public displayNotFoundError ( ) : Nothing
return Nothing

displayProgressBar() static public method

Display a simple progress bar
static public displayProgressBar ( $width, $percent, $options = [] ) : nothing
$width Width of the progress bar
$percent Percent of the progress bar
$options array of possible options: - title : string title to display (default Progesssion) - simple : display a simple progress bar (no title / only percent) - forcepadding : boolean force str_pad to force refresh (default true)
return nothing

displayRightError() static public method

Display common message for privileges errors
static public displayRightError ( ) : Nothing
return Nothing (die)

displayTitle() static public method

Common Title Function
static public displayTitle ( $ref_pic_link = "", $ref_pic_text = "", $ref_title = "", $ref_btts = "" ) : nothing
$ref_pic_link Path to the image to display (default '')
$ref_pic_text Alt text of the icon (default '')
$ref_title Title to display (default '')
$ref_btts Extra items to display array(link=>text...) (default '')
return nothing

entities_deep() static public method

Recursivly execute htmlentities on an Array
static public entities_deep ( $value ) : array
$value string or array
return array of value (same struct as input)

entity_decode_deep() static public method

Recursivly execute html_entity_decode on an Array
static public entity_decode_deep ( $value ) : array
$value string or array
return array of value (same struct as input)

file() static public method

Files are uploaded in files/_tmp/ directory
static public file ( $options = [] ) : string
$options array of options - name string field name (default filename) - multiple boolean allow multiple file upload (default false) - onlyimages boolean restrict to image files (default false) - showfilecontainer string DOM ID of the container showing file uploaded: use selector to display - showfilesize boolean show file size with file name - rand string already computed rand value - pasteZone string DOM ID of the paste zone - dropZone string DOM ID of the drop zone
return string input file field

fileScript() static public method

fileScript : file upload script
static public fileScript ( $options = [] ) : nothing
$options array of possible options: - imagePaste boolean image paste with tinyMce - name string field name (default filename) - multiple boolean allow multiple file upload (default false) - onlyimages boolean restrict to image files (default false) - showfilecontainer string DOM ID of the container showing file uploaded: use selector to display - pasteZone string DOM ID of the paste zone - dropZone string DOM ID of the drop zone - rand string already computed rand value
return nothing (print the image paste)

formatAttribute() static public method

Formats an individual attribute, and returns the string value of the composed attribute.
static public formatAttribute ( $key, $value ) : string
$key The name of the attribute to create
$value The value of the attribute to create.
return string The composed attribute.

formatNumber() static public method

Convert a number to correct display
static public formatNumber ( $number, $edit = false, $forcedecimal ) : formatted
$number float Number to display
$edit boolean display number for edition ? (id edit use . in all case) (false by default)
$forcedecimal integer Force decimal number (do not use default value) (default -1)
return formatted number

generateImageName() static public method

static public generateImageName ( ) : string
return string

getCheckAllAsCheckbox() static public method

Get "check All as" checkbox
static public getCheckAllAsCheckbox ( $container_id, $rand = '' ) : Get
$container_id string html of the container of checkboxes link to this check all checkbox
$rand string rand value to use (default is auto generated)(default '')
return Get checkbox string

getCheckbox() static public method

Get a checkbox.
static public getCheckbox ( array $options ) : the
$options array array of parameters: - title its title - name its name - id its id - value the value to set when checked - readonly can we edit it ? - massive_tags the tag to set for massive checkbox update - checked is it checked or not ? - zero_on_empty do we send 0 on submit when it is not checked ? - specific_tags HTML5 tags to add - criterion the criterion for massive checkbox
return the HTML code for the checkbox

getConfirmationOnActionScript() static public method

Get confirmation on button or link before action
static public getConfirmationOnActionScript ( $string, $additionalactions = '' ) : confirmation
$string string to display or array of string for using multilines
$additionalactions string additional actions to do on success confirmation (default '')
return confirmation script

getCopyrightMessage() static public method

Get copyright message as HTML (used in footers)
Since: 9.1
static public getCopyrightMessage ( ) : text
return text

getCriterionForMassiveCheckboxes() static public method

Get the jquery criterion for massive checkbox update We can filter checkboxes by a container or by a tag. We can also select checkboxes that have a given tag and that are contained inside a container
static public getCriterionForMassiveCheckboxes ( array $options ) : the
$options array array of parameters: - tag_for_massive tag of the checkboxes to update - container_id if of the container of the checkboxes
return the javascript code for jquery criterion or empty string if it is not a massive update checkbox

getGenericDateTimeSearchItems() static public method

Get items to display for showGenericDateTimeSearch
See also: showGenericDateTimeSearch
static public getGenericDateTimeSearchItems ( $options ) : array
$options array of possible options: - with_time display with time selection ? (default false) - with_future display with future date selection ? (default false) - with_days display specific days selection TODAY, BEGINMONTH, LASTMONDAY... ? (default true)
return array of posible values

getMassiveActionCheckBox() static public method

Get the massive action checkbox
static public getMassiveActionCheckBox ( $itemtype, $id, array $options = [] ) : get
$itemtype Massive action itemtype
$id ID of the item
$options array array
return get checkbox

getMenuInfos() static public method

static public getMenuInfos ( ) : string
return string

getOpenMassiveActionsForm() static public method

Get open form for massive action string
static public getOpenMassiveActionsForm ( $name = '' ) : open
$name given name/id to the form (default '')
return open form string

getSimpleForm() static public method

create a minimal form for simple action
static public getSimpleForm ( $action, $btname, $btlabel, array $fields = [], $btimage = '', $btoption = '', $confirm = '' )
$action String URL to call on submit
$btname String button name (maybe if name <> value)
$btlabel String button label
$fields array Array field name => field value
$btimage String button image uri (optional) (default '')
$btoption String optional button option (default '')
$confirm String optional confirm message (default '')

glpi_flush() static public method

Flush the current displayed items (do not works really fine)
static public glpi_flush ( )

header() static public method

Print a nice HTML head for every page
static public header ( $title, $url = '', $sector = "none", $item = "none", $option = "" )
$title title of the page
$url not used anymore (default '')
$sector sector in which the page displayed is (default 'none')
$item item corresponding to the page displayed (default 'none')
$option option corresponding to the page displayed (default '')

header_nocache() static public method

Set page not to use the cache
static public header_nocache ( )

helpFooter() static public method

Print footer for help page
static public helpFooter ( )

helpHeader() static public method

Print a nice HTML head for help page
static public helpHeader ( $title, $url = '' )
$title title of the page
$url not used anymore (default '')

hidden() static public method

If value of options is an array then recursively parse it to generate as many hidden input as necessary
static public hidden ( $fieldName, $options = [] ) : string
$fieldName Name of a field
$options Array of HTML attributes.
return string A generated hidden input

image() static public method

This method will set an empty alt attribute if no alt and no title is not supplied
static public image ( $path, $options = [] ) : string
$path Path to the image file
$options Array of HTML attributes - `url` If provided an image link will be generated and the link will point at `$options['url']`.
return string completed img tag

imagePaste() static public method

imagePaste : Show image paste for an item, with TinyMce
static public imagePaste ( $options = [] ) : nothing
$options array of options - name string field name (default filename) - multiple boolean allow multiple file upload (default false - onlyimages boolean restrict to image files (default false) - showfilecontainer string DOM ID of the container showing file uploaded: use selector to display - imagePaste boolean image paste with tinyMce - dropZone string DOM ID of the drop zone - rand string already computed rand value - pasteZone string DOM ID of the paste zone
return nothing (print the image paste)

includeHeader() static public method

Include common HTML headers
static public includeHeader ( $title = '' ) : nothing
$title title used for the page (default '')
return nothing

initEditorSystem() static public method

Init the Editor System to a textarea
static public initEditorSystem ( $name, $rand = '', $display = true ) : nothing
$name name of the html textarea to use
$rand rand of the html textarea to use (if empty no image paste system)(default '')
$display boolean display or get js script (true by default)
return nothing

initImagePasteSystem() static public method

Init the Image paste System for tiny mce
static public initImagePasteSystem ( $name, $rand ) : nothing
$name name of the html textarea to use
$rand rand of the html textarea to use
return nothing

input() static public method

Creates a text input field.
static public input ( $fieldName, $options = [] ) : string
$fieldName Name of a field
$options Array of HTML attributes.
return string A generated hidden input

jsAdaptDropdown() static public method

Adapt dropdown to clean JS
static public jsAdaptDropdown ( $id, $params = [] ) : String
$id string id of the dom element
$params array of parameters
return String

jsAjaxDropdown() static public method

Create Ajax dropdown to clean JS
static public jsAjaxDropdown ( $name, $field_id, $url, $params = [] ) : String
$name
$field_id string id of the dom element
$url string URL to get datas
$params array of parameters must contains : - 'value' : default value selected - 'valuename' : default name of selected value
return String

jsAlertCallback() static public method

Summary of jsAlertCallback Is a replacement for Javascript native alert function Beware that native alert is synchronous by nature (will block browser waiting an answer from user, but that this is emulating the alert behaviour by using a callback function when user presses 'Ok' button.
static public jsAlertCallback ( $msg, $title, $okCallback = null )
$msg string message to be shown
$title string title for dialog box
$okCallback string function that will be called when 'Ok' is pressed (default null)

jsConfirmCallback() static public method

Summary of confirmCallback Is a replacement for Javascript native confirm function Beware that native confirm is synchronous by nature (will block browser waiting an answer from user, but that this is emulating the confirm behaviour by using callbacks functions when user presses 'Yes' or 'No' buttons.
static public jsConfirmCallback ( $msg, $title, $yesCallback = null, $noCallback = null )
$msg string message to be shown
$title string title for dialog box
$yesCallback string function that will be called when 'Yes' is pressed (default null)
$noCallback string function that will be called when 'No' is pressed (default null)

jsDisable() static public method

Get javascript code for disable an item
static public jsDisable ( $id ) : String
$id string id of the dom element
return String

jsEnable() static public method

Get javascript code for enable an item
static public jsEnable ( $id ) : String
$id string id of the dom element
return String

jsGetDropdownValue() static public method

Get item value
static public jsGetDropdownValue ( $id ) : string
$id string id of the dom element
return string

jsGetElementbyID() static public method

Get javascript code to get item by id
static public jsGetElementbyID ( $id ) : String
$id string id of the dom element
return String

jsHide() static public method

Get javascript code for hide an item
static public jsHide ( $id ) : String
$id string id of the dom element
return String

jsSetDropdownValue() static public method

Set dropdown value
static public jsSetDropdownValue ( $id, $value ) : string
$id string id of the dom element
$value string value to set
return string

jsShow() static public method

Get javascript code for hide an item
static public jsShow ( $id ) : String
$id string id of the dom element
return String

makeTitle() static public method

Create a title for list, as "List (5 on 35)"
static public makeTitle ( $string, $num, $tot ) : String
$string String text for title
$num Integer number of item displayed
$tot Integer number of item existing
return String

nl2br_deep() static public method

Recursivly execute nl2br on an Array
static public nl2br_deep ( $value ) : array
$value string or array
return array of value (same struct as input)

nullFooter() static public method

Print footer for null page
static public nullFooter ( )

nullHeader() static public method

Print a nice HTML head with no controls
static public nullHeader ( $title, $url = '' )
$title title of the page
$url not used anymore (default '')

openArrowMassives() static public method

show arrow for massives actions : opening
static public openArrowMassives ( $formname, $fixed = false, $ontop = false, $onright = false )
$formname string
$fixed boolean used tab_cadre_fixe in both tables (false by default)
$ontop display on top of the list (false by default)
$onright display on right of the list (false by default) \deprecated since 0.84

openMassiveActionsForm() static public method

Display open form for massive action
static public openMassiveActionsForm ( $name = '' ) : nothing
$name given name/id to the form (default '')
return nothing / display item

parseAttributes() static public method

Returns a space-delimited string with items of the $options array.
static public parseAttributes ( $options = [] ) : string
$options Array of options.
return string Composed attributes.

popFooter() static public method

Print footer for a modal window
static public popFooter ( )

popHeader() static public method

Print a nice HTML head for modal window (nothing to display)
static public popHeader ( $title, $url = '', $iframed = false )
$title title of the page
$url not used anymore (default '')
$iframed indicate if page loaded in iframe - css target (default false)

printAjaxPager() static public method

Print Ajax pager for list in tab panel
static public printAjaxPager ( $title, $start, $numrows, $additional_info = '' ) : nothing
$title displayed above
$start from witch item we start
$numrows total items
$additional_info Additional information to display (default '')
return nothing (print a pager)

printCleanArray() static public method

Clean Printing of and array in a table ONLY FOR DEBUG
static public printCleanArray ( $tab, $pad, $jsexpand = false ) : nothing
$tab the array to display
$pad Pad used (default 0)
$jsexpand Expand using JS ? (default false)
return nothing

printPager() static public method

Print pager for search option (first/previous/next/last)
static public printPager ( $start, $numrows, $target, $parameters, $item_type_output, $item_type_output_param, $additional_info = '' ) : nothing
$start from witch item we start
$numrows total items
$target page would be open when click on the option (last,previous etc)
$parameters parameters would be passed on the URL.
$item_type_output item type display - if >0 display export PDF et Sylk form (default 0)
$item_type_output_param item type parameter for export (default 0)
$additional_info Additional information to display (default '')
return nothing (print a pager)

printPagerForm() static public method

Display the list_limit combo choice
static public printPagerForm ( $action = "" ) : nothing
$action page would be posted when change the value (URL + param) (default '') ajax Pager will be displayed if empty
return nothing (print a combo)

progressBar() static public method

Manage progresse bars
static public progressBar ( $id, array $options = [] ) : nothing
$id HTML ID of the progress bar
$options array array progress status - create do we have to create it ? - message add or change the message - percent current level
return nothing (display)

redefineAlert() static public method

In this function, we redefine 'window.alert' javascript function by a jquery-ui dialog equivalent (but prettier).
static public redefineAlert ( )

redefineConfirm() static public method

This dialog is normally asynchronous and can't return a boolean like naive window.confirm. We manage this behavior with a global variable 'confirmed' who watchs the acceptation of dialog. In this case, we trigger a new click on element to return the value (and without display dialog)
static public redefineConfirm ( )

redirect() static public method

Redirection hack
static public redirect ( $dest ) : nothing
$dest string: Redirection destination
return nothing

redirectToLogin() static public method

Redirection to Login page
static public redirectToLogin ( $params = '' ) : nothing
$params param to add to URL (default '')
return nothing

resume_name() static public method

Resume a name for display
static public resume_name ( $string, $length = 255 ) : cut
$string string string to resume
$length integer resume length (default 255)
return cut string

resume_text() static public method

Resume text for followup
static public resume_text ( $string, $length = 255 ) : cut
$string string string to resume
$length integer resume length (default 255)
return cut string

script() static public method

Returns one or many script tags depending on the number of scripts given.
static public script ( $url ) : String
$url String of javascript file to include
return String of script tags

scriptBlock() static public method

Wrap $script in a script tag.
static public scriptBlock ( $script ) : string
$script The script to wrap
return string

scriptEnd() static public method

Generates a script tag inline
static public scriptEnd ( ) : mixed
return mixed depending on the settings of scriptStart() either a script tag or null

scriptStart() static public method

Begin a script block that captures output until HtmlHelper::scriptEnd() is called. This capturing block will capture all output between the methods and create a scriptBlock from it.
static public scriptStart ( )

showCheckbox() static public method

See also: Html::getCheckbox()
static public showCheckbox ( array $options = [] ) : nothing
$options array array
return nothing (display only)

showCheckboxMatrix() static public method

Display choice matrix
static public showCheckboxMatrix ( array $columns, array $rows, array $options = [] ) : random
$columns array array of column field name => column label
$rows array array of field name => array( 'label' the label of the row 'columns' an array of specific information regaring current row and given column indexed by column field_name * a string if only have to display a string * an array('value' => ???, 'readonly' => ???) that is used to Dropdown::showYesNo()
$options array array possible: 'title' of the matrix 'first_cell' the content of the upper-left cell 'row_check_all' set to true to display a checkbox to check all elements of the row 'col_check_all' set to true to display a checkbox to check all elements of the col 'rand' random number to use for ids
return random value used to generate the ids

showColorField() static public method

Display Color field
static public showColorField ( $name, $options = [] )
$name name of the element
$options array of possible options: - value : default value to display (default '') - display : boolean display or get string (default true) - rand : specific random value (default generated one)

showDateField() static public method

Display Date form with calendar
static public showDateField ( $name, $options = [] ) : rand
$name name of the element
$options array of possible options: - value : default value to display (default '') - maybeempty : may be empty ? (true by default) - canedit : could not modify element (true by default) - min : minimum allowed date (default '') - max : maximum allowed date (default '') - showyear : should we set/diplay the year? (true by default) - display : boolean display of return string (default true) - rand : specific rand value (default generated one) - yearrange : set a year range to show in drop-down (default '')
return rand value used if displayes else string

showDateFormItem() static public method

Display Date form with calendar
static public showDateFormItem ( $element, $value = '', $maybeempty = true, $can_edit = true, $minDate = '', $maxDate = '', $displayYear = true ) : rand
$element name of the element
$value default value to display (default '')
$maybeempty may be empty ? (true by default)
$can_edit could not modify element (true by default)
$minDate minimum allowed date (default '')
$maxDate maximum allowed date (default '')
$displayYear should we set/diplay the year? (true by default)
return rand value used \deprecated since 0.84 used Html::showDateField instead

showDateTimeField() static public method

Display DateTime form with calendar
static public showDateTimeField ( $name, $options = [] ) : rand
$name name of the element
$options array of possible options: - value : default value to display (default '') - timestep : step for time in minute (-1 use default config) (default -1) - maybeempty : may be empty ? (true by default) - canedit : could not modify element (true by default) - mindate : minimum allowed date (default '') - maxdate : maximum allowed date (default '') - mintime : minimum allowed time (default '') - maxtime : maximum allowed time (default '') - showyear : should we set/diplay the year? (true by default) - display : boolean display or get string (default true) - rand : specific random value (default generated one)
return rand value used if displayes else string

showDateTimeFormItem() static public method

Display DateTime form with calendar
static public showDateTimeFormItem ( $element, $value = '', $time_step, $maybeempty = true, $can_edit = true, $minDate = '', $maxDate = '', $minTime = '', $maxTime = '' ) : rand
$element name of the element
$value default value to display (default '')
$time_step step for time in minute (-1 use default config) (default -1)
$maybeempty may be empty ? (true by default)
$can_edit could not modify element (true by default)
$minDate minimum allowed date (default '')
$maxDate maximum allowed date (default '')
$minTime minimum allowed time (default '')
$maxTime maximum allowed time (default '')
return rand value used \deprecated since 0.84 used Html::showDateTimeField instead

showGenericDateTimeSearch() static public method

Show generic date search
static public showGenericDateTimeSearch ( $element, $value = '', $options = [] ) : rand
$element name of the html element
$value default value (default '')
$options array of possible options: - with_time display with time selection ? (default false) - with_future display with future date selection ? (default false) - with_days display specific days selection TODAY, BEGINMONTH, LASTMONDAY... ? (default true)
return rand value of dropdown

showMassiveActionCheckBox() static public method

Show the massive action checkbox
static public showMassiveActionCheckBox ( $itemtype, $id, array $options = [] ) : show
$itemtype Massive action itemtype
$id ID of the item
$options array array
return show checkbox

showMassiveActions() static public method

Display massive actions
Since: 0.84 (before Search::displayMassiveActions)
static public showMassiveActions ( $options = [] ) : nothing
$options array of parameters must contains : - container : DOM ID of the container of the item checkboxes (since version 0.85) may contains : - num_displayed : integer number of displayed items. Permit to check suhosin limit. (default -1 not to check) - ontop : boolean true if displayed on top (default true) - fixed : boolean true if used with fixed table display (default true) - forcecreate : boolean force creation of modal window (default = false). Modal is automatically created when displayed the ontop item. If only a bottom one is displayed use it - check_itemtype : string alternate itemtype to check right if different from main itemtype (default empty) - check_items_id : integer ID of the alternate item used to check right / optional (default empty) - is_deleted : boolean is massive actions for deleted items ? - extraparams : string extra URL parameters to pass to massive actions (default empty) if ([extraparams]['hidden'] is set : add hidden fields to post) - specific_actions : array of specific actions (do not use standard one) - add_actions : array of actions to add (do not use standard one) - confirm : string of confirm message before massive action - item : CommonDBTM object that has to be passed to the actions - tag_to_send : the tag of the elements to send to the ajax window (default: common)
return nothing

showProfileSelecter() static public method

Print the form used to select profile if several are available
static public showProfileSelecter ( $target ) : nothing
$target target of the form
return nothing

showSimpleForm() static public method

create a minimal form for simple action
static public showSimpleForm ( $action, $btname, $btlabel, array $fields = [], $btimage = '', $btoption = '', $confirm = '' )
$action String URL to call on submit
$btname String button name
$btlabel String button label
$fields array Array field name => field value
$btimage String button image uri (optional) (default '')
$btoption String optional button option (default '')
$confirm String optional confirm message (default '')

showToolTip() static public method

Show a tooltip on an item
static public showToolTip ( $content, $options = [] ) : nothing
$content string data to put in the tooltip
$options array of possible options: - applyto : string / id of the item to apply tooltip (default empty). If not set display an icon - title : string / title to display (default empty) - contentid : string / id for the content html container (default auto generated) (used for ajax) - link : string / link to put on displayed image if contentid is empty - linkid : string / html id to put to the link link (used for ajax) - linktarget : string / target for the link - popup : string / popup action : link not needed to use it - img : string / url of a specific img to use - display : boolean / display the item : false return the datas - autoclose : boolean / autoclose the item : default true (false permit to scroll)
return nothing (print out an HTML div)

simpleHeader() static public method

Print a simple HTML head with links
static public simpleHeader ( $title, $links = [] )
$title title of the page
$links array of links to display

submit() static public method

Creates a submit button element. This method will generate input elements that can be used to submit, and reset forms by using $options. Image submits can be created by supplying an image option
static public submit ( $caption, $options = [] ) : string
$caption caption of the input
$options Array of options. - image : will use a submit image input - `confirm` JavaScript confirmation message. - `confirmaction` optional action to do on confirmation
return string A HTML submit button

timestampToString() static public method

Make a good string from the unix timestamp $sec
static public timestampToString ( $time, $display_sec = true, $use_days = true ) : string
$time integer timestamp
$display_sec boolean display seconds ? (true by default)
$use_days boolean use days for display ? (true by default)
return string