mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
Merge branch 'split-file_attributedef.class.inc.php_AttributeApplicationLanguage.php' into split-file_attributedef.class.inc.php
This commit is contained in:
File diff suppressed because it is too large
Load Diff
44
core/attributedef/AttributeApplicationLanguage.php
Normal file
44
core/attributedef/AttributeApplicationLanguage.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An attibute that matches one of the language codes availables in the dictionnary
|
||||||
|
*
|
||||||
|
* @package iTopORM
|
||||||
|
*/
|
||||||
|
class AttributeApplicationLanguage extends AttributeString
|
||||||
|
{
|
||||||
|
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING;
|
||||||
|
|
||||||
|
public static function ListExpectedParams()
|
||||||
|
{
|
||||||
|
return parent::ListExpectedParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct($sCode, $aParams)
|
||||||
|
{
|
||||||
|
$this->m_sCode = $sCode;
|
||||||
|
$aAvailableLanguages = Dict::GetLanguages();
|
||||||
|
$aLanguageCodes = array();
|
||||||
|
foreach ($aAvailableLanguages as $sLangCode => $aInfo) {
|
||||||
|
$aLanguageCodes[$sLangCode] = $aInfo['description'] . ' (' . $aInfo['localized_description'] . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// N°6462 This should be sorted directly in \Dict during the compilation but we can't for 2 reasons:
|
||||||
|
// - Additional languages can be added on the fly even though it is not recommended
|
||||||
|
// - Formatting is done at run time (just above)
|
||||||
|
natcasesort($aLanguageCodes);
|
||||||
|
|
||||||
|
$aParams["allowed_values"] = new ValueSetEnum($aLanguageCodes);
|
||||||
|
parent::__construct($sCode, $aParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function RequiresIndex()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetBasicFilterLooseOperator()
|
||||||
|
{
|
||||||
|
return '=';
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user