- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/widget/ratingwidget.php
- Класс: Bitrix\Crm\Widget\RatingWidget
- Вызов: RatingWidget::preparePosition
protected function preparePosition(array $data, $index, $idField, $legendField, WidgetConfig $config)
{
$item = $data[$index];
$position = $index + 1;
$ID = isset($item[$idField]) ? (int)$item[$idField] : 0;
$legend = isset($item[$legendField]) ? $item[$legendField] : '';
$legendType = 'text';
$format = $config->getFomatParams();
if(isset($format['enableDecimals']) && $format['enableDecimals'] == 'N')
{
$legend = round($legend, 0);
}
if(isset($format['isCurrency']) && $format['isCurrency'] == 'Y')
{
$legend = \CCrmCurrency::MoneyToString($legend, \CCrmCurrency::GetAccountCurrencyID());
$legendType = 'html';
}
return array('id' => $ID, 'value' => $position, 'legend' => $legend, 'legendType' => $legendType);
}