Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
reportmanager.php
1<?php
2
4
5use Bitrix\Report\VisualConstructor\BaseReportHandler;
9
14class ReportManager extends Base
15{
16 private static $reportsList = array();
17 private static $indices = array(
18 'categories' => array(),
19 'unit' => array(),
20 'dataType' => array(),
21 'reportClassName' => array()
22 );
23 private static $called = false;
24
28 protected function getEventTypeKey()
29 {
30 return Common::EVENT_REPORT_COLLECT;
31 }
32
33
37 public function getReportList()
38 {
39 return $this->isCalled() ? self::$reportsList : false;
40 }
41
45 public function getIndices()
46 {
47 return $this->isCalled() ? self::$indices : false;
48 }
49
53 public function getIndexByCategory()
54 {
55 return $this->isCalled() ? self::$indices['categories'] : false;
56 }
57
61 public function getIndexByUnit()
62 {
63 return $this->isCalled() ? self::$indices['unit'] : false;
64 }
65
69 public function getIndexByDataType()
70 {
71 return $this->isCalled() ? self::$indices['dataType'] : false;
72 }
73
78 public function call()
79 {
80 if (!self::$called)
81 {
83 $reports = $this->getResult();
84 foreach ($reports as $key => $report)
85 {
86 self::$reportsList[$key] = $report;
87 self::$indices['categories'][$report->getCategoryKey()][] = $key;
88 self::$indices['reportClassName'][$report::getClassName()][] = $key;
89 self::$indices['unit'][$report->getUnitKey()][] = $key;
90 foreach ($report->getReportImplementedDataTypes() as $dataType)
91 {
92 self::$indices['dataType'][$dataType][] = $key;
93 }
94 }
95 }
96 self::$called = true;
97 }
98
99
103 private function isCalled()
104 {
105 if (!self::$called)
106 {
107 $this->errors[] = new Error('invoke call method manager before get some parameters');
108 return false;
109 }
110 else
111 {
112 return true;
113 }
114 }
115
116}