Completed
Push — master ( d9087d...73be91 )
by Mihail
03:34
created
src/Ffcms/Core/Helper/HTML/Table.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
40 40
         // init dom model
41 41
         $dom = new Dom();
42 42
         // draw response
43
-        $table = $dom->table(function () use ($dom, $elements, $selectOptions) {
43
+        $table = $dom->table(function() use ($dom, $elements, $selectOptions) {
44 44
             $res = null;
45 45
             // check if thead is defined
46 46
             if (isset($elements['thead']) && Obj::isArray($elements['thead']) && count($elements['thead']) > 0 && Obj::isArray($elements['thead']['titles'])) {
47 47
                 // add thead container
48
-                $res .= $dom->thead(function () use ($dom, $elements, $selectOptions) {
49
-                    return $dom->tr(function () use ($dom, $elements, $selectOptions) {
48
+                $res .= $dom->thead(function() use ($dom, $elements, $selectOptions) {
49
+                    return $dom->tr(function() use ($dom, $elements, $selectOptions) {
50 50
                         $tr = null;
51 51
                         foreach ($elements['thead']['titles'] as $order => $title) {
52 52
                             $th = htmlentities($title['text']);
53 53
                             // make global checkbox for selectable columns
54 54
                             if ($selectOptions !== false && $order + 1 === $selectOptions['attachOrder']) {
55
-                                $th = $dom->input(function () {
55
+                                $th = $dom->input(function() {
56 56
                                     return null;
57
-                                }, ['type' => 'checkbox', 'name' => 'selectAll']) . ' ' . $th;
57
+                                }, ['type' => 'checkbox', 'name' => 'selectAll']).' '.$th;
58 58
                             }
59 59
                             // build tr row collecting all th's
60
-                            $tr .= $dom->th(function () use ($th) {
60
+                            $tr .= $dom->th(function() use ($th) {
61 61
                                 return $th;
62 62
                             });
63 63
                         }
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
                         // sort td items inside row by key increment
77 77
                         ksort($row);
78 78
                         // add data in tr container
79
-                        $tr .= $dom->tr(function () use ($dom, $row, $selectOptions) {
79
+                        $tr .= $dom->tr(function() use ($dom, $row, $selectOptions) {
80 80
                             $td = null;
81 81
                             foreach ($row as $order => $item) {
82 82
                                 if (!Obj::isInt($order)) {
83 83
                                     continue;
84 84
                                 }
85 85
                                 // collect td item
86
-                                $td .= $dom->td(function () use ($dom, $order, $item, $selectOptions) {
86
+                                $td .= $dom->td(function() use ($dom, $order, $item, $selectOptions) {
87 87
                                     $text = null;
88 88
                                     // make text secure based on passed options
89 89
                                     if ($item['html'] === true) {
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
                                     }
98 98
                                     // check if selectable box is enabled and equal current order id
99 99
                                     if ($selectOptions !== false && $order === $selectOptions['attachOrder']) {
100
-                                        $text = $dom->input(function (){
100
+                                        $text = $dom->input(function() {
101 101
                                             return null;
102
-                                        }, Arr::merge($selectOptions['selector'], ['value' => htmlentities($text)])) . ' ' . $text;
102
+                                        }, Arr::merge($selectOptions['selector'], ['value' => htmlentities($text)])).' '.$text;
103 103
                                     }
104 104
                                     return $text;
105 105
                                 }, $item['property']);
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
             // build js code for "selectAll" checkbox
123 123
             self::buildSelectorHtml($selectOptions);
124 124
             // return response inside "form" tag
125
-            return $dom->form(function () use ($dom, $selectOptions, $table) {
125
+            return $dom->form(function() use ($dom, $selectOptions, $table) {
126 126
                 foreach ($selectOptions['buttons'] as $btn) {
127 127
                     if (!Obj::isArray($btn)) {
128 128
                         continue;
129 129
                     }
130
-                    $table .= $dom->input(function(){
130
+                    $table .= $dom->input(function() {
131 131
                         return null;
132
-                    }, $btn) . ' ';
132
+                    }, $btn).' ';
133 133
                 }
134 134
                 return $table;
135 135
             }, $selectOptions['form']);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     private static function buildSelectorHtml(array $opt)
146 146
     {
147 147
         $js = '$(function () {
148
-            var targetSwitchbox = $(\'input[name="' . $opt['selector']['name'] . '"]\');
148
+            var targetSwitchbox = $(\'input[name="' . $opt['selector']['name'].'"]\');
149 149
             $(\'input[name="selectAll"]\').change(function() {
150 150
                 $(targetSwitchbox).each(function () {
151 151
                     $(this).prop(\'checked\', !$(this).is(\':checked\'));
Please login to merge, or discard this patch.