@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @return Doctrine\ORM\Query |
| 55 | - */ |
|
| 55 | + */ |
|
| 56 | 56 | public function getQuery() |
| 57 | 57 | { |
| 58 | 58 | return $this->data_source->getQuery(); |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $or = []; |
| 123 | 123 | |
| 124 | 124 | foreach ($condition as $column => $value) { |
| 125 | - if($filter->isExactSearch()){ |
|
| 125 | + if ($filter->isExactSearch()) { |
|
| 126 | 126 | $this->data_source->where("$column = %s", $value); |
| 127 | 127 | continue; |
| 128 | 128 | } |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | use Nette\Utils\Html; |
| 12 | 12 | use Ublaboo\DataGrid\DataGrid; |
| 13 | -use Ublaboo\DataGrid\Exception\DataGridHasToBeAttachedToPresenterComponentException; |
|
| 14 | 13 | use Ublaboo\DataGrid\Exception\DataGridException; |
| 15 | 14 | use Ublaboo\DataGrid\Row; |
| 16 | 15 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | /** |
| 186 | 186 | * Set icon |
| 187 | 187 | * @param string|callable $icon |
| 188 | - * @return static|callable |
|
| 188 | + * @return Action |
|
| 189 | 189 | * @throws DataGridException |
| 190 | 190 | */ |
| 191 | 191 | public function setIcon($icon) |
@@ -270,7 +270,8 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * Check whether given property is string or callable |
| 273 | - * @param mixed $property |
|
| 273 | + * @param callable $property |
|
| 274 | + * @param string $name |
|
| 274 | 275 | * @return void |
| 275 | 276 | * @throws DataGridException |
| 276 | 277 | */ |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | use Nette\Utils\Html; |
| 12 | 12 | use Ublaboo\DataGrid\DataGrid; |
| 13 | -use Ublaboo\DataGrid\Exception\DataGridHasToBeAttachedToPresenterComponentException; |
|
| 14 | 13 | use Ublaboo\DataGrid\Exception\DataGridException; |
| 15 | 14 | use Ublaboo\DataGrid\Row; |
| 16 | 15 | |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | $element = $a; |
| 109 | 109 | |
| 110 | 110 | if ($this->icon) { |
| 111 | - $a->addHtml(Html::el('span')->class(DataGrid::$icon_prefix . $this->icon)); |
|
| 111 | + $a->addHtml(Html::el('span')->class(DataGrid::$icon_prefix.$this->icon)); |
|
| 112 | 112 | |
| 113 | 113 | if (strlen($value)) { |
| 114 | 114 | $a->addHtml(' '); |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | |
| 9 | 9 | namespace Ublaboo\DataGrid; |
| 10 | 10 | |
| 11 | -use Nette; |
|
| 12 | 11 | use DibiFluent; |
| 13 | 12 | use DibiOdbcDriver; |
| 14 | 13 | use DibiMsSqlDriver; |
@@ -148,17 +148,17 @@ |
||
| 148 | 148 | /** |
| 149 | 149 | * @param array |
| 150 | 150 | */ |
| 151 | - public function aggregationRow(array $columns){ |
|
| 151 | + public function aggregationRow(array $columns) { |
|
| 152 | 152 | $hasAggregation = FALSE; |
| 153 | 153 | /** @var Column $column */ |
| 154 | - foreach($columns as $column){ |
|
| 155 | - if($column->hasAggregationFunction()){ |
|
| 154 | + foreach ($columns as $column) { |
|
| 155 | + if ($column->hasAggregationFunction()) { |
|
| 156 | 156 | $hasAggregation = TRUE; |
| 157 | 157 | $aggregationFunction = $column->getAggregationFunction(); |
| 158 | 158 | $this->data_source->addAggregationColumn($aggregationFunction->getAggregationType(), $aggregationFunction->getColumn()); |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | - if(!$hasAggregation){ |
|
| 161 | + if (!$hasAggregation) { |
|
| 162 | 162 | return FALSE; |
| 163 | 163 | } |
| 164 | 164 | $this->data_source->getAggregationData(); |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | namespace Ublaboo\DataGrid\DataSource; |
| 10 | 10 | |
| 11 | 11 | use DibiFluent; |
| 12 | -use Nette\Utils\Callback; |
|
| 13 | 12 | use Nette\Utils\Strings; |
| 14 | 13 | use Ublaboo\DataGrid\Filter; |
| 15 | 14 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @param DibiFluent $data_source |
|
| 43 | + * @param Dibi\Fluent $data_source |
|
| 44 | 44 | * @param string $primary_key |
| 45 | 45 | */ |
| 46 | 46 | public function __construct(\Dibi\Fluent $data_source, $primary_key) |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | \dibi::IDENTIFIER |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - if ($filter->isExactSearch()){ |
|
| 174 | + if ($filter->isExactSearch()) { |
|
| 175 | 175 | $this->data_source->where("$column = %s", $value); |
| 176 | 176 | continue; |
| 177 | 177 | } |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | public function addAggregationColumn($aggregation_type, $column) { |
| 305 | 305 | |
| 306 | - $this->aggregation_data_source = $this->aggregation_data_source->select($aggregation_type .'(%n)', $column)->as($column); |
|
| 306 | + $this->aggregation_data_source = $this->aggregation_data_source->select($aggregation_type.'(%n)', $column)->as($column); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - public function getAggregationData(){ |
|
| 309 | + public function getAggregationData() { |
|
| 310 | 310 | $data = $this->aggregation_data_source->from($this->data_source)->as('data')->fetch(); |
| 311 | 311 | return $data; |
| 312 | 312 | } |
@@ -8,9 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | namespace Ublaboo\DataGrid\DataSource; |
| 10 | 10 | |
| 11 | -use DibiFluent; |
|
| 12 | 11 | use Nette\Utils\Callback; |
| 13 | -use Nette\Utils\Strings; |
|
| 14 | 12 | use Ublaboo\DataGrid\Filter; |
| 15 | 13 | |
| 16 | 14 | abstract class FilterableDataSource |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | $this->key = $key; |
| 50 | 50 | |
| 51 | - $this->setTemplate(__DIR__ . '/../templates/column_status.latte'); |
|
| 51 | + $this->setTemplate(__DIR__.'/../templates/column_status.latte'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -10,9 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | use Ublaboo\DataGrid\Filter\Filter; |
| 12 | 12 | use Ublaboo\DataGrid\Filter\FilterDate; |
| 13 | -use Nette\Utils\Callback; |
|
| 14 | 13 | use Nette\Utils\Strings; |
| 15 | -use Ublaboo\DataGrid\Exception\DataGridException; |
|
| 16 | 14 | use Ublaboo\DataGrid\Exception\DataGridArrayDataSourceException; |
| 17 | 15 | use Ublaboo\DataGrid\Utils\DateTimeHelper; |
| 18 | 16 | use Ublaboo\DataGrid\Exception\DataGridDateTimeHelperException; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * Filter by multi select value |
| 170 | 170 | * @param mixed $row |
| 171 | 171 | * @param FilterMultiSelect $filter |
| 172 | - * @return void |
|
| 172 | + * @return boolean |
|
| 173 | 173 | */ |
| 174 | 174 | public function applyFilterMultiSelect($row, FilterMultiSelect $filter) |
| 175 | 175 | { |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | /** |
| 184 | 184 | * @param mixed $row |
| 185 | 185 | * @param FilterRange $filter |
| 186 | - * @return void |
|
| 186 | + * @return boolean |
|
| 187 | 187 | */ |
| 188 | 188 | public function applyFilterRange($row, FilterRange $filter) |
| 189 | 189 | { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * @param mixed $row |
| 211 | 211 | * @param FilterDateRange $filter |
| 212 | - * @return void |
|
| 212 | + * @return boolean |
|
| 213 | 213 | */ |
| 214 | 214 | public function applyFilterDateRange($row, FilterDateRange $filter) |
| 215 | 215 | { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * Apply fitler date and tell whether row value matches or not |
| 271 | 271 | * @param mixed $row |
| 272 | 272 | * @param Filter $filter |
| 273 | - * @return mixed |
|
| 273 | + * @return boolean|null |
|
| 274 | 274 | */ |
| 275 | 275 | protected function applyFilterDate($row, FilterDate $filter) |
| 276 | 276 | { |
@@ -389,23 +389,23 @@ discard block |
||
| 389 | 389 | public function getAggregationData() |
| 390 | 390 | { |
| 391 | 391 | $result = []; |
| 392 | - foreach($this->data as $row){ |
|
| 393 | - foreach($this->aggregations as $column => $aggregation_type){ |
|
| 394 | - switch($aggregation_type){ |
|
| 392 | + foreach ($this->data as $row) { |
|
| 393 | + foreach ($this->aggregations as $column => $aggregation_type) { |
|
| 394 | + switch ($aggregation_type) { |
|
| 395 | 395 | case ColumnAggregationFunction::$aggregation_type_sum: |
| 396 | 396 | case ColumnAggregationFunction::$aggregation_type_avg: |
| 397 | - if(!isset($result[$column])){ |
|
| 397 | + if (!isset($result[$column])) { |
|
| 398 | 398 | $result[$column] = 0; |
| 399 | 399 | } |
| 400 | 400 | $result[$column] += $row[$column]; |
| 401 | 401 | break; |
| 402 | 402 | case ColumnAggregationFunction::$aggregation_type_min: |
| 403 | - if(!isset($result[$column]) || $row[$column] < $result[$column]){ |
|
| 403 | + if (!isset($result[$column]) || $row[$column] < $result[$column]) { |
|
| 404 | 404 | $result[$column] = $row[$column]; |
| 405 | 405 | } |
| 406 | 406 | break; |
| 407 | 407 | case ColumnAggregationFunction::$aggregation_type_max: |
| 408 | - if(!isset($result[$column]) || $row[$column] > $result[$column]){ |
|
| 408 | + if (!isset($result[$column]) || $row[$column] > $result[$column]) { |
|
| 409 | 409 | $result[$column] = $row[$column]; |
| 410 | 410 | } |
| 411 | 411 | break; |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - foreach($this->aggregations as $column => $aggregation_type) { |
|
| 417 | - if($aggregation_type == ColumnAggregationFunction::$aggregation_type_avg){ |
|
| 418 | - $result[$column] = $result[$column] / count($this->data); |
|
| 416 | + foreach ($this->aggregations as $column => $aggregation_type) { |
|
| 417 | + if ($aggregation_type == ColumnAggregationFunction::$aggregation_type_avg) { |
|
| 418 | + $result[$column] = $result[$column] / count($this->data); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | return $result; |
@@ -219,7 +219,7 @@ |
||
| 219 | 219 | /** |
| 220 | 220 | * @param string $key |
| 221 | 221 | * @param Column\Column $column |
| 222 | - * @return void |
|
| 222 | + * @return Column\Column |
|
| 223 | 223 | */ |
| 224 | 224 | public function applyColumnCallback($key, Column\Column $column) |
| 225 | 225 | { |