@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | // } |
| 33 | 33 | $this->setWide($numCols); |
| 34 | 34 | } |
| 35 | - if($createCols) |
|
| 35 | + if ($createCols) |
|
| 36 | 36 | $this->setRowsCount($numRows, $numCols); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asSegment() { |
| 40 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 40 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function asContainer() { |
| 44 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 44 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | * @param int $wide |
| 50 | 50 | */ |
| 51 | 51 | public function setWide($wide) { |
| 52 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
| 53 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 52 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
| 53 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 54 | 54 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 55 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 55 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 56 | 56 | } |
| 57 | 57 | return $this; |
| 58 | 58 | } |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | * @return mixed |
| 73 | 73 | */ |
| 74 | 74 | public function addRow($colsCount=NULL) { |
| 75 | - $rowCount=$this->rowCount() + 1; |
|
| 75 | + $rowCount=$this->rowCount()+1; |
|
| 76 | 76 | $this->setRowsCount($rowCount, $colsCount, true); |
| 77 | - return $this->content[$rowCount - 1]; |
|
| 77 | + return $this->content[$rowCount-1]; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 84 | 84 | */ |
| 85 | 85 | public function addCol($width=NULL) { |
| 86 | - $colCount=$this->colCount() + 1; |
|
| 86 | + $colCount=$this->colCount()+1; |
|
| 87 | 87 | $this->setColsCount($colCount, true, $width); |
| 88 | 88 | if ($this->hasOnlyCols($this->count())) |
| 89 | - return $this->content[$colCount - 1]; |
|
| 89 | + return $this->content[$colCount-1]; |
|
| 90 | 90 | return $this; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 97 | 97 | */ |
| 98 | 98 | public function addCols($sizes=array()) { |
| 99 | - foreach ( $sizes as $size ) { |
|
| 99 | + foreach ($sizes as $size) { |
|
| 100 | 100 | $this->addCol($size); |
| 101 | 101 | } |
| 102 | 102 | return $this; |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 112 | 112 | $count=$this->count(); |
| 113 | - if ($rowsCount < 2 && $force === false) { |
|
| 114 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 115 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 113 | + if ($rowsCount<2 && $force===false) { |
|
| 114 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 115 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 116 | 116 | } |
| 117 | 117 | } else { |
| 118 | 118 | if ($this->hasOnlyCols($count)) { |
| 119 | 119 | $tmpContent=$this->content; |
| 120 | 120 | $item=$this->addItem($colsCount); |
| 121 | 121 | $item->setContent($tmpContent); |
| 122 | - $this->content=array (); |
|
| 122 | + $this->content=array(); |
|
| 123 | 123 | $count=1; |
| 124 | 124 | } |
| 125 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 125 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 126 | 126 | $this->addItem($colsCount); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | protected function hasOnlyCols($count) { |
| 133 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 133 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | if (isset($width)===false) { |
| 145 | 145 | $this->setWide($numCols); |
| 146 | 146 | } |
| 147 | - if ($toCreate === true) { |
|
| 147 | + if ($toCreate===true) { |
|
| 148 | 148 | $count=$this->count(); |
| 149 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 150 | - for($i=$count; $i < $numCols; $i++) { |
|
| 151 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 149 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 150 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 151 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - for($i=0; $i < $count; $i++) { |
|
| 154 | + for ($i=0; $i<$count; $i++) { |
|
| 155 | 155 | $this->getItem($i)->setColsCount($numCols); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $count=$this->count(); |
| 188 | 188 | if ($this->hasOnlyCols($count)) |
| 189 | 189 | return $count; |
| 190 | - if ($count > 0) |
|
| 190 | + if ($count>0) |
|
| 191 | 191 | return $this->getItem(0)->count(); |
| 192 | 192 | return 0; |
| 193 | 193 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 200 | 200 | */ |
| 201 | 201 | public function getCell($row, $col) { |
| 202 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 202 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 203 | 203 | return $this->getItem($col); |
| 204 | 204 | $row=$this->getItem($row); |
| 205 | 205 | if (isset($row)) { |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 215 | 215 | */ |
| 216 | 216 | public function setDivided($vertically=false) { |
| 217 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 218 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 217 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 218 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -224,15 +224,15 @@ discard block |
||
| 224 | 224 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 225 | 225 | */ |
| 226 | 226 | public function setCelled($internally=false) { |
| 227 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 228 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 227 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 228 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * A grid can have its columns centered |
| 233 | 233 | */ |
| 234 | 234 | public function setCentered() { |
| 235 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 235 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function setPadded($value=NULL) { |
| 252 | 252 | if (isset($value)) |
| 253 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 253 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 254 | 254 | return $this->addToProperty("class", "padded"); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 261 | 261 | */ |
| 262 | 262 | public function setRelaxed($very=false) { |
| 263 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 264 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 263 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 264 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 268 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 268 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 276 | 276 | */ |
| 277 | 277 | protected function createItem($value) { |
| 278 | - if ($this->_createCols === false) |
|
| 278 | + if ($this->_createCols===false) |
|
| 279 | 279 | $value=null; |
| 280 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 280 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 281 | 281 | return $item; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -288,20 +288,20 @@ discard block |
||
| 288 | 288 | public function setValues($values, $force=true) { |
| 289 | 289 | $count=$this->count(); |
| 290 | 290 | $valuesSize=\sizeof($values); |
| 291 | - if ($this->_createCols === false || $force === true) { |
|
| 292 | - for($i=$count; $i < $valuesSize; $i++) { |
|
| 291 | + if ($this->_createCols===false || $force===true) { |
|
| 292 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 293 | 293 | $colSize=\sizeof($values[$i]); |
| 294 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 294 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | - $count=\min(array ($this->count(),$valuesSize )); |
|
| 298 | - for($i=0; $i < $count; $i++) { |
|
| 299 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 297 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 298 | + for ($i=0; $i<$count; $i++) { |
|
| 299 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - public function setColWidth($numCol,$width){ |
|
| 304 | - foreach ($this->content as $row){ |
|
| 303 | + public function setColWidth($numCol, $width) { |
|
| 304 | + foreach ($this->content as $row) { |
|
| 305 | 305 | $row->getCol($numCol)->setWidth($width); |
| 306 | 306 | } |
| 307 | 307 | return $this; |