PHP Class DropdownTranslation, glpi

Inheritance: extends CommonDBChild
显示文件 Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$dohistory
$items_id
$itemtype
$rightname

Public Methods

Method Description
canBeTranslated ( CommonGLPI $item ) : true Check if an item can be translated It be translated if translation if globally on and item is an instance of CommonDropdown or CommonTreeDropdown and if translation is enabled for this class
checkBeforeAddorUpdate ( $input, $add = true ) : true Check if a field's translation can be added or updated
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
dropdownFields ( CommonDBTM $item, $language = '', $value = '' ) : the Display a dropdown with fields that can be translated for an itemtype
generateCompletename ( $input, $add = true ) : nothing Generate completename associated with a tree dropdown
getAvailableTranslations ( $language ) : array Get available translations for a language
getForbiddenStandardMassiveAction ( ) Forbidden massives actions
getNumberOfTranslations ( $itemtype, $items_id, $field, $language ) : the Return the number of translations for a field in a language
getNumberOfTranslationsForItem ( $item ) : the Return the number of translations for an item
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTranslatedValue ( $ID, $itemtype, $field = 'name', $language, $value = '' ) : the Get translated value for a field in a particular language
getTranslationByName ( $itemtype, $field, $value ) : the Get a translation for a value
getTranslationID ( $ID, $itemtype, $field, $language ) : the Get the id of a translated string
getTranslationsForAnItem ( $itemtype, $items_id, $field ) : the Get translations for an item
getTypeName ( $nb )
hasItemtypeATranslation ( $itemtype ) : true Check if there's at least one translation for this itemtype
isDropdownTranslationActive ( ) : true Is dropdown item translation functionnality active
post_addItem ( )
post_purgeItem ( )
post_updateItem ( $history = 1 )
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
regenerateAllCompletenameTranslationsFor ( $itemtype, $items_id ) : the Regenerate all completename translations for an item
showForm ( $ID, $options = [] ) Display translation form
showTranslations ( CommonDropdown $item ) : true; Display all translated field for a dropdown

Method Details

canBeTranslated() static public method

Check if an item can be translated It be translated if translation if globally on and item is an instance of CommonDropdown or CommonTreeDropdown and if translation is enabled for this class
static public canBeTranslated ( CommonGLPI $item ) : true
$item CommonGLPI the item to check
return true if item can be translated, false otherwise

checkBeforeAddorUpdate() public method

Check if a field's translation can be added or updated
public checkBeforeAddorUpdate ( $input, $add = true ) : true
$input translation's fields
$add boolean true if a transaltion must be added, false if updated (true by default)
return true if translation can be added/update, false otherwise

displayTabContentForItem() static public method

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI CommonGLPI object
$tabnum (default 1)
$withtemplate (default 0)

dropdownFields() static public method

Display a dropdown with fields that can be translated for an itemtype
static public dropdownFields ( CommonDBTM $item, $language = '', $value = '' ) : the
$item CommonDBTM a Dropdown item
$language language to look for translations (default '')
$value field which must be selected by default (default '')
return the dropdown's random identifier

generateCompletename() public method

Generate completename associated with a tree dropdown
public generateCompletename ( $input, $add = true ) : nothing
$input array of user values
$add boolean true if translation is added, false if update (tgrue by default)
return nothing

getAvailableTranslations() static public method

Get available translations for a language
static public getAvailableTranslations ( $language ) : array
$language language
return array of table / field translated item

getForbiddenStandardMassiveAction() public method

Forbidden massives actions

getNumberOfTranslations() static public method

Return the number of translations for a field in a language
static public getNumberOfTranslations ( $itemtype, $items_id, $field, $language ) : the
return the number of translations for this field

getNumberOfTranslationsForItem() static public method

Return the number of translations for an item
static public getNumberOfTranslationsForItem ( $item ) : the
return the number of translations for this item

getTabNameForItem() public method

See also: CommonGLPI::getTabNameForItem()
public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTranslatedValue() static public method

Get translated value for a field in a particular language
static public getTranslatedValue ( $ID, $itemtype, $field = 'name', $language, $value = '' ) : the
$ID dropdown item's id
$itemtype dropdown itemtype
$field the field to look for (default 'name')
$language get translation for this language
$value default value for the field (default '')
return the translated value of the value in the default language

getTranslationByName() static public method

Get a translation for a value
static public getTranslationByName ( $itemtype, $field, $value ) : the
$itemtype itemtype
$field field to query
$value value to translate
return the value translated if a translation is available, or the same value if not

getTranslationID() static public method

Get the id of a translated string
static public getTranslationID ( $ID, $itemtype, $field, $language ) : the
$ID item id
$itemtype item type
$field the field for which the translation is needed
$language the target language
return the row id or 0 if not translation found

getTranslationsForAnItem() static public method

Get translations for an item
static public getTranslationsForAnItem ( $itemtype, $items_id, $field ) : the
$itemtype itemtype
$items_id item ID
$field the field for which the translation is needed
return the value translated if a translation is available, or the same value if not

getTypeName() static public method

static public getTypeName ( $nb )

hasItemtypeATranslation() static public method

Check if there's at least one translation for this itemtype
static public hasItemtypeATranslation ( $itemtype ) : true
$itemtype itemtype to check
return true if there's at least one translation, otherwise false

isDropdownTranslationActive() static public method

Is dropdown item translation functionnality active
static public isDropdownTranslationActive ( ) : true
return true if active, false if not

post_addItem() public method

public post_addItem ( )

post_purgeItem() public method

public post_purgeItem ( )

post_updateItem() public method

public post_updateItem ( $history = 1 )

prepareInputForAdd() public method

public prepareInputForAdd ( $input )

prepareInputForUpdate() public method

public prepareInputForUpdate ( $input )

regenerateAllCompletenameTranslationsFor() static public method

Regenerate all completename translations for an item
static public regenerateAllCompletenameTranslationsFor ( $itemtype, $items_id ) : the
$itemtype itemtype
$items_id item ID
return the value translated if a translation is available, or the same value if not

showForm() public method

Display translation form
public showForm ( $ID, $options = [] )
$ID field (default -1)
$options array

showTranslations() static public method

Display all translated field for a dropdown
static public showTranslations ( CommonDropdown $item ) : true;
$item CommonDropdown a Dropdown item
return true;

Property Details

$dohistory public_oe property

public $dohistory

$items_id public_oe static_oe property

public static $items_id

$itemtype public_oe static_oe property

public static $itemtype

$rightname static_oe public_oe property

static public $rightname