PHP Класс DropdownTranslation, glpi

Наследование: extends CommonDBChild
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$dohistory
$items_id
$itemtype
$rightname

Открытые методы

Метод Описание
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

Описание методов

canBeTranslated() статический публичный Метод

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
Результат true if item can be translated, false otherwise

checkBeforeAddorUpdate() публичный Метод

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)
Результат true if translation can be added/update, false otherwise

displayTabContentForItem() статический публичный Метод

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

dropdownFields() статический публичный Метод

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 '')
Результат the dropdown's random identifier

generateCompletename() публичный Метод

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)
Результат nothing

getAvailableTranslations() статический публичный Метод

Get available translations for a language
static public getAvailableTranslations ( $language ) : array
$language language
Результат array of table / field translated item

getForbiddenStandardMassiveAction() публичный Метод

Forbidden massives actions

getNumberOfTranslations() статический публичный Метод

Return the number of translations for a field in a language
static public getNumberOfTranslations ( $itemtype, $items_id, $field, $language ) : the
Результат the number of translations for this field

getNumberOfTranslationsForItem() статический публичный Метод

Return the number of translations for an item
static public getNumberOfTranslationsForItem ( $item ) : the
Результат the number of translations for this item

getTabNameForItem() публичный Метод

См. также: CommonGLPI::getTabNameForItem()
public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTranslatedValue() статический публичный Метод

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 '')
Результат the translated value of the value in the default language

getTranslationByName() статический публичный Метод

Get a translation for a value
static public getTranslationByName ( $itemtype, $field, $value ) : the
$itemtype itemtype
$field field to query
$value value to translate
Результат the value translated if a translation is available, or the same value if not

getTranslationID() статический публичный Метод

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
Результат the row id or 0 if not translation found

getTranslationsForAnItem() статический публичный Метод

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
Результат the value translated if a translation is available, or the same value if not

getTypeName() статический публичный Метод

static public getTypeName ( $nb )

hasItemtypeATranslation() статический публичный Метод

Check if there's at least one translation for this itemtype
static public hasItemtypeATranslation ( $itemtype ) : true
$itemtype itemtype to check
Результат true if there's at least one translation, otherwise false

isDropdownTranslationActive() статический публичный Метод

Is dropdown item translation functionnality active
static public isDropdownTranslationActive ( ) : true
Результат true if active, false if not

post_addItem() публичный Метод

public post_addItem ( )

post_purgeItem() публичный Метод

public post_purgeItem ( )

post_updateItem() публичный Метод

public post_updateItem ( $history = 1 )

prepareInputForAdd() публичный Метод

public prepareInputForAdd ( $input )

prepareInputForUpdate() публичный Метод

public prepareInputForUpdate ( $input )

regenerateAllCompletenameTranslationsFor() статический публичный Метод

Regenerate all completename translations for an item
static public regenerateAllCompletenameTranslationsFor ( $itemtype, $items_id ) : the
$itemtype itemtype
$items_id item ID
Результат the value translated if a translation is available, or the same value if not

showForm() публичный Метод

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

showTranslations() статический публичный Метод

Display all translated field for a dropdown
static public showTranslations ( CommonDropdown $item ) : true;
$item CommonDropdown a Dropdown item
Результат true;

Описание свойств

$dohistory публичное свойство

public $dohistory

$items_id публичное статическое свойство

public static $items_id

$itemtype публичное статическое свойство

public static $itemtype

$rightname статическое публичное свойство

static public $rightname