1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
analyticboard.php
См. документацию.
1
<?php
2
namespace
Bitrix\Report\VisualConstructor
;
3
4
use
Bitrix\Main\ArgumentException
;
5
use
Bitrix\Main\SystemException
;
6
use
Bitrix\Report\VisualConstructor\Helper\Filter
;
7
12
class
AnalyticBoard
13
{
14
private
$title;
15
private
$boardKey;
16
private
$machineKey;
17
private
$filter;
18
private
$batchKey =
null
;
19
private
$group =
null
;
20
private
$buttons = [];
21
private
$disabled =
false
;
22
private
$stepperEnabled =
false
;
23
private
$stepperIds = [];
24
private
$limited =
false
;
25
private
$limitComponentParams = [];
26
private
$isExternal =
false
;
27
private
$externalUrl =
""
;
28
private
$isSliderSupport =
true
;
29
private
$options;
30
private
$setOptionsCallback;
31
private
?
string
$sliderLoader =
null
;
32
33
public
function
__construct
(
string
$boardId =
''
,
array
$options = [])
34
{
35
$this->options = $options;
36
37
if
($boardId)
38
{
39
$this->
setBoardKey
($boardId);
40
41
$configurationButton =
new
BoardComponentButton
(
42
'bitrix:report.analytics.config.control'
,
43
''
,
44
[
45
'BOARD_ID'
=> $this->
getBoardKey
(),
46
'BOARD_OPTIONS'
=> $this->
getOptions
(),
47
]
48
);
49
$this->
addButton
($configurationButton);
50
}
51
}
52
56
public
function
getTitle
()
57
{
58
return
$this->title
;
59
}
60
64
public
function
setTitle
($title)
65
{
66
$this->
title
= $title;
67
}
68
72
public
function
getBoardKey
()
73
{
74
return
$this->boardKey;
75
}
76
80
public
function
setBoardKey
($boardKey)
81
{
82
$this->boardKey = $boardKey;
83
}
84
88
public
function
getMachineKey
()
89
{
90
return
$this->machineKey ?: $this->boardKey;
91
}
92
96
public
function
setMachineKey
($machineKey)
97
{
98
$this->machineKey = $machineKey;
99
}
100
104
public
function
getFilter
()
105
{
106
return
$this->filter
;
107
}
108
112
public
function
setFilter
(
Filter
$filter)
113
{
114
$this->filter = $filter;
115
}
116
120
public
function
getBatchKey
()
121
{
122
return
$this->batchKey;
123
}
124
128
public
function
setBatchKey
($batchKey)
129
{
130
$this->batchKey = $batchKey;
131
}
132
136
public
function
isNestedInBatch
()
137
{
138
return
$this->batchKey !==
null
;
139
}
140
144
public
function
addButton
(
BoardButton
$button)
145
{
146
$this->buttons[] = $button;
147
}
148
149
public
function
getButtonsContent
()
150
{
151
$result
= [
152
'html'
=>
''
,
153
'assets'
=> [
154
'js'
=> [],
155
'css'
=> [],
156
'string'
=> [],
157
]
158
];
159
if
($this->
isDisabled
())
160
{
161
return
$result
;
162
}
163
$buttons = $this->
getButtons
();
164
foreach
($buttons as $button)
165
{
166
$result
[
'html'
] .= $button->process()->getHtml();
167
foreach
($button->getJsList() as $jsPath)
168
{
169
$result
[
'assets'
][
'js'
][] = $jsPath;
170
}
171
172
foreach
($button->getCssList() as $cssPath)
173
{
174
$result
[
'assets'
][
'css'
][] = $cssPath;
175
}
176
177
foreach
($button->getStringList() as $string)
178
{
179
$result
[
'assets'
][
'string'
][] = $string;
180
}
181
}
182
183
return
$result
;
184
}
185
189
public
function
getButtons
()
190
{
191
return
$this->buttons;
192
}
193
197
public
function
isDisabled
()
198
{
199
return
$this->disabled;
200
}
201
205
public
function
setDisabled
($disabled)
206
{
207
$this->
disabled
= $disabled;
208
}
209
210
public
function
addFeedbackButton
()
211
{
212
$feedbackButton =
new
BoardComponentButton
(
'bitrix:ui.feedback.form'
,
''
, [
213
'ID'
=>
'crm-analytics'
,
214
'VIEW_TARGET'
=>
null
,
215
'FORMS'
=> [
216
[
'zones'
=> [
'com.br'
],
'id'
=>
'58'
,
'lang'
=>
'br'
,
'sec'
=>
'k6be5r'
],
217
[
'zones'
=> [
'es'
],
'id'
=>
'60'
,
'lang'
=>
'la'
,
'sec'
=>
'1shpig'
],
218
[
'zones'
=> [
'de'
],
'id'
=>
'62'
,
'lang'
=>
'de'
,
'sec'
=>
'dj2q8l'
],
219
[
'zones'
=> [
'ua'
],
'id'
=>
'66'
,
'lang'
=>
'ua'
,
'sec'
=>
't5y7px'
],
220
[
'zones'
=> [
'ru'
,
'kz'
,
'by'
],
'id'
=>
'68'
,
'lang'
=>
'ru'
,
'sec'
=>
'h6thh2'
],
221
[
'zones'
=> [
'en'
],
'id'
=>
'64'
,
'lang'
=>
'en'
,
'sec'
=>
'776ire'
],
222
],
223
'PRESETS'
=> [
224
'BOARD_KEY'
=> $this->
getBoardKey
(),
225
'sender_page'
=> $this->
getTitle
()
226
],
227
'air'
=>
true
,
228
]);
229
$this->
addButton
($feedbackButton);
230
}
231
235
public
function
isStepperEnabled
()
236
{
237
return
$this->stepperEnabled;
238
}
239
240
public
function
getStepperIds
()
241
{
242
return
$this->stepperIds;
243
}
244
245
public
function
setStepperIds
($stepperIds = [])
246
{
247
$this->stepperIds =$stepperIds;
248
}
249
252
public
function
setStepperEnabled
($stepperEnabled)
253
{
254
$this->stepperEnabled = $stepperEnabled;
255
}
256
257
public
function
isLimited
()
258
{
259
return
$this->limited;
260
}
261
262
private
function
getLimitComponentOptions()
263
{
264
return
$this->limitComponentParams;
265
}
266
267
public
function
getLimitComponentName
()
268
{
269
$componentParams
= $this->getLimitComponentOptions();
270
if
(!isset(
$componentParams
[
'NAME'
]))
271
{
272
throw
new
ArgumentException
(
"Component name do not isset"
);
273
}
274
return
$componentParams
[
'NAME'
];
275
}
276
277
public
function
getLimitComponentTemplateName
()
278
{
279
$componentOptions = $this->getLimitComponentOptions();
280
if
(!isset($componentOptions[
'TEMPLATE_NAME'
]))
281
{
282
return
''
;
283
}
284
return
$componentOptions[
'TEMPLATE_NAME'
];
285
}
286
287
public
function
getLimitComponentParams
()
288
{
289
$componentOptions = $this->getLimitComponentOptions();
290
if
(!isset($componentOptions[
'PARAMS'
]))
291
{
292
return
[];
293
}
294
return
$componentOptions[
'PARAMS'
];
295
}
296
297
public
function
setLimit
($limitComponentParams, $limit =
false
)
298
{
299
$this->limitComponentParams = $limitComponentParams;
300
$this->limited = $limit;
301
}
302
306
public
function
isExternal
(): bool
307
{
308
return
$this->isExternal;
309
}
310
314
public
function
setExternal
(
bool
$isExternal): void
315
{
316
$this->
isExternal
= $isExternal;
317
}
318
322
public
function
getExternalUrl
(): string
323
{
324
return
$this->externalUrl;
325
}
326
330
public
function
setExternalUrl
(
string
$externalUrl): void
331
{
332
$this->externalUrl = $externalUrl;
333
}
334
338
public
function
isSliderSupport
(): bool
339
{
340
return
$this->isSliderSupport;
341
}
342
346
public
function
setSliderSupport
(
bool
$isSliderSupport): void
347
{
348
$this->
isSliderSupport
= $isSliderSupport;
349
}
350
351
public
function
getSliderLoader
(): ?string
352
{
353
return
$this->sliderLoader;
354
}
355
356
public
function
setSliderLoader
(
string
$sliderLoader): void
357
{
358
$this->sliderLoader = $sliderLoader;
359
}
360
361
public
function
getDisplayComponentName
()
362
{
363
if
($this->
isDisabled
())
364
{
365
return
'bitrix:report.analytics.empty'
;
366
}
367
elseif
($this->
isLimited
())
368
{
369
return
$this->
getLimitComponentName
();
370
}
371
else
372
{
373
return
'bitrix:report.visualconstructor.board.base'
;
374
}
375
}
376
377
public
function
getDisplayComponentTemplate
()
378
{
379
return
($this->
isLimited
() ? $this->
getLimitComponentTemplateName
() :
""
);
380
}
381
382
public
function
getDisplayComponentParams
()
383
{
384
if
($this->
isDisabled
())
385
{
386
return
[];
387
}
388
elseif
($this->
isLimited
())
389
{
390
return
$this->
getLimitComponentParams
();
391
}
392
else
393
{
394
return
[
395
'BOARD_ID'
=> $this->
getBoardKey
(),
396
'IS_DEFAULT_MODE_DEMO'
=>
false
,
397
'IS_BOARD_DEFAULT'
=>
true
,
398
'FILTER'
=> $this->
getFilter
(),
399
'BOARD_BUTTONS'
=> $this->
getButtons
(),
400
'IS_ENABLED_STEPPER'
=> $this->
isStepperEnabled
(),
401
'STEPPER_IDS'
=> $this->
getStepperIds
()
402
];
403
}
404
}
405
409
public
function
resetToDefault
()
410
{
411
// nothing here
412
}
413
417
public
function
getGroup
()
418
{
419
return
$this->group;
420
}
421
425
public
function
setGroup
($group): void
426
{
427
$this->group = $group;
428
}
429
430
public
function
toggleOption
(
string
$optionName
)
431
{
432
$found =
false
;
433
foreach
($this->options as $optionFields)
434
{
435
if
($optionFields[
'NAME'
] ===
$optionName
)
436
{
437
$found =
true
;
438
break
;
439
}
440
}
441
442
if
(!$found)
443
{
444
throw
new
SystemException
(
"Unknown option {$optionName} for the board {$this->boardKey}"
);
445
}
446
447
if
(!is_callable($this->setOptionsCallback))
448
{
449
throw
new
SystemException
(
"setOptionsCallback is not callable for the board {$this->boardKey}"
);
450
}
451
452
call_user_func($this->setOptionsCallback,
$optionName
, !$optionFields[
'VALUE'
]);
453
}
454
455
public
function
registerSetOptionsCallback
(callable $cb)
456
{
457
$this->setOptionsCallback = $cb;
458
}
459
460
public
function
getOptions
() :
array
461
{
462
return
$this->options
;
463
}
464
}
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Report\VisualConstructor\AnalyticBoard
Определения
analyticboard.php:13
Bitrix\Report\VisualConstructor\AnalyticBoard\isStepperEnabled
isStepperEnabled()
Определения
analyticboard.php:235
Bitrix\Report\VisualConstructor\AnalyticBoard\getStepperIds
getStepperIds()
Определения
analyticboard.php:240
Bitrix\Report\VisualConstructor\AnalyticBoard\getOptions
getOptions()
Определения
analyticboard.php:460
Bitrix\Report\VisualConstructor\AnalyticBoard\setBoardKey
setBoardKey($boardKey)
Определения
analyticboard.php:80
Bitrix\Report\VisualConstructor\AnalyticBoard\setBatchKey
setBatchKey($batchKey)
Определения
analyticboard.php:128
Bitrix\Report\VisualConstructor\AnalyticBoard\getFilter
getFilter()
Определения
analyticboard.php:104
Bitrix\Report\VisualConstructor\AnalyticBoard\setStepperIds
setStepperIds($stepperIds=[])
Определения
analyticboard.php:245
Bitrix\Report\VisualConstructor\AnalyticBoard\resetToDefault
resetToDefault()
Определения
analyticboard.php:409
Bitrix\Report\VisualConstructor\AnalyticBoard\getGroup
getGroup()
Определения
analyticboard.php:417
Bitrix\Report\VisualConstructor\AnalyticBoard\setSliderSupport
setSliderSupport(bool $isSliderSupport)
Определения
analyticboard.php:346
Bitrix\Report\VisualConstructor\AnalyticBoard\setExternal
setExternal(bool $isExternal)
Определения
analyticboard.php:314
Bitrix\Report\VisualConstructor\AnalyticBoard\addFeedbackButton
addFeedbackButton()
Определения
analyticboard.php:210
Bitrix\Report\VisualConstructor\AnalyticBoard\toggleOption
toggleOption(string $optionName)
Определения
analyticboard.php:430
Bitrix\Report\VisualConstructor\AnalyticBoard\getLimitComponentParams
getLimitComponentParams()
Определения
analyticboard.php:287
Bitrix\Report\VisualConstructor\AnalyticBoard\getSliderLoader
getSliderLoader()
Определения
analyticboard.php:351
Bitrix\Report\VisualConstructor\AnalyticBoard\isLimited
isLimited()
Определения
analyticboard.php:257
Bitrix\Report\VisualConstructor\AnalyticBoard\setStepperEnabled
setStepperEnabled($stepperEnabled)
Определения
analyticboard.php:252
Bitrix\Report\VisualConstructor\AnalyticBoard\isExternal
isExternal()
Определения
analyticboard.php:306
Bitrix\Report\VisualConstructor\AnalyticBoard\setTitle
setTitle($title)
Определения
analyticboard.php:64
Bitrix\Report\VisualConstructor\AnalyticBoard\getTitle
getTitle()
Определения
analyticboard.php:56
Bitrix\Report\VisualConstructor\AnalyticBoard\setFilter
setFilter(Filter $filter)
Определения
analyticboard.php:112
Bitrix\Report\VisualConstructor\AnalyticBoard\getDisplayComponentName
getDisplayComponentName()
Определения
analyticboard.php:361
Bitrix\Report\VisualConstructor\AnalyticBoard\registerSetOptionsCallback
registerSetOptionsCallback(callable $cb)
Определения
analyticboard.php:455
Bitrix\Report\VisualConstructor\AnalyticBoard\addButton
addButton(BoardButton $button)
Определения
analyticboard.php:144
Bitrix\Report\VisualConstructor\AnalyticBoard\setLimit
setLimit($limitComponentParams, $limit=false)
Определения
analyticboard.php:297
Bitrix\Report\VisualConstructor\AnalyticBoard\getBoardKey
getBoardKey()
Определения
analyticboard.php:72
Bitrix\Report\VisualConstructor\AnalyticBoard\getDisplayComponentParams
getDisplayComponentParams()
Определения
analyticboard.php:382
Bitrix\Report\VisualConstructor\AnalyticBoard\setMachineKey
setMachineKey($machineKey)
Определения
analyticboard.php:96
Bitrix\Report\VisualConstructor\AnalyticBoard\setDisabled
setDisabled($disabled)
Определения
analyticboard.php:205
Bitrix\Report\VisualConstructor\AnalyticBoard\getExternalUrl
getExternalUrl()
Определения
analyticboard.php:322
Bitrix\Report\VisualConstructor\AnalyticBoard\isDisabled
isDisabled()
Определения
analyticboard.php:197
Bitrix\Report\VisualConstructor\AnalyticBoard\getLimitComponentTemplateName
getLimitComponentTemplateName()
Определения
analyticboard.php:277
Bitrix\Report\VisualConstructor\AnalyticBoard\isSliderSupport
isSliderSupport()
Определения
analyticboard.php:338
Bitrix\Report\VisualConstructor\AnalyticBoard\__construct
__construct(string $boardId='', array $options=[])
Определения
analyticboard.php:33
Bitrix\Report\VisualConstructor\AnalyticBoard\getButtonsContent
getButtonsContent()
Определения
analyticboard.php:149
Bitrix\Report\VisualConstructor\AnalyticBoard\setGroup
setGroup($group)
Определения
analyticboard.php:425
Bitrix\Report\VisualConstructor\AnalyticBoard\getMachineKey
getMachineKey()
Определения
analyticboard.php:88
Bitrix\Report\VisualConstructor\AnalyticBoard\getDisplayComponentTemplate
getDisplayComponentTemplate()
Определения
analyticboard.php:377
Bitrix\Report\VisualConstructor\AnalyticBoard\getBatchKey
getBatchKey()
Определения
analyticboard.php:120
Bitrix\Report\VisualConstructor\AnalyticBoard\setExternalUrl
setExternalUrl(string $externalUrl)
Определения
analyticboard.php:330
Bitrix\Report\VisualConstructor\AnalyticBoard\getLimitComponentName
getLimitComponentName()
Определения
analyticboard.php:267
Bitrix\Report\VisualConstructor\AnalyticBoard\setSliderLoader
setSliderLoader(string $sliderLoader)
Определения
analyticboard.php:356
Bitrix\Report\VisualConstructor\AnalyticBoard\isNestedInBatch
isNestedInBatch()
Определения
analyticboard.php:136
Bitrix\Report\VisualConstructor\AnalyticBoard\getButtons
getButtons()
Определения
analyticboard.php:189
Bitrix\Report\VisualConstructor\BoardButton
Определения
boardbutton.php:8
Bitrix\Report\VisualConstructor\BoardComponentButton
Определения
boardcomponentbutton.php:11
Bitrix\Report\VisualConstructor\Helper\Filter
Определения
filter.php:12
$options
$options
Определения
commerceml2.php:49
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
disabled
Form FILTER_ACTION disabled
Определения
options.php:358
$result
$result
Определения
get_property_values.php:14
$componentParams
$componentParams
Определения
group_wiki_index.php:20
$filter
$filter
Определения
iblock_catalog_list.php:54
Bitrix\Report\VisualConstructor
Определения
analyticboard.php:2
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
title
<? endif;?> window document title
Определения
prolog_main_admin.php:76
$title
$title
Определения
pdf.php:123
$optionName
$optionName
Определения
options.php:1735
bitrix
modules
report
lib
visualconstructor
analyticboard.php
Создано системой
1.14.0