@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function setWidth($width) { |
| 33 | 33 | if (\is_int($width)) { |
| 34 | - $width=Wide::getConstants()["W" . $width]; |
|
| 34 | + $width=Wide::getConstants()["W".$width]; |
|
| 35 | 35 | } |
| 36 | 36 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 37 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
| 37 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setValue($value) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $divider->setVertical(); |
| 53 | 53 | else |
| 54 | 54 | $divider->setHorizontal(); |
| 55 | - $this->wrap($divider,""); |
|
| 55 | + $this->wrap($divider, ""); |
|
| 56 | 56 | return $divider; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -13,32 +13,32 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 15 | 15 | use IconTrait; |
| 16 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) { |
|
| 16 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) { |
|
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 20 | + if ($value!==NULL) |
|
| 21 | 21 | $this->setData($value); |
| 22 | - if($image!==NULL) |
|
| 22 | + if ($image!==NULL) |
|
| 23 | 23 | $this->asMiniAvatar($image); |
| 24 | - if($description!==NULL) |
|
| 24 | + if ($description!==NULL) |
|
| 25 | 25 | $this->setDescription($description); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setDescription($description){ |
|
| 29 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 28 | + public function setDescription($description) { |
|
| 29 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 30 | 30 | $descO->setClass("description"); |
| 31 | 31 | $descO->setContent($description); |
| 32 | - return $this->addContent($descO,true); |
|
| 32 | + return $this->addContent($descO, true); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setData($value){ |
|
| 35 | + public function setData($value) { |
|
| 36 | 36 | $this->setProperty("data-value", $value); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function asOption(){ |
|
| 39 | + public function asOption() { |
|
| 40 | 40 | $this->tagName="option"; |
| 41 | - if($this->getProperty("data-value")!==null) |
|
| 41 | + if ($this->getProperty("data-value")!==null) |
|
| 42 | 42 | $this->setProperty("value", $this->getProperty("data-value")); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | * @param string $image the image src |
| 47 | 47 | * @return \Ajax\common\html\html5\HtmlImg |
| 48 | 48 | */ |
| 49 | - public function asMiniAvatar($image){ |
|
| 49 | + public function asMiniAvatar($image) { |
|
| 50 | 50 | $this->tagName="div"; |
| 51 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 51 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 52 | 52 | $img->setClass("ui mini avatar image"); |
| 53 | - $this->addContent($img,true); |
|
| 53 | + $this->addContent($img, true); |
|
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @param string $icon |
| 60 | 60 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 61 | 61 | */ |
| 62 | - public function asIcon($caption,$icon){ |
|
| 62 | + public function asIcon($caption, $icon) { |
|
| 63 | 63 | $this->setContent($caption); |
| 64 | - $this->addContent(new HtmlIcon("", $icon),true); |
|
| 64 | + $this->addContent(new HtmlIcon("", $icon), true); |
|
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,32 +70,32 @@ discard block |
||
| 70 | 70 | * @param string $color |
| 71 | 71 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 72 | 72 | */ |
| 73 | - public function asCircularLabel($caption,$color){ |
|
| 73 | + public function asCircularLabel($caption, $color) { |
|
| 74 | 74 | $this->setContent($caption); |
| 75 | 75 | $lbl=new HtmlLabel(""); |
| 76 | 76 | $lbl->setCircular()->setColor($color)->setEmpty(); |
| 77 | - $this->addContent($lbl,true); |
|
| 77 | + $this->addContent($lbl, true); |
|
| 78 | 78 | return $this; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 81 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 82 | 82 | $this->setClass("ui icon search input"); |
| 83 | 83 | $input=new HtmlInput("search-".$this->identifier); |
| 84 | - if(isset($placeholder)) |
|
| 84 | + if (isset($placeholder)) |
|
| 85 | 85 | $input->setProperty("placeholder", $placeholder); |
| 86 | 86 | $this->content=$input; |
| 87 | - if(isset($icon)) |
|
| 87 | + if (isset($icon)) |
|
| 88 | 88 | $this->addIcon($icon); |
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function setContent($content){ |
|
| 93 | - if($content==="-"){ |
|
| 92 | + public function setContent($content) { |
|
| 93 | + if ($content==="-") { |
|
| 94 | 94 | $this->asDivider(); |
| 95 | - }elseif($content==="-search-"){ |
|
| 96 | - $values=\explode(",",$content,-1); |
|
| 97 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 98 | - }else |
|
| 95 | + }elseif ($content==="-search-") { |
|
| 96 | + $values=\explode(",", $content, -1); |
|
| 97 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 98 | + } else |
|
| 99 | 99 | parent::setContent($content); |
| 100 | 100 | return $this; |
| 101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 105 | 105 | */ |
| 106 | - public function asDivider(){ |
|
| 106 | + public function asDivider() { |
|
| 107 | 107 | $this->content=NULL; |
| 108 | 108 | $this->setClass("divider"); |
| 109 | 109 | return $this; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * @param string $icon |
| 115 | 115 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 116 | 116 | */ |
| 117 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 117 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 118 | 118 | $this->setClass("header"); |
| 119 | 119 | $this->content=$caption; |
| 120 | - if(isset($icon)) |
|
| 121 | - $this->addIcon($icon,true); |
|
| 120 | + if (isset($icon)) |
|
| 121 | + $this->addIcon($icon, true); |
|
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | * @param string $icon |
| 128 | 128 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 129 | 129 | */ |
| 130 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 131 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 130 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 131 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 136 | 136 | */ |
| 137 | - public static function divider(){ |
|
| 137 | + public static function divider() { |
|
| 138 | 138 | return (new HtmlDropdownItem(""))->asDivider(); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $icon |
| 144 | 144 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 145 | 145 | */ |
| 146 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 147 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 146 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 147 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * @param string $color |
| 153 | 153 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 154 | 154 | */ |
| 155 | - public static function circular($caption,$color){ |
|
| 156 | - return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color); |
|
| 155 | + public static function circular($caption, $color) { |
|
| 156 | + return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * @param string $icon |
| 162 | 162 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 163 | 163 | */ |
| 164 | - public static function icon($caption,$icon){ |
|
| 165 | - return (new HtmlDropdownItem(""))->asIcon($caption,$icon); |
|
| 164 | + public static function icon($caption, $icon) { |
|
| 165 | + return (new HtmlDropdownItem(""))->asIcon($caption, $icon); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param unknown $image |
| 171 | 171 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 172 | 172 | */ |
| 173 | - public static function avatar($caption,$image){ |
|
| 174 | - return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image); |
|
| 173 | + public static function avatar($caption, $image) { |
|
| 174 | + return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | \ No newline at end of file |
@@ -17,12 +17,15 @@ discard block |
||
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 21 | - $this->setData($value); |
|
| 22 | - if($image!==NULL) |
|
| 23 | - $this->asMiniAvatar($image); |
|
| 24 | - if($description!==NULL) |
|
| 25 | - $this->setDescription($description); |
|
| 20 | + if($value!==NULL) { |
|
| 21 | + $this->setData($value); |
|
| 22 | + } |
|
| 23 | + if($image!==NULL) { |
|
| 24 | + $this->asMiniAvatar($image); |
|
| 25 | + } |
|
| 26 | + if($description!==NULL) { |
|
| 27 | + $this->setDescription($description); |
|
| 28 | + } |
|
| 26 | 29 | } |
| 27 | 30 | |
| 28 | 31 | public function setDescription($description){ |
@@ -38,8 +41,9 @@ discard block |
||
| 38 | 41 | |
| 39 | 42 | public function asOption(){ |
| 40 | 43 | $this->tagName="option"; |
| 41 | - if($this->getProperty("data-value")!==null) |
|
| 42 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 44 | + if($this->getProperty("data-value")!==null) { |
|
| 45 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 46 | + } |
|
| 43 | 47 | } |
| 44 | 48 | |
| 45 | 49 | /** |
@@ -81,22 +85,25 @@ discard block |
||
| 81 | 85 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 82 | 86 | $this->setClass("ui icon search input"); |
| 83 | 87 | $input=new HtmlInput("search-".$this->identifier); |
| 84 | - if(isset($placeholder)) |
|
| 85 | - $input->setProperty("placeholder", $placeholder); |
|
| 88 | + if(isset($placeholder)) { |
|
| 89 | + $input->setProperty("placeholder", $placeholder); |
|
| 90 | + } |
|
| 86 | 91 | $this->content=$input; |
| 87 | - if(isset($icon)) |
|
| 88 | - $this->addIcon($icon); |
|
| 92 | + if(isset($icon)) { |
|
| 93 | + $this->addIcon($icon); |
|
| 94 | + } |
|
| 89 | 95 | return $this; |
| 90 | 96 | } |
| 91 | 97 | |
| 92 | 98 | public function setContent($content){ |
| 93 | 99 | if($content==="-"){ |
| 94 | 100 | $this->asDivider(); |
| 95 | - }elseif($content==="-search-"){ |
|
| 101 | + } elseif($content==="-search-"){ |
|
| 96 | 102 | $values=\explode(",",$content,-1); |
| 97 | 103 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
| 98 | - }else |
|
| 99 | - parent::setContent($content); |
|
| 104 | + } else { |
|
| 105 | + parent::setContent($content); |
|
| 106 | + } |
|
| 100 | 107 | return $this; |
| 101 | 108 | } |
| 102 | 109 | |
@@ -117,8 +124,9 @@ discard block |
||
| 117 | 124 | public function asHeader($caption=NULL,$icon=NULL){ |
| 118 | 125 | $this->setClass("header"); |
| 119 | 126 | $this->content=$caption; |
| 120 | - if(isset($icon)) |
|
| 121 | - $this->addIcon($icon,true); |
|
| 127 | + if(isset($icon)) { |
|
| 128 | + $this->addIcon($icon,true); |
|
| 129 | + } |
|
| 122 | 130 | return $this; |
| 123 | 131 | } |
| 124 | 132 | |
@@ -17,31 +17,31 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | protected $mClass="menu"; |
| 19 | 19 | protected $mTagName="div"; |
| 20 | - protected $items=array (); |
|
| 21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 20 | + protected $items=array(); |
|
| 21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 22 | 22 | protected $input; |
| 23 | 23 | |
| 24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
| 25 | 25 | parent::__construct($identifier, "div"); |
| 26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 27 | 27 | $this->setProperty("class", "ui dropdown"); |
| 28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 29 | 29 | $content->setClass("text"); |
| 30 | 30 | $content->setContent($value); |
| 31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 32 | 32 | $this->content=array($content); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | $this->addItems($items); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 38 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 37 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 38 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 39 | 39 | $this->items[]=$itemO; |
| 40 | 40 | return $itemO; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 44 | - $this->addIconP($icon,$before,$labeled); |
|
| 43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 44 | + $this->addIconP($icon, $before, $labeled); |
|
| 45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,26 +51,26 @@ discard block |
||
| 51 | 51 | * @param number $position |
| 52 | 52 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 53 | 53 | */ |
| 54 | - public function insertItem($item,$position=0){ |
|
| 54 | + public function insertItem($item, $position=0) { |
|
| 55 | 55 | $itemO=$this->beforeAddItem($item); |
| 56 | - $start = array_slice($this->items, 0, $position); |
|
| 57 | - $end = array_slice($this->items, $position); |
|
| 58 | - $start[] = $item; |
|
| 56 | + $start=array_slice($this->items, 0, $position); |
|
| 57 | + $end=array_slice($this->items, $position); |
|
| 58 | + $start[]=$item; |
|
| 59 | 59 | $this->items=array_merge($start, $end); |
| 60 | 60 | return $itemO; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 63 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 64 | 64 | $itemO=$item; |
| 65 | - if(\is_array($item)){ |
|
| 65 | + if (\is_array($item)) { |
|
| 66 | 66 | $description=JArray::getValue($item, "description", 3); |
| 67 | 67 | $value=JArray::getValue($item, "value", 1); |
| 68 | 68 | $image=JArray::getValue($item, "image", 2); |
| 69 | 69 | $item=JArray::getValue($item, "item", 0); |
| 70 | 70 | } |
| 71 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 72 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 73 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 71 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 72 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 73 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 74 | 74 | $this->addToProperty("class", "vertical"); |
| 75 | 75 | } |
| 76 | 76 | return $itemO; |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | $this->addItem($function($object)); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addInput($name){ |
|
| 87 | - if(!isset($name)) |
|
| 86 | + public function addInput($name) { |
|
| 87 | + if (!isset($name)) |
|
| 88 | 88 | $name="input-".$this->identifier; |
| 89 | 89 | $this->setAction("activate"); |
| 90 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 90 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | * @param string $icon |
| 97 | 97 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 98 | 98 | */ |
| 99 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 100 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 99 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 100 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Adds a divider item |
| 105 | 105 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 106 | 106 | */ |
| 107 | - public function addDividerItem(){ |
|
| 107 | + public function addDividerItem() { |
|
| 108 | 108 | return $this->addItem(HtmlDropdownItem::divider()); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * @param string $icon |
| 115 | 115 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 116 | 116 | */ |
| 117 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 118 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 117 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 118 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param string $color |
| 125 | 125 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 126 | 126 | */ |
| 127 | - public function addCircularLabelItem($caption,$color){ |
|
| 127 | + public function addCircularLabelItem($caption, $color) { |
|
| 128 | 128 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | * @param string $image |
| 134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 135 | 135 | */ |
| 136 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 136 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 137 | 137 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - public function addItems($items){ |
|
| 141 | - if(JArray::isAssociative($items)){ |
|
| 142 | - foreach ($items as $k=>$v){ |
|
| 140 | + public function addItems($items) { |
|
| 141 | + if (JArray::isAssociative($items)) { |
|
| 142 | + foreach ($items as $k=>$v) { |
|
| 143 | 143 | $this->addItem($v)->setData($k); |
| 144 | 144 | } |
| 145 | - }else{ |
|
| 146 | - foreach ($items as $item){ |
|
| 145 | + } else { |
|
| 146 | + foreach ($items as $item) { |
|
| 147 | 147 | $this->addItem($item); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -152,60 +152,60 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * @return int |
| 154 | 154 | */ |
| 155 | - public function count(){ |
|
| 155 | + public function count() { |
|
| 156 | 156 | return \sizeof($this->items); |
| 157 | 157 | } |
| 158 | 158 | /** |
| 159 | 159 | * @param boolean $dropdown |
| 160 | 160 | */ |
| 161 | - public function asDropdown($dropdown){ |
|
| 162 | - if($dropdown===false){ |
|
| 161 | + public function asDropdown($dropdown) { |
|
| 162 | + if ($dropdown===false) { |
|
| 163 | 163 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 164 | 164 | $dropdown="menu"; |
| 165 | - }else{ |
|
| 165 | + } else { |
|
| 166 | 166 | $dropdown="dropdown"; |
| 167 | 167 | $this->mClass="menu"; |
| 168 | 168 | } |
| 169 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 169 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - public function setVertical(){ |
|
| 173 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 172 | + public function setVertical() { |
|
| 173 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function setSimple(){ |
|
| 177 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 176 | + public function setSimple() { |
|
| 177 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function asButton($floating=false){ |
|
| 181 | - if($floating) |
|
| 180 | + public function asButton($floating=false) { |
|
| 181 | + if ($floating) |
|
| 182 | 182 | $this->addToProperty("class", "floating"); |
| 183 | 183 | $this->removePropertyValue("class", "selection"); |
| 184 | 184 | return $this->addToProperty("class", "button"); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 188 | - if(isset($name)) |
|
| 187 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 188 | + if (isset($name)) |
|
| 189 | 189 | $this->addInput($name); |
| 190 | - if($multiple) |
|
| 190 | + if ($multiple) |
|
| 191 | 191 | $this->addToProperty("class", "multiple"); |
| 192 | - if ($selection){ |
|
| 193 | - if($this->propertyContains("class", "button")===false) |
|
| 194 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 192 | + if ($selection) { |
|
| 193 | + if ($this->propertyContains("class", "button")===false) |
|
| 194 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 195 | 195 | } |
| 196 | 196 | return $this; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 200 | - $this->asSelect($name,$multiple,$selection); |
|
| 199 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 200 | + $this->asSelect($name, $multiple, $selection); |
|
| 201 | 201 | return $this->addToProperty("class", "search"); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 205 | - if(!isset($name)) |
|
| 204 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 205 | + if (!isset($name)) |
|
| 206 | 206 | $name="select-".$this->identifier; |
| 207 | 207 | $this->input=null; |
| 208 | - if($multiple){ |
|
| 208 | + if ($multiple) { |
|
| 209 | 209 | $this->setProperty("multiple", true); |
| 210 | 210 | $this->addToProperty("class", "multiple"); |
| 211 | 211 | } |
@@ -213,32 +213,32 @@ discard block |
||
| 213 | 213 | $this->tagName="select"; |
| 214 | 214 | $this->setProperty("name", $name); |
| 215 | 215 | $this->content=null; |
| 216 | - foreach ($this->items as $item){ |
|
| 216 | + foreach ($this->items as $item) { |
|
| 217 | 217 | $item->asOption(); |
| 218 | 218 | } |
| 219 | 219 | return $this; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - public function asSubmenu($pointing=NULL){ |
|
| 222 | + public function asSubmenu($pointing=NULL) { |
|
| 223 | 223 | $this->setClass("ui dropdown link item"); |
| 224 | - if(isset($pointing)){ |
|
| 224 | + if (isset($pointing)) { |
|
| 225 | 225 | $this->setPointing($pointing); |
| 226 | 226 | } |
| 227 | 227 | return $this; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - public function setPointing($value=Direction::NONE){ |
|
| 231 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 230 | + public function setPointing($value=Direction::NONE) { |
|
| 231 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function setValue($value){ |
|
| 235 | - if(isset($this->input)){ |
|
| 234 | + public function setValue($value) { |
|
| 235 | + if (isset($this->input)) { |
|
| 236 | 236 | $this->input->setProperty("value", $value); |
| 237 | - }else{ |
|
| 237 | + } else { |
|
| 238 | 238 | $this->setProperty("value", $value); |
| 239 | 239 | } |
| 240 | 240 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 241 | - if(isset($textElement)) |
|
| 241 | + if (isset($textElement)) |
|
| 242 | 242 | $textElement->setContent($value); |
| 243 | 243 | return $this; |
| 244 | 244 | } |
@@ -248,23 +248,23 @@ discard block |
||
| 248 | 248 | * @see BaseHtml::run() |
| 249 | 249 | */ |
| 250 | 250 | public function run(JsUtils $js) { |
| 251 | - if($this->propertyContains("class", "simple")===false){ |
|
| 252 | - if(isset($this->_bsComponent)===false) |
|
| 253 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 251 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 252 | + if (isset($this->_bsComponent)===false) |
|
| 253 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 254 | 254 | $this->addEventsOnRun($js); |
| 255 | 255 | return $this->_bsComponent; |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - public function setCompact(){ |
|
| 259 | + public function setCompact() { |
|
| 260 | 260 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - public function setAction($action){ |
|
| 263 | + public function setAction($action) { |
|
| 264 | 264 | $this->_params["action"]=$action; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - public function setFullTextSearch($value){ |
|
| 267 | + public function setFullTextSearch($value) { |
|
| 268 | 268 | $this->_params["fullTextSearch"]=$value; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | \ No newline at end of file |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | if(!$item instanceof HtmlDropdownItem){ |
| 72 | 72 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
| 73 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 73 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 74 | 74 | $this->addToProperty("class", "vertical"); |
| 75 | 75 | } |
| 76 | 76 | return $itemO; |
@@ -84,8 +84,9 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function addInput($name){ |
| 87 | - if(!isset($name)) |
|
| 88 | - $name="input-".$this->identifier; |
|
| 87 | + if(!isset($name)) { |
|
| 88 | + $name="input-".$this->identifier; |
|
| 89 | + } |
|
| 89 | 90 | $this->setAction("activate"); |
| 90 | 91 | $this->input=new HtmlInput($name,"hidden"); |
| 91 | 92 | } |
@@ -142,7 +143,7 @@ discard block |
||
| 142 | 143 | foreach ($items as $k=>$v){ |
| 143 | 144 | $this->addItem($v)->setData($k); |
| 144 | 145 | } |
| 145 | - }else{ |
|
| 146 | + } else{ |
|
| 146 | 147 | foreach ($items as $item){ |
| 147 | 148 | $this->addItem($item); |
| 148 | 149 | } |
@@ -162,7 +163,7 @@ discard block |
||
| 162 | 163 | if($dropdown===false){ |
| 163 | 164 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 164 | 165 | $dropdown="menu"; |
| 165 | - }else{ |
|
| 166 | + } else{ |
|
| 166 | 167 | $dropdown="dropdown"; |
| 167 | 168 | $this->mClass="menu"; |
| 168 | 169 | } |
@@ -178,20 +179,24 @@ discard block |
||
| 178 | 179 | } |
| 179 | 180 | |
| 180 | 181 | public function asButton($floating=false){ |
| 181 | - if($floating) |
|
| 182 | - $this->addToProperty("class", "floating"); |
|
| 182 | + if($floating) { |
|
| 183 | + $this->addToProperty("class", "floating"); |
|
| 184 | + } |
|
| 183 | 185 | $this->removePropertyValue("class", "selection"); |
| 184 | 186 | return $this->addToProperty("class", "button"); |
| 185 | 187 | } |
| 186 | 188 | |
| 187 | 189 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 188 | - if(isset($name)) |
|
| 189 | - $this->addInput($name); |
|
| 190 | - if($multiple) |
|
| 191 | - $this->addToProperty("class", "multiple"); |
|
| 190 | + if(isset($name)) { |
|
| 191 | + $this->addInput($name); |
|
| 192 | + } |
|
| 193 | + if($multiple) { |
|
| 194 | + $this->addToProperty("class", "multiple"); |
|
| 195 | + } |
|
| 192 | 196 | if ($selection){ |
| 193 | - if($this->propertyContains("class", "button")===false) |
|
| 194 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 197 | + if($this->propertyContains("class", "button")===false) { |
|
| 198 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 199 | + } |
|
| 195 | 200 | } |
| 196 | 201 | return $this; |
| 197 | 202 | } |
@@ -202,8 +207,9 @@ discard block |
||
| 202 | 207 | } |
| 203 | 208 | |
| 204 | 209 | public function setSelect($name=NULL,$multiple=false){ |
| 205 | - if(!isset($name)) |
|
| 206 | - $name="select-".$this->identifier; |
|
| 210 | + if(!isset($name)) { |
|
| 211 | + $name="select-".$this->identifier; |
|
| 212 | + } |
|
| 207 | 213 | $this->input=null; |
| 208 | 214 | if($multiple){ |
| 209 | 215 | $this->setProperty("multiple", true); |
@@ -234,12 +240,13 @@ discard block |
||
| 234 | 240 | public function setValue($value){ |
| 235 | 241 | if(isset($this->input)){ |
| 236 | 242 | $this->input->setProperty("value", $value); |
| 237 | - }else{ |
|
| 243 | + } else{ |
|
| 238 | 244 | $this->setProperty("value", $value); |
| 239 | 245 | } |
| 240 | 246 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 241 | - if(isset($textElement)) |
|
| 242 | - $textElement->setContent($value); |
|
| 247 | + if(isset($textElement)) { |
|
| 248 | + $textElement->setContent($value); |
|
| 249 | + } |
|
| 243 | 250 | return $this; |
| 244 | 251 | } |
| 245 | 252 | |
@@ -249,8 +256,9 @@ discard block |
||
| 249 | 256 | */ |
| 250 | 257 | public function run(JsUtils $js) { |
| 251 | 258 | if($this->propertyContains("class", "simple")===false){ |
| 252 | - if(isset($this->_bsComponent)===false) |
|
| 253 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 259 | + if(isset($this->_bsComponent)===false) { |
|
| 260 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 261 | + } |
|
| 254 | 262 | $this->addEventsOnRun($js); |
| 255 | 263 | return $this->_bsComponent; |
| 256 | 264 | } |