HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbBadge.php
Go to the documentation of this file.
1 <?php
9 Yii::import('booster.widgets.TbWidget');
17 class TbBadge extends TbWidget {
18 
22  public $label;
23 
27  public $encodeLabel = true;
28 
32  public $htmlOptions = array();
33 
39  public function init() {
40 
41  $classes = array('badge');
42 
43  if ($this->isValidContext())
44  $classes[] = 'alert-' . $this->getContextClass();
45 
46  if (!empty($classes)) {
47  $classes = implode(' ', $classes);
48  if (isset($this->htmlOptions['class'])) {
49  $this->htmlOptions['class'] .= ' ' . $classes;
50  } else {
51  $this->htmlOptions['class'] = $classes;
52  }
53  }
54 
55  if ($this->encodeLabel === true) {
56  $this->label = CHtml::encode($this->label);
57  }
58  }
59 
65  public function run()
66  {
67  echo CHtml::tag('span', $this->htmlOptions, $this->label);
68  }
69 }