1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
base.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Report\VisualConstructor\Views\Component
;
4
5
use
Bitrix\Report\VisualConstructor\Config\Common
;
6
use
Bitrix\Report\VisualConstructor\Entity\Widget
;
7
use
Bitrix\Report\VisualConstructor\Helper\Widget
as WidgetHelper;
8
use
Bitrix\Report\VisualConstructor\View
;
9
15
abstract
class
Base
extends
View
16
{
17
private
$componentName;
18
private
$componentTemplateName =
''
;
19
private
$componentParameters;
20
24
public
function
__construct
()
25
{
26
$this->
setJsClassName
(
'BX.Report.Dashboard.Content.Html'
);
27
}
28
32
public
function
getComponentName
()
33
{
34
return
$this->componentName
;
35
}
36
43
public
function
setComponentName
($componentName)
44
{
45
$this->componentName = $componentName;
46
}
47
51
public
function
getComponentParameters
()
52
{
53
return
$this->componentParameters;
54
}
55
62
public
function
setComponentParameters
($componentParameters)
63
{
64
$this->componentParameters = $componentParameters;
65
}
66
71
public
function
addComponentParameters
(
$key
, $value)
72
{
73
$this->componentParameters[
$key
] = $value;
74
}
75
82
public
function
handlerFinallyBeforePassToView
($calculatedPerformedData)
83
{
84
$result
[
'data'
] = $calculatedPerformedData;
85
return
$result
;
86
}
87
95
public
function
prepareWidgetContent
(
Widget
$widget, $withCalculatedData =
false
)
96
{
97
$resultWidget = parent::prepareWidgetContent($widget, $withCalculatedData);
98
if
(!$withCalculatedData)
99
{
100
return
$resultWidget;
101
}
102
if
($withCalculatedData)
103
{
104
$resultWidget[
'content'
][
'params'
][
'color'
] = $widget->
getWidgetHandler
()->getFormElement(
'color'
)->getValue();
105
}
106
107
try
108
{
109
$result
= $this->
getCalculatedPerformedData
($widget, $withCalculatedData);
110
}
111
catch
(\Throwable $exception)
112
{
113
$result
= [];
114
$error
= $exception->getMessage();
115
}
116
117
if
(!empty(
$result
[
'data'
]) && static::MAX_RENDER_REPORT_COUNT > 1)
118
{
119
foreach
(
$result
[
'data'
] as $num => &$reportResult)
120
{
121
if
(!isset($reportResult[
'config'
][
'color'
]))
122
{
123
$reportResult[
'config'
][
'color'
] = $widget->
getWidgetHandler
()->getReportHandlers()[$num]->getFormElement(
'color'
)->getValue();
124
}
125
126
if
(!isset($reportResult[
'config'
][
'title'
]))
127
{
128
$reportResult[
'title'
] = $widget->
getWidgetHandler
()->getReportHandlers()[$num]->getFormElement(
'label'
)->getValue();
129
}
130
else
131
{
132
$reportResult[
'title'
] = $reportResult[
'config'
][
'title'
];
133
}
134
}
135
}
136
elseif
(!empty(
$result
[
'data'
]))
137
{
138
$reportResult[
'config'
][
'color'
] = $widget->
getWidgetHandler
()->getReportHandlers()[0]->getFormElement(
'color'
)->getValue();
139
$reportResult[
'title'
] = $widget->
getWidgetHandler
()->getReportHandlers()[0]->getFormElement(
'label'
)->getValue();
140
}
141
142
$this->
addComponentParameters
(
'WIDGET'
, $widget);
143
$this->
addComponentParameters
(
'RESULT'
,
$result
);
144
145
if
(!isset(
$error
))
146
{
147
$componentResult = $this->includeComponent();
148
149
$resultWidget[
'content'
][
'params'
][
'html'
] = $componentResult[
'html'
];
150
$resultWidget[
'content'
][
'params'
][
'css'
] = $componentResult[
'css'
];
151
$resultWidget[
'content'
][
'params'
][
'js'
] = $componentResult[
'js'
];
152
}
153
else
154
{
155
$errorResult = static::GetErrorHTML(
$error
);
156
157
$resultWidget[
'content'
][
'params'
][
'html'
] = $errorResult[
'html'
];
158
$resultWidget[
'content'
][
'params'
][
'css'
] = $errorResult[
'css'
];
159
$resultWidget[
'content'
][
'params'
][
'js'
] = $errorResult[
'js'
];
160
}
161
162
return
$resultWidget;
163
}
164
165
protected
static
function
GetErrorHTML
($errorText)
166
{
167
global
$APPLICATION
;
168
ob_start();
169
ShowError
($errorText);
170
$result
[
'html'
] = ob_get_clean();;
171
$result
[
'js'
] =
$APPLICATION
->arHeadScripts;
172
$result
[
'css'
] =
$APPLICATION
->sPath2css;
173
174
foreach
(
$result
[
'js'
] as
$key
=> $value)
175
{
176
$result
[
'js'
][
$key
] = \CUtil::GetAdditionalFileURL($value);
177
}
178
foreach
(
$result
[
'css'
] as
$key
=> $value)
179
{
180
$result
[
'css'
][
$key
] = \CUtil::GetAdditionalFileURL($value);
181
}
182
return
$result
;
183
}
184
192
protected
function
getCalculatedPerformedData
(
Widget
$widget, $withCalculatedData)
193
{
194
static
$data
;
195
if
(!
$data
)
196
{
197
$data
= $withCalculatedData ? WidgetHelper::getCalculatedPerformedData($this, $widget) :
array
();
198
$data
= $this->
handlerFinallyBeforePassToView
(
$data
);
199
}
200
return
$data
;
201
}
202
208
private
function
includeComponent()
209
{
210
global
$APPLICATION
;
211
ob_start();
212
$APPLICATION
->IncludeComponent(
213
$this->
getComponentName
(),
214
$this->
getComponentTemplateName
(),
215
$this->
getComponentParameters
()
216
);
217
$componentContent = ob_get_clean();
218
$result
[
'html'
] = $componentContent;
219
$result
[
'js'
] =
$APPLICATION
->arHeadScripts;
220
$result
[
'css'
] =
$APPLICATION
->sPath2css;
221
222
foreach
(
$result
[
'js'
] as
$key
=> $value)
223
{
224
$result
[
'js'
][
$key
] = \CUtil::GetAdditionalFileURL($value);
225
}
226
foreach
(
$result
[
'css'
] as
$key
=> $value)
227
{
228
$result
[
'css'
][
$key
] = \CUtil::GetAdditionalFileURL($value);
229
}
230
return
$result
;
231
}
232
236
public
function
getComponentTemplateName
()
237
{
238
return
$this->componentTemplateName;
239
}
240
244
public
function
setComponentTemplateName
($componentTemplateName)
245
{
246
$this->componentTemplateName = $componentTemplateName;
247
}
248
}
$APPLICATION
global $APPLICATION
Определения
include.php:80
Bitrix\Report\VisualConstructor\Config\Common
Определения
common.php:11
Bitrix\Report\VisualConstructor\Entity\Widget
Определения
widget.php:22
Bitrix\Report\VisualConstructor\Entity\Widget\getWidgetHandler
getWidgetHandler($isRuntime=false)
Определения
widget.php:192
Bitrix\Report\VisualConstructor\Helper\Widget
Определения
widget.php:18
Bitrix\Report\VisualConstructor\View
Определения
view.php:26
Bitrix\Report\VisualConstructor\View\setJsClassName
setJsClassName($jsClassName)
Определения
view.php:383
Bitrix\Report\VisualConstructor\Views\Component\Base
Определения
base.php:16
Bitrix\Report\VisualConstructor\Views\Component\Base\prepareWidgetContent
prepareWidgetContent(Widget $widget, $withCalculatedData=false)
Определения
base.php:95
Bitrix\Report\VisualConstructor\Views\Component\Base\__construct
__construct()
Определения
base.php:24
Bitrix\Report\VisualConstructor\Views\Component\Base\setComponentParameters
setComponentParameters($componentParameters)
Определения
base.php:62
Bitrix\Report\VisualConstructor\Views\Component\Base\GetErrorHTML
static GetErrorHTML($errorText)
Определения
base.php:165
Bitrix\Report\VisualConstructor\Views\Component\Base\getCalculatedPerformedData
getCalculatedPerformedData(Widget $widget, $withCalculatedData)
Определения
base.php:192
Bitrix\Report\VisualConstructor\Views\Component\Base\getComponentName
getComponentName()
Определения
base.php:32
Bitrix\Report\VisualConstructor\Views\Component\Base\addComponentParameters
addComponentParameters($key, $value)
Определения
base.php:71
Bitrix\Report\VisualConstructor\Views\Component\Base\handlerFinallyBeforePassToView
handlerFinallyBeforePassToView($calculatedPerformedData)
Определения
base.php:82
Bitrix\Report\VisualConstructor\Views\Component\Base\getComponentTemplateName
getComponentTemplateName()
Определения
base.php:236
Bitrix\Report\VisualConstructor\Views\Component\Base\setComponentName
setComponentName($componentName)
Определения
base.php:43
Bitrix\Report\VisualConstructor\Views\Component\Base\getComponentParameters
getComponentParameters()
Определения
base.php:51
Bitrix\Report\VisualConstructor\Views\Component\Base\setComponentTemplateName
setComponentTemplateName($componentTemplateName)
Определения
base.php:244
$componentName
$componentName
Определения
component_props2.php:49
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
ShowError
ShowError($strError, $cls="errortext")
Определения
tools.php:4499
Bitrix\Report\VisualConstructor\Views\Component
Определения
base.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
report
lib
visualconstructor
views
component
base.php
Создано системой
1.14.0