phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlIcon.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
15  protected $_icon;
16 
17  public function __construct($identifier, $icon) {
18  parent::__construct($identifier, "i", "icon", NULL);
19  $this->setIcon($icon);
20  }
21 
22  public function getIcon() {
23  return $this->_icon;
24  }
25 
31  public function setIcon($icon) {
32  if (isset($this->_icon)) {
33  $this->removePropertyValue("class", $this->_icon);
34  }
35  $this->_icon=$icon;
36  $this->addToProperty("class", $icon);
37  return $this;
38  }
39 
45  public function addToIcon($icon) {
46  $this->addToProperty("class", $icon);
47  return $this->addToMember($this->_icon, $icon);
48  }
49 
54  public function asLoader() {
55  return $this->addToProperty("class", "loading");
56  }
57 
62  public function setFitted() {
63  return $this->addToProperty("class", "fitted");
64  }
65 
71  public function setFlipped($sens="horizontally") {
72  return $this->addToProperty("class", "flipped " . $sens);
73  }
74 
80  public function setRotated($sens="clockwise") {
81  return $this->addToProperty("class", "rotated " . $sens);
82  }
83 
90  public function asLink($href=NULL,$target=NULL) {
91  if (isset($href)) {
92  $_target="";
93  if(isset($target))
94  $_target="target='{$target}'";
95  $this->wrap("<a href='" . $href . "' {$_target}>", "</a>");
96  }
97  return $this->addToProperty("class", "link");
98  }
99 
100  public function setOutline() {
101  return $this->addToProperty("class", "outline");
102  }
103 
109  public function setBordered($inverted=false) {
110  $invertedStr="";
111  if ($inverted !== false)
112  $invertedStr=" inverted";
113  return $this->addToProperty("class", "bordered" . $invertedStr);
114  }
115 
120  public function toCorner() {
121  return $this->addToProperty("class", "corner");
122  }
123 
124  public function addLabel($label, $before=false, $icon=NULL) {
125  if($before)
126  $this->wrap($label);
127  else
128  $this->wrap("", $label);
129  if(isset($icon))
130  $this->addToIcon($icon);
131  return $this;
132  }
133 
134  public static function label($identifier, $icon, $label) {
135  $result=new HtmlIcon($identifier, $icon);
136  return $result->addLabel($label);
137  }
138 }
asLink($href=NULL, $target=NULL)
icon formatted as a link
Definition: HtmlIcon.php:90
addToProperty($name, $value, $separator=" ")
wrap($before, $after="")
Definition: BaseHtml.php:171
setFlipped($sens="horizontally")
Definition: HtmlIcon.php:71
setIcon($icon)
sets the icon
Definition: HtmlIcon.php:31
Semantic Icon component.
Definition: HtmlIcon.php:14
Base class for Semantic double elements.
addLabel($label, $before=false, $icon=NULL)
Definition: HtmlIcon.php:124
addToMember(&$name, $value, $separator=' ')
Definition: BaseHtml.php:99
addToIcon($icon)
adds an icon in icon element
Definition: HtmlIcon.php:45
__construct($identifier, $icon)
Definition: HtmlIcon.php:17
static label($identifier, $icon, $label)
Definition: HtmlIcon.php:134
asLoader()
Icon used as a simple loader.
Definition: HtmlIcon.php:54
setFitted()
An icon can be fitted, without any space to the left or right of it.
Definition: HtmlIcon.php:62