PHP Class DropdownTranslation, glpi

Inheritance: extends CommonDBChild
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$dohistory
$items_id
$itemtype
$rightname

Méthodes publiques

Méthode 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 méthode

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
Résultat true if item can be translated, false otherwise

checkBeforeAddorUpdate() public méthode

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)
Résultat true if translation can be added/update, false otherwise

displayTabContentForItem() static public méthode

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

dropdownFields() static public méthode

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 '')
Résultat the dropdown's random identifier

generateCompletename() public méthode

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)
Résultat nothing

getAvailableTranslations() static public méthode

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

getForbiddenStandardMassiveAction() public méthode

Forbidden massives actions

getNumberOfTranslations() static public méthode

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

getNumberOfTranslationsForItem() static public méthode

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

getTabNameForItem() public méthode

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

getTranslatedValue() static public méthode

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 '')
Résultat the translated value of the value in the default language

getTranslationByName() static public méthode

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

getTranslationID() static public méthode

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
Résultat the row id or 0 if not translation found

getTranslationsForAnItem() static public méthode

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
Résultat the value translated if a translation is available, or the same value if not

getTypeName() static public méthode

static public getTypeName ( $nb )

hasItemtypeATranslation() static public méthode

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

isDropdownTranslationActive() static public méthode

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

post_addItem() public méthode

public post_addItem ( )

post_purgeItem() public méthode

public post_purgeItem ( )

post_updateItem() public méthode

public post_updateItem ( $history = 1 )

prepareInputForAdd() public méthode

public prepareInputForAdd ( $input )

prepareInputForUpdate() public méthode

public prepareInputForUpdate ( $input )

regenerateAllCompletenameTranslationsFor() static public méthode

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

showForm() public méthode

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

showTranslations() static public méthode

Display all translated field for a dropdown
static public showTranslations ( CommonDropdown $item ) : true;
$item CommonDropdown a Dropdown item
Résultat 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