@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Sets the menu type |
| 33 | 33 | * @param string $type one of text,item |
| 34 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
| 34 | + * @return HtmlMenu |
|
| 35 | 35 | */ |
| 36 | 36 | public function setType($type=""){ |
| 37 | 37 | return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
@@ -73,6 +73,7 @@ discard block |
||
| 73 | 73 | /** |
| 74 | 74 | * {@inheritDoc} |
| 75 | 75 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
| 76 | + * @param HtmlIcon $item |
|
| 76 | 77 | */ |
| 77 | 78 | public function insertItem($item,$position=0){ |
| 78 | 79 | $item=parent::insertItem($this->getItemToInsert($item),$position); |
@@ -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,51 +117,51 @@ 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 setFixed(){ |
|
| 156 | + public function setFixed() { |
|
| 157 | 157 | return $this->addToProperty("class", "fixed"); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function setFluid(){ |
|
| 160 | + public function setFluid() { |
|
| 161 | 161 | return $this->addToProperty("class", "fluid"); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function setCompact(){ |
|
| 164 | + public function setCompact() { |
|
| 165 | 165 | return $this->addToProperty("class", "compact"); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function fromDatabaseObject($object, $function) { |
| 172 | 172 | $return=$function($object); |
| 173 | - if(\is_array($return)) |
|
| 173 | + if (\is_array($return)) |
|
| 174 | 174 | $this->addItems($return); |
| 175 | 175 | else |
| 176 | 176 | $this->addItem($return); |
@@ -181,19 +181,19 @@ discard block |
||
| 181 | 181 | * @param int $width |
| 182 | 182 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 183 | 183 | */ |
| 184 | - public function setWidth($width){ |
|
| 185 | - if(\is_int($width)){ |
|
| 184 | + public function setWidth($width) { |
|
| 185 | + if (\is_int($width)) { |
|
| 186 | 186 | $width=Wide::getConstants()["W".$width]; |
| 187 | 187 | } |
| 188 | 188 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 189 | - return $this->addToPropertyCtrl("class", "item",array("item")); |
|
| 189 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public function addImage($identifier, $src="", $alt=""){ |
|
| 193 | - return $this->addItem(new HtmlImg($identifier,$src,$alt)); |
|
| 192 | + public function addImage($identifier, $src="", $alt="") { |
|
| 193 | + return $this->addItem(new HtmlImg($identifier, $src, $alt)); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public static function vertical($identifier,$items=array()){ |
|
| 197 | - return (new HtmlMenu($identifier,$items))->setVertical(); |
|
| 196 | + public static function vertical($identifier, $items=array()) { |
|
| 197 | + return (new HtmlMenu($identifier, $items))->setVertical(); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | \ No newline at end of file |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $identifier |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($identifier, $tagName="ul") { |
| 24 | 27 | parent::__construct($identifier, $tagName); |
| 25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -4,22 +4,22 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | |
| 7 | -class HtmlTableContent extends HtmlSemCollection{ |
|
| 7 | +class HtmlTableContent extends HtmlSemCollection { |
|
| 8 | 8 | |
| 9 | - protected $_tdTagNames=["thead"=>"th","tbody"=>"td","tfoot"=>"th"]; |
|
| 9 | + protected $_tdTagNames=["thead"=>"th", "tbody"=>"td", "tfoot"=>"th"]; |
|
| 10 | 10 | |
| 11 | - public function __construct( $identifier,$tagName="tbody",$rowCount=NULL,$colCount=NULL){ |
|
| 12 | - parent::__construct( $identifier, $tagName, ""); |
|
| 13 | - if(isset($rowCount) && isset($colCount)) |
|
| 11 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
| 12 | + parent::__construct($identifier, $tagName, ""); |
|
| 13 | + if (isset($rowCount) && isset($colCount)) |
|
| 14 | 14 | $this->setRowCount($rowCount, $colCount); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function setRowCount($rowCount,$colCount){ |
|
| 17 | + public function setRowCount($rowCount, $colCount) { |
|
| 18 | 18 | $count=$this->count(); |
| 19 | - for($i=$count;$i<$rowCount;$i++){ |
|
| 19 | + for ($i=$count; $i<$rowCount; $i++) { |
|
| 20 | 20 | $this->addItem($colCount); |
| 21 | 21 | } |
| 22 | - for($i=0;$i<$rowCount;$i++){ |
|
| 22 | + for ($i=0; $i<$rowCount; $i++) { |
|
| 23 | 23 | $item=$this->content[$i]; |
| 24 | 24 | $item->setTdTagName($this->_tdTagNames[$this->tagName]); |
| 25 | 25 | $this->content[$i]->setColCount($colCount); |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - protected function createItem($value){ |
|
| 30 | + protected function createItem($value) { |
|
| 31 | 31 | $count=$this->count(); |
| 32 | - $tr= new HtmlTR("", $value); |
|
| 32 | + $tr=new HtmlTR("", $value); |
|
| 33 | 33 | $tr->setContainer($this, $count); |
| 34 | 34 | return $tr; |
| 35 | 35 | } |
@@ -40,57 +40,57 @@ discard block |
||
| 40 | 40 | * @param int $col |
| 41 | 41 | * @return \Ajax\semantic\html\content\HtmlTD |
| 42 | 42 | */ |
| 43 | - public function getCell($row,$col){ |
|
| 43 | + public function getCell($row, $col) { |
|
| 44 | 44 | $row=$this->getItem($row); |
| 45 | - if(isset($row)){ |
|
| 45 | + if (isset($row)) { |
|
| 46 | 46 | $col=$row->getItem($col); |
| 47 | 47 | } |
| 48 | 48 | return $col; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getRow($index){ |
|
| 51 | + public function getRow($index) { |
|
| 52 | 52 | return $this->getItem($index); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setCellValue($row,$col,$value=""){ |
|
| 55 | + public function setCellValue($row, $col, $value="") { |
|
| 56 | 56 | $cell=$this->getCell($row, $col); |
| 57 | - if(isset($cell)){ |
|
| 57 | + if (isset($cell)) { |
|
| 58 | 58 | $cell->setValue($value); |
| 59 | 59 | } |
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setValues($values=array()){ |
|
| 63 | + public function setValues($values=array()) { |
|
| 64 | 64 | $count=$this->count(); |
| 65 | - if(\is_array($values)===false){ |
|
| 65 | + if (\is_array($values)===false) { |
|
| 66 | 66 | $values=\array_fill(0, $count, $values); |
| 67 | 67 | } |
| 68 | - $count=\min(\sizeof($values),$count); |
|
| 68 | + $count=\min(\sizeof($values), $count); |
|
| 69 | 69 | |
| 70 | - for ($i=0;$i<$count;$i++){ |
|
| 70 | + for ($i=0; $i<$count; $i++) { |
|
| 71 | 71 | $row=$this->content[$i]; |
| 72 | 72 | $row->setValues($values[$i]); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function getRowCount(){ |
|
| 76 | + public function getRowCount() { |
|
| 77 | 77 | return $this->count(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function getColCount(){ |
|
| 80 | + public function getColCount() { |
|
| 81 | 81 | $result=0; |
| 82 | - if($this->count()>0) |
|
| 82 | + if ($this->count()>0) |
|
| 83 | 83 | $result=$this->getItem(0)->getColCount(); |
| 84 | 84 | return $result; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function delete($rowIndex,$colIndex=NULL){ |
|
| 88 | - if(isset($colIndex)){ |
|
| 87 | + public function delete($rowIndex, $colIndex=NULL) { |
|
| 88 | + if (isset($colIndex)) { |
|
| 89 | 89 | $row=$this->getItem($rowIndex); |
| 90 | - if(isset($row)===true){ |
|
| 90 | + if (isset($row)===true) { |
|
| 91 | 91 | $row->delete($colIndex); |
| 92 | 92 | } |
| 93 | - }else{ |
|
| 93 | + }else { |
|
| 94 | 94 | $this->removeItem($rowIndex); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | private $_container; |
| 11 | 11 | private $_row; |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct( $identifier, $colCount){ |
| 14 | 17 | parent::__construct( $identifier, "tr", ""); |
| 15 | 18 | } |
@@ -35,6 +38,9 @@ discard block |
||
| 35 | 38 | $this->_tdTagName=$tagName; |
| 36 | 39 | } |
| 37 | 40 | |
| 41 | + /** |
|
| 42 | + * @param HtmlTableContent $container |
|
| 43 | + */ |
|
| 38 | 44 | public function setContainer($container,$row){ |
| 39 | 45 | $this->_container=$container; |
| 40 | 46 | $this->_row=$row; |
@@ -4,19 +4,19 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | |
| 7 | -class HtmlTR extends HtmlSemCollection{ |
|
| 7 | +class HtmlTR extends HtmlSemCollection { |
|
| 8 | 8 | |
| 9 | 9 | private $_tdTagName; |
| 10 | 10 | private $_container; |
| 11 | 11 | private $_row; |
| 12 | 12 | |
| 13 | - public function __construct( $identifier, $colCount){ |
|
| 14 | - parent::__construct( $identifier, "tr", ""); |
|
| 13 | + public function __construct($identifier, $colCount) { |
|
| 14 | + parent::__construct($identifier, "tr", ""); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function setColCount($colCount){ |
|
| 17 | + public function setColCount($colCount) { |
|
| 18 | 18 | $count=$this->count(); |
| 19 | - for($i=$count;$i<$colCount;$i++){ |
|
| 19 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 20 | 20 | $item=$this->addItem(NULL); |
| 21 | 21 | $item->setTagName($this->_tdTagName); |
| 22 | 22 | } |
@@ -24,36 +24,36 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - protected function createItem($value){ |
|
| 27 | + protected function createItem($value) { |
|
| 28 | 28 | $count=$this->count(); |
| 29 | - $td=new HtmlTD("",$this->_container,$value,$this->_tdTagName); |
|
| 29 | + $td=new HtmlTD("", $this->_container, $value, $this->_tdTagName); |
|
| 30 | 30 | $td->setContainer($this->_container, $this->_row, $count); |
| 31 | 31 | return $td; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setTdTagName($tagName="td"){ |
|
| 34 | + public function setTdTagName($tagName="td") { |
|
| 35 | 35 | $this->_tdTagName=$tagName; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function setContainer($container,$row){ |
|
| 38 | + public function setContainer($container, $row) { |
|
| 39 | 39 | $this->_container=$container; |
| 40 | 40 | $this->_row=$row; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setValues($values=array()){ |
|
| 43 | + public function setValues($values=array()) { |
|
| 44 | 44 | $count=$this->count(); |
| 45 | - if(\is_array($values)===false){ |
|
| 45 | + if (\is_array($values)===false) { |
|
| 46 | 46 | $values=\array_fill(0, $count, $values); |
| 47 | 47 | } |
| 48 | - $count=\min(\sizeof($values),$count); |
|
| 48 | + $count=\min(\sizeof($values), $count); |
|
| 49 | 49 | |
| 50 | - for ($i=0;$i<$count;$i++){ |
|
| 50 | + for ($i=0; $i<$count; $i++) { |
|
| 51 | 51 | $cell=$this->content[$i]; |
| 52 | 52 | $cell->setValue($values[$i]); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function delete($index){ |
|
| 56 | + public function delete($index) { |
|
| 57 | 57 | $this->removeItem($index); |
| 58 | 58 | return $this; |
| 59 | 59 | } |
@@ -10,6 +10,10 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
| 12 | 12 | use LabeledIconTrait; |
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param string $icon |
|
| 16 | + */ |
|
| 13 | 17 | public function __construct($identifier,$caption="",$icon=NULL,$tagName="div") { |
| 14 | 18 | parent::__construct($identifier,$tagName,"ui label"); |
| 15 | 19 | $this->content=$caption; |
@@ -18,7 +22,6 @@ discard block |
||
| 18 | 22 | } |
| 19 | 23 | |
| 20 | 24 | /** |
| 21 | - * @param string $side |
|
| 22 | 25 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 23 | 26 | */ |
| 24 | 27 | public function setPointing($value=Direction::NONE){ |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
| 12 | 12 | use LabeledIconTrait; |
| 13 | - public function __construct($identifier,$caption="",$icon=NULL,$tagName="div") { |
|
| 14 | - parent::__construct($identifier,$tagName,"ui label"); |
|
| 13 | + public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
|
| 14 | + parent::__construct($identifier, $tagName, "ui label"); |
|
| 15 | 15 | $this->content=$caption; |
| 16 | - if(isset($icon)) |
|
| 16 | + if (isset($icon)) |
|
| 17 | 17 | $this->addIcon($icon); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -21,33 +21,33 @@ discard block |
||
| 21 | 21 | * @param string $side |
| 22 | 22 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 23 | 23 | */ |
| 24 | - public function setPointing($value=Direction::NONE){ |
|
| 25 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 24 | + public function setPointing($value=Direction::NONE) { |
|
| 25 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @param string $side |
| 30 | 30 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 31 | 31 | */ |
| 32 | - public function toCorner($side="left"){ |
|
| 33 | - return $this->addToPropertyCtrl("class", $side." corner",array("right corner","left corner")); |
|
| 32 | + public function toCorner($side="left") { |
|
| 33 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 38 | 38 | */ |
| 39 | - public function asTag(){ |
|
| 39 | + public function asTag() { |
|
| 40 | 40 | return $this->addToProperty("class", "tag"); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 45 | 45 | */ |
| 46 | - public function asLink(){ |
|
| 46 | + public function asLink() { |
|
| 47 | 47 | return $this->setTagName("a"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function setBasic(){ |
|
| 50 | + public function setBasic() { |
|
| 51 | 51 | return $this->addToProperty("class", "basic"); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,28 +58,28 @@ discard block |
||
| 58 | 58 | * @param string $before |
| 59 | 59 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 60 | 60 | */ |
| 61 | - public function addImage($src,$alt="",$before=true){ |
|
| 61 | + public function addImage($src, $alt="", $before=true) { |
|
| 62 | 62 | $this->addToProperty("class", "image"); |
| 63 | - return $this->addContent(new HtmlImg("image-".$this->identifier,$src,$alt),$before); |
|
| 63 | + return $this->addContent(new HtmlImg("image-".$this->identifier, $src, $alt), $before); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @param string $detail |
| 68 | 68 | * @return \Ajax\common\html\HtmlDoubleElement |
| 69 | 69 | */ |
| 70 | - public function addDetail($detail){ |
|
| 71 | - $div=new HtmlDoubleElement("detail-".$this->identifier,$this->tagName); |
|
| 70 | + public function addDetail($detail) { |
|
| 71 | + $div=new HtmlDoubleElement("detail-".$this->identifier, $this->tagName); |
|
| 72 | 72 | $div->setClass("detail"); |
| 73 | 73 | $div->setContent($detail); |
| 74 | 74 | $this->addContent($div); |
| 75 | 75 | return $div; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function asRibbon(){ |
|
| 78 | + public function asRibbon() { |
|
| 79 | 79 | return $this->addToPropertyCtrl("class", "ribbon", array("ribbon")); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public static function ribbon($identifier,$caption){ |
|
| 83 | - return (new HtmlLabel($identifier,$caption))->asRibbon(); |
|
| 82 | + public static function ribbon($identifier, $caption) { |
|
| 83 | + return (new HtmlLabel($identifier, $caption))->asRibbon(); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -17,35 +17,35 @@ discard block |
||
| 17 | 17 | * @param string $key |
| 18 | 18 | * @return HtmlTableContent |
| 19 | 19 | */ |
| 20 | - private function getPart($key){ |
|
| 21 | - if(\array_key_exists($key, $this->content)===false){ |
|
| 22 | - $this->content[$key]=new HtmlTableContent("",$key); |
|
| 23 | - if($key!=="tbody"){ |
|
| 20 | + private function getPart($key) { |
|
| 21 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 22 | + $this->content[$key]=new HtmlTableContent("", $key); |
|
| 23 | + if ($key!=="tbody") { |
|
| 24 | 24 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | return $this->content[$key]; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function getBody(){ |
|
| 30 | + public function getBody() { |
|
| 31 | 31 | return $this->getPart("tbody"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getHeader(){ |
|
| 34 | + public function getHeader() { |
|
| 35 | 35 | return $this->getPart("thead"); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getFooter(){ |
|
| 38 | + public function getFooter() { |
|
| 39 | 39 | return $this->getPart("tfoot"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function hasPart($key){ |
|
| 42 | + public function hasPart($key) { |
|
| 43 | 43 | return \array_key_exists($key, $this->content)===true; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setRowCount($rowCount, $colCount) { |
| 47 | 47 | $this->_colCount=$colCount; |
| 48 | - return $this->getBody()->setRowCount($rowCount,$colCount); |
|
| 48 | + return $this->getBody()->setRowCount($rowCount, $colCount); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param int $col |
| 55 | 55 | * @return \Ajax\semantic\html\content\HtmlTD |
| 56 | 56 | */ |
| 57 | - public function getCell($row,$col){ |
|
| 58 | - return $this->getBody()->getCell($row,$col); |
|
| 57 | + public function getCell($row, $col) { |
|
| 58 | + return $this->getBody()->getCell($row, $col); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function setValues($values=array()){ |
|
| 61 | + public function setValues($values=array()) { |
|
| 62 | 62 | $this->getBody()->setValues($values); |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | use Phalcon\Mvc\View; |
| 8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
| 9 | 9 | |
| 10 | -class HtmlPaginationMenu extends HtmlMenu{ |
|
| 10 | +class HtmlPaginationMenu extends HtmlMenu { |
|
| 11 | 11 | |
| 12 | - public function __construct( $identifier, $items=array() ){ |
|
| 13 | - parent::__construct( $identifier,$items); |
|
| 12 | + public function __construct($identifier, $items=array()) { |
|
| 13 | + parent::__construct($identifier, $items); |
|
| 14 | 14 | } |
| 15 | 15 | /** |
| 16 | 16 | * {@inheritDoc} |
| 17 | 17 | * @see \Ajax\common\html\BaseHtml::compile() |
| 18 | 18 | */ |
| 19 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
| 19 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
| 20 | 20 | $this->insertItem(new HtmlIcon("", "left chevron")); |
| 21 | 21 | $this->addItem(new HtmlIcon("", "right chevron")); |
| 22 | 22 | $this->asPagination(); |
| 23 | - return parent::compile($js,$view); |
|
| 23 | + return parent::compile($js, $view); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -8,42 +8,42 @@ |
||
| 8 | 8 | private $_container; |
| 9 | 9 | private $_row; |
| 10 | 10 | private $_col; |
| 11 | - public function __construct($identifier,$content=NULL,$tagName="td") { |
|
| 11 | + public function __construct($identifier, $content=NULL, $tagName="td") { |
|
| 12 | 12 | parent::__construct($identifier, $tagName, "", $content); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function setContainer($container,$row,$col){ |
|
| 15 | + public function setContainer($container, $row, $col) { |
|
| 16 | 16 | $this->_container=$container; |
| 17 | 17 | $this->_row=$row; |
| 18 | 18 | $this->_col=$col; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setValue($value){ |
|
| 21 | + public function setValue($value) { |
|
| 22 | 22 | $this->content=$value; |
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setRowspan($rowspan){ |
|
| 27 | - $to=min($this->_container->count(),$this->_row+$rowspan-1); |
|
| 28 | - for($i=$to;$i>$this->_row;$i--){ |
|
| 29 | - $this->_container->delete($this->_row+1,$this->_col); |
|
| 26 | + public function setRowspan($rowspan) { |
|
| 27 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
| 28 | + for ($i=$to; $i>$this->_row; $i--) { |
|
| 29 | + $this->_container->delete($this->_row+1, $this->_col); |
|
| 30 | 30 | } |
| 31 | 31 | $this->setProperty("rowspan", $rowspan); |
| 32 | 32 | return $this->_container; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function rowMerge(){ |
|
| 35 | + public function rowMerge() { |
|
| 36 | 36 | return $this->setRowspan($this->_container->count()); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function colMerge(){ |
|
| 39 | + public function colMerge() { |
|
| 40 | 40 | return $this->setColspan($this->_container->getRow($this->_row)->count()); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setColspan($colspan){ |
|
| 44 | - $to=min($this->_container->getRow($this->_row)->count(),$this->_col+$colspan-1); |
|
| 45 | - for($i=$to;$i>$this->_col;$i--){ |
|
| 46 | - $this->_container->delete($this->_row,$this->_col+1); |
|
| 43 | + public function setColspan($colspan) { |
|
| 44 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
| 45 | + for ($i=$to; $i>$this->_col; $i--) { |
|
| 46 | + $this->_container->delete($this->_row, $this->_col+1); |
|
| 47 | 47 | } |
| 48 | 48 | $this->setProperty("colspan", $colspan); |
| 49 | 49 | return $this->_container; |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @param mixed $value |
| 18 | 18 | * @param CheckboxType $type |
| 19 | 19 | */ |
| 20 | - public function htmlCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
| 21 | - return $this->addHtmlComponent(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
| 20 | + public function htmlCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 21 | + return $this->addHtmlComponent(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param int $rowCount |
| 27 | 27 | * @param int $colCount |
| 28 | 28 | */ |
| 29 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
| 29 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
| 30 | 30 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param boolean $asIcons |
| 43 | 43 | * @return HtmlButtonGroups |
| 44 | 44 | */ |
| 45 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
| 46 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
| 45 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
| 46 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $content |
| 53 | 53 | * @return HtmlContainer |
| 54 | 54 | */ |
| 55 | - public function htmlContainer($identifier,$content=""){ |
|
| 55 | + public function htmlContainer($identifier, $content="") { |
|
| 56 | 56 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @param string $content |
| 62 | 62 | * @return HtmlDivider |
| 63 | 63 | */ |
| 64 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
| 65 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
| 64 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
| 65 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @param string $type |
| 73 | 73 | * @return HtmlHeader |
| 74 | 74 | */ |
| 75 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
| 76 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
| 75 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
| 76 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param string $icon |
| 82 | 82 | * @return HtmlIcon |
| 83 | 83 | */ |
| 84 | - public function htmlIcon($identifier,$icon){ |
|
| 84 | + public function htmlIcon($identifier, $icon) { |
|
| 85 | 85 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | * @param array $icons |
| 92 | 92 | * @return HtmlIconGroups |
| 93 | 93 | */ |
| 94 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
| 95 | - $group=new HtmlIconGroups($identifier,$size); |
|
| 96 | - if(JArray::isAssociative($icons)){ |
|
| 97 | - foreach ($icons as $icon=>$size){ |
|
| 98 | - $group->add($icon,$size); |
|
| 94 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
| 95 | + $group=new HtmlIconGroups($identifier, $size); |
|
| 96 | + if (JArray::isAssociative($icons)) { |
|
| 97 | + foreach ($icons as $icon=>$size) { |
|
| 98 | + $group->add($icon, $size); |
|
| 99 | 99 | } |
| 100 | - }else{ |
|
| 101 | - foreach ($icons as $icon){ |
|
| 100 | + }else { |
|
| 101 | + foreach ($icons as $icon) { |
|
| 102 | 102 | $group->add($icon); |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | * @param string $placeholder |
| 114 | 114 | * @return HtmlInput |
| 115 | 115 | */ |
| 116 | - public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
|
| 117 | - return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
|
| 116 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
| 117 | + return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | * @param string $tagName |
| 124 | 124 | * @return HtmlLabel |
| 125 | 125 | */ |
| 126 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
| 127 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
| 126 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
| 127 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @param array $items |
| 134 | 134 | * @return HtmlList |
| 135 | 135 | */ |
| 136 | - public function htmlList($identifier,$items=array()){ |
|
| 137 | - return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
|
| 136 | + public function htmlList($identifier, $items=array()) { |
|
| 137 | + return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $content |
| 144 | 144 | * @return HtmlSegment |
| 145 | 145 | */ |
| 146 | - public function htmlSegment($identifier, $content=""){ |
|
| 147 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
| 146 | + public function htmlSegment($identifier, $content="") { |
|
| 147 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * @param array $items the segments |
| 154 | 154 | * @return HtmlSegmentGroups |
| 155 | 155 | */ |
| 156 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
| 157 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
| 156 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
| 157 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | * @param RevealType|string $type |
| 165 | 165 | * @param Direction|string $attributeType |
| 166 | 166 | */ |
| 167 | - public function htmlReveal($identifier, $visibleContent,$hiddenContent,$type=RevealType::FADE,$attributeType=NULL){ |
|
| 168 | - return $this->addHtmlComponent(new HtmlReveal($identifier,$visibleContent,$hiddenContent,$type,$attributeType)); |
|
| 167 | + public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
| 168 | + return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function htmlStep($identifier, $steps=array()){ |
|
| 172 | - return $this->addHtmlComponent(new HtmlStep($identifier,$steps)); |
|
| 171 | + public function htmlStep($identifier, $steps=array()) { |
|
| 172 | + return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | \ No newline at end of file |