@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 39 | 39 | */ |
| 40 | 40 | public function setType($type="") { |
| 41 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 41 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function setActiveItem($index) { |
| 45 | 45 | $item=$this->getItem($index); |
| 46 | - if ($item !== null) { |
|
| 46 | + if ($item!==null) { |
|
| 47 | 47 | $item->addToProperty("class", "active"); |
| 48 | 48 | } |
| 49 | 49 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | private function getItemToInsert($item) { |
| 53 | 53 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
| 54 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 54 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 55 | 55 | $item=$itemO; |
| 56 | 56 | } |
| 57 | 57 | return $item; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | 61 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 63 | 63 | else { |
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function addItem($item) { |
| 76 | 76 | $number=$item; |
| 77 | 77 | $item=parent::addItem($this->getItemToInsert($item)); |
| 78 | - if(\is_int($number)) |
|
| 78 | + if (\is_int($number)) |
|
| 79 | 79 | $item->setProperty("data-page", $number); |
| 80 | 80 | return $this->afterInsert($item); |
| 81 | 81 | } |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function generateMenuAsItem($menu, $header=null) { |
| 95 | 95 | $count=$this->count(); |
| 96 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 96 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 97 | 97 | if (isset($header)) { |
| 98 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 98 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 99 | 99 | $headerItem->setContent($header); |
| 100 | 100 | $item->addContent($headerItem); |
| 101 | 101 | $this->_itemHeader=$headerItem; |
| 102 | 102 | } |
| 103 | - if(\is_array($menu)){ |
|
| 104 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 103 | + if (\is_array($menu)) { |
|
| 104 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 105 | 105 | } |
| 106 | 106 | $menu->setClass("menu"); |
| 107 | 107 | $item->addContent($menu); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 117 | 117 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 118 | 118 | $value=$this->addItem($value); |
| 119 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 119 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 120 | 120 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 121 | 121 | $this->wrap("", $popup); |
| 122 | 122 | return $popup; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function addDropdownAsItem($value, $items=NULL) { |
| 126 | 126 | $dd=$value; |
| 127 | 127 | if (\is_string($value)) { |
| 128 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 128 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 129 | 129 | } |
| 130 | 130 | $this->addItem($dd); |
| 131 | 131 | return $dd; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 139 | 139 | */ |
| 140 | 140 | protected function createItem($value) { |
| 141 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 141 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 142 | 142 | $itemO->setTagName("a"); |
| 143 | 143 | $itemO->setContent($value); |
| 144 | 144 | return $itemO; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setSecondary($value=true) { |
| 152 | - if($value) |
|
| 152 | + if ($value) |
|
| 153 | 153 | $this->addToProperty("class", "secondary"); |
| 154 | 154 | else |
| 155 | 155 | $this->removePropertyValue("class", "secondary"); |
@@ -157,28 +157,28 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public function setVertical() { |
| 160 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 160 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function setPosition($value="right") { |
| 164 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 164 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function setPointing($value=Direction::NONE) { |
| 168 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 168 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | public function asTab($vertical=false) { |
| 172 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 172 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 173 | 173 | $item->setTagName("a"); |
| 174 | 174 | }); |
| 175 | - if ($vertical === true) |
|
| 175 | + if ($vertical===true) |
|
| 176 | 176 | $this->setVertical(); |
| 177 | 177 | return $this->addToProperty("class", "tabular"); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | public function asPagination() { |
| 181 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 181 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 182 | 182 | $item->setTagName("a"); |
| 183 | 183 | }); |
| 184 | 184 | return $this->addToProperty("class", "pagination"); |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function setWidth($width) { |
| 217 | 217 | if (\is_int($width)) { |
| 218 | - $width=Wide::getConstants()["W" . $width]; |
|
| 218 | + $width=Wide::getConstants()["W".$width]; |
|
| 219 | 219 | } |
| 220 | 220 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 221 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 221 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | public function addImage($identifier, $src="", $alt="") { |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | return $this->_itemHeader; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - public function run(JsUtils $js){ |
|
| 237 | - $result= parent::run($js); |
|
| 236 | + public function run(JsUtils $js) { |
|
| 237 | + $result=parent::run($js); |
|
| 238 | 238 | return $result->setItemSelector(".item"); |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | \ No newline at end of file |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | - if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
|
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | - else { |
|
| 61 | + if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) { |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | + } else { |
|
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
| 66 | 66 | return $item; |
@@ -75,8 +75,9 @@ discard block |
||
| 75 | 75 | public function addItem($item) { |
| 76 | 76 | $number=$item; |
| 77 | 77 | $item=parent::addItem($this->getItemToInsert($item)); |
| 78 | - if(\is_int($number)) |
|
| 79 | - $item->setProperty("data-page", $number); |
|
| 78 | + if(\is_int($number)) { |
|
| 79 | + $item->setProperty("data-page", $number); |
|
| 80 | + } |
|
| 80 | 81 | return $this->afterInsert($item); |
| 81 | 82 | } |
| 82 | 83 | |
@@ -149,10 +150,11 @@ discard block |
||
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | public function setSecondary($value=true) { |
| 152 | - if($value) |
|
| 153 | - $this->addToProperty("class", "secondary"); |
|
| 154 | - else |
|
| 155 | - $this->removePropertyValue("class", "secondary"); |
|
| 153 | + if($value) { |
|
| 154 | + $this->addToProperty("class", "secondary"); |
|
| 155 | + } else { |
|
| 156 | + $this->removePropertyValue("class", "secondary"); |
|
| 157 | + } |
|
| 156 | 158 | return $this; |
| 157 | 159 | } |
| 158 | 160 | |
@@ -172,8 +174,9 @@ discard block |
||
| 172 | 174 | $this->apply(function (HtmlDoubleElement &$item) { |
| 173 | 175 | $item->setTagName("a"); |
| 174 | 176 | }); |
| 175 | - if ($vertical === true) |
|
| 176 | - $this->setVertical(); |
|
| 177 | + if ($vertical === true) { |
|
| 178 | + $this->setVertical(); |
|
| 179 | + } |
|
| 177 | 180 | return $this->addToProperty("class", "tabular"); |
| 178 | 181 | } |
| 179 | 182 | |
@@ -202,10 +205,11 @@ discard block |
||
| 202 | 205 | */ |
| 203 | 206 | public function fromDatabaseObject($object, $function) { |
| 204 | 207 | $return=$function($object); |
| 205 | - if (\is_array($return)) |
|
| 206 | - $this->addItems($return); |
|
| 207 | - else |
|
| 208 | - $this->addItem($return); |
|
| 208 | + if (\is_array($return)) { |
|
| 209 | + $this->addItems($return); |
|
| 210 | + } else { |
|
| 211 | + $this->addItem($return); |
|
| 212 | + } |
|
| 209 | 213 | } |
| 210 | 214 | |
| 211 | 215 | /** |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function __construct($identifier, $rowCount, $colCount) { |
| 23 | 23 | parent::__construct($identifier, "table", "ui table"); |
| 24 | - $this->content=array (); |
|
| 24 | + $this->content=array(); |
|
| 25 | 25 | $this->setRowCount($rowCount, $colCount); |
| 26 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 27 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 26 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 27 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | * @return HtmlTableContent |
| 34 | 34 | */ |
| 35 | 35 | public function getPart($key) { |
| 36 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 36 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 37 | 37 | $this->content[$key]=new HtmlTableContent("", $key); |
| 38 | - if ($key !== "tbody") { |
|
| 38 | + if ($key!=="tbody") { |
|
| 39 | 39 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @return boolean |
| 73 | 73 | */ |
| 74 | 74 | public function hasPart($key) { |
| 75 | - return \array_key_exists($key, $this->content) === true; |
|
| 75 | + return \array_key_exists($key, $this->content)===true; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | private function colAlign($colIndex, $function) { |
| 179 | 179 | if (\is_array($colIndex)) { |
| 180 | - foreach ( $colIndex as $cIndex ) { |
|
| 180 | + foreach ($colIndex as $cIndex) { |
|
| 181 | 181 | $this->colAlign($cIndex, $function); |
| 182 | 182 | } |
| 183 | 183 | } else { |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | public function setBasic($very=false) { |
| 197 | 197 | if ($very) |
| 198 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 199 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 198 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 199 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | public function setCollapsing() { |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 258 | 258 | */ |
| 259 | 259 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 260 | - if(\sizeof($this->_compileParts)<3){ |
|
| 260 | + if (\sizeof($this->_compileParts)<3) { |
|
| 261 | 261 | $this->_template="%content%"; |
| 262 | 262 | $this->refresh(); |
| 263 | - }else{ |
|
| 263 | + } else { |
|
| 264 | 264 | if ($this->propertyContains("class", "sortable")) { |
| 265 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 265 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | $this->content=JArray::sortAssociative($this->content, $this->_compileParts); |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | return $this; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - public function refresh(){ |
|
| 296 | + public function refresh() { |
|
| 297 | 297 | $this->_footer=$this->getFooter(); |
| 298 | 298 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - public function run(JsUtils $js){ |
|
| 302 | - $result= parent::run($js); |
|
| 303 | - if(isset($this->_footer)) |
|
| 301 | + public function run(JsUtils $js) { |
|
| 302 | + $result=parent::run($js); |
|
| 303 | + if (isset($this->_footer)) |
|
| 304 | 304 | $this->_footer->run($js); |
| 305 | 305 | return $result; |
| 306 | 306 | } |
@@ -194,8 +194,9 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function setBasic($very=false) { |
| 197 | - if ($very) |
|
| 198 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 197 | + if ($very) { |
|
| 198 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 199 | + } |
|
| 199 | 200 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 200 | 201 | } |
| 201 | 202 | |
@@ -260,7 +261,7 @@ discard block |
||
| 260 | 261 | if(\sizeof($this->_compileParts)<3){ |
| 261 | 262 | $this->_template="%content%"; |
| 262 | 263 | $this->refresh(); |
| 263 | - }else{ |
|
| 264 | + } else{ |
|
| 264 | 265 | if ($this->propertyContains("class", "sortable")) { |
| 265 | 266 | $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
| 266 | 267 | } |
@@ -300,8 +301,9 @@ discard block |
||
| 300 | 301 | |
| 301 | 302 | public function run(JsUtils $js){ |
| 302 | 303 | $result= parent::run($js); |
| 303 | - if(isset($this->_footer)) |
|
| 304 | - $this->_footer->run($js); |
|
| 304 | + if(isset($this->_footer)) { |
|
| 305 | + $this->_footer->run($js); |
|
| 306 | + } |
|
| 305 | 307 | return $result; |
| 306 | 308 | } |
| 307 | 309 | |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | use Ajax\JsUtils; |
| 11 | 11 | |
| 12 | 12 | class HtmlInput extends HtmlSemDoubleElement { |
| 13 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
| 13 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 17 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
| 18 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 19 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 17 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
| 18 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 19 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getField() { |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function run(JsUtils $js) { |
| 38 | 38 | $result=parent::run($js); |
| 39 | - $result->attach("#" . $this->getDataField()->getIdentifier()); |
|
| 39 | + $result->attach("#".$this->getDataField()->getIdentifier()); |
|
| 40 | 40 | return $result; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setTransparent(){ |
|
| 43 | + public function setTransparent() { |
|
| 44 | 44 | return $this->addToProperty("class", "transparent"); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -8,16 +8,16 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | trait MenuItemTrait { |
| 10 | 10 | |
| 11 | - public function setContent($content){ |
|
| 12 | - if($content==="-"){ |
|
| 11 | + public function setContent($content) { |
|
| 12 | + if ($content==="-") { |
|
| 13 | 13 | $this->asDivider(); |
| 14 | - }elseif($content==="-search-"){ |
|
| 15 | - $values=\explode(",",$content,-1); |
|
| 16 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 17 | - }elseif(JString::startswith($content, "-")){ |
|
| 18 | - $content=\ltrim($content,"-"); |
|
| 14 | + }elseif ($content==="-search-") { |
|
| 15 | + $values=\explode(",", $content, -1); |
|
| 16 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 17 | + }elseif (JString::startswith($content, "-")) { |
|
| 18 | + $content=\ltrim($content, "-"); |
|
| 19 | 19 | $this->asHeader($content); |
| 20 | - }else |
|
| 20 | + } else |
|
| 21 | 21 | parent::setContent($content); |
| 22 | 22 | return $this; |
| 23 | 23 | } |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | * @param string $icon |
| 28 | 28 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 29 | 29 | */ |
| 30 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 30 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 31 | 31 | $this->setClass("ui icon search input"); |
| 32 | 32 | $input=new HtmlInput("search-".$this->identifier); |
| 33 | - if(isset($placeholder)) |
|
| 33 | + if (isset($placeholder)) |
|
| 34 | 34 | $input->setProperty("placeholder", $placeholder); |
| 35 | 35 | $this->content=$input; |
| 36 | - if(isset($icon)) |
|
| 36 | + if (isset($icon)) |
|
| 37 | 37 | $this->addIcon($icon); |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 43 | 43 | */ |
| 44 | - public function asDivider(){ |
|
| 44 | + public function asDivider() { |
|
| 45 | 45 | $this->content=NULL; |
| 46 | 46 | $this->tagName="div"; |
| 47 | 47 | $this->setClass("divider"); |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | * @param string $icon |
| 54 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 55 | 55 | */ |
| 56 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 56 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 57 | 57 | $this->setClass("header"); |
| 58 | 58 | $this->tagName="div"; |
| 59 | 59 | $this->content=$caption; |
| 60 | - if(isset($icon)) |
|
| 61 | - $this->addIcon($icon,Direction::LEFT); |
|
| 60 | + if (isset($icon)) |
|
| 61 | + $this->addIcon($icon, Direction::LEFT); |
|
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function setPosition($direction){ |
|
| 66 | - $this->addToProperty("class",$direction); |
|
| 65 | + public function setPosition($direction) { |
|
| 66 | + $this->addToProperty("class", $direction); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | \ No newline at end of file |
@@ -11,14 +11,15 @@ discard block |
||
| 11 | 11 | public function setContent($content){ |
| 12 | 12 | if($content==="-"){ |
| 13 | 13 | $this->asDivider(); |
| 14 | - }elseif($content==="-search-"){ |
|
| 14 | + } elseif($content==="-search-"){ |
|
| 15 | 15 | $values=\explode(",",$content,-1); |
| 16 | 16 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
| 17 | - }elseif(JString::startswith($content, "-")){ |
|
| 17 | + } elseif(JString::startswith($content, "-")){ |
|
| 18 | 18 | $content=\ltrim($content,"-"); |
| 19 | 19 | $this->asHeader($content); |
| 20 | - }else |
|
| 21 | - parent::setContent($content); |
|
| 20 | + } else { |
|
| 21 | + parent::setContent($content); |
|
| 22 | + } |
|
| 22 | 23 | return $this; |
| 23 | 24 | } |
| 24 | 25 | |
@@ -30,11 +31,13 @@ discard block |
||
| 30 | 31 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 31 | 32 | $this->setClass("ui icon search input"); |
| 32 | 33 | $input=new HtmlInput("search-".$this->identifier); |
| 33 | - if(isset($placeholder)) |
|
| 34 | - $input->setProperty("placeholder", $placeholder); |
|
| 34 | + if(isset($placeholder)) { |
|
| 35 | + $input->setProperty("placeholder", $placeholder); |
|
| 36 | + } |
|
| 35 | 37 | $this->content=$input; |
| 36 | - if(isset($icon)) |
|
| 37 | - $this->addIcon($icon); |
|
| 38 | + if(isset($icon)) { |
|
| 39 | + $this->addIcon($icon); |
|
| 40 | + } |
|
| 38 | 41 | return $this; |
| 39 | 42 | } |
| 40 | 43 | |
@@ -57,8 +60,9 @@ discard block |
||
| 57 | 60 | $this->setClass("header"); |
| 58 | 61 | $this->tagName="div"; |
| 59 | 62 | $this->content=$caption; |
| 60 | - if(isset($icon)) |
|
| 61 | - $this->addIcon($icon,Direction::LEFT); |
|
| 63 | + if(isset($icon)) { |
|
| 64 | + $this->addIcon($icon,Direction::LEFT); |
|
| 65 | + } |
|
| 62 | 66 | return $this; |
| 63 | 67 | } |
| 64 | 68 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use Ajax\JsUtils; |
| 8 | 8 | |
| 9 | 9 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
| 10 | - protected $_params=array (); |
|
| 10 | + protected $_params=array(); |
|
| 11 | 11 | |
| 12 | 12 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
| 13 | 13 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | $this->setLabel($label); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setChecked($value=true){ |
|
| 22 | - if($value===true){ |
|
| 21 | + public function setChecked($value=true) { |
|
| 22 | + if ($value===true) { |
|
| 23 | 23 | $this->getField()->setProperty("checked", "checked"); |
| 24 | - }else{ |
|
| 24 | + } else { |
|
| 25 | 25 | $this->getField()->removeProperty("checked"); |
| 26 | 26 | } |
| 27 | 27 | return $this; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
| 84 | 84 | */ |
| 85 | 85 | public function attachEvent($selector, $action=NULL) { |
| 86 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
| 86 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
| 87 | 87 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
| 88 | 88 | } else { |
| 89 | 89 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function attachEvents($events=array()) { |
| 101 | 101 | if (\is_array($events)) { |
| 102 | - foreach ( $events as $action => $selector ) { |
|
| 102 | + foreach ($events as $action => $selector) { |
|
| 103 | 103 | $this->attachEvent($selector, $action); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | return $this->addToProperty("class", "fitted"); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function setOnChecked($jsCode){ |
|
| 113 | + public function setOnChecked($jsCode) { |
|
| 114 | 114 | $this->_params["onChecked"]=$jsCode; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setOnUnchecked($jsCode){ |
|
| 117 | + public function setOnUnchecked($jsCode) { |
|
| 118 | 118 | $this->_params["onUnchecked"]=$jsCode; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function run(JsUtils $js) { |
| 122 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
| 122 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
| 123 | 123 | return parent::run($js); |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | \ No newline at end of file |