Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
previewblock.php
1
<?php
2
namespace
Bitrix\Report\VisualConstructor\Fields\Valuable
;
3
4
use
Bitrix\Report\VisualConstructor\Helper\Widget
;
5
use
Bitrix\Report\VisualConstructor\RuntimeProvider\ViewProvider
;
6
11
class
PreviewBlock
extends
BaseValuable
12
{
13
const
JS_EVENT_ON_VIEW_SELECT
=
'onSelect'
;
14
15
protected
$widget
;
22
public
function
__construct
($key)
23
{
24
parent::__construct($key);
25
$this->
setLabel
(
''
);
26
$this->
setDefaultValue
(
'linearGraph'
);
27
}
28
36
public
function
printContent
()
37
{
38
$params = array(
39
'AVAILABLE_VIEWS'
=> $this->getAvailableViewList(),
40
'PREPARED_WIDGET'
=>
Widget::prepareWidgetContent
($this->
getWidget
(),
true
),
41
);
42
$this->
includeFieldComponent
(
'previewblock'
, $params);
43
}
44
48
public
function
getWidget
()
49
{
50
return
$this->widget
;
51
}
52
59
public
function
setWidget
(\
Bitrix
\
Report
\VisualConstructor\
Entity
\
Widget
$widget
)
60
{
61
$this->widget =
$widget
;
62
$this->
setDefaultValue
($widget->getViewKey());
63
}
64
68
private
function
getAvailableViews()
69
{
70
static
$views;
71
if
(!$views)
72
{
73
$viewProvider =
new
ViewProvider
();
74
$results = $viewProvider->execute()->getResults();
75
foreach
($results as $result)
76
{
77
if
($result::USE_IN_VISUAL_CONSTRUCTOR)
78
{
79
$views[$result->getKey()] = $result;
80
}
81
}
82
}
83
84
return
$views;
85
}
86
90
private
function
getAvailableViewList()
91
{
92
$result = array();
93
$views = $this->getAvailableViews();
94
foreach
($views as $view)
95
{
96
$result[] = array(
97
'key'
=> $view->getKey(),
98
'label'
=> $view->getLabel(),
99
'logoUrl'
=> $view->getLogoUri(),
100
);
101
}
102
return
$result;
103
}
104
105
106
}
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Report\VisualConstructor\Entity\Report
Definition
report.php:17
Bitrix\Report\VisualConstructor\Fields\Base\includeFieldComponent
includeFieldComponent($templateName, $params=array())
Definition
base.php:530
Bitrix\Report\VisualConstructor\Fields\Base\setLabel
setLabel($label)
Definition
base.php:243
Bitrix\Report\VisualConstructor\Fields\Valuable\BaseValuable
Definition
basevaluable.php:11
Bitrix\Report\VisualConstructor\Fields\Valuable\BaseValuable\setDefaultValue
setDefaultValue($defaultValue)
Definition
basevaluable.php:40
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock
Definition
previewblock.php:12
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\printContent
printContent()
Definition
previewblock.php:36
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\JS_EVENT_ON_VIEW_SELECT
const JS_EVENT_ON_VIEW_SELECT
Definition
previewblock.php:13
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\getWidget
getWidget()
Definition
previewblock.php:48
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\setWidget
setWidget(\Bitrix\Report\VisualConstructor\Entity\Widget $widget)
Definition
previewblock.php:59
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\$widget
$widget
Definition
previewblock.php:15
Bitrix\Report\VisualConstructor\Fields\Valuable\PreviewBlock\__construct
__construct($key)
Definition
previewblock.php:22
Bitrix\Report\VisualConstructor\Helper\Widget
Definition
widget.php:18
Bitrix\Report\VisualConstructor\Helper\Widget\prepareWidgetContent
static prepareWidgetContent(WidgetEntity $widget, $withCalculatedData=false)
Definition
widget.php:28
Bitrix\Report\VisualConstructor\RuntimeProvider\ViewProvider
Definition
viewprovider.php:14
Bitrix\Report\VisualConstructor\Fields\Valuable
Definition
basevaluable.php:2
Bitrix
modules
report
lib
visualconstructor
fields
valuable
previewblock.php
Создано системой
1.10.0