@@ 84-107 (lines=24) @@ | ||
81 | * @throws DataGridException |
|
82 | * @return void |
|
83 | */ |
|
84 | public function beforeDataModelFilter(IDataSource $dataSource) |
|
85 | { |
|
86 | if (!$this->hasSomeAggregationFunction()) { |
|
87 | return; |
|
88 | } |
|
89 | ||
90 | if (!$dataSource instanceof IAggregatable) { |
|
91 | throw new DataGridException('Used DataSource has to implement IAggregatable for aggegations to work'); |
|
92 | } |
|
93 | ||
94 | if ($this->multipleAggregationFunction) { |
|
95 | if ($this->multipleAggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_ALL) { |
|
96 | $dataSource->processAggregation([$this->multipleAggregationFunction, 'processDataSource']); |
|
97 | } |
|
98 | ||
99 | return; |
|
100 | } |
|
101 | ||
102 | foreach ($this->aggregationFunctions as $aggregationFunction) { |
|
103 | if ($aggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_ALL) { |
|
104 | $dataSource->processAggregation([$aggregationFunction, 'processDataSource']); |
|
105 | } |
|
106 | } |
|
107 | } |
|
108 | ||
109 | ||
110 | /** |
|
@@ 115-138 (lines=24) @@ | ||
112 | * @throws DataGridException |
|
113 | * @return void |
|
114 | */ |
|
115 | public function afterDataModelFilter(IDataSource $dataSource) |
|
116 | { |
|
117 | if (!$this->hasSomeAggregationFunction()) { |
|
118 | return; |
|
119 | } |
|
120 | ||
121 | if (!$dataSource instanceof IAggregatable) { |
|
122 | throw new DataGridException('Used DataSource has to implement IAggregatable for aggegations to work'); |
|
123 | } |
|
124 | ||
125 | if ($this->multipleAggregationFunction) { |
|
126 | if ($this->multipleAggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_FILTERED) { |
|
127 | $dataSource->processAggregation([$this->multipleAggregationFunction, 'processDataSource']); |
|
128 | } |
|
129 | ||
130 | return; |
|
131 | } |
|
132 | ||
133 | foreach ($this->aggregationFunctions as $aggregationFunction) { |
|
134 | if ($aggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_FILTERED) { |
|
135 | $dataSource->processAggregation([$aggregationFunction, 'processDataSource']); |
|
136 | } |
|
137 | } |
|
138 | } |
|
139 | ||
140 | ||
141 | /** |
|
@@ 146-169 (lines=24) @@ | ||
143 | * @throws DataGridException |
|
144 | * @return void |
|
145 | */ |
|
146 | public function afterDataModelPaginated(IDataSource $dataSource) |
|
147 | { |
|
148 | if (!$this->hasSomeAggregationFunction()) { |
|
149 | return; |
|
150 | } |
|
151 | ||
152 | if (!$dataSource instanceof IAggregatable) { |
|
153 | throw new DataGridException('Used DataSource has to implement IAggregatable for aggegations to work'); |
|
154 | } |
|
155 | ||
156 | if ($this->multipleAggregationFunction) { |
|
157 | if ($this->multipleAggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_PAGINATED) { |
|
158 | $dataSource->processAggregation([$this->multipleAggregationFunction, 'processDataSource']); |
|
159 | } |
|
160 | ||
161 | return; |
|
162 | } |
|
163 | ||
164 | foreach ($this->aggregationFunctions as $aggregationFunction) { |
|
165 | if ($aggregationFunction->getFilterDataType() === IAggregationFunction::DATA_TYPE_PAGINATED) { |
|
166 | $dataSource->processAggregation([$aggregationFunction, 'processDataSource']); |
|
167 | } |
|
168 | } |
|
169 | } |
|
170 | ||
171 | ||
172 | /** |