@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | /** @var Nayjest\Grids\Components\SelectFilter $component */ |
| 3 | 3 | $value = $component->getValue(); |
| 4 | 4 | if (!is_array($value)) $value = []; |
| 5 | -$id = uniqid() . mt_rand(); |
|
| 5 | +$id = uniqid().mt_rand(); |
|
| 6 | 6 | ?> |
| 7 | 7 | <div class="btn-group"> |
| 8 | 8 | <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | </label> |
| 26 | 26 | </div> |
| 27 | 27 | </li> |
| 28 | - <?php foreach($component->getVariants() as $val => $label): ?> |
|
| 29 | - <?php if(is_array($label)):?> |
|
| 28 | + <?php foreach ($component->getVariants() as $val => $label): ?> |
|
| 29 | + <?php if (is_array($label)):?> |
|
| 30 | 30 | <?php |
| 31 | 31 | $class = ''; |
| 32 | - if(array_intersect(array_keys($label['values']), array_keys($value))) { |
|
| 32 | + if (array_intersect(array_keys($label['values']), array_keys($value))) { |
|
| 33 | 33 | $class = ' in'; |
| 34 | 34 | } |
| 35 | 35 | ?> |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | </label> |
| 52 | 52 | </div> |
| 53 | 53 | <?php endif ?> |
| 54 | - <?php foreach($label['values'] as $option_val=>$option_label):?> |
|
| 54 | + <?php foreach ($label['values'] as $option_val=>$option_label):?> |
|
| 55 | 55 | <div> |
| 56 | 56 | <label> |
| 57 | 57 | <input |
| 58 | 58 | type="checkbox" |
| 59 | - <?php if(!empty($value[$option_val])) echo "checked='checked'" ?> |
|
| 59 | + <?php if (!empty($value[$option_val])) echo "checked='checked'" ?> |
|
| 60 | 60 | name="<?= $component->getInputName() ?>[<?= $option_val ?>]" |
| 61 | 61 | > |
| 62 | 62 | <span><?= $option_label ?></span> |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | <label> |
| 71 | 71 | <input |
| 72 | 72 | type="checkbox" |
| 73 | - <?php if(!empty($value[$val])) echo "checked='checked'" ?> |
|
| 73 | + <?php if (!empty($value[$val])) echo "checked='checked'" ?> |
|
| 74 | 74 | name="<?= $component->getInputName() ?>[<?= $val ?>]" |
| 75 | 75 | > |
| 76 | 76 | <span><?= $label ?></span> |
@@ -1,7 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** @var Nayjest\Grids\Components\SelectFilter $component */ |
| 3 | 3 | $value = $component->getValue(); |
| 4 | -if (!is_array($value)) $value = []; |
|
| 4 | +if (!is_array($value)) { |
|
| 5 | + $value = []; |
|
| 6 | +} |
|
| 5 | 7 | $id = uniqid() . mt_rand(); |
| 6 | 8 | ?> |
| 7 | 9 | <div class="btn-group"> |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | } else { |
| 28 | 28 | try { |
| 29 | 29 | return $this->src->{$fieldName}; |
| 30 | - } catch(Exception $e) { |
|
| 30 | + } catch (Exception $e) { |
|
| 31 | 31 | throw new RuntimeException( |
| 32 | 32 | "Can't read '$fieldName' property from DataRow", |
| 33 | 33 | 0, |
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | protected function setupPaginationForReading() |
| 25 | 25 | { |
| 26 | 26 | Paginator::currentPageResolver(function () { |
| 27 | - if (version_compare(App::version(), '6.0', '>=')) { |
|
| 27 | + if (version_compare(App::version(), '6.0', '>=')) { |
|
| 28 | 28 | return \Illuminate\Support\Facades\Request::input("$this->input_key.page", 1); |
| 29 | - } else { |
|
| 29 | + } else { |
|
| 30 | 30 | return \Illuminate\Support\Facades\Input::get("$this->input_key.page", 1); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | }); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | protected function setupPaginationForReading() |
| 25 | 25 | { |
| 26 | - Paginator::currentPageResolver(function () { |
|
| 26 | + Paginator::currentPageResolver(function() { |
|
| 27 | 27 | if (version_compare(App::version(), '6.0', '>=')) { |
| 28 | 28 | return \Illuminate\Support\Facades\Request::input("$this->input_key.page", 1); |
| 29 | 29 | } else { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if (isset($input['page'])) { |
| 55 | 55 | unset($input['page']); |
| 56 | 56 | } |
| 57 | - return str_replace('/?', '?',$paginator->appends($this->input_key, $input)->render()); |
|
| 57 | + return str_replace('/?', '?', $paginator->appends($this->input_key, $input)->render()); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function initialize(Grid $grid) |
@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - function headings(): array |
|
| 71 | + /** |
|
| 72 | + * |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + function headings(): array |
|
| 76 | 76 | { |
| 77 | 77 | return $this->getHeaderRow(); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * |
|
| 82 | - * @return array |
|
| 83 | - */ |
|
| 84 | - function registerEvents(): array |
|
| 80 | + /** |
|
| 81 | + * |
|
| 82 | + * @return array |
|
| 83 | + */ |
|
| 84 | + function registerEvents(): array |
|
| 85 | 85 | { |
| 86 | 86 | return [ |
| 87 | 87 | BeforeSheet::class => function(BeforeSheet $event) { |
@@ -91,6 +91,6 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | ]; |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function __construct() |
| 34 | 34 | { |
| 35 | - if(!interface_exists('Maatwebsite\Excel\Exporter')) { |
|
| 35 | + if (!interface_exists('Maatwebsite\Excel\Exporter')) { |
|
| 36 | 36 | throw new \RuntimeException('It seems there is no Maatwebsite v3 installed. Install it or use ExcelExport component'); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | $provider = $this->grid->getConfig()->getDataProvider(); |
| 58 | 58 | $this->resetPagination($provider); |
| 59 | 59 | $provider->reset(); |
| 60 | - while($row = $provider->getRow()) { |
|
| 60 | + while ($row = $provider->getRow()) { |
|
| 61 | 61 | $output = []; |
| 62 | - foreach($columnsConfig as $column) { |
|
| 62 | + foreach ($columnsConfig as $column) { |
|
| 63 | 63 | if ($this->isColumnExported($column)) { |
| 64 | 64 | $output[] = $this->escapeString($column->getValue($row)); |
| 65 | 65 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function initialize(Grid $grid) |
| 66 | 66 | { |
| 67 | 67 | parent::initialize($grid); |
| 68 | - Event::listen(Grid::EVENT_PREPARE, function (Grid $grid) { |
|
| 68 | + Event::listen(Grid::EVENT_PREPARE, function(Grid $grid) { |
|
| 69 | 69 | if ($this->grid !== $grid) { |
| 70 | 70 | return; |
| 71 | 71 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function getFileName() |
| 92 | 92 | { |
| 93 | - return $this->fileName . static::CSV_EXT; |
|
| 93 | + return $this->fileName.static::CSV_EXT; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | protected function setCsvHeaders(Response $response) |
| 173 | 173 | { |
| 174 | 174 | $response->header('Content-Type', 'application/csv'); |
| 175 | - $response->header('Content-Disposition', 'attachment; filename=' . $this->getFileName()); |
|
| 175 | + $response->header('Content-Disposition', 'attachment; filename='.$this->getFileName()); |
|
| 176 | 176 | $response->header('Pragma', 'no-cache'); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if (version_compare(Application::VERSION, '5.0.0', '<')) { |
| 182 | 182 | $provider->getPaginationFactory()->setPageName('page_unused'); |
| 183 | 183 | } else { |
| 184 | - Paginator::currentPageResolver(function () { |
|
| 184 | + Paginator::currentPageResolver(function() { |
|
| 185 | 185 | return 1; |
| 186 | 186 | }); |
| 187 | 187 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $file = fopen('php://output', 'w'); |
| 195 | 195 | |
| 196 | 196 | header('Content-Type: text/csv'); |
| 197 | - header('Content-Disposition: attachment; filename="'. $this->getFileName() .'"'); |
|
| 197 | + header('Content-Disposition: attachment; filename="'.$this->getFileName().'"'); |
|
| 198 | 198 | header('Pragma: no-cache'); |
| 199 | 199 | |
| 200 | 200 | set_time_limit(0); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $output = []; |
| 212 | 212 | foreach ($this->grid->getConfig()->getColumns() as $column) { |
| 213 | 213 | if ($this->isColumnExported($column)) { |
| 214 | - $output[] = $this->escapeString( $column->getValue($row) ); |
|
| 214 | + $output[] = $this->escapeString($column->getValue($row)); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | fputcsv($file, $output, static::CSV_DELIMITER); |