@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
| 14 | 17 | parent::__construct($identifier, "div"); |
| 15 | 18 | $this->setClass("item"); |
@@ -60,6 +63,9 @@ discard block |
||
| 60 | 63 | return $this; |
| 61 | 64 | } |
| 62 | 65 | |
| 66 | + /** |
|
| 67 | + * @param string $content |
|
| 68 | + */ |
|
| 63 | 69 | public function setContent($content){ |
| 64 | 70 | if($content==="-"){ |
| 65 | 71 | $this->asDivider(); |
@@ -10,30 +10,30 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 12 | 12 | |
| 13 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
| 13 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
| 14 | 14 | parent::__construct($identifier, "div"); |
| 15 | 15 | $this->setClass("item"); |
| 16 | 16 | $this->setContent($content); |
| 17 | - if($value!==NULL) |
|
| 17 | + if ($value!==NULL) |
|
| 18 | 18 | $this->setData($value); |
| 19 | - if($image!==NULL) |
|
| 19 | + if ($image!==NULL) |
|
| 20 | 20 | $this->asMiniAvatar($image); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setDescription($description){ |
|
| 24 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 23 | + public function setDescription($description) { |
|
| 24 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 25 | 25 | $descO->setClass("description"); |
| 26 | 26 | $descO->setContent($description); |
| 27 | - return $this->addContent($descO,true); |
|
| 27 | + return $this->addContent($descO, true); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setData($value){ |
|
| 30 | + public function setData($value) { |
|
| 31 | 31 | $this->setProperty("data-value", $value); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function asOption(){ |
|
| 34 | + public function asOption() { |
|
| 35 | 35 | $this->tagName="option"; |
| 36 | - if($this->getProperty("data-value")!==null) |
|
| 36 | + if ($this->getProperty("data-value")!==null) |
|
| 37 | 37 | $this->setProperty("value", $this->getProperty("data-value")); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,58 +41,58 @@ discard block |
||
| 41 | 41 | * @param string $image the image src |
| 42 | 42 | * @return \Ajax\common\html\html5\HtmlImg |
| 43 | 43 | */ |
| 44 | - public function asMiniAvatar($image){ |
|
| 44 | + public function asMiniAvatar($image) { |
|
| 45 | 45 | $this->tagName="div"; |
| 46 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 46 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 47 | 47 | $img->setClass("ui mini avatar image"); |
| 48 | - $this->addContent($img,true); |
|
| 48 | + $this->addContent($img, true); |
|
| 49 | 49 | return $img; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 52 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 53 | 53 | $this->setClass("ui icon search input"); |
| 54 | 54 | $input=new HtmlInput("search-".$this->identifier); |
| 55 | - if(isset($placeholder)) |
|
| 55 | + if (isset($placeholder)) |
|
| 56 | 56 | $input->setProperty("placeholder", $placeholder); |
| 57 | 57 | $this->content=$input; |
| 58 | - if(isset($icon)) |
|
| 58 | + if (isset($icon)) |
|
| 59 | 59 | $this->addIcon($icon); |
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setContent($content){ |
|
| 64 | - if($content==="-"){ |
|
| 63 | + public function setContent($content) { |
|
| 64 | + if ($content==="-") { |
|
| 65 | 65 | $this->asDivider(); |
| 66 | - }elseif($content==="-search-"){ |
|
| 67 | - $values=\explode(",",$content,-1); |
|
| 68 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 66 | + }elseif ($content==="-search-") { |
|
| 67 | + $values=\explode(",", $content, -1); |
|
| 68 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 69 | 69 | }else |
| 70 | 70 | parent::setContent($content); |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function asDivider(){ |
|
| 74 | + public function asDivider() { |
|
| 75 | 75 | $this->content=NULL; |
| 76 | 76 | $this->setClass("divider"); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 79 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 80 | 80 | $this->setClass("header"); |
| 81 | 81 | $this->content=$caption; |
| 82 | - if(isset($icon)) |
|
| 83 | - $this->addIcon($icon,true); |
|
| 82 | + if (isset($icon)) |
|
| 83 | + $this->addIcon($icon, true); |
|
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 88 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 87 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 88 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
| 91 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
| 92 | 92 | return (new HtmlDropdownItem(""))->asDivider(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 96 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 95 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 96 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | \ No newline at end of file |
@@ -14,10 +14,12 @@ discard block |
||
| 14 | 14 | parent::__construct($identifier, "div"); |
| 15 | 15 | $this->setClass("item"); |
| 16 | 16 | $this->setContent($content); |
| 17 | - if($value!==NULL) |
|
| 18 | - $this->setData($value); |
|
| 19 | - if($image!==NULL) |
|
| 20 | - $this->asMiniAvatar($image); |
|
| 17 | + if($value!==NULL) { |
|
| 18 | + $this->setData($value); |
|
| 19 | + } |
|
| 20 | + if($image!==NULL) { |
|
| 21 | + $this->asMiniAvatar($image); |
|
| 22 | + } |
|
| 21 | 23 | } |
| 22 | 24 | |
| 23 | 25 | public function setDescription($description){ |
@@ -33,8 +35,9 @@ discard block |
||
| 33 | 35 | |
| 34 | 36 | public function asOption(){ |
| 35 | 37 | $this->tagName="option"; |
| 36 | - if($this->getProperty("data-value")!==null) |
|
| 37 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 38 | + if($this->getProperty("data-value")!==null) { |
|
| 39 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 40 | + } |
|
| 38 | 41 | } |
| 39 | 42 | |
| 40 | 43 | /** |
@@ -52,22 +55,25 @@ discard block |
||
| 52 | 55 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 53 | 56 | $this->setClass("ui icon search input"); |
| 54 | 57 | $input=new HtmlInput("search-".$this->identifier); |
| 55 | - if(isset($placeholder)) |
|
| 56 | - $input->setProperty("placeholder", $placeholder); |
|
| 58 | + if(isset($placeholder)) { |
|
| 59 | + $input->setProperty("placeholder", $placeholder); |
|
| 60 | + } |
|
| 57 | 61 | $this->content=$input; |
| 58 | - if(isset($icon)) |
|
| 59 | - $this->addIcon($icon); |
|
| 62 | + if(isset($icon)) { |
|
| 63 | + $this->addIcon($icon); |
|
| 64 | + } |
|
| 60 | 65 | return $this; |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | 68 | public function setContent($content){ |
| 64 | 69 | if($content==="-"){ |
| 65 | 70 | $this->asDivider(); |
| 66 | - }elseif($content==="-search-"){ |
|
| 71 | + } elseif($content==="-search-"){ |
|
| 67 | 72 | $values=\explode(",",$content,-1); |
| 68 | 73 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
| 69 | - }else |
|
| 70 | - parent::setContent($content); |
|
| 74 | + } else { |
|
| 75 | + parent::setContent($content); |
|
| 76 | + } |
|
| 71 | 77 | return $this; |
| 72 | 78 | } |
| 73 | 79 | |
@@ -79,8 +85,9 @@ discard block |
||
| 79 | 85 | public function asHeader($caption=NULL,$icon=NULL){ |
| 80 | 86 | $this->setClass("header"); |
| 81 | 87 | $this->content=$caption; |
| 82 | - if(isset($icon)) |
|
| 83 | - $this->addIcon($icon,true); |
|
| 88 | + if(isset($icon)) { |
|
| 89 | + $this->addIcon($icon,true); |
|
| 90 | + } |
|
| 84 | 91 | return $this; |
| 85 | 92 | } |
| 86 | 93 | |