@@ -10,21 +10,21 @@ discard block |
||
| 10 | 10 | * @author jc |
| 11 | 11 | * @version 1.001 |
| 12 | 12 | */ |
| 13 | -class HtmlGridRow extends HtmlCollection{ |
|
| 13 | +class HtmlGridRow extends HtmlCollection { |
|
| 14 | 14 | |
| 15 | 15 | private $_colSize; |
| 16 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false){ |
|
| 17 | - parent::__construct( $identifier,"div"); |
|
| 16 | + public function __construct($identifier, $numCols=NULL, $colSizing=false) { |
|
| 17 | + parent::__construct($identifier, "div"); |
|
| 18 | 18 | $this->setClass("row"); |
| 19 | 19 | $width=null; |
| 20 | - if(isset($numCols)){ |
|
| 21 | - $numCols=min(16,$numCols); |
|
| 22 | - $numCols=max(1,$numCols); |
|
| 23 | - if($colSizing) |
|
| 24 | - $width=(int)(16/$numCols); |
|
| 20 | + if (isset($numCols)) { |
|
| 21 | + $numCols=min(16, $numCols); |
|
| 22 | + $numCols=max(1, $numCols); |
|
| 23 | + if ($colSizing) |
|
| 24 | + $width=(int) (16 / $numCols); |
|
| 25 | 25 | else |
| 26 | - $this->_colSize=16/$numCols; |
|
| 27 | - for ($i=0;$i<$numCols;$i++){ |
|
| 26 | + $this->_colSize=16 / $numCols; |
|
| 27 | + for ($i=0; $i<$numCols; $i++) { |
|
| 28 | 28 | $this->addItem($width); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * @param int $width |
| 36 | 36 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 37 | 37 | */ |
| 38 | - public function setWidth($width){ |
|
| 39 | - if(\is_int($width)){ |
|
| 38 | + public function setWidth($width) { |
|
| 39 | + if (\is_int($width)) { |
|
| 40 | 40 | $width=Wide::getConstants()["W".$width]; |
| 41 | 41 | } |
| 42 | 42 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 43 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 43 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param int $index |
| 49 | 49 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 50 | 50 | */ |
| 51 | - public function getCol($index){ |
|
| 51 | + public function getCol($index) { |
|
| 52 | 52 | return $this->getItem($index); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * stretch the row contents to take up the entire column height |
| 57 | 57 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 58 | 58 | */ |
| 59 | - public function setStretched(){ |
|
| 59 | + public function setStretched() { |
|
| 60 | 60 | return $this->addToProperty("class", "stretched"); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | * {@inheritDoc} |
| 65 | 65 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 66 | 66 | */ |
| 67 | - protected function createItem($value){ |
|
| 68 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 67 | + protected function createItem($value) { |
|
| 68 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 69 | 69 | return $col; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | * @author jc |
| 11 | 11 | * @version 1.001 |
| 12 | 12 | */ |
| 13 | -class HtmlGridCol extends HtmlSemDoubleElement{ |
|
| 14 | - public function __construct($identifier,$width){ |
|
| 15 | - parent::__construct($identifier,"div"); |
|
| 13 | +class HtmlGridCol extends HtmlSemDoubleElement { |
|
| 14 | + public function __construct($identifier, $width) { |
|
| 15 | + parent::__construct($identifier, "div"); |
|
| 16 | 16 | $this->setClass("column"); |
| 17 | - if(isset($width)) |
|
| 17 | + if (isset($width)) |
|
| 18 | 18 | $this->setWidth($width); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | * @param int $width |
| 24 | 24 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 25 | 25 | */ |
| 26 | - public function setWidth($width){ |
|
| 27 | - if(\is_int($width)){ |
|
| 26 | + public function setWidth($width) { |
|
| 27 | + if (\is_int($width)) { |
|
| 28 | 28 | $width=Wide::getConstants()["W".$width]; |
| 29 | 29 | } |
| 30 | 30 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 31 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 31 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param string $value left or right |
| 37 | 37 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 38 | 38 | */ |
| 39 | - public function setFloated($value="left"){ |
|
| 39 | + public function setFloated($value="left") { |
|
| 40 | 40 | return $this->addToProperty("class", $value." floated"); |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -11,22 +11,22 @@ discard block |
||
| 11 | 11 | * @author jc |
| 12 | 12 | * @version 1.001 |
| 13 | 13 | */ |
| 14 | -class HtmlGrid extends HtmlCollection{ |
|
| 14 | +class HtmlGrid extends HtmlCollection { |
|
| 15 | 15 | |
| 16 | 16 | private $_createCols; |
| 17 | 17 | private $_colSizing=true; |
| 18 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true){ |
|
| 19 | - parent::__construct( $identifier, "div"); |
|
| 18 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true) { |
|
| 19 | + parent::__construct($identifier, "div"); |
|
| 20 | 20 | $this->_createCols=$createCols; |
| 21 | - if(isset($numCols)){ |
|
| 22 | - if($this->_createCols){ |
|
| 21 | + if (isset($numCols)) { |
|
| 22 | + if ($this->_createCols) { |
|
| 23 | 23 | $this->_colSizing=false; |
| 24 | 24 | } |
| 25 | 25 | $cols=Wide::getConstants()["W".$numCols]; |
| 26 | 26 | $this->setClass($cols." column"); |
| 27 | 27 | } |
| 28 | - $this->addToProperty("class","ui grid"); |
|
| 29 | - $this->setNumRows($numRows,$numCols); |
|
| 28 | + $this->addToProperty("class", "ui grid"); |
|
| 29 | + $this->setNumRows($numRows, $numCols); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @param int $numCols |
| 36 | 36 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 37 | 37 | */ |
| 38 | - public function setNumRows($numRows,$numCols=NULL){ |
|
| 38 | + public function setNumRows($numRows, $numCols=NULL) { |
|
| 39 | 39 | $count=$this->count(); |
| 40 | - for($i=$count;$i<$numRows;$i++){ |
|
| 40 | + for ($i=$count; $i<$numRows; $i++) { |
|
| 41 | 41 | $this->addItem($numCols); |
| 42 | 42 | } |
| 43 | 43 | return $this; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param int $index |
| 49 | 49 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
| 50 | 50 | */ |
| 51 | - public function getRow($index){ |
|
| 51 | + public function getRow($index) { |
|
| 52 | 52 | return $this->getItem($index); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | * @param int $col |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCell($row,$col){ |
|
| 60 | + public function getCell($row, $col) { |
|
| 61 | 61 | $row=$this->getItem($row); |
| 62 | - if(isset($row)){ |
|
| 62 | + if (isset($row)) { |
|
| 63 | 63 | $col=$row->getItem($col); |
| 64 | 64 | } |
| 65 | 65 | return $col; |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | * @param boolean $vertically |
| 71 | 71 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 72 | 72 | */ |
| 73 | - public function setDivided($vertically=false){ |
|
| 74 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
| 73 | + public function setDivided($vertically=false) { |
|
| 74 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 75 | 75 | return $this->addToProperty("class", $value); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | * @param boolean $internal true for internal cells |
| 81 | 81 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 82 | 82 | */ |
| 83 | - public function setCelled($internal=false){ |
|
| 84 | - $value=($internal===true)?"internal celled":"celled"; |
|
| 83 | + public function setCelled($internal=false) { |
|
| 84 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
| 85 | 85 | return $this->addToProperty("class", $value); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function setEqualWidth(){ |
|
| 88 | + public function setEqualWidth() { |
|
| 89 | 89 | return $this->addToProperty("class", "equal width"); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | * {@inheritDoc} |
| 94 | 94 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 95 | 95 | */ |
| 96 | - protected function createItem($value){ |
|
| 97 | - if($this->_createCols===false) |
|
| 96 | + protected function createItem($value) { |
|
| 97 | + if ($this->_createCols===false) |
|
| 98 | 98 | $value=null; |
| 99 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing); |
|
| 99 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing); |
|
| 100 | 100 | return $item; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -6,23 +6,23 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 8 | 8 | |
| 9 | - public function __construct($identifier,$tagName="div"){ |
|
| 10 | - parent::__construct($identifier,$tagName); |
|
| 9 | + public function __construct($identifier, $tagName="div") { |
|
| 10 | + parent::__construct($identifier, $tagName); |
|
| 11 | 11 | $this->content=array(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function addItems($items){ |
|
| 15 | - foreach ($items as $item){ |
|
| 14 | + public function addItems($items) { |
|
| 15 | + foreach ($items as $item) { |
|
| 16 | 16 | $this->addItem($item); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function setItems($items){ |
|
| 20 | + public function setItems($items) { |
|
| 21 | 21 | $this->content=$items; |
| 22 | 22 | return $this; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getItems(){ |
|
| 25 | + public function getItems() { |
|
| 26 | 26 | return $this->content; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param HtmlDoubleElement|string $item |
| 32 | 32 | * @return \Ajax\common\html\HtmlDoubleElement |
| 33 | 33 | */ |
| 34 | - public function addItem($item){ |
|
| 34 | + public function addItem($item) { |
|
| 35 | 35 | $itemO=$item; |
| 36 | - if(\is_object($item)===false){ |
|
| 36 | + if (\is_object($item)===false) { |
|
| 37 | 37 | $itemO=$this->createItem($item); |
| 38 | 38 | } |
| 39 | 39 | $this->addContent($itemO); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | return $this; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function removeItem($index){ |
|
| 62 | + public function removeItem($index) { |
|
| 63 | 63 | return array_splice($this->content, $index, 1); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function count(){ |
|
| 66 | + public function count() { |
|
| 67 | 67 | return \sizeof($this->content); |
| 68 | 68 | } |
| 69 | 69 | |