1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
reportdispatcher.php
См. документацию.
1<?php
2
3namespace Bitrix\Report\VisualConstructor;
4
5use Bitrix\Report\VisualConstructor\Config\Common;
6use Bitrix\Report\VisualConstructor\Entity\Report;
7use Bitrix\Report\VisualConstructor\Handler\BaseReport;
8use Bitrix\Report\VisualConstructor\Helper\Dashboard;
9use Bitrix\Report\VisualConstructor\Internal\Error\Error;
10use Bitrix\Report\VisualConstructor\Internal\Error\IErrorable;
11
17{
18 private $view;
19 private $report;
20 private $errors = array();
21
25 public function getReportCompatibleData()
26 {
27 if (!$this->getView())
28 {
29 $this->errors[] = new Error("Set view to get data");
30 return null;
31 }
32 if (!$this->getReport())
33 {
34 $this->errors[] = new Error("Set report to get data");
35 return null;
36 }
37
38 $compatibleDataType = $this->getView()->getCompatibleDataType();
39 $result = array();
40
41 if(!isset(Common::$reportImplementationTypesMap[$compatibleDataType]))
42 {
43 $this->errors[] = new Error("No isset : '" . $compatibleDataType . "' compatible data type.'");
44 return null;
45 }
46 else
47 {
48 $reportHandler = $this->getReport()->getReportHandler();
49 if (!$reportHandler->isEnabled())
50 {
51 return null;
52 }
53
54 $reportHandler->setView($this->getView());
55 if ($reportHandler instanceof Common::$reportImplementationTypesMap[$compatibleDataType]['interface'])
56 {
57 if (!Dashboard::getBoardModeIsDemo($this->getReport()->getWidget()->getBoardId()))
58 {
59 $reportHandler->setCalculatedData($reportHandler->prepare());
60 $getDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['method'];
61 $result = $reportHandler->{$getDataMethodName}();
62 }
63 else
64 {
65 $getDemoDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['demoMethod'];
66 $result = $reportHandler->{$getDemoDataMethodName}();
67 }
68 }
69 elseif ($reportHandler::getClassName() === BaseReport::getClassName())
70 {
71 $getDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['method'];
72 if (method_exists($reportHandler, $getDataMethodName))
73 {
74 $result = $reportHandler->{$getDataMethodName}();
75 }
76 else
77 {
78 $result = array();
79 }
80
81 }
82 else
83 {
84 $this->errors[] = new Error('Report handler ' . $reportHandler::getClassName() . ' does not implement a compatible interface');
85 return null;
86 }
87 }
88
89
90 return $result;
91 }
92
96 public function getErrors()
97 {
98 return $this->errors;
99 }
100
104 public function getView()
105 {
106 return $this->view;
107 }
108
113 public function setView(View $view)
114 {
115 $this->view = $view;
116 }
117
121 public function getReport()
122 {
123 return $this->report;
124 }
125
130 public function setReport($report)
131 {
132 $this->report = $report;
133 }
134}
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$errors
Определения iblock_catalog_edit.php:74
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393