@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * @author jc |
| 13 | 13 | * @version 1.001 |
| 14 | 14 | */ |
| 15 | -class HtmlGridCol extends HtmlSemDoubleElement{ |
|
| 15 | +class HtmlGridCol extends HtmlSemDoubleElement { |
|
| 16 | 16 | use TextAlignmentTrait; |
| 17 | - public function __construct($identifier,$width){ |
|
| 18 | - parent::__construct($identifier,"div"); |
|
| 17 | + public function __construct($identifier, $width) { |
|
| 18 | + parent::__construct($identifier, "div"); |
|
| 19 | 19 | $this->setClass("column"); |
| 20 | - if(isset($width)) |
|
| 20 | + if (isset($width)) |
|
| 21 | 21 | $this->setWidth($width); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * @param int $width |
| 27 | 27 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 28 | 28 | */ |
| 29 | - public function setWidth($width){ |
|
| 30 | - if(\is_int($width)){ |
|
| 29 | + public function setWidth($width) { |
|
| 30 | + if (\is_int($width)) { |
|
| 31 | 31 | $width=Wide::getConstants()["W".$width]; |
| 32 | 32 | } |
| 33 | 33 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 34 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 34 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | * @param string $value left or right |
| 40 | 40 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 41 | 41 | */ |
| 42 | - public function setFloated($value="left"){ |
|
| 42 | + public function setFloated($value="left") { |
|
| 43 | 43 | return $this->addToProperty("class", $value." floated"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function setValue($value){ |
|
| 47 | + public function setValue($value) { |
|
| 48 | 48 | $this->content=$value; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -16,23 +16,23 @@ 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 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 25 | - parent::__construct( $identifier,"div","row"); |
|
| 24 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 25 | + parent::__construct($identifier, "div", "row"); |
|
| 26 | 26 | $this->_implicite=$implicite; |
| 27 | 27 | $width=null; |
| 28 | - if(isset($numCols)){ |
|
| 29 | - $numCols=min(16,$numCols); |
|
| 30 | - $numCols=max(1,$numCols); |
|
| 31 | - if($colSizing) |
|
| 32 | - $width=(int)(16/$numCols); |
|
| 28 | + if (isset($numCols)) { |
|
| 29 | + $numCols=min(16, $numCols); |
|
| 30 | + $numCols=max(1, $numCols); |
|
| 31 | + if ($colSizing) |
|
| 32 | + $width=(int) (16 / $numCols); |
|
| 33 | 33 | else |
| 34 | - $this->_colSize=16/$numCols; |
|
| 35 | - for ($i=0;$i<$numCols;$i++){ |
|
| 34 | + $this->_colSize=16 / $numCols; |
|
| 35 | + for ($i=0; $i<$numCols; $i++) { |
|
| 36 | 36 | $this->addItem($width); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | * @param int $width |
| 44 | 44 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 45 | 45 | */ |
| 46 | - public function setWidth($width){ |
|
| 47 | - if(\is_int($width)){ |
|
| 46 | + public function setWidth($width) { |
|
| 47 | + if (\is_int($width)) { |
|
| 48 | 48 | $width=Wide::getConstants()["W".$width]; |
| 49 | 49 | } |
| 50 | 50 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 51 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 51 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param int $index |
| 57 | 57 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 58 | 58 | */ |
| 59 | - public function getCol($index){ |
|
| 59 | + public function getCol($index) { |
|
| 60 | 60 | return $this->getItem($index); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * stretch the row contents to take up the entire column height |
| 65 | 65 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 66 | 66 | */ |
| 67 | - public function setStretched(){ |
|
| 67 | + public function setStretched() { |
|
| 68 | 68 | return $this->addToProperty("class", "stretched"); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,19 +72,19 @@ discard block |
||
| 72 | 72 | * @param string $color |
| 73 | 73 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 74 | 74 | */ |
| 75 | - public function setColor($color){ |
|
| 76 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 75 | + public function setColor($color) { |
|
| 76 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function setValues($values,$force=false){ |
|
| 79 | + public function setValues($values, $force=false) { |
|
| 80 | 80 | $count=$this->count(); |
| 81 | - if($force===true){ |
|
| 82 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 83 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 81 | + if ($force===true) { |
|
| 82 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 83 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 87 | - for($i=0;$i<$count;$i++){ |
|
| 86 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 87 | + for ($i=0; $i<$count; $i++) { |
|
| 88 | 88 | $this->content[$i]->setValue($values[$i]); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | * {@inheritDoc} |
| 94 | 94 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 95 | 95 | */ |
| 96 | - protected function createItem($value){ |
|
| 97 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 96 | + protected function createItem($value) { |
|
| 97 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 98 | 98 | return $col; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
| 102 | - if($this->_implicite===true){ |
|
| 101 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
| 102 | + if ($this->_implicite===true) { |
|
| 103 | 103 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 104 | 104 | } |
| 105 | - return parent::compile($js,$view); |
|
| 105 | + return parent::compile($js, $view); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | \ No newline at end of file |