29 if (!Loader::includeModule(
'currency'))
31 $this->errorCollection->add([
new Error(
Loc::getMessage(
'STORE_CHART_REPORT_NO_CURRENCY_ERROR'))]);
33 if (!self::checkDocumentReadRights())
35 $this->errorCollection->add([
new Error(
Loc::getMessage(
'STORE_CHART_REPORT_NO_READ_RIGHTS_ERROR'))]);
43 $this->arResult[
'ERROR_MESSAGES'] = array_map(
static function(
Error $error) {
45 }, $this->errorCollection->getValues());
47 $this->includeComponentTemplate();
60 $this->arResult[
'chartData'] = [
63 'detailSliderUrl' => $innerChartData[
'isCommonChart'] ? $innerChartData[
'sliderUrl'] :
null,
65 'isPopupEnabled' => !$innerChartData[
'isCommonChart'] || ($innerChartData[
'storesInfo'][
'storeCount'] ?? 0) > 0,
67 'isCommonChart' => $innerChartData[
'isCommonChart'],
69 'id' => $innerChartData[
'currency'],
70 'symbol' => $this->getCurrencySymbol($innerChartData[
'currency']),
71 'format' => \CCurrencyLang::GetFormatDescription($innerChartData[
'currency']),
79 if (!$chartData[
'isCommonChart'] || $chartData[
'storesInfo'][
'storeCount'] <= 0)
84 $storesInfo = $chartData[
'storesInfo'];
85 $storesList = htmlspecialcharsbx($storesInfo[
'cropStoreNamesList']);
88 'STORE_CHART_REPORT_STORES_TOTAL',
89 [
'#TOTAL_NUMBER#' => $storesInfo[
'storeCount']]
92 $totalLink = $totalLinkContent;
93 if (isset($chartData[
'sliderUrl']))
99 'STORE_CHART_REPORT_STORES_LIST_TEMPLATE',
101 '#STORES_LIST#' => $storesList,
102 '#STORES_TOTAL_LINK#' => $totalLink,
108 private function getCurrencySymbol(
string $currency): string
110 if (CurrencyManager::isCurrencyExist($currency))
112 return CurrencyManager::getSymbolList()[$currency];
116 'STORE_CHART_REPORT_UNDEFINED_CURRENCY_ERROR',
117 [
'#CURRENCY#' => htmlspecialcharsbx($currency)]
123 private static function checkDocumentReadRights(): bool
125 return AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ);
static getMessage($code, $replace=null, $language=null)
trait ErrorableImplementation