@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @inheritdoc |
| 35 | 35 | */ |
| 36 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 36 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 37 | 37 | { |
| 38 | 38 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 39 | 39 | if (!empty($searchData)) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function getComponentDetails() |
| 60 | 60 | { |
| 61 | 61 | return [ |
| 62 | - 'name' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
| 62 | + 'name' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
| 63 | 63 | ]; |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | public function setValue($value) |
| 54 | 54 | { |
| 55 | 55 | if ($value === 'true' || $value === true) |
| 56 | - $this->getForm()->submittedButton=$this->getName(); |
|
| 56 | + $this->getForm()->submittedButton = $this->getName(); |
|
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -52,8 +52,9 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public function setValue($value) |
| 54 | 54 | { |
| 55 | - if ($value === 'true' || $value === true) |
|
| 56 | - $this->getForm()->submittedButton=$this->getName(); |
|
| 55 | + if ($value === 'true' || $value === true) { |
|
| 56 | + $this->getForm()->submittedButton=$this->getName(); |
|
| 57 | + } |
|
| 57 | 58 | return $this; |
| 58 | 59 | } |
| 59 | 60 | |
@@ -70,18 +70,18 @@ discard block |
||
| 70 | 70 | 'toolbar' => [ |
| 71 | 71 | [ |
| 72 | 72 | 'name' => 'paragraph', |
| 73 | - 'items' => [ 'Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source' ] |
|
| 73 | + 'items' => ['Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source'] |
|
| 74 | 74 | ] |
| 75 | 75 | ] |
| 76 | 76 | ], |
| 77 | 77 | 'default' => [ |
| 78 | 78 | 'toolbar' => [ |
| 79 | - [ 'name' => 'paragraph', 'items' => [ 'Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote'] ], |
|
| 80 | - [ 'name' => 'links', 'items' => [ 'Link', 'Unlink', 'Anchor', '-', 'EmojiPanel' ] ], |
|
| 81 | - [ 'name' => 'insert', 'items' => [ |
|
| 82 | - 'Image', ($this->useMediaBrowser ? 'Fireflyimage' : 'SimpleImageUpload'), '-', 'Table', 'SpecialChar' ] ], |
|
| 83 | - [ 'name' => 'document', 'items' => ['Maximize' ] ], |
|
| 84 | - [ 'name' => 'source', 'items' => [ 'RemoveFormat', '-', 'Source' ] ] |
|
| 79 | + ['name' => 'paragraph', 'items' => ['Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote']], |
|
| 80 | + ['name' => 'links', 'items' => ['Link', 'Unlink', 'Anchor', '-', 'EmojiPanel']], |
|
| 81 | + ['name' => 'insert', 'items' => [ |
|
| 82 | + 'Image', ($this->useMediaBrowser ? 'Fireflyimage' : 'SimpleImageUpload'), '-', 'Table', 'SpecialChar']], |
|
| 83 | + ['name' => 'document', 'items' => ['Maximize']], |
|
| 84 | + ['name' => 'source', 'items' => ['RemoveFormat', '-', 'Source']] |
|
| 85 | 85 | ], |
| 86 | 86 | 'extraPlugins' => [($this->useMediaBrowser ? 'fireflyimage' : 'simpleImageUpload')], |
| 87 | 87 | 'extraAllowedContent'=>'img[srcset,sizes,loading]' |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | * Return the purified value but allow tags to be as normal |
| 119 | 119 | * otherwise will lose ability to edit wysiwyg fields properly |
| 120 | 120 | */ |
| 121 | - public function getValueDisplay($context='') |
|
| 121 | + public function getValueDisplay($context = '') |
|
| 122 | 122 | { |
| 123 | - if ($context==='grid') { |
|
| 123 | + if ($context === 'grid') { |
|
| 124 | 124 | return strip_tags(Str::truncate($this->getValue(), 200, '...', null, true)); |
| 125 | 125 | } |
| 126 | 126 | return $this->getValue(); |
@@ -131,6 +131,6 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getComponentDetails() |
| 133 | 133 | { |
| 134 | - return ['label' => 'Rich Text', 'group' => 'Formatted Text', 'icon' => 'fa fa-font', 'order' => 220]; |
|
| 134 | + return ['label' => 'Rich Text', 'group' => 'Formatted Text', 'icon' => 'fa fa-font', 'order' => 220]; |
|
| 135 | 135 | } |
| 136 | 136 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function getComponentDetails() |
| 41 | 41 | { |
| 42 | 42 | return [ |
| 43 | - 'label' => 'El Switch', 'icon' => 'fa fa-toggle-on', 'group' => 'Choice', 'order'=>465, |
|
| 43 | + 'label' => 'El Switch', 'icon' => 'fa fa-toggle-on', 'group' => 'Choice', 'order'=>465, |
|
| 44 | 44 | ]; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -66,10 +66,12 @@ discard block |
||
| 66 | 66 | if ($searchData !== '') { |
| 67 | 67 | $dateFrom = Arr::get($searchData, 'from'); |
| 68 | 68 | $dateTo = Arr::get($searchData, 'to'); |
| 69 | - if ($dateFrom) |
|
| 70 | - $query->where($this->getDataKey(), '>=', $dateFrom); |
|
| 71 | - if ($dateTo) |
|
| 72 | - $query->where($this->getDataKey(), '<=', $dateTo); |
|
| 69 | + if ($dateFrom) { |
|
| 70 | + $query->where($this->getDataKey(), '>=', $dateFrom); |
|
| 71 | + } |
|
| 72 | + if ($dateTo) { |
|
| 73 | + $query->where($this->getDataKey(), '<=', $dateTo); |
|
| 74 | + } |
|
| 73 | 75 | } |
| 74 | 76 | } |
| 75 | 77 | |
@@ -87,8 +89,9 @@ discard block |
||
| 87 | 89 | public function getValue() |
| 88 | 90 | { |
| 89 | 91 | $value = parent::getValue(); |
| 90 | - if (is_array($value)) |
|
| 91 | - return $value; |
|
| 92 | + if (is_array($value)) { |
|
| 93 | + return $value; |
|
| 94 | + } |
|
| 92 | 95 | return ['from' => '', 'to' => '']; |
| 93 | 96 | } |
| 94 | 97 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * Any filters you want to apply to a data map selection. |
| 64 | 64 | * @var array field=>value |
| 65 | 65 | */ |
| 66 | - public $dataMapFilters=[]; |
|
| 66 | + public $dataMapFilters = []; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Any fields you want to return in a data map selection if not the default. |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * string (otherwise with a space) and prefix postfix arguments will be |
| 75 | 75 | * applied to it. |
| 76 | 76 | */ |
| 77 | - public $dataMapFields=[]; |
|
| 77 | + public $dataMapFields = []; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @inheritdoc |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @return array |
| 134 | 134 | * @throws \Exception |
| 135 | 135 | */ |
| 136 | - public function getMapObjects($query=null, $start=0, $length=100) |
|
| 136 | + public function getMapObjects($query = null, $start = 0, $length = 100) |
|
| 137 | 137 | { |
| 138 | 138 | $provider = $this->getProviderService(); |
| 139 | 139 | $format = ['prefix'=>'', 'concat'=>' ', 'postfix' => '']; |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * @inheritdoc |
| 167 | 167 | */ |
| 168 | - public function getValueDisplay($context='') |
|
| 168 | + public function getValueDisplay($context = '') |
|
| 169 | 169 | { |
| 170 | 170 | $items = $this->getItems(); |
| 171 | 171 | if (is_array($this->value)) { |
| 172 | 172 | $values = array_intersect_key($items, array_flip($this->value)); |
| 173 | - return implode(', ',$values); |
|
| 173 | + return implode(', ', $values); |
|
| 174 | 174 | } else if (isset($items[$this->value])) { |
| 175 | 175 | return $items[$this->value]; |
| 176 | 176 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /** |
| 206 | 206 | * @inheritdoc |
| 207 | 207 | */ |
| 208 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 208 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 209 | 209 | { |
| 210 | 210 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 211 | 211 | if ($searchData !== '') { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class HtmlRaw extends TextArea |
| 17 | 17 | { |
| 18 | - const TEXT_TRUNCATE_LENGTH=250; |
|
| 18 | + const TEXT_TRUNCATE_LENGTH = 250; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Set some allowable tags for single text fields |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @inheritdoc |
| 35 | 35 | */ |
| 36 | - public function getValueDisplay($context='') |
|
| 36 | + public function getValueDisplay($context = '') |
|
| 37 | 37 | { |
| 38 | 38 | $text = parent::getValueDisplay(); |
| 39 | 39 | if (strlen($text) > self::TEXT_TRUNCATE_LENGTH) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @inheritdoc |
| 56 | 56 | */ |
| 57 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 57 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 58 | 58 | { |
| 59 | 59 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 60 | 60 | if ($searchData !== '') { |
@@ -311,8 +311,9 @@ discard block |
||
| 311 | 311 | return $scope['key']; |
| 312 | 312 | } |
| 313 | 313 | // No url request scope defined check if a default is set |
| 314 | - if ($this->defaultScope !== null) |
|
| 315 | - return $this->defaultScope; |
|
| 314 | + if ($this->defaultScope !== null) { |
|
| 315 | + return $this->defaultScope; |
|
| 316 | + } |
|
| 316 | 317 | |
| 317 | 318 | // No default scope so return the first in the list as the default |
| 318 | 319 | $defaultScope = reset($this->_scopes); |
@@ -441,8 +442,9 @@ discard block |
||
| 441 | 442 | foreach($this->getColumns() as $key => $column) { |
| 442 | 443 | if ($column->getFilter() && $column->getFilterField() !== false) { |
| 443 | 444 | $field = $column->getFilterField(); |
| 444 | - if (is_object($field)) |
|
| 445 | - $field = $field->toArray(); |
|
| 445 | + if (is_object($field)) { |
|
| 446 | + $field = $field->toArray(); |
|
| 447 | + } |
|
| 446 | 448 | $field['name'] = $key; |
| 447 | 449 | $field['dataKey'] = $column->getDbField(); |
| 448 | 450 | $this->_filterForm->add($field); |
@@ -643,8 +645,9 @@ discard block |
||
| 643 | 645 | $formsDefinitionCache[$cacheKey] = $formDefinition; |
| 644 | 646 | } |
| 645 | 647 | $form = new \neon\core\form\Form($formsDefinitionCache[$cacheKey]); |
| 646 | - if ($member === null) |
|
| 647 | - $member = $key; |
|
| 648 | + if ($member === null) { |
|
| 649 | + $member = $key; |
|
| 650 | + } |
|
| 648 | 651 | return $this->addColumn($key, [ |
| 649 | 652 | 'title' => $form->getField($member)->getLabel(), |
| 650 | 653 | 'class' => 'neon\core\grid\column\Column', |
@@ -706,8 +709,9 @@ discard block |
||
| 706 | 709 | */ |
| 707 | 710 | public function removeColumn($key) |
| 708 | 711 | { |
| 709 | - if ($this->columnExists($key)) |
|
| 710 | - unset($this->_columns[$key]); |
|
| 712 | + if ($this->columnExists($key)) { |
|
| 713 | + unset($this->_columns[$key]); |
|
| 714 | + } |
|
| 711 | 715 | } |
| 712 | 716 | |
| 713 | 717 | /** |
@@ -754,8 +758,9 @@ discard block |
||
| 754 | 758 | */ |
| 755 | 759 | public function refreshDataProvider() |
| 756 | 760 | { |
| 757 | - if ($this->_dataProvider) |
|
| 758 | - $this->_dataProvider = clone $this->getDataProvider(); |
|
| 761 | + if ($this->_dataProvider) { |
|
| 762 | + $this->_dataProvider = clone $this->getDataProvider(); |
|
| 763 | + } |
|
| 759 | 764 | } |
| 760 | 765 | |
| 761 | 766 | /** |
@@ -780,8 +785,9 @@ discard block |
||
| 780 | 785 | */ |
| 781 | 786 | public function gridBoot() |
| 782 | 787 | { |
| 783 | - if (! $this->hasData()) |
|
| 784 | - $this->_gridData = Arr::get($_REQUEST, $this->id, null); |
|
| 788 | + if (! $this->hasData()) { |
|
| 789 | + $this->_gridData = Arr::get($_REQUEST, $this->id, null); |
|
| 790 | + } |
|
| 785 | 791 | // load the active scope |
| 786 | 792 | $this->_scope = Arr::get($this->_gridData, "scope", []); |
| 787 | 793 | // load request data into the form |
@@ -818,8 +824,9 @@ discard block |
||
| 818 | 824 | public function exportCsv($page=0, $pageSize=1000, $asRows=false) |
| 819 | 825 | { |
| 820 | 826 | // check we're allowed to do this |
| 821 | - if (!$this->canExportCsv) |
|
| 822 | - return null; |
|
| 827 | + if (!$this->canExportCsv) { |
|
| 828 | + return null; |
|
| 829 | + } |
|
| 823 | 830 | |
| 824 | 831 | $this->gridBoot(); |
| 825 | 832 | // Get header column names |
@@ -841,8 +848,9 @@ discard block |
||
| 841 | 848 | $pagination->page=$page; |
| 842 | 849 | $pagination->pageSize = min(1000,$pageSize); |
| 843 | 850 | $models = $dataProvider->getModels(); |
| 844 | - if (empty($models)) |
|
| 845 | - return null; |
|
| 851 | + if (empty($models)) { |
|
| 852 | + return null; |
|
| 853 | + } |
|
| 846 | 854 | |
| 847 | 855 | $rows = []; |
| 848 | 856 | foreach($models as $index => $row) { |
@@ -858,8 +866,9 @@ discard block |
||
| 858 | 866 | $dataProvider->models = null; |
| 859 | 867 | |
| 860 | 868 | // Add headers columns as the first row if we are on the first page |
| 861 | - if ($page==0) |
|
| 862 | - array_unshift($rows, implode(',', $headerCols)); |
|
| 869 | + if ($page==0) { |
|
| 870 | + array_unshift($rows, implode(',', $headerCols)); |
|
| 871 | + } |
|
| 863 | 872 | |
| 864 | 873 | return $asRows ? $rows : implode("\n", $rows); |
| 865 | 874 | } |
@@ -935,8 +944,9 @@ discard block |
||
| 935 | 944 | { |
| 936 | 945 | foreach ($this->getScopes() as $key => $scope) { |
| 937 | 946 | // counts across whole tables are very very expensive. Don't count more than once |
| 938 | - if (isset($this->_scopeCounts[$key])) |
|
| 939 | - continue; |
|
| 947 | + if (isset($this->_scopeCounts[$key])) { |
|
| 948 | + continue; |
|
| 949 | + } |
|
| 940 | 950 | $dp = clone $this->getDataProvider(); |
| 941 | 951 | // call the scope function defined by `'scope'.$key` functions in child classes |
| 942 | 952 | $this->callScope($scope, $dp->getQueryBuilder()); |
@@ -964,8 +974,9 @@ discard block |
||
| 964 | 974 | public function processSearch() |
| 965 | 975 | { |
| 966 | 976 | $data = $this->getGridData(); |
| 967 | - if (!isset($data['filter'])) |
|
| 968 | - return; |
|
| 977 | + if (!isset($data['filter'])) { |
|
| 978 | + return; |
|
| 979 | + } |
|
| 969 | 980 | foreach ($this->getColumns() as $key => $column) { |
| 970 | 981 | // check there is a form filter field |
| 971 | 982 | // check that the filter field has request data |
@@ -1049,8 +1060,9 @@ discard block |
||
| 1049 | 1060 | */ |
| 1050 | 1061 | public function getColumn($columnKey) |
| 1051 | 1062 | { |
| 1052 | - if (!isset($this->_columns[$columnKey])) |
|
| 1053 | - throw new \Exception("No column with key '$columnKey' exists in the grid"); |
|
| 1063 | + if (!isset($this->_columns[$columnKey])) { |
|
| 1064 | + throw new \Exception("No column with key '$columnKey' exists in the grid"); |
|
| 1065 | + } |
|
| 1054 | 1066 | return $this->_columns[$columnKey]; |
| 1055 | 1067 | } |
| 1056 | 1068 | |
@@ -1141,8 +1153,9 @@ discard block |
||
| 1141 | 1153 | { |
| 1142 | 1154 | $columns = []; |
| 1143 | 1155 | foreach($this->getColumns() as $key => $column) { |
| 1144 | - if ($column->visible) |
|
| 1145 | - $columns[$key] = $column; |
|
| 1156 | + if ($column->visible) { |
|
| 1157 | + $columns[$key] = $column; |
|
| 1158 | + } |
|
| 1146 | 1159 | } |
| 1147 | 1160 | return $columns; |
| 1148 | 1161 | } |
@@ -1187,8 +1200,9 @@ discard block |
||
| 1187 | 1200 | */ |
| 1188 | 1201 | public function getIndexColumn() |
| 1189 | 1202 | { |
| 1190 | - if (!isset($this->_columns[$this->_indexedByColumn])) |
|
| 1191 | - throw new \Exception("No index column exists with key '$this->_indexedByColumn'."); |
|
| 1203 | + if (!isset($this->_columns[$this->_indexedByColumn])) { |
|
| 1204 | + throw new \Exception("No index column exists with key '$this->_indexedByColumn'."); |
|
| 1205 | + } |
|
| 1192 | 1206 | return $this->_columns[$this->_indexedByColumn]; |
| 1193 | 1207 | } |
| 1194 | 1208 | |
@@ -1250,8 +1264,9 @@ discard block |
||
| 1250 | 1264 | $plain = html_entity_decode( |
| 1251 | 1265 | str_replace(["\n", '"'], ['', '\''], strip_tags($content)), |
| 1252 | 1266 | ENT_HTML401 | ENT_QUOTES | ENT_HTML5); |
| 1253 | - if ($plain === $this->emptyCellDisplay) |
|
| 1254 | - $plain = ''; |
|
| 1267 | + if ($plain === $this->emptyCellDisplay) { |
|
| 1268 | + $plain = ''; |
|
| 1269 | + } |
|
| 1255 | 1270 | return '"'.$plain.'"'; |
| 1256 | 1271 | } |
| 1257 | 1272 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | // depending on how this grid was set up, this call may or may not have been made. |
| 73 | 73 | // The results are cached so call it here to be safe. |
| 74 | 74 | $totalCount = $this->getTotalCount(); |
| 75 | - $limit = [ |
|
| 75 | + $limit = [ |
|
| 76 | 76 | 'start' => $pagination->getOffset(), |
| 77 | 77 | 'length' => $pagination->getLimit(), |
| 78 | 78 | 'total' => ($totalCount > 0 ? $totalCount : true) |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * Store a total count to save multiple recalculations |
| 122 | 122 | * @var type |
| 123 | 123 | */ |
| 124 | - private $_totalCountCache=[]; |
|
| 124 | + private $_totalCountCache = []; |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @inheritDoc |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | public function __clone() |
| 46 | 46 | { |
| 47 | 47 | parent::__clone(); |
| 48 | - if ($this->_queryBuilder) |
|
| 49 | - $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 48 | + if ($this->_queryBuilder) { |
|
| 49 | + $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 50 | + } |
|
| 50 | 51 | } |
| 51 | 52 | |
| 52 | 53 | /** |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | { |
| 68 | 69 | // prepare pagination |
| 69 | 70 | $pagination = $this->getPagination(); |
| 70 | - if ($pagination === false) |
|
| 71 | - return []; |
|
| 71 | + if ($pagination === false) { |
|
| 72 | + return []; |
|
| 73 | + } |
|
| 72 | 74 | // depending on how this grid was set up, this call may or may not have been made. |
| 73 | 75 | // The results are cached so call it here to be safe. |
| 74 | 76 | $totalCount = $this->getTotalCount(); |