@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct($identifier) { |
24 | 24 | parent::__construct($identifier, "tr", ""); |
25 | - $this->_states = [ |
|
25 | + $this->_states=[ |
|
26 | 26 | State::ACTIVE, |
27 | 27 | State::POSITIVE, |
28 | 28 | State::NEGATIVE, |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setColCount($colCount) { |
36 | - $count = $this->count(); |
|
37 | - for ($i = $count; $i < $colCount; $i ++) { |
|
38 | - $item = $this->addItem(NULL); |
|
36 | + $count=$this->count(); |
|
37 | + for ($i=$count; $i<$colCount; $i++) { |
|
38 | + $item=$this->addItem(NULL); |
|
39 | 39 | $item->setTagName($this->_tdTagName); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @see \Ajax\common\html\HtmlCollection::createItem() |
53 | 53 | */ |
54 | 54 | protected function createItem($value) { |
55 | - $count = $this->count(); |
|
56 | - $td = new HtmlTD("", $value, $this->_tdTagName); |
|
55 | + $count=$this->count(); |
|
56 | + $td=new HtmlTD("", $value, $this->_tdTagName); |
|
57 | 57 | $td->setContainer($this->_container, $this->_row, $count); |
58 | 58 | return $td; |
59 | 59 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | return parent::getItem($index); |
67 | 67 | } |
68 | 68 | |
69 | - public function setTdTagName($tagName = "td") { |
|
70 | - $this->_tdTagName = $tagName; |
|
69 | + public function setTdTagName($tagName="td") { |
|
70 | + $this->_tdTagName=$tagName; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @param int $row |
78 | 78 | */ |
79 | 79 | public function setContainer($container, $row) { |
80 | - $this->_container = $container; |
|
81 | - $this->_row = $row; |
|
80 | + $this->_container=$container; |
|
81 | + $this->_row=$row; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param mixed $values |
88 | 88 | */ |
89 | - public function setValues($values = array()) { |
|
90 | - return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) { |
|
89 | + public function setValues($values=array()) { |
|
90 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) { |
|
91 | 91 | $cell->setValue($value); |
92 | 92 | }); |
93 | 93 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param mixed $values |
99 | 99 | */ |
100 | - public function addValues($values = array()) { |
|
101 | - return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) { |
|
100 | + public function addValues($values=array()) { |
|
101 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) { |
|
102 | 102 | $cell->addValue($value); |
103 | 103 | }); |
104 | 104 | } |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | * @param mixed $values |
110 | 110 | */ |
111 | 111 | protected function _addOrSetValues($values, $callback) { |
112 | - $count = $this->count(); |
|
113 | - if (! \is_array($values)) { |
|
114 | - $values = \array_fill(0, $count, $values); |
|
112 | + $count=$this->count(); |
|
113 | + if (!\is_array($values)) { |
|
114 | + $values=\array_fill(0, $count, $values); |
|
115 | 115 | } else { |
116 | - if (JArray::isAssociative($values) === true) { |
|
117 | - $values = \array_values($values); |
|
116 | + if (JArray::isAssociative($values)===true) { |
|
117 | + $values=\array_values($values); |
|
118 | 118 | } |
119 | 119 | } |
120 | - $count = \min(\sizeof($values), $count); |
|
120 | + $count=\min(\sizeof($values), $count); |
|
121 | 121 | |
122 | - for ($i = 0; $i < $count; $i ++) { |
|
123 | - $cell = $this->content[$i]; |
|
122 | + for ($i=0; $i<$count; $i++) { |
|
123 | + $cell=$this->content[$i]; |
|
124 | 124 | $callback($cell, $values[$i]); |
125 | 125 | } |
126 | 126 | return $this; |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | return $this; |
139 | 139 | } |
140 | 140 | |
141 | - public function mergeCol($colIndex = 0) { |
|
141 | + public function mergeCol($colIndex=0) { |
|
142 | 142 | return $this->getItem($colIndex)->mergeCol(); |
143 | 143 | } |
144 | 144 | |
145 | - public function mergeRow($colIndex = 0) { |
|
146 | - $row = $this->getItem($colIndex); |
|
145 | + public function mergeRow($colIndex=0) { |
|
146 | + $row=$this->getItem($colIndex); |
|
147 | 147 | if (isset($row)) { |
148 | 148 | $this->getItem($colIndex)->mergeRow(); |
149 | 149 | } |
@@ -151,31 +151,31 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | public function getColPosition($colIndex) { |
154 | - if ($this->_container->_isMerged() !== true) |
|
154 | + if ($this->_container->_isMerged()!==true) |
|
155 | 155 | return $colIndex; |
156 | - $pos = 0; |
|
157 | - $rows = $this->_container->getContent(); |
|
158 | - for ($i = 0; $i < $this->_row; $i ++) { |
|
159 | - $max = \min($colIndex, $rows[$i]->count()); |
|
160 | - for ($j = 0; $j < $max; $j ++) { |
|
161 | - $rowspan = $rows[$i]->getItem($j)->getRowspan(); |
|
162 | - if ($rowspan + $i > $this->_row) |
|
163 | - $pos ++; |
|
156 | + $pos=0; |
|
157 | + $rows=$this->_container->getContent(); |
|
158 | + for ($i=0; $i<$this->_row; $i++) { |
|
159 | + $max=\min($colIndex, $rows[$i]->count()); |
|
160 | + for ($j=0; $j<$max; $j++) { |
|
161 | + $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
|
162 | + if ($rowspan+$i>$this->_row) |
|
163 | + $pos++; |
|
164 | 164 | } |
165 | 165 | } |
166 | - if ($pos > $colIndex) |
|
166 | + if ($pos>$colIndex) |
|
167 | 167 | return NULL; |
168 | - $count = $this->count(); |
|
169 | - for ($i = 0; $i < $count; $i ++) { |
|
170 | - $pos += $this->content[$i]->getColspan(); |
|
171 | - if ($pos >= $colIndex + 1) |
|
168 | + $count=$this->count(); |
|
169 | + for ($i=0; $i<$count; $i++) { |
|
170 | + $pos+=$this->content[$i]->getColspan(); |
|
171 | + if ($pos>=$colIndex+1) |
|
172 | 172 | return $i; |
173 | 173 | } |
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | |
177 | 177 | public function conditionalCellFormat($callback, $format) { |
178 | - $cells = $this->content; |
|
178 | + $cells=$this->content; |
|
179 | 179 | foreach ($cells as $cell) { |
180 | 180 | $cell->conditionalCellFormat($callback, $format); |
181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | public function containsStr($needle) { |
193 | - $cells = $this->content; |
|
193 | + $cells=$this->content; |
|
194 | 194 | foreach ($cells as $cell) { |
195 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
195 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
196 | 196 | return true; |
197 | 197 | } |
198 | 198 | return false; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | public function applyCells($callback) { |
207 | - $cells = $this->content; |
|
207 | + $cells=$this->content; |
|
208 | 208 | foreach ($cells as $cell) { |
209 | 209 | $cell->apply($callback); |
210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | public function toRowspanned($colIndex) { |
220 | - $cell = $this->getItem($colIndex); |
|
220 | + $cell=$this->getItem($colIndex); |
|
221 | 221 | $cell->addClass('rowspanned'); |
222 | 222 | $cell->setContent(''); |
223 | 223 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | use Ajax\JsUtils; |
12 | 12 | |
13 | 13 | class HtmlTD extends HtmlSemDoubleElement { |
14 | - use TextAlignmentTrait,TableElementTrait; |
|
14 | + use TextAlignmentTrait, TableElementTrait; |
|
15 | 15 | |
16 | 16 | private $_container; |
17 | 17 | |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | |
20 | 20 | private $_col; |
21 | 21 | |
22 | - private $_colMerged = false; |
|
22 | + private $_colMerged=false; |
|
23 | 23 | |
24 | - private $_rowMerged = false; |
|
24 | + private $_rowMerged=false; |
|
25 | 25 | |
26 | - private $_deleted = false; |
|
26 | + private $_deleted=false; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * @param mixed $content |
32 | 32 | * @param string $tagName |
33 | 33 | */ |
34 | - public function __construct($identifier, $content = NULL, $tagName = "td") { |
|
34 | + public function __construct($identifier, $content=NULL, $tagName="td") { |
|
35 | 35 | parent::__construct($identifier, $tagName, "", $content); |
36 | - $this->_variations = [ |
|
36 | + $this->_variations=[ |
|
37 | 37 | Variation::COLLAPSING |
38 | 38 | ]; |
39 | - $this->_states = [ |
|
39 | + $this->_states=[ |
|
40 | 40 | State::ACTIVE, |
41 | 41 | State::POSITIVE, |
42 | 42 | State::NEGATIVE, |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | public function setContainer($container, $row, $col) { |
50 | - $this->_container = $container; |
|
51 | - $this->_row = $row; |
|
52 | - $this->_col = $col; |
|
50 | + $this->_container=$container; |
|
51 | + $this->_row=$row; |
|
52 | + $this->_col=$col; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setValue($value) { |
56 | - $this->content = $value; |
|
56 | + $this->content=$value; |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | public function setRowspan($rowspan) { |
66 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
67 | - for ($i = $to; $i > $this->_row; $i --) { |
|
66 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
67 | + for ($i=$to; $i>$this->_row; $i--) { |
|
68 | 68 | $this->_container->toDelete($i, $this->_col); |
69 | 69 | } |
70 | 70 | $this->setProperty("rowspan", $rowspan); |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function setRowspanned($rowspan) { |
75 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
76 | - for ($i = $to; $i > $this->_row; $i --) { |
|
75 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
76 | + for ($i=$to; $i>$this->_row; $i--) { |
|
77 | 77 | $this->_container->toRowspanned($i, $this->_col); |
78 | 78 | } |
79 | 79 | $this->setProperty("rowspan", $rowspan); |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function mergeRow() { |
84 | - if (! $this->_rowMerged) { |
|
85 | - $this->_rowMerged = true; |
|
84 | + if (!$this->_rowMerged) { |
|
85 | + $this->_rowMerged=true; |
|
86 | 86 | return $this->setRowspan($this->_container->count()); |
87 | 87 | } |
88 | 88 | return $this->_container; |
89 | 89 | } |
90 | 90 | |
91 | 91 | public function mergeCol() { |
92 | - if (! $this->_colMerged) { |
|
93 | - $this->_colMerged = true; |
|
92 | + if (!$this->_colMerged) { |
|
93 | + $this->_colMerged=true; |
|
94 | 94 | return $this->setColspan($this->_container->getRow($this->_row) |
95 | 95 | ->count()); |
96 | 96 | } |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | public function setColspan($colspan) { |
101 | - $to = min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
102 | - for ($i = $to; $i > $this->_col; $i --) { |
|
103 | - $this->_container->delete($this->_row, $this->_col + 1); |
|
101 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
102 | + for ($i=$to; $i>$this->_col; $i--) { |
|
103 | + $this->_container->delete($this->_row, $this->_col+1); |
|
104 | 104 | } |
105 | 105 | $this->setProperty("colspan", $colspan); |
106 | 106 | return $this->_container; |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function getColspan() { |
110 | - $colspan = 1; |
|
110 | + $colspan=1; |
|
111 | 111 | if (\array_key_exists("colspan", $this->properties)) |
112 | - $colspan = $this->getProperty("colspan"); |
|
112 | + $colspan=$this->getProperty("colspan"); |
|
113 | 113 | return $colspan; |
114 | 114 | } |
115 | 115 | |
116 | 116 | public function getRowspan() { |
117 | - $rowspan = 1; |
|
117 | + $rowspan=1; |
|
118 | 118 | if (\array_key_exists("rowspan", $this->properties)) |
119 | - $rowspan = $this->getProperty("rowspan"); |
|
119 | + $rowspan=$this->getProperty("rowspan"); |
|
120 | 120 | return $rowspan; |
121 | 121 | } |
122 | 122 | |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | return $this; |
133 | 133 | } |
134 | 134 | |
135 | - public function setSelectable($href = "#") { |
|
135 | + public function setSelectable($href="#") { |
|
136 | 136 | if (\is_string($this->content)) { |
137 | - $this->content = new HtmlLink("", $href, $this->content); |
|
137 | + $this->content=new HtmlLink("", $href, $this->content); |
|
138 | 138 | } |
139 | 139 | return $this->addToProperty("class", "selectable"); |
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setWidth($width) { |
143 | 143 | if (\is_int($width)) { |
144 | - $width = Wide::getConstants()["W" . $width]; |
|
144 | + $width=Wide::getConstants()["W".$width]; |
|
145 | 145 | } |
146 | 146 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
147 | 147 | return $this->addToPropertyCtrl("class", "wide", array( |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function toDelete() { |
153 | - $this->_deleted = true; |
|
153 | + $this->_deleted=true; |
|
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
158 | - if (! $this->_deleted) |
|
157 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
158 | + if (!$this->_deleted) |
|
159 | 159 | return parent::compile($js, $view); |
160 | 160 | } |
161 | 161 | } |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class HtmlTableContent extends HtmlSemCollection { |
17 | 17 | |
18 | - protected $_tdTagNames = [ |
|
18 | + protected $_tdTagNames=[ |
|
19 | 19 | "thead" => "th", |
20 | 20 | "tbody" => "td", |
21 | 21 | "tfoot" => "th" |
22 | 22 | ]; |
23 | 23 | |
24 | - protected $_merged = false; |
|
24 | + protected $_merged=false; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param int $rowCount |
31 | 31 | * @param int $colCount |
32 | 32 | */ |
33 | - public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) { |
|
33 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
34 | 34 | parent::__construct($identifier, $tagName, ""); |
35 | 35 | if (isset($rowCount) && isset($colCount)) |
36 | 36 | $this->setRowCount($rowCount, $colCount); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @return HtmlTableContent |
44 | 44 | */ |
45 | 45 | public function setRowCount($rowCount, $colCount) { |
46 | - $count = $this->count(); |
|
47 | - for ($i = $count; $i < $rowCount; $i ++) { |
|
46 | + $count=$this->count(); |
|
47 | + for ($i=$count; $i<$rowCount; $i++) { |
|
48 | 48 | $this->addItem($colCount); |
49 | 49 | } |
50 | 50 | return $this; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function refreshTR() { |
58 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
58 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @return HtmlTR |
67 | 67 | */ |
68 | 68 | protected function createItem($value) { |
69 | - $count = $this->count(); |
|
70 | - $tr = new HtmlTR(""); |
|
69 | + $count=$this->count(); |
|
70 | + $tr=new HtmlTR(""); |
|
71 | 71 | $tr->setContainer($this, $count); |
72 | 72 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
73 | - if (isset($value) === true) { |
|
73 | + if (isset($value)===true) { |
|
74 | 74 | $tr->setColCount($value); |
75 | 75 | } |
76 | 76 | return $tr; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | return $this->addItem($row); |
99 | 99 | } |
100 | 100 | |
101 | - public function addMergeRow($colCount, $value = null) { |
|
102 | - $row = $this->addRow($colCount); |
|
101 | + public function addMergeRow($colCount, $value=null) { |
|
102 | + $row=$this->addRow($colCount); |
|
103 | 103 | $row->mergeCol(); |
104 | 104 | if (isset($value)) { |
105 | 105 | $row->setValues([ |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | * @return HtmlTD|HtmlDoubleElement |
126 | 126 | */ |
127 | 127 | public function getCell($row, $col) { |
128 | - $row = $this->getItem($row); |
|
128 | + $row=$this->getItem($row); |
|
129 | 129 | if (isset($row) && $row instanceof HtmlCollection) { |
130 | - $col = $row->getItem($col); |
|
130 | + $col=$row->getItem($col); |
|
131 | 131 | } else { |
132 | - $col = $row; |
|
132 | + $col=$row; |
|
133 | 133 | } |
134 | 134 | return $col; |
135 | 135 | } |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @param mixed $value |
151 | 151 | * @return HtmlTableContent |
152 | 152 | */ |
153 | - public function setCellValue($row, $col, $value = "") { |
|
154 | - $cell = $this->getCell($row, $col); |
|
155 | - if (isset($cell) === true) { |
|
153 | + public function setCellValue($row, $col, $value="") { |
|
154 | + $cell=$this->getCell($row, $col); |
|
155 | + if (isset($cell)===true) { |
|
156 | 156 | $cell->setValue($value); |
157 | 157 | } |
158 | 158 | return $this; |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @param mixed $values |
165 | 165 | */ |
166 | - public function setValues($values = array()) { |
|
167 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
166 | + public function setValues($values=array()) { |
|
167 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
168 | 168 | $row->setValues($_values); |
169 | 169 | }); |
170 | 170 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @param mixed $values |
176 | 176 | */ |
177 | - public function addValues($values = array()) { |
|
178 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
177 | + public function addValues($values=array()) { |
|
178 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
179 | 179 | $row->addValues($_values); |
180 | 180 | }); |
181 | 181 | } |
@@ -187,42 +187,42 @@ discard block |
||
187 | 187 | * @param callable $callback |
188 | 188 | */ |
189 | 189 | protected function _addOrSetValues($values, $callback) { |
190 | - $count = $this->count(); |
|
191 | - $isArray = true; |
|
192 | - if (! \is_array($values)) { |
|
193 | - $values = \array_fill(0, $count, $values); |
|
194 | - $isArray = false; |
|
190 | + $count=$this->count(); |
|
191 | + $isArray=true; |
|
192 | + if (!\is_array($values)) { |
|
193 | + $values=\array_fill(0, $count, $values); |
|
194 | + $isArray=false; |
|
195 | 195 | } |
196 | - if (JArray::dimension($values) == 1 && $isArray) |
|
197 | - $values = [ |
|
196 | + if (JArray::dimension($values)==1 && $isArray) |
|
197 | + $values=[ |
|
198 | 198 | $values |
199 | 199 | ]; |
200 | 200 | |
201 | - $count = \min(\sizeof($values), $count); |
|
201 | + $count=\min(\sizeof($values), $count); |
|
202 | 202 | |
203 | - for ($i = 0; $i < $count; $i ++) { |
|
204 | - $row = $this->content[$i]; |
|
203 | + for ($i=0; $i<$count; $i++) { |
|
204 | + $row=$this->content[$i]; |
|
205 | 205 | $callback($row, $values[$i]); |
206 | 206 | } |
207 | 207 | return $this; |
208 | 208 | } |
209 | 209 | |
210 | - public function setColValues($colIndex, $values = array()) { |
|
211 | - $count = $this->count(); |
|
212 | - if (! \is_array($values)) { |
|
213 | - $values = \array_fill(0, $count, $values); |
|
210 | + public function setColValues($colIndex, $values=array()) { |
|
211 | + $count=$this->count(); |
|
212 | + if (!\is_array($values)) { |
|
213 | + $values=\array_fill(0, $count, $values); |
|
214 | 214 | } |
215 | - $count = \min(\sizeof($values), $count); |
|
216 | - for ($i = 0; $i < $count; $i ++) { |
|
215 | + $count=\min(\sizeof($values), $count); |
|
216 | + for ($i=0; $i<$count; $i++) { |
|
217 | 217 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
218 | 218 | } |
219 | 219 | return $this; |
220 | 220 | } |
221 | 221 | |
222 | - public function addColVariations($colIndex, $variations = array()) { |
|
223 | - $count = $this->count(); |
|
224 | - for ($i = 0; $i < $count; $i ++) { |
|
225 | - $cell = $this->getCell($i, $colIndex); |
|
222 | + public function addColVariations($colIndex, $variations=array()) { |
|
223 | + $count=$this->count(); |
|
224 | + for ($i=0; $i<$count; $i++) { |
|
225 | + $cell=$this->getCell($i, $colIndex); |
|
226 | 226 | if ($cell instanceof BaseTrait) |
227 | 227 | $cell->addVariations($variations); |
228 | 228 | } |
@@ -230,41 +230,41 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | public function addPropertyCol($colIndex, $name, $value) { |
233 | - $count = $this->count(); |
|
234 | - for ($i = 0; $i < $count; $i ++) { |
|
235 | - $cell = $this->getCell($i, $colIndex); |
|
233 | + $count=$this->count(); |
|
234 | + for ($i=0; $i<$count; $i++) { |
|
235 | + $cell=$this->getCell($i, $colIndex); |
|
236 | 236 | if (isset($cell)) |
237 | 237 | $cell->addToProperty($name, $value); |
238 | 238 | } |
239 | 239 | return $this; |
240 | 240 | } |
241 | 241 | |
242 | - public function setRowValues($rowIndex, $values = array()) { |
|
243 | - $count = $this->count(); |
|
244 | - if (! \is_array($values)) { |
|
245 | - $values = \array_fill(0, $count, $values); |
|
242 | + public function setRowValues($rowIndex, $values=array()) { |
|
243 | + $count=$this->count(); |
|
244 | + if (!\is_array($values)) { |
|
245 | + $values=\array_fill(0, $count, $values); |
|
246 | 246 | } |
247 | 247 | $this->getItem($rowIndex)->setValues($values); |
248 | 248 | return $this; |
249 | 249 | } |
250 | 250 | |
251 | 251 | private function colAlign($colIndex, $function) { |
252 | - $count = $this->count(); |
|
253 | - for ($i = 0; $i < $count; $i ++) { |
|
254 | - $index = $this->content[$i]->getColPosition($colIndex); |
|
255 | - if ($index !== NULL) |
|
252 | + $count=$this->count(); |
|
253 | + for ($i=0; $i<$count; $i++) { |
|
254 | + $index=$this->content[$i]->getColPosition($colIndex); |
|
255 | + if ($index!==NULL) |
|
256 | 256 | $this->getCell($i, $index)->$function(); |
257 | 257 | } |
258 | 258 | return $this; |
259 | 259 | } |
260 | 260 | |
261 | 261 | private function colAlignFromRight($colIndex, $function) { |
262 | - $count = $this->count(); |
|
263 | - for ($i = 0; $i < $count; $i ++) { |
|
264 | - $maxRow = $this->content[$i]->count(); |
|
265 | - $index = $maxRow - $colIndex - 1; |
|
266 | - if (($cell = $this->getCell($i, $index)) !== NULL) { |
|
267 | - if ($cell->getColspan() == 1) |
|
262 | + $count=$this->count(); |
|
263 | + for ($i=0; $i<$count; $i++) { |
|
264 | + $maxRow=$this->content[$i]->count(); |
|
265 | + $index=$maxRow-$colIndex-1; |
|
266 | + if (($cell=$this->getCell($i, $index))!==NULL) { |
|
267 | + if ($cell->getColspan()==1) |
|
268 | 268 | $cell->$function(); |
269 | 269 | } |
270 | 270 | } |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | * @return int |
311 | 311 | */ |
312 | 312 | public function getColCount() { |
313 | - $result = 0; |
|
314 | - if ($this->count() > 0) |
|
315 | - $result = $this->getItem(0)->count(); |
|
313 | + $result=0; |
|
314 | + if ($this->count()>0) |
|
315 | + $result=$this->getItem(0)->count(); |
|
316 | 316 | return $result; |
317 | 317 | } |
318 | 318 | |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | * @param int $colIndex |
324 | 324 | * @return HtmlTableContent |
325 | 325 | */ |
326 | - public function delete($rowIndex, $colIndex = NULL) { |
|
326 | + public function delete($rowIndex, $colIndex=NULL) { |
|
327 | 327 | if (isset($colIndex)) { |
328 | - $row = $this->getItem($rowIndex); |
|
329 | - if (isset($row) === true) { |
|
328 | + $row=$this->getItem($rowIndex); |
|
329 | + if (isset($row)===true) { |
|
330 | 330 | $row->delete($colIndex); |
331 | 331 | } |
332 | 332 | } else { |
@@ -336,24 +336,24 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | public function toDelete($rowIndex, $colIndex) { |
339 | - $row = $this->getItem($rowIndex); |
|
340 | - if (isset($row) === true) |
|
339 | + $row=$this->getItem($rowIndex); |
|
340 | + if (isset($row)===true) |
|
341 | 341 | $row->toDelete($colIndex); |
342 | 342 | return $this; |
343 | 343 | } |
344 | 344 | |
345 | 345 | public function toRowspanned($rowIndex, $colIndex) { |
346 | - $row = $this->getItem($rowIndex); |
|
347 | - if (isset($row) === true) |
|
346 | + $row=$this->getItem($rowIndex); |
|
347 | + if (isset($row)===true) |
|
348 | 348 | $row->toRowspanned($colIndex); |
349 | 349 | return $this; |
350 | 350 | } |
351 | 351 | |
352 | - public function mergeCol($rowIndex = 0, $colIndex = 0) { |
|
352 | + public function mergeCol($rowIndex=0, $colIndex=0) { |
|
353 | 353 | return $this->getItem($rowIndex)->mergeCol($colIndex); |
354 | 354 | } |
355 | 355 | |
356 | - public function mergeRow($rowIndex = 0, $colIndex = 0) { |
|
356 | + public function mergeRow($rowIndex=0, $colIndex=0) { |
|
357 | 357 | return $this->getItem($rowIndex)->mergeRow($colIndex); |
358 | 358 | } |
359 | 359 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * @return HtmlTableContent |
374 | 374 | */ |
375 | 375 | public function conditionalCellFormat($callback, $format) { |
376 | - $rows = $this->content; |
|
376 | + $rows=$this->content; |
|
377 | 377 | foreach ($rows as $row) { |
378 | 378 | $row->conditionalCellFormat($callback, $format); |
379 | 379 | } |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | public function conditionalColFormat($colIndex, $callback, $format) { |
384 | - $rows = $this->content; |
|
384 | + $rows=$this->content; |
|
385 | 385 | foreach ($rows as $row) { |
386 | - $cell = $row->getItem($colIndex); |
|
386 | + $cell=$row->getItem($colIndex); |
|
387 | 387 | $cell->conditionnalCellFormat($callback, $format); |
388 | 388 | } |
389 | 389 | return $this; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @return HtmlTableContent |
397 | 397 | */ |
398 | 398 | public function conditionalRowFormat($callback, $format) { |
399 | - $rows = $this->content; |
|
399 | + $rows=$this->content; |
|
400 | 400 | foreach ($rows as $row) { |
401 | 401 | $row->conditionalRowFormat($callback, $format); |
402 | 402 | } |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | } |
405 | 405 | |
406 | 406 | public function hideColumn($colIndex) { |
407 | - $rows = $this->content; |
|
407 | + $rows=$this->content; |
|
408 | 408 | foreach ($rows as $row) { |
409 | - $cell = $row->getItem($colIndex); |
|
409 | + $cell=$row->getItem($colIndex); |
|
410 | 410 | $cell->addToProperty("style", "display:none;"); |
411 | 411 | } |
412 | 412 | return $this; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @return HtmlTableContent |
419 | 419 | */ |
420 | 420 | public function applyCells($callback) { |
421 | - $rows = $this->content; |
|
421 | + $rows=$this->content; |
|
422 | 422 | foreach ($rows as $row) { |
423 | 423 | $row->applyCells($callback); |
424 | 424 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @return HtmlTableContent |
432 | 432 | */ |
433 | 433 | public function applyRows($callback) { |
434 | - $rows = $this->content; |
|
434 | + $rows=$this->content; |
|
435 | 435 | foreach ($rows as $row) { |
436 | 436 | $row->apply($callback); |
437 | 437 | } |
@@ -446,28 +446,28 @@ discard block |
||
446 | 446 | * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class |
447 | 447 | * @since fomantic-ui 2.4.8 |
448 | 448 | */ |
449 | - public function mergeIdentiqualValues($colIndex, $function = "strip_tags") { |
|
450 | - $rows = $this->content; |
|
451 | - $identiqual = null; |
|
452 | - $counter = 0; |
|
453 | - $cellToMerge = null; |
|
454 | - $functionExists = \function_exists($function); |
|
449 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
450 | + $rows=$this->content; |
|
451 | + $identiqual=null; |
|
452 | + $counter=0; |
|
453 | + $cellToMerge=null; |
|
454 | + $functionExists=\function_exists($function); |
|
455 | 455 | foreach ($rows as $row) { |
456 | - $cell = $row->getItem($colIndex); |
|
457 | - $value = $cell->getContent(); |
|
456 | + $cell=$row->getItem($colIndex); |
|
457 | + $value=$cell->getContent(); |
|
458 | 458 | if ($functionExists) |
459 | - $value = \call_user_func($function, $value); |
|
460 | - if ($value !== $identiqual) { |
|
461 | - if ($counter > 0 && isset($cellToMerge)) { |
|
459 | + $value=\call_user_func($function, $value); |
|
460 | + if ($value!==$identiqual) { |
|
461 | + if ($counter>0 && isset($cellToMerge)) { |
|
462 | 462 | $cellToMerge->setRowspanned($counter); |
463 | 463 | } |
464 | - $counter = 0; |
|
465 | - $cellToMerge = $cell; |
|
466 | - $identiqual = $value; |
|
464 | + $counter=0; |
|
465 | + $cellToMerge=$cell; |
|
466 | + $identiqual=$value; |
|
467 | 467 | } |
468 | - $counter ++; |
|
468 | + $counter++; |
|
469 | 469 | } |
470 | - if ($counter > 0 && isset($cellToMerge)) { |
|
470 | + if ($counter>0 && isset($cellToMerge)) { |
|
471 | 471 | $cellToMerge->setRowspanned($counter); |
472 | 472 | } |
473 | 473 | return $this; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | public function _setMerged($value) { |
481 | - $this->_merged = $value; |
|
481 | + $this->_merged=$value; |
|
482 | 482 | return $this; |
483 | 483 | } |
484 | 484 | } |