phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlDropdownItem.php
Go to the documentation of this file.
1<?php
2
4
13
15 public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) {
16 parent::__construct($identifier, "a");
17 $this->setClass("item");
18 $this->setContent($content);
19 if($value!==NULL)
20 $this->setData($value);
21 if($image!==NULL)
22 $this->asMiniAvatar($image);
23 if($description!==NULL)
24 $this->setDescription($description);
25 }
26
27 public function setDescription($description){
28 $descO=new HtmlDoubleElement("desc-".$this->identifier,"span");
29 $descO->setClass("description");
30 $descO->setContent($description);
31 return $this->addContent($descO,true);
32 }
33
34 public function setData($value){
35 $this->setProperty("data-value", $value);
36 return $this;
37 }
38
39 public function asOption(){
40 $this->tagName="option";
41 if($this->getProperty("data-value")!==null)
42 $this->setProperty("value", $this->getProperty("data-value"));
43 }
44
49 public function asMiniAvatar($image){
50 $this->tagName="div";
51 $img=new HtmlImg("image-".$this->identifier,$image);
52 $img->setClass("ui mini avatar image");
53 $this->addContent($img,true);
54 return $this;
55 }
56
62 public function asIcon($caption,$icon){
63 $this->setContent($caption);
64 $this->addContent(new HtmlIcon("", $icon),true);
65 return $this;
66 }
67
73 public function asCircularLabel($caption,$color){
74 $this->setContent($caption);
75 $lbl=new HtmlLabel("");
76 $lbl->setCircular()->setColor($color)->setEmpty();
77 $this->addContent($lbl,true);
78 return $this;
79 }
80
81
82
83 public function addMenuItem($items) {
84 $menu=new HtmlMenu("menu-" . $this->identifier, $items);
86 $this->setTagName("div");
87 $this->setProperty("class", "item");
88 $icon=new HtmlIcon("", "dropdown");
89 $this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu];
90 return $menu;
91 }
92
98 public static function searchInput($placeholder=NULL,$icon=NULL){
99 return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon);
100 }
101
105 public static function divider(){
106 return (new HtmlDropdownItem(""))->asDivider();
107 }
108
114 public static function header($caption=NULL,$icon=NULL){
115 return (new HtmlDropdownItem(""))->asHeader($caption,$icon);
116 }
117
123 public static function circular($caption,$color){
124 return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color);
125 }
126
132 public static function icon($caption,$icon){
133 return (new HtmlDropdownItem(""))->asIcon($caption,$icon);
134 }
135
141 public static function avatar($caption,$image){
142 $dd=new HtmlDropdownItem("",$caption);
143 $dd->asMiniAvatar($image);
144 return $dd;
145 }
146}
Base class for Semantic double elements.
addContent($content, $before=false)
asCircularLabel($caption, $color)
Adds a circular label to the item.
__construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL)
static searchInput($placeholder=NULL, $icon=NULL)
static header($caption=NULL, $icon=NULL)
Semantic Icon component.
Definition HtmlIcon.php:14
Semantic Label component.
Definition HtmlLabel.php:20