- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/classes/general/tasks_report_helper.php
- Класс: CTasksReportHelper
- Вызов: CTasksReportHelper::formatResultValue
static function formatResultValue($k, &$v, &$row, &$cInfo, $total, &$customChartValue = null)
{
$field = $cInfo['field'];
$bChartValue = false;
$chartValueType = null;
$chartValue = null;
if ($k == 'STATUS' || $k == 'STATUS_PSEUDO' || $k == 'PRIORITY')
{
if (empty($cInfo['aggr']) || $cInfo['aggr'] !== 'COUNT_DISTINCT')
{
$v = htmlspecialcharsbx(GetMessage($field->getLangCode().'_VALUE_'.$v));
}
}
elseif (mb_strpos($k, 'DURATION_PLAN_HOURS') !== false && !mb_strlen($cInfo['prcnt']))
{
$bChartValue = true;
$chartValueType = 'float';
$chartValue = 0.0;
if (!empty($v))
{
$days = floor($v/24);
$hours = $v - $days*24;
$v = '';
if (!empty($days))
{
$chartValue += floatval($days * 24);
$v .= $days.GetMessage('TASKS_REPORT_DURATION_DAYS');
}
if (!empty($hours))
{
$chartValue += floatval($hours);
if (!empty($days)) $v .= ' ';
$v .= $hours.GetMessage('TASKS_REPORT_DURATION_HOURS');
}
$chartValue = round($chartValue, 2);
}
}
elseif (mb_strpos($k, 'DURATION') !== false && !mb_strlen($cInfo['prcnt']))
{
$hours = floor($v/60);
$minutes = date('i', ($v % 60)*60);
$v = $hours.':'.$minutes;
$bChartValue = true;
$chartValueType = 'float';
$chartValue = round(floatval($hours) + (floatval($minutes)/60), 2);
}
elseif (
(
mb_strpos($k, 'TIME_ESTIMATE') !== false
||
mb_strpos($k, 'TIME_SPENT_IN_LOGS') !== false
||
mb_strpos($k, 'TIME_SPENT_IN_LOGS_FOR_PERIOD') !== false
)
&& !mb_strlen($cInfo['prcnt']))
{
$hours = floor($v/3600);
$minutes = date('i', $v % 3600);
$v = $hours.':'.$minutes;
$bChartValue = true;
$chartValueType = 'float';
$chartValue = round(floatval($hours) + (floatval($minutes)/60), 2);
}
elseif ($k == 'MARK' && empty($cInfo['aggr']))
{
$v = GetMessage($field->getLangCode().'_VALUE_'.$v);
if (empty($v))
{
$v = GetMessage($field->getLangCode().'_VALUE_NONE');
}
}
elseif ($k == 'DESCRIPTION_TR')
{
$v = BitrixTasksUI::convertBBCodeToHtml($v);
$v = htmlspecialcharsbx(str_replace("x0D", ' ', str_replace("x0A", ' ', PrepareTxtForEmail(strip_tags($v)))));
}
else
{
parent::formatResultValue($k, $v, $row, $cInfo, $total);
}
if ($bChartValue && is_array($customChartValue))
{
$customChartValue['exist'] = true;
$customChartValue['type'] = $chartValueType;
$customChartValue['value'] = $chartValue;
}
}