@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSizing=true; |
| 23 | 23 | private $_implicitRows=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
| 26 | 29 | parent::__construct($identifier, "div", "ui grid"); |
| 27 | 30 | $this->_implicitRows=$implicitRows; |
@@ -158,7 +161,7 @@ discard block |
||
| 158 | 161 | /** |
| 159 | 162 | * return the row at $index |
| 160 | 163 | * @param int $index |
| 161 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
| 164 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 162 | 165 | */ |
| 163 | 166 | public function getRow($index) { |
| 164 | 167 | return $this->getItem($index); |
@@ -297,7 +300,7 @@ discard block |
||
| 297 | 300 | |
| 298 | 301 | /** |
| 299 | 302 | * stretch the row contents to take up the entire column height |
| 300 | - * @return \Ajax\semantic\html\content\HtmlGridRow |
|
| 303 | + * @return HtmlGrid |
|
| 301 | 304 | */ |
| 302 | 305 | public function setStretched() { |
| 303 | 306 | return $this->addToProperty("class", "stretched"); |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function asSegment() { |
| 39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function asContainer() { |
| 43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @param int $wide |
| 49 | 49 | */ |
| 50 | 50 | public function setWide($wide) { |
| 51 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 51 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 52 | 52 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 53 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 53 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | * @return mixed |
| 69 | 69 | */ |
| 70 | 70 | public function addRow($colsCount=NULL) { |
| 71 | - $rowCount=$this->rowCount() + 1; |
|
| 71 | + $rowCount=$this->rowCount()+1; |
|
| 72 | 72 | $this->setRowsCount($rowCount, $colsCount, true); |
| 73 | - return $this->content[$rowCount - 1]; |
|
| 73 | + return $this->content[$rowCount-1]; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 80 | 80 | */ |
| 81 | 81 | public function addCol($width=NULL) { |
| 82 | - $colCount=$this->colCount() + 1; |
|
| 82 | + $colCount=$this->colCount()+1; |
|
| 83 | 83 | $this->setColsCount($colCount, true, $width); |
| 84 | 84 | if ($this->hasOnlyCols($this->count())) |
| 85 | - return $this->content[$colCount - 1]; |
|
| 85 | + return $this->content[$colCount-1]; |
|
| 86 | 86 | return $this; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 93 | 93 | */ |
| 94 | 94 | public function addCols($sizes=array()) { |
| 95 | - foreach ( $sizes as $size ) { |
|
| 95 | + foreach ($sizes as $size) { |
|
| 96 | 96 | $this->addCol($size); |
| 97 | 97 | } |
| 98 | 98 | return $this; |
@@ -106,19 +106,19 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 108 | 108 | $count=$this->count(); |
| 109 | - if ($rowsCount < 2 && $force === false) { |
|
| 110 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 111 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 109 | + if ($rowsCount<2 && $force===false) { |
|
| 110 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 111 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 112 | 112 | } |
| 113 | 113 | } else { |
| 114 | 114 | if ($this->hasOnlyCols($count)) { |
| 115 | 115 | $tmpContent=$this->content; |
| 116 | 116 | $item=$this->addItem($colsCount); |
| 117 | 117 | $item->setContent($tmpContent); |
| 118 | - $this->content=array (); |
|
| 118 | + $this->content=array(); |
|
| 119 | 119 | $count=1; |
| 120 | 120 | } |
| 121 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 121 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 122 | 122 | $this->addItem($colsCount); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | protected function hasOnlyCols($count) { |
| 129 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 129 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | /*if (isset($width)==false) { |
| 141 | 141 | $this->setWide($numCols); |
| 142 | 142 | }*/ |
| 143 | - if ($toCreate == true) { |
|
| 143 | + if ($toCreate==true) { |
|
| 144 | 144 | $count=$this->count(); |
| 145 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 146 | - for($i=$count; $i < $numCols; $i++) { |
|
| 147 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 145 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 146 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 147 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - for($i=0; $i < $count; $i++) { |
|
| 150 | + for ($i=0; $i<$count; $i++) { |
|
| 151 | 151 | $this->getItem($i)->setColsCount($numCols); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $count=$this->count(); |
| 184 | 184 | if ($this->hasOnlyCols($count)) |
| 185 | 185 | return $count; |
| 186 | - if ($count > 0) |
|
| 186 | + if ($count>0) |
|
| 187 | 187 | return $this->getItem(0)->count(); |
| 188 | 188 | return 0; |
| 189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 196 | 196 | */ |
| 197 | 197 | public function getCell($row, $col) { |
| 198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 198 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 199 | 199 | return $this->getItem($col); |
| 200 | 200 | $row=$this->getItem($row); |
| 201 | 201 | if (isset($row)) { |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 211 | 211 | */ |
| 212 | 212 | public function setDivided($vertically=false) { |
| 213 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 214 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 213 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 214 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 221 | 221 | */ |
| 222 | 222 | public function setCelled($internally=false) { |
| 223 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 224 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 223 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 224 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * A grid can have its columns centered |
| 229 | 229 | */ |
| 230 | 230 | public function setCentered() { |
| 231 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 231 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function setPadded($value=NULL) { |
| 248 | 248 | if (isset($value)) |
| 249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 249 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 250 | 250 | return $this->addToProperty("class", "padded"); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 257 | 257 | */ |
| 258 | 258 | public function setRelaxed($very=false) { |
| 259 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 260 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 259 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 260 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 264 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 264 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -271,9 +271,9 @@ discard block |
||
| 271 | 271 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 272 | 272 | */ |
| 273 | 273 | protected function createItem($value) { |
| 274 | - if ($this->_createCols === false) |
|
| 274 | + if ($this->_createCols===false) |
|
| 275 | 275 | $value=null; |
| 276 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 276 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 277 | 277 | return $item; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function setValues($values, $force=true) { |
| 285 | 285 | $count=$this->count(); |
| 286 | - if ($this->_createCols === false || $force === true) { |
|
| 287 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
| 286 | + if ($this->_createCols===false || $force===true) { |
|
| 287 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 288 | 288 | $colSize=\sizeof($values[$i]); |
| 289 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 289 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
| 293 | - for($i=0; $i < $count; $i++) { |
|
| 294 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 292 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 293 | + for ($i=0; $i<$count; $i++) { |
|
| 294 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
@@ -81,8 +81,9 @@ discard block |
||
| 81 | 81 | public function addCol($width=NULL) { |
| 82 | 82 | $colCount=$this->colCount() + 1; |
| 83 | 83 | $this->setColsCount($colCount, true, $width); |
| 84 | - if ($this->hasOnlyCols($this->count())) |
|
| 85 | - return $this->content[$colCount - 1]; |
|
| 84 | + if ($this->hasOnlyCols($this->count())) { |
|
| 85 | + return $this->content[$colCount - 1]; |
|
| 86 | + } |
|
| 86 | 87 | return $this; |
| 87 | 88 | } |
| 88 | 89 | |
@@ -170,8 +171,9 @@ discard block |
||
| 170 | 171 | */ |
| 171 | 172 | public function rowCount() { |
| 172 | 173 | $count=$this->count(); |
| 173 | - if ($this->hasOnlyCols($count)) |
|
| 174 | - return 0; |
|
| 174 | + if ($this->hasOnlyCols($count)) { |
|
| 175 | + return 0; |
|
| 176 | + } |
|
| 175 | 177 | return $count; |
| 176 | 178 | } |
| 177 | 179 | |
@@ -181,10 +183,12 @@ discard block |
||
| 181 | 183 | */ |
| 182 | 184 | public function colCount() { |
| 183 | 185 | $count=$this->count(); |
| 184 | - if ($this->hasOnlyCols($count)) |
|
| 185 | - return $count; |
|
| 186 | - if ($count > 0) |
|
| 187 | - return $this->getItem(0)->count(); |
|
| 186 | + if ($this->hasOnlyCols($count)) { |
|
| 187 | + return $count; |
|
| 188 | + } |
|
| 189 | + if ($count > 0) { |
|
| 190 | + return $this->getItem(0)->count(); |
|
| 191 | + } |
|
| 188 | 192 | return 0; |
| 189 | 193 | } |
| 190 | 194 | |
@@ -195,8 +199,9 @@ discard block |
||
| 195 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 196 | 200 | */ |
| 197 | 201 | public function getCell($row, $col) { |
| 198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 199 | - return $this->getItem($col); |
|
| 202 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
| 203 | + return $this->getItem($col); |
|
| 204 | + } |
|
| 200 | 205 | $row=$this->getItem($row); |
| 201 | 206 | if (isset($row)) { |
| 202 | 207 | $col=$row->getItem($col); |
@@ -245,8 +250,9 @@ discard block |
||
| 245 | 250 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 246 | 251 | */ |
| 247 | 252 | public function setPadded($value=NULL) { |
| 248 | - if (isset($value)) |
|
| 249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 253 | + if (isset($value)) { |
|
| 254 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 255 | + } |
|
| 250 | 256 | return $this->addToProperty("class", "padded"); |
| 251 | 257 | } |
| 252 | 258 | |
@@ -271,8 +277,9 @@ discard block |
||
| 271 | 277 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 272 | 278 | */ |
| 273 | 279 | protected function createItem($value) { |
| 274 | - if ($this->_createCols === false) |
|
| 275 | - $value=null; |
|
| 280 | + if ($this->_createCols === false) { |
|
| 281 | + $value=null; |
|
| 282 | + } |
|
| 276 | 283 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
| 277 | 284 | return $item; |
| 278 | 285 | } |
@@ -17,6 +17,11 @@ discard block |
||
| 17 | 17 | class HtmlTable extends HtmlSemDoubleElement { |
| 18 | 18 | private $_colCount; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $identifier |
|
| 22 | + * @param integer $rowCount |
|
| 23 | + * @param integer $colCount |
|
| 24 | + */ |
|
| 20 | 25 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 26 | parent::__construct($identifier, "table", "ui table"); |
| 22 | 27 | $this->content=array (); |
@@ -96,7 +101,7 @@ discard block |
||
| 96 | 101 | /** |
| 97 | 102 | * Retuns the row at $rowIndex |
| 98 | 103 | * @param int $rowIndex |
| 99 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
| 104 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 100 | 105 | */ |
| 101 | 106 | public function getRow($rowIndex) { |
| 102 | 107 | return $this->getBody()->getRow($rowIndex); |
@@ -172,6 +177,9 @@ discard block |
||
| 172 | 177 | return $this->colAlign($colIndex, "colLeft"); |
| 173 | 178 | } |
| 174 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $function |
|
| 182 | + */ |
|
| 175 | 183 | private function colAlign($colIndex, $function) { |
| 176 | 184 | if (\is_array($colIndex)) { |
| 177 | 185 | foreach ( $colIndex as $cIndex ) { |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 21 | parent::__construct($identifier, "table", "ui table"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | $this->setRowCount($rowCount, $colCount); |
| 24 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 24 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @return HtmlTableContent |
| 31 | 31 | */ |
| 32 | 32 | private function getPart($key) { |
| 33 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 33 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 34 | 34 | $this->content[$key]=new HtmlTableContent("", $key); |
| 35 | - if ($key !== "tbody") { |
|
| 35 | + if ($key!=="tbody") { |
|
| 36 | 36 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return boolean |
| 70 | 70 | */ |
| 71 | 71 | public function hasPart($key) { |
| 72 | - return \array_key_exists($key, $this->content) === true; |
|
| 72 | + return \array_key_exists($key, $this->content)===true; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | private function colAlign($colIndex, $function) { |
| 176 | 176 | if (\is_array($colIndex)) { |
| 177 | - foreach ( $colIndex as $cIndex ) { |
|
| 177 | + foreach ($colIndex as $cIndex) { |
|
| 178 | 178 | $this->colAlign($cIndex, $function); |
| 179 | 179 | } |
| 180 | 180 | } else { |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | public function setBasic($very=false) { |
| 194 | 194 | if ($very) |
| 195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 196 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 195 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 196 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | public function setCollapsing() { |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 255 | 255 | */ |
| 256 | 256 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 257 | - $this->content=JArray::sortAssociative($this->content, [ "thead","tbody","tfoot" ]); |
|
| 257 | + $this->content=JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); |
|
| 258 | 258 | if ($this->propertyContains("class", "sortable")) { |
| 259 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 259 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 260 | 260 | } |
| 261 | 261 | return parent::compile($js, $view); |
| 262 | 262 | } |
@@ -191,8 +191,9 @@ |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function setBasic($very=false) { |
| 194 | - if ($very) |
|
| 195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 194 | + if ($very) { |
|
| 195 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 196 | + } |
|
| 196 | 197 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 197 | 198 | } |
| 198 | 199 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Sets the menu type |
| 35 | 35 | * @param string $type one of text,item |
| 36 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
| 36 | + * @return HtmlMenu |
|
| 37 | 37 | */ |
| 38 | 38 | public function setType($type="") { |
| 39 | 39 | return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
@@ -81,6 +81,7 @@ discard block |
||
| 81 | 81 | * {@inheritDoc} |
| 82 | 82 | * |
| 83 | 83 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
| 84 | + * @param HtmlIcon $item |
|
| 84 | 85 | */ |
| 85 | 86 | public function insertItem($item, $position=0) { |
| 86 | 87 | $item=parent::insertItem($this->getItemToInsert($item), $position); |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | private function afterInsert($item) { |
| 60 | - if (!$item instanceof HtmlMenu) |
|
| 61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | - else { |
|
| 60 | + if (!$item instanceof HtmlMenu) { |
|
| 61 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | + } else { |
|
| 63 | 63 | $this->setSecondary(); |
| 64 | 64 | } |
| 65 | 65 | return $item; |
@@ -158,8 +158,9 @@ discard block |
||
| 158 | 158 | $this->apply(function (HtmlDoubleElement &$item) { |
| 159 | 159 | $item->setTagName("a"); |
| 160 | 160 | }); |
| 161 | - if ($vertical === true) |
|
| 162 | - $this->setVertical(); |
|
| 161 | + if ($vertical === true) { |
|
| 162 | + $this->setVertical(); |
|
| 163 | + } |
|
| 163 | 164 | return $this->addToProperty("class", "tabular"); |
| 164 | 165 | } |
| 165 | 166 | |
@@ -188,10 +189,11 @@ discard block |
||
| 188 | 189 | */ |
| 189 | 190 | public function fromDatabaseObject($object, $function) { |
| 190 | 191 | $return=$function($object); |
| 191 | - if (\is_array($return)) |
|
| 192 | - $this->addItems($return); |
|
| 193 | - else |
|
| 194 | - $this->addItem($return); |
|
| 192 | + if (\is_array($return)) { |
|
| 193 | + $this->addItems($return); |
|
| 194 | + } else { |
|
| 195 | + $this->addItem($return); |
|
| 196 | + } |
|
| 195 | 197 | } |
| 196 | 198 | |
| 197 | 199 | /** |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 38 | 38 | */ |
| 39 | 39 | public function setType($type="") { |
| 40 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 40 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function setActiveItem($index) { |
| 44 | 44 | $item=$this->getItem($index); |
| 45 | - if ($item !== null) { |
|
| 45 | + if ($item!==null) { |
|
| 46 | 46 | $item->addToProperty("class", "active"); |
| 47 | 47 | } |
| 48 | 48 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | private function getItemToInsert($item) { |
| 52 | 52 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
| 53 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
| 53 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
| 54 | 54 | $itemO->setContent($item); |
| 55 | 55 | $item=$itemO; |
| 56 | 56 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | 61 | if (!$item instanceof HtmlMenu) |
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 63 | 63 | else { |
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function generateMenuAsItem($menu, $header=null) { |
| 92 | 92 | $count=$this->count(); |
| 93 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 93 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 94 | 94 | if (isset($header)) { |
| 95 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 95 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 96 | 96 | $headerItem->setContent($header); |
| 97 | 97 | $item->addContent($headerItem); |
| 98 | 98 | $this->_itemHeader=$headerItem; |
| 99 | 99 | } |
| 100 | - if(\is_array($menu)){ |
|
| 101 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 100 | + if (\is_array($menu)) { |
|
| 101 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 102 | 102 | } |
| 103 | 103 | $menu->setClass("menu"); |
| 104 | 104 | $item->addContent($menu); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 114 | 114 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 115 | 115 | $value=$this->addItem($value); |
| 116 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 116 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 117 | 117 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 118 | 118 | $this->wrap("", $popup); |
| 119 | 119 | return $popup; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function addDropdownAsItem($value, $items=NULL) { |
| 123 | 123 | $dd=$value; |
| 124 | 124 | if (\is_string($value)) { |
| 125 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 125 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 126 | 126 | } |
| 127 | 127 | return $this->addItem($dd); |
| 128 | 128 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 135 | 135 | */ |
| 136 | 136 | protected function createItem($value) { |
| 137 | - $itemO=new HtmlLink($this->identifier."item" . \sizeof($this->content), "", $value); |
|
| 137 | + $itemO=new HtmlLink($this->identifier."item".\sizeof($this->content), "", $value); |
|
| 138 | 138 | return $itemO->setClass("item"); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,28 +147,28 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public function setVertical() { |
| 150 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 150 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function setPosition($value="right") { |
| 154 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 154 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function setPointing($value=Direction::NONE) { |
| 158 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 158 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function asTab($vertical=false) { |
| 162 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 162 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 163 | 163 | $item->setTagName("a"); |
| 164 | 164 | }); |
| 165 | - if ($vertical === true) |
|
| 165 | + if ($vertical===true) |
|
| 166 | 166 | $this->setVertical(); |
| 167 | 167 | return $this->addToProperty("class", "tabular"); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function asPagination() { |
| 171 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 171 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 172 | 172 | $item->setTagName("a"); |
| 173 | 173 | }); |
| 174 | 174 | return $this->addToProperty("class", "pagination"); |
@@ -205,10 +205,10 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function setWidth($width) { |
| 207 | 207 | if (\is_int($width)) { |
| 208 | - $width=Wide::getConstants()["W" . $width]; |
|
| 208 | + $width=Wide::getConstants()["W".$width]; |
|
| 209 | 209 | } |
| 210 | 210 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 211 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 211 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function addImage($identifier, $src="", $alt="") { |
@@ -11,6 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $baseClass |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
| 15 | 18 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 19 | $this->content=array(); |
@@ -60,8 +60,9 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function asLink($href=NULL,$part=NULL){ |
| 62 | 62 | $this->setTagName("a"); |
| 63 | - if(isset($href)) |
|
| 64 | - $this->setProperty("href", $href); |
|
| 63 | + if(isset($href)) { |
|
| 64 | + $this->setProperty("href", $href); |
|
| 65 | + } |
|
| 65 | 66 | return $this; |
| 66 | 67 | } |
| 67 | 68 | |
@@ -72,8 +73,9 @@ discard block |
||
| 72 | 73 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 73 | 74 | */ |
| 74 | 75 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(\is_array($this->content)) |
|
| 76 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 76 | + if(\is_array($this->content)) { |
|
| 77 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 78 | + } |
|
| 77 | 79 | return parent::compile($js, $view); |
| 78 | 80 | } |
| 79 | 81 | } |
| 80 | 82 | \ No newline at end of file |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,41 +19,41 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected abstract function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setImage($image){ |
|
| 26 | + public function setImage($image) { |
|
| 27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 28 | 28 | $image->asAvatar(); |
| 29 | 29 | $this->content["image"]=$image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function createContent(){ |
|
| 33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 32 | + private function createContent() { |
|
| 33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 34 | 34 | return $this->content["content"]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 39 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 39 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 40 | 40 | $this->createContent(); |
| 41 | 41 | } |
| 42 | 42 | $this->content["content"]->addContent($title); |
| 43 | - if(isset($description)){ |
|
| 44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 43 | + if (isset($description)) { |
|
| 44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 45 | 45 | $this->content["content"]->addContent($description); |
| 46 | 46 | } |
| 47 | 47 | return $this; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getPart($partName="header"){ |
|
| 51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 50 | + public function getPart($partName="header") { |
|
| 51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setActive($value=true){ |
|
| 56 | - if($value){ |
|
| 55 | + public function setActive($value=true) { |
|
| 56 | + if ($value) { |
|
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | return $this; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function asLink($href=NULL,$part=NULL){ |
|
| 64 | + public function asLink($href=NULL, $part=NULL) { |
|
| 65 | 65 | $this->setTagName("a"); |
| 66 | - if(isset($href)) |
|
| 66 | + if (isset($href)) |
|
| 67 | 67 | $this->setProperty("href", $href); |
| 68 | 68 | return $this; |
| 69 | 69 | } |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 76 | 76 | */ |
| 77 | 77 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 78 | - if(\is_array($this->content)) |
|
| 79 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 78 | + if (\is_array($this->content)) |
|
| 79 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 80 | 80 | return parent::compile($js, $view); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | \ No newline at end of file |
@@ -11,6 +11,10 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 13 | 13 | use IconTrait; |
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * @param string $identifier |
|
| 17 | + */ |
|
| 14 | 18 | public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
| 15 | 19 | parent::__construct($identifier, "a"); |
| 16 | 20 | $this->setClass("item"); |
@@ -61,6 +65,9 @@ discard block |
||
| 61 | 65 | return $this; |
| 62 | 66 | } |
| 63 | 67 | |
| 68 | + /** |
|
| 69 | + * @param string $content |
|
| 70 | + */ |
|
| 64 | 71 | public function setContent($content){ |
| 65 | 72 | if($content==="-"){ |
| 66 | 73 | $this->asDivider(); |
@@ -11,30 +11,30 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 13 | 13 | use IconTrait; |
| 14 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
| 14 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "a"); |
| 16 | 16 | $this->setClass("item"); |
| 17 | 17 | $this->setContent($content); |
| 18 | - if($value!==NULL) |
|
| 18 | + if ($value!==NULL) |
|
| 19 | 19 | $this->setData($value); |
| 20 | - if($image!==NULL) |
|
| 20 | + if ($image!==NULL) |
|
| 21 | 21 | $this->asMiniAvatar($image); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setDescription($description){ |
|
| 25 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 24 | + public function setDescription($description) { |
|
| 25 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 26 | 26 | $descO->setClass("description"); |
| 27 | 27 | $descO->setContent($description); |
| 28 | - return $this->addContent($descO,true); |
|
| 28 | + return $this->addContent($descO, true); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function setData($value){ |
|
| 31 | + public function setData($value) { |
|
| 32 | 32 | $this->setProperty("data-value", $value); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function asOption(){ |
|
| 35 | + public function asOption() { |
|
| 36 | 36 | $this->tagName="option"; |
| 37 | - if($this->getProperty("data-value")!==null) |
|
| 37 | + if ($this->getProperty("data-value")!==null) |
|
| 38 | 38 | $this->setProperty("value", $this->getProperty("data-value")); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,58 +42,58 @@ discard block |
||
| 42 | 42 | * @param string $image the image src |
| 43 | 43 | * @return \Ajax\common\html\html5\HtmlImg |
| 44 | 44 | */ |
| 45 | - public function asMiniAvatar($image){ |
|
| 45 | + public function asMiniAvatar($image) { |
|
| 46 | 46 | $this->tagName="div"; |
| 47 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 47 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 48 | 48 | $img->setClass("ui mini avatar image"); |
| 49 | - $this->addContent($img,true); |
|
| 49 | + $this->addContent($img, true); |
|
| 50 | 50 | return $img; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 53 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 54 | 54 | $this->setClass("ui icon search input"); |
| 55 | 55 | $input=new HtmlInput("search-".$this->identifier); |
| 56 | - if(isset($placeholder)) |
|
| 56 | + if (isset($placeholder)) |
|
| 57 | 57 | $input->setProperty("placeholder", $placeholder); |
| 58 | 58 | $this->content=$input; |
| 59 | - if(isset($icon)) |
|
| 59 | + if (isset($icon)) |
|
| 60 | 60 | $this->addIcon($icon); |
| 61 | 61 | return $this; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setContent($content){ |
|
| 65 | - if($content==="-"){ |
|
| 64 | + public function setContent($content) { |
|
| 65 | + if ($content==="-") { |
|
| 66 | 66 | $this->asDivider(); |
| 67 | - }elseif($content==="-search-"){ |
|
| 68 | - $values=\explode(",",$content,-1); |
|
| 69 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 70 | - }else |
|
| 67 | + }elseif ($content==="-search-") { |
|
| 68 | + $values=\explode(",", $content, -1); |
|
| 69 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 70 | + } else |
|
| 71 | 71 | parent::setContent($content); |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function asDivider(){ |
|
| 75 | + public function asDivider() { |
|
| 76 | 76 | $this->content=NULL; |
| 77 | 77 | $this->setClass("divider"); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 80 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 81 | 81 | $this->setClass("header"); |
| 82 | 82 | $this->content=$caption; |
| 83 | - if(isset($icon)) |
|
| 84 | - $this->addIcon($icon,true); |
|
| 83 | + if (isset($icon)) |
|
| 84 | + $this->addIcon($icon, true); |
|
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 89 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 88 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 89 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
| 92 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
| 93 | 93 | return (new HtmlDropdownItem(""))->asDivider(); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 97 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 96 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 97 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | \ No newline at end of file |
@@ -15,10 +15,12 @@ discard block |
||
| 15 | 15 | parent::__construct($identifier, "a"); |
| 16 | 16 | $this->setClass("item"); |
| 17 | 17 | $this->setContent($content); |
| 18 | - if($value!==NULL) |
|
| 19 | - $this->setData($value); |
|
| 20 | - if($image!==NULL) |
|
| 21 | - $this->asMiniAvatar($image); |
|
| 18 | + if($value!==NULL) { |
|
| 19 | + $this->setData($value); |
|
| 20 | + } |
|
| 21 | + if($image!==NULL) { |
|
| 22 | + $this->asMiniAvatar($image); |
|
| 23 | + } |
|
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | public function setDescription($description){ |
@@ -34,8 +36,9 @@ discard block |
||
| 34 | 36 | |
| 35 | 37 | public function asOption(){ |
| 36 | 38 | $this->tagName="option"; |
| 37 | - if($this->getProperty("data-value")!==null) |
|
| 38 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 39 | + if($this->getProperty("data-value")!==null) { |
|
| 40 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 41 | + } |
|
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | /** |
@@ -53,22 +56,25 @@ discard block |
||
| 53 | 56 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 54 | 57 | $this->setClass("ui icon search input"); |
| 55 | 58 | $input=new HtmlInput("search-".$this->identifier); |
| 56 | - if(isset($placeholder)) |
|
| 57 | - $input->setProperty("placeholder", $placeholder); |
|
| 59 | + if(isset($placeholder)) { |
|
| 60 | + $input->setProperty("placeholder", $placeholder); |
|
| 61 | + } |
|
| 58 | 62 | $this->content=$input; |
| 59 | - if(isset($icon)) |
|
| 60 | - $this->addIcon($icon); |
|
| 63 | + if(isset($icon)) { |
|
| 64 | + $this->addIcon($icon); |
|
| 65 | + } |
|
| 61 | 66 | return $this; |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | 69 | public function setContent($content){ |
| 65 | 70 | if($content==="-"){ |
| 66 | 71 | $this->asDivider(); |
| 67 | - }elseif($content==="-search-"){ |
|
| 72 | + } elseif($content==="-search-"){ |
|
| 68 | 73 | $values=\explode(",",$content,-1); |
| 69 | 74 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
| 70 | - }else |
|
| 71 | - parent::setContent($content); |
|
| 75 | + } else { |
|
| 76 | + parent::setContent($content); |
|
| 77 | + } |
|
| 72 | 78 | return $this; |
| 73 | 79 | } |
| 74 | 80 | |
@@ -80,8 +86,9 @@ discard block |
||
| 80 | 86 | public function asHeader($caption=NULL,$icon=NULL){ |
| 81 | 87 | $this->setClass("header"); |
| 82 | 88 | $this->content=$caption; |
| 83 | - if(isset($icon)) |
|
| 84 | - $this->addIcon($icon,true); |
|
| 89 | + if(isset($icon)) { |
|
| 90 | + $this->addIcon($icon,true); |
|
| 91 | + } |
|
| 85 | 92 | return $this; |
| 86 | 93 | } |
| 87 | 94 | |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
| 26 | 29 | parent::__construct( $identifier,"div","row"); |
| 27 | 30 | $this->_implicite=$implicite; |
@@ -55,7 +58,7 @@ discard block |
||
| 55 | 58 | /** |
| 56 | 59 | * return the col at $index |
| 57 | 60 | * @param int $index |
| 58 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
| 61 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 59 | 62 | */ |
| 60 | 63 | public function getCol($index){ |
| 61 | 64 | return $this->getItem($index); |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
| 19 | +class HtmlGridRow extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | |
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 26 | - parent::__construct( $identifier,"div","row"); |
|
| 25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 26 | + parent::__construct($identifier, "div", "row"); |
|
| 27 | 27 | $this->_implicite=$implicite; |
| 28 | 28 | $width=null; |
| 29 | - if(isset($numCols)){ |
|
| 30 | - $numCols=min(16,$numCols); |
|
| 31 | - $numCols=max(1,$numCols); |
|
| 32 | - if($colSizing) |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | 33 | $width=(int)(16/$numCols); |
| 34 | 34 | else |
| 35 | 35 | $this->_colSize=16/$numCols; |
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 36 | + for ($i=0; $i<$numCols; $i++) { |
|
| 37 | 37 | $this->addItem($width); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param int $width |
| 45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 46 | 46 | */ |
| 47 | - public function setWidth($width){ |
|
| 48 | - if(\is_int($width)){ |
|
| 47 | + public function setWidth($width) { |
|
| 48 | + if (\is_int($width)) { |
|
| 49 | 49 | $width=Wide::getConstants()["W".$width]; |
| 50 | 50 | } |
| 51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
| 57 | 57 | * @param int $index |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | - if($force===true){ |
|
| 105 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 106 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 104 | + if ($force===true) { |
|
| 105 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 106 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 110 | - for($i=0;$i<$count;$i++){ |
|
| 109 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 110 | + for ($i=0; $i<$count; $i++) { |
|
| 111 | 111 | $this->content[$i]->setValue($values[$i]); |
| 112 | 112 | } |
| 113 | 113 | return $this; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * {@inheritDoc} |
| 118 | 118 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 119 | 119 | */ |
| 120 | - protected function createItem($value){ |
|
| 121 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 120 | + protected function createItem($value) { |
|
| 121 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 122 | 122 | return $col; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 126 | - if($this->_implicite===true){ |
|
| 125 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 126 | + if ($this->_implicite===true) { |
|
| 127 | 127 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 128 | 128 | } |
| 129 | - return parent::compile($js,$view); |
|
| 129 | + return parent::compile($js, $view); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -29,10 +29,11 @@ |
||
| 29 | 29 | if(isset($numCols)){ |
| 30 | 30 | $numCols=min(16,$numCols); |
| 31 | 31 | $numCols=max(1,$numCols); |
| 32 | - if($colSizing) |
|
| 33 | - $width=(int)(16/$numCols); |
|
| 34 | - else |
|
| 35 | - $this->_colSize=16/$numCols; |
|
| 32 | + if($colSizing) { |
|
| 33 | + $width=(int)(16/$numCols); |
|
| 34 | + } else { |
|
| 35 | + $this->_colSize=16/$numCols; |
|
| 36 | + } |
|
| 36 | 37 | for ($i=0;$i<$numCols;$i++){ |
| 37 | 38 | $this->addItem($width); |
| 38 | 39 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -68,10 +68,16 @@ discard block |
||
| 68 | 68 | return $tr; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + /** |
|
| 72 | + * @param integer $value |
|
| 73 | + */ |
|
| 71 | 74 | public function newRow($value) { |
| 72 | 75 | return $this->createItem($value); |
| 73 | 76 | } |
| 74 | 77 | |
| 78 | + /** |
|
| 79 | + * @param integer $colCount |
|
| 80 | + */ |
|
| 75 | 81 | public function addRow($colCount) { |
| 76 | 82 | return $this->addItem($colCount); |
| 77 | 83 | } |
@@ -97,7 +103,7 @@ discard block |
||
| 97 | 103 | /** |
| 98 | 104 | * |
| 99 | 105 | * @param int $index |
| 100 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
| 106 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 101 | 107 | */ |
| 102 | 108 | public function getRow($index) { |
| 103 | 109 | return $this->getItem($index); |
@@ -141,6 +147,9 @@ discard block |
||
| 141 | 147 | return $this; |
| 142 | 148 | } |
| 143 | 149 | |
| 150 | + /** |
|
| 151 | + * @param integer $colIndex |
|
| 152 | + */ |
|
| 144 | 153 | public function setColValues($colIndex, $values=array()) { |
| 145 | 154 | $count=$this->count(); |
| 146 | 155 | if (\is_array($values) === false) { |
@@ -161,6 +170,9 @@ discard block |
||
| 161 | 170 | return $this; |
| 162 | 171 | } |
| 163 | 172 | |
| 173 | + /** |
|
| 174 | + * @param integer $rowIndex |
|
| 175 | + */ |
|
| 164 | 176 | public function setRowValues($rowIndex, $values=array()) { |
| 165 | 177 | $count=$this->count(); |
| 166 | 178 | if (\is_array($values) === false) { |
@@ -170,6 +182,9 @@ discard block |
||
| 170 | 182 | return $this; |
| 171 | 183 | } |
| 172 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $function |
|
| 187 | + */ |
|
| 173 | 188 | private function colAlign($colIndex, $function) { |
| 174 | 189 | $count=$this->count(); |
| 175 | 190 | for($i=0; $i < $count; $i++) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
| 14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
| 14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function setRowCount($rowCount, $colCount) { |
| 36 | 36 | $count=$this->count(); |
| 37 | - for($i=$count; $i < $rowCount; $i++) { |
|
| 37 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 38 | 38 | $this->addItem($colCount); |
| 39 | 39 | } |
| 40 | 40 | /* |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $tr=new HtmlTR("", $value); |
| 63 | 63 | $tr->setContainer($this, $count); |
| 64 | 64 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 65 | - if (isset($value) === true) { |
|
| 65 | + if (isset($value)===true) { |
|
| 66 | 66 | $tr->setColCount($value); |
| 67 | 67 | } |
| 68 | 68 | return $tr; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function setCellValue($row, $col, $value="") { |
| 114 | 114 | $cell=$this->getCell($row, $col); |
| 115 | - if (isset($cell) === true) { |
|
| 115 | + if (isset($cell)===true) { |
|
| 116 | 116 | $cell->setValue($value); |
| 117 | 117 | } |
| 118 | 118 | return $this; |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | public function setValues($values=array()) { |
| 126 | 126 | $count=$this->count(); |
| 127 | 127 | $isArray=true; |
| 128 | - if (\is_array($values) === false) { |
|
| 128 | + if (\is_array($values)===false) { |
|
| 129 | 129 | $values=\array_fill(0, $count, $values); |
| 130 | 130 | $isArray=false; |
| 131 | 131 | } |
| 132 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 133 | - $values=[ $values ]; |
|
| 132 | + if (JArray::dimension($values)==1 && $isArray) |
|
| 133 | + $values=[$values]; |
|
| 134 | 134 | |
| 135 | 135 | $count=\min(\sizeof($values), $count); |
| 136 | 136 | |
| 137 | - for($i=0; $i < $count; $i++) { |
|
| 137 | + for ($i=0; $i<$count; $i++) { |
|
| 138 | 138 | $row=$this->content[$i]; |
| 139 | 139 | $row->setValues($values[$i]); |
| 140 | 140 | } |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function setColValues($colIndex, $values=array()) { |
| 145 | 145 | $count=$this->count(); |
| 146 | - if (\is_array($values) === false) { |
|
| 146 | + if (\is_array($values)===false) { |
|
| 147 | 147 | $values=\array_fill(0, $count, $values); |
| 148 | 148 | } |
| 149 | 149 | $count=\min(\sizeof($values), $count); |
| 150 | - for($i=0; $i < $count; $i++) { |
|
| 150 | + for ($i=0; $i<$count; $i++) { |
|
| 151 | 151 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 152 | 152 | } |
| 153 | 153 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function addColVariations($colIndex, $variations=array()) { |
| 157 | 157 | $count=$this->count(); |
| 158 | - for($i=0; $i < $count; $i++) { |
|
| 158 | + for ($i=0; $i<$count; $i++) { |
|
| 159 | 159 | $this->getCell($i, $colIndex)->addVariations($variations); |
| 160 | 160 | } |
| 161 | 161 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | public function setRowValues($rowIndex, $values=array()) { |
| 165 | 165 | $count=$this->count(); |
| 166 | - if (\is_array($values) === false) { |
|
| 166 | + if (\is_array($values)===false) { |
|
| 167 | 167 | $values=\array_fill(0, $count, $values); |
| 168 | 168 | } |
| 169 | 169 | $this->getItem($rowIndex)->setValues($values); |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | private function colAlign($colIndex, $function) { |
| 174 | 174 | $count=$this->count(); |
| 175 | - for($i=0; $i < $count; $i++) { |
|
| 175 | + for ($i=0; $i<$count; $i++) { |
|
| 176 | 176 | $index=$this->content[$i]->getColPosition($colIndex); |
| 177 | - if ($index !== NULL) |
|
| 177 | + if ($index!==NULL) |
|
| 178 | 178 | $this->getCell($i, $index)->$function(); |
| 179 | 179 | } |
| 180 | 180 | return $this; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function getColCount() { |
| 208 | 208 | $result=0; |
| 209 | - if ($this->count() > 0) |
|
| 209 | + if ($this->count()>0) |
|
| 210 | 210 | $result=$this->getItem(0)->getColCount(); |
| 211 | 211 | return $result; |
| 212 | 212 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function delete($rowIndex, $colIndex=NULL) { |
| 221 | 221 | if (isset($colIndex)) { |
| 222 | 222 | $row=$this->getItem($rowIndex); |
| 223 | - if (isset($row) === true) { |
|
| 223 | + if (isset($row)===true) { |
|
| 224 | 224 | $row->delete($colIndex); |
| 225 | 225 | } |
| 226 | 226 | } else { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function conditionalCellFormat($callback, $format) { |
| 254 | 254 | $rows=$this->content; |
| 255 | - foreach ( $rows as $row ) { |
|
| 255 | + foreach ($rows as $row) { |
|
| 256 | 256 | $row->conditionalCellFormat($callback, $format); |
| 257 | 257 | } |
| 258 | 258 | return $this; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function conditionalRowFormat($callback, $format) { |
| 267 | 267 | $rows=$this->content; |
| 268 | - foreach ( $rows as $row ) { |
|
| 268 | + foreach ($rows as $row) { |
|
| 269 | 269 | $row->conditionalRowFormat($callback, $format); |
| 270 | 270 | } |
| 271 | 271 | return $this; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function applyCells($callback) { |
| 279 | 279 | $rows=$this->content; |
| 280 | - foreach ( $rows as $row ) { |
|
| 280 | + foreach ($rows as $row) { |
|
| 281 | 281 | $row->applyCells($callback); |
| 282 | 282 | } |
| 283 | 283 | return $this; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function applyRows($callback) { |
| 291 | 291 | $rows=$this->content; |
| 292 | - foreach ( $rows as $row ) { |
|
| 292 | + foreach ($rows as $row) { |
|
| 293 | 293 | $row->apply($callback); |
| 294 | 294 | } |
| 295 | 295 | return $this; |
@@ -22,8 +22,9 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
| 24 | 24 | parent::__construct($identifier, $tagName, ""); |
| 25 | - if (isset($rowCount) && isset($colCount)) |
|
| 26 | - $this->setRowCount($rowCount, $colCount); |
|
| 25 | + if (isset($rowCount) && isset($colCount)) { |
|
| 26 | + $this->setRowCount($rowCount, $colCount); |
|
| 27 | + } |
|
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | /** |
@@ -129,8 +130,9 @@ discard block |
||
| 129 | 130 | $values=\array_fill(0, $count, $values); |
| 130 | 131 | $isArray=false; |
| 131 | 132 | } |
| 132 | - if (JArray::dimension($values) == 1 && $isArray) |
|
| 133 | - $values=[ $values ]; |
|
| 133 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
| 134 | + $values=[ $values ]; |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | $count=\min(\sizeof($values), $count); |
| 136 | 138 | |
@@ -174,8 +176,9 @@ discard block |
||
| 174 | 176 | $count=$this->count(); |
| 175 | 177 | for($i=0; $i < $count; $i++) { |
| 176 | 178 | $index=$this->content[$i]->getColPosition($colIndex); |
| 177 | - if ($index !== NULL) |
|
| 178 | - $this->getCell($i, $index)->$function(); |
|
| 179 | + if ($index !== NULL) { |
|
| 180 | + $this->getCell($i, $index)->$function(); |
|
| 181 | + } |
|
| 179 | 182 | } |
| 180 | 183 | return $this; |
| 181 | 184 | } |
@@ -206,8 +209,9 @@ discard block |
||
| 206 | 209 | */ |
| 207 | 210 | public function getColCount() { |
| 208 | 211 | $result=0; |
| 209 | - if ($this->count() > 0) |
|
| 210 | - $result=$this->getItem(0)->getColCount(); |
|
| 212 | + if ($this->count() > 0) { |
|
| 213 | + $result=$this->getItem(0)->getColCount(); |
|
| 214 | + } |
|
| 211 | 215 | return $result; |
| 212 | 216 | } |
| 213 | 217 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Set the button value |
| 40 | 40 | * @param string $value |
| 41 | - * @return \Ajax\semantic\html\HtmlButton |
|
| 41 | + * @return HtmlButton |
|
| 42 | 42 | */ |
| 43 | 43 | public function setValue($value) { |
| 44 | 44 | $this->content=$value; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * define the button style |
| 50 | - * @param string|int $cssStyle |
|
| 51 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
| 50 | + * @param string $cssStyle |
|
| 51 | + * @return HtmlButton default : "" |
|
| 52 | 52 | */ |
| 53 | 53 | public function setStyle($cssStyle) { |
| 54 | 54 | return $this->addToProperty("class", $cssStyle); |
@@ -98,7 +98,6 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Add and return a button label |
| 101 | - * @param string $caption |
|
| 102 | 101 | * @param string $before |
| 103 | 102 | * @param string $icon |
| 104 | 103 | * @return \Ajax\semantic\html\elements\HtmlLabel |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | 107 | $this->tagName="div"; |
| 108 | 108 | $this->addToProperty("class", "labeled"); |
| 109 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 109 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | - $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
|
| 112 | - if(isset($icon)) |
|
| 111 | + $label=new HtmlLabel("label-".$this->identifier, $label, "a"); |
|
| 112 | + if (isset($icon)) |
|
| 113 | 113 | $label->addIcon($icon); |
| 114 | 114 | $label->setBasic(); |
| 115 | 115 | $this->addContent($label, $before); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function fromArray($array) { |
| 124 | 124 | $array=parent::fromArray($array); |
| 125 | - foreach ( $array as $key => $value ) { |
|
| 125 | + foreach ($array as $key => $value) { |
|
| 126 | 126 | $this->setProperty($key, $value); |
| 127 | 127 | } |
| 128 | 128 | return $array; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 188 | + if ($value===NULL) |
|
| 189 | 189 | $value=\ucfirst($social); |
| 190 | 190 | $return=new HtmlButton($identifier, $value); |
| 191 | 191 | $return->addIcon($social); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function asLink($href=NULL) { |
| 208 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content); |
|
| 208 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content); |
|
| 209 | 209 | $this->content=$lnk; |
| 210 | 210 | return $this; |
| 211 | 211 | } |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 59 | - $this->setProperty("tabindex", "0"); |
|
| 60 | - else { |
|
| 58 | + if ($value === true) { |
|
| 59 | + $this->setProperty("tabindex", "0"); |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removeProperty("tabindex"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -109,8 +109,9 @@ discard block |
||
| 109 | 109 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | 111 | $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
| 112 | - if(isset($icon)) |
|
| 113 | - $label->addIcon($icon); |
|
| 112 | + if(isset($icon)) { |
|
| 113 | + $label->addIcon($icon); |
|
| 114 | + } |
|
| 114 | 115 | $label->setBasic(); |
| 115 | 116 | $this->addContent($label, $before); |
| 116 | 117 | return $label; |
@@ -185,8 +186,9 @@ discard block |
||
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 189 | - $value=\ucfirst($social); |
|
| 189 | + if ($value === NULL) { |
|
| 190 | + $value=\ucfirst($social); |
|
| 191 | + } |
|
| 190 | 192 | $return=new HtmlButton($identifier, $value); |
| 191 | 193 | $return->addIcon($social); |
| 192 | 194 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class HtmlIconGroups extends HtmlSemCollection { |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $identifier |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($identifier, $icons=array(), $size="") { |
| 17 | 20 | parent::__construct($identifier, "i", "icons"); |
| 18 | 21 | $this->addItems($icons); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $icon=JArray::getValue($value, "icon", 0); |
| 26 | 26 | $size=JArray::getValue($value, "size", 1); |
| 27 | 27 | } |
| 28 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 28 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 29 | 29 | if (isset($size)) { |
| 30 | 30 | $iconO->setSize($size); |
| 31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function createCondition($value) { |
| 36 | - return ($value instanceof HtmlIcon) === false; |
|
| 36 | + return ($value instanceof HtmlIcon)===false; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function getIcon($index) { |