N°8699 - attributedef.class.inc.php to PSR4 [3-PSR4]

- Add namespaces
- Add use statements
- reformat code
This commit is contained in:
Benjamin Dalsass
2025-09-11 08:15:59 +02:00
committed by Benjamin Dalsass
parent f0adbbba29
commit 3fa500c9c1
65 changed files with 12100 additions and 11369 deletions

View File

@@ -1,4 +1,13 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Core\AttributeDefinition;
use Dict;
use ValueSetEnum;
/**
* An attibute that matches one of the language codes availables in the dictionnary
@@ -7,38 +16,38 @@
*/
class AttributeApplicationLanguage extends AttributeString
{
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING;
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING;
public static function ListExpectedParams()
{
return parent::ListExpectedParams();
}
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'] . ')';
}
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);
// 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);
}
$aParams["allowed_values"] = new ValueSetEnum($aLanguageCodes);
parent::__construct($sCode, $aParams);
}
public function RequiresIndex()
{
return true;
}
public function RequiresIndex()
{
return true;
}
public function GetBasicFilterLooseOperator()
{
return '=';
}
public function GetBasicFilterLooseOperator()
{
return '=';
}
}