public function __construct($sCode, $sLabel = '', $defaultValue = '') { parent::__construct($sCode, $sLabel, $defaultValue); if (count(self::$aAllIcons) == 0) { self::$aAllIcons = self::FindIconsOnDisk(APPROOT . 'env-' . utils::GetCurrentEnvironment()); ksort(self::$aAllIcons); } $aValues = array(); foreach (self::$aAllIcons as $sFilePath) { $aValues[] = array('value' => $sFilePath, 'label' => basename($sFilePath), 'icon' => utils::GetAbsoluteUrlModulesRoot() . $sFilePath); } $this->SetAllowedValues($aValues); }
public function GetPropertiesFields(DesignerForm $oForm) { if (is_null(self::$aClassList)) { // Cache the ordered list of classes (ordered on the label) // (has a significant impact when editing a page with lots of badges) // $aClasses = array(); foreach ($this->oModelReflection->GetClasses('bizmodel', true) as $sClass) { $aClasses[$sClass] = $this->oModelReflection->GetName($sClass); } asort($aClasses); self::$aClassList = array(); foreach ($aClasses as $sClass => $sLabel) { $sIconUrl = $this->oModelReflection->GetClassIcon($sClass, false); $sIconFilePath = str_replace(utils::GetAbsoluteUrlAppRoot(), APPROOT, $sIconUrl); if ($sIconUrl == '') { // The icon does not exist, let's use a transparent one of the same size. $sIconUrl = utils::GetAbsoluteUrlAppRoot() . 'images/transparent_32_32.png'; } self::$aClassList[] = array('value' => $sClass, 'label' => $sLabel, 'icon' => $sIconUrl); } } $oField = new DesignerIconSelectionField('class', Dict::S('UI:DashletBadge:Prop-Class'), $this->aProperties['class']); $oField->SetAllowedValues(self::$aClassList); $oForm->AddField($oField); }