phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlLabel.php
Go to the documentation of this file.
1 <?php
2 
4 
12 
22 
23  public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
24  parent::__construct($identifier, $tagName, "ui label");
25  $this->content=$caption;
26  if (isset($icon))
27  $this->addIcon($icon);
28  }
29 
35  public function setPointing($value=Direction::NONE) {
36  if($value==="left" || $value==="right")
37  return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
38  else
39  return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
40  }
41 
47  public function toCorner($side="left") {
48  return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" ));
49  }
50 
51  public function setHorizontal(){
52  return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal"));
53  }
54 
55  public function setFloating(){
56  return $this->addToPropertyCtrl("class", "floating",array("floating"));
57  }
58 
63  public function asTag() {
64  return $this->addToProperty("class", "tag");
65  }
66 
67  public function setEmpty(){
68  $this->content=NULL;
69  return $this->addToPropertyCtrl("class", "empty",array("empty"));
70  }
71 
72  public function setBasic() {
73  return $this->addToProperty("class", "basic");
74  }
75 
83  public function addEmphasisImage($src, $alt="", $before=true) {
84  $this->addToProperty("class", "image");
85  return $this->addImage($src,$alt,$before);
86  }
87 
95  public function addAvatarImage($src, $alt="", $before=true) {
96  $img=$this->addImage($src,$alt,$before);
97  $img->setClass("ui image");
98  $img->asAvatar();
99  return $img;
100  }
101 
109  public function addImage($src, $alt="", $before=true) {
110  $img=new HtmlImg("image-" . $this->identifier, $src, $alt);
111  $img->setClass("");
112  $this->addContent($img, $before);
113  return $img;
114  }
115 
121  public function addDetail($detail) {
122  $div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail");
123  $div->setContent($detail);
124  $this->addContent($div);
125  return $div;
126  }
127 
132  public function asRibbon($direction=Direction::NONE) {
133  return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" ));
134  }
135 
136  public function setAttached($side=Side::TOP,$direction=Direction::NONE){
137  if($direction!==Direction::NONE)
138  return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
139  else
140  return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
141  }
142 
149  public static function ribbon($identifier, $caption,$direction=Direction::NONE) {
150  return (new HtmlLabel($identifier, $caption))->asRibbon($direction);
151  }
152 
158  public static function tag($identifier, $caption) {
159  return (new HtmlLabel($identifier, $caption))->asTag();
160  }
161 }
__construct($identifier, $caption="", $icon=NULL, $tagName="div")
Definition: HtmlLabel.php:23
static tag($identifier, $caption)
Definition: HtmlLabel.php:158
addToProperty($name, $value, $separator=" ")
static ribbon($identifier, $caption, $direction=Direction::NONE)
Definition: HtmlLabel.php:149
Semantic Label component.
Definition: HtmlLabel.php:20
addContent($content, $before=false)
addImage($src, $alt="", $before=true)
Adds an image.
Definition: HtmlLabel.php:109
setPointing($value=Direction::NONE)
Definition: HtmlLabel.php:35
addAvatarImage($src, $alt="", $before=true)
Adds an avatar image.
Definition: HtmlLabel.php:95
asRibbon($direction=Direction::NONE)
Definition: HtmlLabel.php:132
static getConstantValues($postFix="", $prefixBefore=false)
Definition: BaseEnum.php:29
setAttached($side=Side::TOP, $direction=Direction::NONE)
Definition: HtmlLabel.php:136
Base class for Semantic double elements.
addEmphasisImage($src, $alt="", $before=true)
Adds an image to emphasize.
Definition: HtmlLabel.php:83
addToPropertyCtrl($name, $value, $typeCtrl)
addIcon($icon, $before=true)
Definition: BaseTrait.php:92