@@ -25,10 +25,16 @@ |
||
| 25 | 25 | return $this->addComponent(new Popup($this->js), $attachTo, $params); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $attachTo |
|
| 30 | + */ |
|
| 28 | 31 | public function dropdown($attachTo=NULL, $params=NULL) { |
| 29 | 32 | return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $attachTo |
|
| 37 | + */ |
|
| 32 | 38 | public function accordion($attachTo=NULL, $params=NULL) { |
| 33 | 39 | return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
| 34 | 40 | } |
@@ -15,42 +15,42 @@ |
||
| 15 | 15 | * @param mixed $content |
| 16 | 16 | * @param string $tagName |
| 17 | 17 | */ |
| 18 | - public function __construct($identifier,$content=NULL,$tagName="td") { |
|
| 18 | + public function __construct($identifier, $content=NULL, $tagName="td") { |
|
| 19 | 19 | parent::__construct($identifier, $tagName, "", $content); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function setContainer($container,$row,$col){ |
|
| 22 | + public function setContainer($container, $row, $col) { |
|
| 23 | 23 | $this->_container=$container; |
| 24 | 24 | $this->_row=$row; |
| 25 | 25 | $this->_col=$col; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setValue($value){ |
|
| 28 | + public function setValue($value) { |
|
| 29 | 29 | $this->content=$value; |
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setRowspan($rowspan){ |
|
| 34 | - $to=min($this->_container->count(),$this->_row+$rowspan-1); |
|
| 35 | - for($i=$to;$i>$this->_row;$i--){ |
|
| 36 | - $this->_container->delete($this->_row+1,$this->_col); |
|
| 33 | + public function setRowspan($rowspan) { |
|
| 34 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
| 35 | + for ($i=$to; $i>$this->_row; $i--) { |
|
| 36 | + $this->_container->delete($this->_row+1, $this->_col); |
|
| 37 | 37 | } |
| 38 | 38 | $this->setProperty("rowspan", $rowspan); |
| 39 | 39 | return $this->_container; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function mergeRow(){ |
|
| 42 | + public function mergeRow() { |
|
| 43 | 43 | return $this->setRowspan($this->_container->count()); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function mergeCol(){ |
|
| 46 | + public function mergeCol() { |
|
| 47 | 47 | return $this->setColspan($this->_container->getRow($this->_row)->count()); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function setColspan($colspan){ |
|
| 51 | - $to=min($this->_container->getRow($this->_row)->count(),$this->_col+$colspan-1); |
|
| 52 | - for($i=$to;$i>$this->_col;$i--){ |
|
| 53 | - $this->_container->delete($this->_row,$this->_col+1); |
|
| 50 | + public function setColspan($colspan) { |
|
| 51 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
| 52 | + for ($i=$to; $i>$this->_col; $i--) { |
|
| 53 | + $this->_container->delete($this->_row, $this->_col+1); |
|
| 54 | 54 | } |
| 55 | 55 | $this->setProperty("colspan", $colspan); |
| 56 | 56 | return $this->_container; |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | * @author jc |
| 10 | 10 | * |
| 11 | 11 | */ |
| 12 | -class HtmlTableContent extends HtmlSemCollection{ |
|
| 12 | +class HtmlTableContent extends HtmlSemCollection { |
|
| 13 | 13 | |
| 14 | - protected $_tdTagNames=["thead"=>"th","tbody"=>"td","tfoot"=>"th"]; |
|
| 14 | + protected $_tdTagNames=["thead"=>"th", "tbody"=>"td", "tfoot"=>"th"]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @param string $identifier |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | * @param int $rowCount |
| 20 | 20 | * @param int $colCount |
| 21 | 21 | */ |
| 22 | - public function __construct( $identifier,$tagName="tbody",$rowCount=NULL,$colCount=NULL){ |
|
| 23 | - parent::__construct( $identifier, $tagName, ""); |
|
| 24 | - if(isset($rowCount) && isset($colCount)) |
|
| 22 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
| 23 | + parent::__construct($identifier, $tagName, ""); |
|
| 24 | + if (isset($rowCount) && isset($colCount)) |
|
| 25 | 25 | $this->setRowCount($rowCount, $colCount); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | * @param int $colCount |
| 31 | 31 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 32 | 32 | */ |
| 33 | - public function setRowCount($rowCount,$colCount){ |
|
| 33 | + public function setRowCount($rowCount, $colCount) { |
|
| 34 | 34 | $count=$this->count(); |
| 35 | - for($i=$count;$i<$rowCount;$i++){ |
|
| 35 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 36 | 36 | $this->addItem($colCount); |
| 37 | 37 | } |
| 38 | - for($i=0;$i<$rowCount;$i++){ |
|
| 38 | + for ($i=0; $i<$rowCount; $i++) { |
|
| 39 | 39 | $item=$this->content[$i]; |
| 40 | 40 | $item->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 41 | 41 | $this->content[$i]->setColCount($colCount); |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | * {@inheritDoc} |
| 48 | 48 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 49 | 49 | */ |
| 50 | - protected function createItem($value){ |
|
| 50 | + protected function createItem($value) { |
|
| 51 | 51 | $count=$this->count(); |
| 52 | - $tr= new HtmlTR("", $value); |
|
| 52 | + $tr=new HtmlTR("", $value); |
|
| 53 | 53 | $tr->setContainer($this, $count); |
| 54 | 54 | return $tr; |
| 55 | 55 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param int $col |
| 61 | 61 | * @return \Ajax\semantic\html\content\HtmlTD |
| 62 | 62 | */ |
| 63 | - public function getCell($row,$col){ |
|
| 63 | + public function getCell($row, $col) { |
|
| 64 | 64 | $row=$this->getItem($row); |
| 65 | - if(isset($row)){ |
|
| 65 | + if (isset($row)) { |
|
| 66 | 66 | $col=$row->getItem($col); |
| 67 | 67 | } |
| 68 | 68 | return $col; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param int $index |
| 73 | 73 | * @return \Ajax\semantic\html\content\HtmlTR |
| 74 | 74 | */ |
| 75 | - public function getRow($index){ |
|
| 75 | + public function getRow($index) { |
|
| 76 | 76 | return $this->getItem($index); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | * @param mixed $value |
| 83 | 83 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 84 | 84 | */ |
| 85 | - public function setCellValue($row,$col,$value=""){ |
|
| 85 | + public function setCellValue($row, $col, $value="") { |
|
| 86 | 86 | $cell=$this->getCell($row, $col); |
| 87 | - if(isset($cell)===true){ |
|
| 87 | + if (isset($cell)===true) { |
|
| 88 | 88 | $cell->setValue($value); |
| 89 | 89 | } |
| 90 | 90 | return $this; |
@@ -94,35 +94,35 @@ discard block |
||
| 94 | 94 | * Sets the cells values |
| 95 | 95 | * @param mixed $values |
| 96 | 96 | */ |
| 97 | - public function setValues($values=array()){ |
|
| 97 | + public function setValues($values=array()) { |
|
| 98 | 98 | $count=$this->count(); |
| 99 | - if(\is_array($values)===false){ |
|
| 99 | + if (\is_array($values)===false) { |
|
| 100 | 100 | $values=\array_fill(0, $count, $values); |
| 101 | 101 | } |
| 102 | - $count=\min(\sizeof($values),$count); |
|
| 102 | + $count=\min(\sizeof($values), $count); |
|
| 103 | 103 | |
| 104 | - for ($i=0;$i<$count;$i++){ |
|
| 104 | + for ($i=0; $i<$count; $i++) { |
|
| 105 | 105 | $row=$this->content[$i]; |
| 106 | 106 | $row->setValues($values[$i]); |
| 107 | 107 | } |
| 108 | 108 | return $this; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function setColValues($colIndex,$values=array()){ |
|
| 111 | + public function setColValues($colIndex, $values=array()) { |
|
| 112 | 112 | $count=$this->count(); |
| 113 | - if(\is_array($values)===false){ |
|
| 113 | + if (\is_array($values)===false) { |
|
| 114 | 114 | $values=\array_fill(0, $count, $values); |
| 115 | 115 | } |
| 116 | - $count=\min(\sizeof($values),$count); |
|
| 117 | - for ($i=0;$i<$count;$i++){ |
|
| 116 | + $count=\min(\sizeof($values), $count); |
|
| 117 | + for ($i=0; $i<$count; $i++) { |
|
| 118 | 118 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
| 119 | 119 | } |
| 120 | 120 | return $this; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function colCenter($colIndex){ |
|
| 123 | + public function colCenter($colIndex) { |
|
| 124 | 124 | $count=$this->count(); |
| 125 | - for ($i=0;$i<$count;$i++){ |
|
| 125 | + for ($i=0; $i<$count; $i++) { |
|
| 126 | 126 | $this->getCell($i, $colIndex)->textCenterAligned(); |
| 127 | 127 | } |
| 128 | 128 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Returns the number of rows (TR) |
| 133 | 133 | * @return int |
| 134 | 134 | */ |
| 135 | - public function getRowCount(){ |
|
| 135 | + public function getRowCount() { |
|
| 136 | 136 | return $this->count(); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | * Returns the number of columns (TD) |
| 141 | 141 | * @return int |
| 142 | 142 | */ |
| 143 | - public function getColCount(){ |
|
| 143 | + public function getColCount() { |
|
| 144 | 144 | $result=0; |
| 145 | - if($this->count()>0) |
|
| 145 | + if ($this->count()>0) |
|
| 146 | 146 | $result=$this->getItem(0)->getColCount(); |
| 147 | 147 | return $result; |
| 148 | 148 | } |
@@ -153,23 +153,23 @@ discard block |
||
| 153 | 153 | * @param int $colIndex |
| 154 | 154 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 155 | 155 | */ |
| 156 | - public function delete($rowIndex,$colIndex=NULL){ |
|
| 157 | - if(isset($colIndex)){ |
|
| 156 | + public function delete($rowIndex, $colIndex=NULL) { |
|
| 157 | + if (isset($colIndex)) { |
|
| 158 | 158 | $row=$this->getItem($rowIndex); |
| 159 | - if(isset($row)===true){ |
|
| 159 | + if (isset($row)===true) { |
|
| 160 | 160 | $row->delete($colIndex); |
| 161 | 161 | } |
| 162 | - }else{ |
|
| 162 | + }else { |
|
| 163 | 163 | $this->removeItem($rowIndex); |
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - public function mergeCol($rowIndex=0,$colIndex=0){ |
|
| 168 | + public function mergeCol($rowIndex=0, $colIndex=0) { |
|
| 169 | 169 | return $this->getItem($rowIndex)->mergeCol($colIndex); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - public function mergeRow($rowIndex=0,$colIndex=0){ |
|
| 172 | + public function mergeRow($rowIndex=0, $colIndex=0) { |
|
| 173 | 173 | return $this->getItem($rowIndex)->mergeRow($colIndex); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -8,19 +8,19 @@ discard block |
||
| 8 | 8 | * @author jc |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | -class HtmlTR extends HtmlSemCollection{ |
|
| 11 | +class HtmlTR extends HtmlSemCollection { |
|
| 12 | 12 | |
| 13 | 13 | private $_tdTagName; |
| 14 | 14 | private $_container; |
| 15 | 15 | private $_row; |
| 16 | 16 | |
| 17 | - public function __construct( $identifier, $colCount){ |
|
| 18 | - parent::__construct( $identifier, "tr", ""); |
|
| 17 | + public function __construct($identifier, $colCount) { |
|
| 18 | + parent::__construct($identifier, "tr", ""); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setColCount($colCount){ |
|
| 21 | + public function setColCount($colCount) { |
|
| 22 | 22 | $count=$this->count(); |
| 23 | - for($i=$count;$i<$colCount;$i++){ |
|
| 23 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 24 | 24 | $item=$this->addItem(NULL); |
| 25 | 25 | $item->setTagName($this->_tdTagName); |
| 26 | 26 | } |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * {@inheritDoc} |
| 33 | 33 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 34 | 34 | */ |
| 35 | - protected function createItem($value){ |
|
| 35 | + protected function createItem($value) { |
|
| 36 | 36 | $count=$this->count(); |
| 37 | - $td=new HtmlTD("",$this->_container,$value,$this->_tdTagName); |
|
| 37 | + $td=new HtmlTD("", $this->_container, $value, $this->_tdTagName); |
|
| 38 | 38 | $td->setContainer($this->_container, $this->_row, $count); |
| 39 | 39 | return $td; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setTdTagName($tagName="td"){ |
|
| 42 | + public function setTdTagName($tagName="td") { |
|
| 43 | 43 | $this->_tdTagName=$tagName; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param HtmlTableContent $container |
| 49 | 49 | * @param int $row |
| 50 | 50 | */ |
| 51 | - public function setContainer($container,$row){ |
|
| 51 | + public function setContainer($container, $row) { |
|
| 52 | 52 | $this->_container=$container; |
| 53 | 53 | $this->_row=$row; |
| 54 | 54 | } |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * Sets values to the row cols |
| 58 | 58 | * @param mixed $values |
| 59 | 59 | */ |
| 60 | - public function setValues($values=array()){ |
|
| 60 | + public function setValues($values=array()) { |
|
| 61 | 61 | $count=$this->count(); |
| 62 | - if(\is_array($values)===false){ |
|
| 62 | + if (\is_array($values)===false) { |
|
| 63 | 63 | $values=\array_fill(0, $count, $values); |
| 64 | 64 | } |
| 65 | - $count=\min(\sizeof($values),$count); |
|
| 65 | + $count=\min(\sizeof($values), $count); |
|
| 66 | 66 | |
| 67 | - for ($i=0;$i<$count;$i++){ |
|
| 67 | + for ($i=0; $i<$count; $i++) { |
|
| 68 | 68 | $cell=$this->content[$i]; |
| 69 | 69 | $cell->setValue($values[$i]); |
| 70 | 70 | } |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | * @param int $index the index of the col to remove |
| 76 | 76 | * @return \Ajax\semantic\html\content\table\HtmlTR |
| 77 | 77 | */ |
| 78 | - public function delete($index){ |
|
| 78 | + public function delete($index) { |
|
| 79 | 79 | $this->removeItem($index); |
| 80 | 80 | return $this; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function mergeCol($colIndex=0){ |
|
| 83 | + public function mergeCol($colIndex=0) { |
|
| 84 | 84 | return $this->getItem($colIndex)->mergeCol(); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function mergeRow($colIndex=0){ |
|
| 87 | + public function mergeRow($colIndex=0) { |
|
| 88 | 88 | return $this->getItem($colIndex)->mergeRow(); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class Variation extends BaseEnum { |
| 8 | - const ANIMATED="animated",AVATAR="avatar",CELLED="celled",COMPACT="compact",FLUID="fluid",INVERTED="inverted",PADDED="padded",TRANSPARENT="transparent"; |
|
| 8 | + const ANIMATED="animated", AVATAR="avatar", CELLED="celled", COMPACT="compact", FLUID="fluid", INVERTED="inverted", PADDED="padded", TRANSPARENT="transparent"; |
|
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |
@@ -10,23 +10,23 @@ |
||
| 10 | 10 | * @param string $value |
| 11 | 11 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 12 | 12 | */ |
| 13 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
| 14 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
| 13 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
| 14 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function textCenterAligned(){ |
|
| 17 | + public function textCenterAligned() { |
|
| 18 | 18 | return $this->setTextAlignment(TextAlignment::CENTER); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function textJustified(){ |
|
| 21 | + public function textJustified() { |
|
| 22 | 22 | return $this->setTextAlignment(TextAlignment::JUSTIFIED); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function textRightAligned(){ |
|
| 25 | + public function textRightAligned() { |
|
| 26 | 26 | return $this->setTextAlignment(TextAlignment::RIGHT); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function textLeftAligned(){ |
|
| 29 | + public function textLeftAligned() { |
|
| 30 | 30 | return $this->setTextAlignment(); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | parent::__construct($identifier, "table", "ui table"); |
| 18 | 18 | $this->content=array(); |
| 19 | 19 | $this->setRowCount($rowCount, $colCount); |
| 20 | - $this->_variations=[Variation::CELLED,Variation::PADDED]; |
|
| 20 | + $this->_variations=[Variation::CELLED, Variation::PADDED]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | * @param string $key |
| 26 | 26 | * @return HtmlTableContent |
| 27 | 27 | */ |
| 28 | - private function getPart($key){ |
|
| 29 | - if(\array_key_exists($key, $this->content)===false){ |
|
| 30 | - $this->content[$key]=new HtmlTableContent("",$key); |
|
| 31 | - if($key!=="tbody"){ |
|
| 28 | + private function getPart($key) { |
|
| 29 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 30 | + $this->content[$key]=new HtmlTableContent("", $key); |
|
| 31 | + if ($key!=="tbody") { |
|
| 32 | 32 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * Returns/create eventually the body of the table |
| 40 | 40 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 41 | 41 | */ |
| 42 | - public function getBody(){ |
|
| 42 | + public function getBody() { |
|
| 43 | 43 | return $this->getPart("tbody"); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Returns/create eventually the header of the table |
| 48 | 48 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 49 | 49 | */ |
| 50 | - public function getHeader(){ |
|
| 50 | + public function getHeader() { |
|
| 51 | 51 | return $this->getPart("thead"); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * Returns/create eventually the footer of the table |
| 56 | 56 | * @return \Ajax\semantic\html\content\table\HtmlTableContent |
| 57 | 57 | */ |
| 58 | - public function getFooter(){ |
|
| 58 | + public function getFooter() { |
|
| 59 | 59 | return $this->getPart("tfoot"); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param string $key |
| 65 | 65 | * @return boolean |
| 66 | 66 | */ |
| 67 | - public function hasPart($key){ |
|
| 67 | + public function hasPart($key) { |
|
| 68 | 68 | return \array_key_exists($key, $this->content)===true; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function setRowCount($rowCount, $colCount) { |
| 77 | 77 | $this->_colCount=$colCount; |
| 78 | - return $this->getBody()->setRowCount($rowCount,$colCount); |
|
| 78 | + return $this->getBody()->setRowCount($rowCount, $colCount); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -84,28 +84,28 @@ discard block |
||
| 84 | 84 | * @param int $col |
| 85 | 85 | * @return \Ajax\semantic\html\content\HtmlTD |
| 86 | 86 | */ |
| 87 | - public function getCell($row,$col){ |
|
| 88 | - return $this->getBody()->getCell($row,$col); |
|
| 87 | + public function getCell($row, $col) { |
|
| 88 | + return $this->getBody()->getCell($row, $col); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function setValues($values=array()){ |
|
| 91 | + public function setValues($values=array()) { |
|
| 92 | 92 | $this->getBody()->setValues($values); |
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function setColValues($colIndex,$values=array()){ |
|
| 97 | - $this->getBody()->setColValues($colIndex,$values); |
|
| 96 | + public function setColValues($colIndex, $values=array()) { |
|
| 97 | + $this->getBody()->setColValues($colIndex, $values); |
|
| 98 | 98 | return $this; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function colCenter($colIndex){ |
|
| 102 | - if($this->hasPart("thead")) |
|
| 101 | + public function colCenter($colIndex) { |
|
| 102 | + if ($this->hasPart("thead")) |
|
| 103 | 103 | $this->getHeader()->colCenter($colIndex); |
| 104 | 104 | $this->getBody()->colCenter($colIndex); |
| 105 | 105 | return $this; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function setCelled(){ |
|
| 108 | + public function setCelled() { |
|
| 109 | 109 | return $this->addToProperty("class", "celled"); |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | class HtmlMenu extends HtmlSemCollection { |
| 25 | 25 | |
| 26 | 26 | public function __construct($identifier, $items=array()) { |
| 27 | - parent::__construct($identifier, "div","ui menu"); |
|
| 27 | + parent::__construct($identifier, "div", "ui menu"); |
|
| 28 | 28 | $this->addItems($items); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -33,30 +33,30 @@ discard block |
||
| 33 | 33 | * @param string $type one of text,item |
| 34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 35 | 35 | */ |
| 36 | - public function setType($type=""){ |
|
| 37 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
| 36 | + public function setType($type="") { |
|
| 37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setActiveItem($index){ |
|
| 40 | + public function setActiveItem($index) { |
|
| 41 | 41 | $item=$this->getItem($index); |
| 42 | - if($item!==null){ |
|
| 42 | + if ($item!==null) { |
|
| 43 | 43 | $item->addToProperty("class", "active"); |
| 44 | 44 | } |
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | - private function getItemToInsert($item){ |
|
| 48 | - if($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon){ |
|
| 49 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div",""); |
|
| 47 | + private function getItemToInsert($item) { |
|
| 48 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon) { |
|
| 49 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
| 50 | 50 | $itemO->setContent($item); |
| 51 | 51 | $item=$itemO; |
| 52 | 52 | } |
| 53 | 53 | return $item; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - private function afterInsert($item){ |
|
| 57 | - if(!$item instanceof HtmlMenu) |
|
| 58 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
| 59 | - else{ |
|
| 56 | + private function afterInsert($item) { |
|
| 57 | + if (!$item instanceof HtmlMenu) |
|
| 58 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 59 | + else { |
|
| 60 | 60 | $this->setSecondary(); |
| 61 | 61 | } |
| 62 | 62 | return $item; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * {@inheritDoc} |
| 66 | 66 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
| 67 | 67 | */ |
| 68 | - public function addItem($item){ |
|
| 68 | + public function addItem($item) { |
|
| 69 | 69 | $item=parent::addItem($this->getItemToInsert($item)); |
| 70 | 70 | return $this->afterInsert($item); |
| 71 | 71 | } |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | * {@inheritDoc} |
| 75 | 75 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
| 76 | 76 | */ |
| 77 | - public function insertItem($item,$position=0){ |
|
| 78 | - $item=parent::insertItem($this->getItemToInsert($item),$position); |
|
| 77 | + public function insertItem($item, $position=0) { |
|
| 78 | + $item=parent::insertItem($this->getItemToInsert($item), $position); |
|
| 79 | 79 | return $this->afterInsert($item); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function generateMenuAsItem($menu,$header=null){ |
|
| 82 | + public function generateMenuAsItem($menu, $header=null) { |
|
| 83 | 83 | $count=$this->count(); |
| 84 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
| 85 | - if(isset($header)){ |
|
| 86 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
| 84 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 85 | + if (isset($header)) { |
|
| 86 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 87 | 87 | $headerItem->setContent($header); |
| 88 | 88 | $item->addContent($headerItem); |
| 89 | 89 | } |
@@ -91,24 +91,24 @@ discard block |
||
| 91 | 91 | $item->addContent($menu); |
| 92 | 92 | return $item; |
| 93 | 93 | } |
| 94 | - public function addMenuAsItem($menu,$header=null){ |
|
| 95 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
| 94 | + public function addMenuAsItem($menu, $header=null) { |
|
| 95 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function addPopupAsItem($value,$identifier, $content=""){ |
|
| 99 | - $value=new HtmlSemDoubleElement($identifier,"a","browse item",$value); |
|
| 98 | + public function addPopupAsItem($value, $identifier, $content="") { |
|
| 99 | + $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
|
| 100 | 100 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 101 | 101 | $value=$this->addItem($value); |
| 102 | - $popup=new HtmlPopup($value,"popup-".$this->identifier."-".$this->count(),$content); |
|
| 102 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 103 | 103 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 104 | - $this->wrap("",$popup); |
|
| 104 | + $this->wrap("", $popup); |
|
| 105 | 105 | return $popup; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function addDropdownAsItem($value,$items=NULL){ |
|
| 108 | + public function addDropdownAsItem($value, $items=NULL) { |
|
| 109 | 109 | $dd=$value; |
| 110 | - if(\is_string($value)){ |
|
| 111 | - $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(),$value,$items); |
|
| 110 | + if (\is_string($value)) { |
|
| 111 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 112 | 112 | } |
| 113 | 113 | return $this->addItem($dd); |
| 114 | 114 | } |
@@ -117,63 +117,63 @@ discard block |
||
| 117 | 117 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 118 | 118 | */ |
| 119 | 119 | protected function createItem($value) { |
| 120 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
| 120 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
| 121 | 121 | return $itemO->setClass("item"); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function setInverted(){ |
|
| 124 | + public function setInverted() { |
|
| 125 | 125 | return $this->addToProperty("class", "inverted"); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function setSecondary(){ |
|
| 128 | + public function setSecondary() { |
|
| 129 | 129 | return $this->addToProperty("class", "secondary"); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function setVertical(){ |
|
| 133 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 132 | + public function setVertical() { |
|
| 133 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - public function setPosition($value="right"){ |
|
| 137 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
| 136 | + public function setPosition($value="right") { |
|
| 137 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - public function setPointing($value=Direction::NONE){ |
|
| 141 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 140 | + public function setPointing($value=Direction::NONE) { |
|
| 141 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function asTab($vertical=false){ |
|
| 145 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
| 146 | - if($vertical===true) |
|
| 144 | + public function asTab($vertical=false) { |
|
| 145 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
| 146 | + if ($vertical===true) |
|
| 147 | 147 | $this->setVertical(); |
| 148 | 148 | return $this->addToProperty("class", "tabular"); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - public function asPagination(){ |
|
| 152 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
| 151 | + public function asPagination() { |
|
| 152 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
| 153 | 153 | return $this->addToProperty("class", "pagination"); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function setFloated($direction="right"){ |
|
| 156 | + public function setFloated($direction="right") { |
|
| 157 | 157 | return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function floatRight(){ |
|
| 160 | + public function floatRight() { |
|
| 161 | 161 | return $this->setFloated(); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function floatLeft(){ |
|
| 164 | + public function floatLeft() { |
|
| 165 | 165 | return $this->setFloated("left"); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - public function setFixed(){ |
|
| 168 | + public function setFixed() { |
|
| 169 | 169 | return $this->addToProperty("class", "fixed"); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - public function setFluid(){ |
|
| 172 | + public function setFluid() { |
|
| 173 | 173 | return $this->addToProperty("class", "fluid"); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function setCompact(){ |
|
| 176 | + public function setCompact() { |
|
| 177 | 177 | return $this->addToProperty("class", "compact"); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function fromDatabaseObject($object, $function) { |
| 184 | 184 | $return=$function($object); |
| 185 | - if(\is_array($return)) |
|
| 185 | + if (\is_array($return)) |
|
| 186 | 186 | $this->addItems($return); |
| 187 | 187 | else |
| 188 | 188 | $this->addItem($return); |
@@ -193,19 +193,19 @@ discard block |
||
| 193 | 193 | * @param int $width |
| 194 | 194 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 195 | 195 | */ |
| 196 | - public function setWidth($width){ |
|
| 197 | - if(\is_int($width)){ |
|
| 196 | + public function setWidth($width) { |
|
| 197 | + if (\is_int($width)) { |
|
| 198 | 198 | $width=Wide::getConstants()["W".$width]; |
| 199 | 199 | } |
| 200 | 200 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 201 | - return $this->addToPropertyCtrl("class", "item",array("item")); |
|
| 201 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function addImage($identifier, $src="", $alt=""){ |
|
| 205 | - return $this->addItem(new HtmlImg($identifier,$src,$alt)); |
|
| 204 | + public function addImage($identifier, $src="", $alt="") { |
|
| 205 | + return $this->addItem(new HtmlImg($identifier, $src, $alt)); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - public static function vertical($identifier,$items=array()){ |
|
| 209 | - return (new HtmlMenu($identifier,$items))->setVertical(); |
|
| 208 | + public static function vertical($identifier, $items=array()) { |
|
| 209 | + return (new HtmlMenu($identifier, $items))->setVertical(); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class HtmlRating extends HtmlSemDoubleElement { |
| 9 | 9 | protected $_params=array(); |
| 10 | - public function __construct($identifier, $value,$max=5,$icon="star") { |
|
| 10 | + public function __construct($identifier, $value, $max=5, $icon="star") { |
|
| 11 | 11 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
| 12 | 12 | $this->setValue($value); |
| 13 | 13 | $this->setMax($max); |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | * {@inheritDoc} |
| 18 | 18 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
| 19 | 19 | */ |
| 20 | - public function setValue($value){ |
|
| 20 | + public function setValue($value) { |
|
| 21 | 21 | $this->setProperty("data-rating", $value); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setMax($max){ |
|
| 24 | + public function setMax($max) { |
|
| 25 | 25 | $this->setProperty("data-max-rating", $max); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * {@inheritDoc} |
| 30 | 30 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 31 | 31 | */ |
| 32 | - public function run(JsUtils $js){ |
|
| 32 | + public function run(JsUtils $js) { |
|
| 33 | 33 | parent::run($js); |
| 34 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
| 34 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |