9 Yii::import(
'booster.widgets.TbWidget');
68 $this->progressBarClasses[] =
'progress-bar-' . $this->
getContextClass();
71 $this->progressClasses[] =
'progress-striped';
74 $this->progressClasses[] =
'active';
76 if ($this->percent < 0)
78 else if ($this->percent > 100)
81 if (!empty($this->progressClasses)) {
82 $this->progressClasses = implode(
' ', $this->progressClasses);
83 if (isset($this->htmlOptions[
'class'])) {
98 public function run() {
100 echo CHtml::openTag(
'div', $this->htmlOptions);
101 if (empty($this->stacked)) {
102 echo
'<div class="'.implode(
' ', $this->progressBarClasses).
'" style="width: ' . $this->percent .
'%;">' . $this->content .
'</div>';
103 } elseif (is_array($this->stacked)) {
104 foreach ($this->stacked as $bar) {
105 $options = isset($bar[
'htmlOptions']) ? $bar[
'htmlOptions'] : array();
106 if (empty($options[
'style'])) {
107 $options[
'style'] =
'';
109 $options[
'style'] .=
' ';
111 $options[
'style'] .=
'width: ' . $bar[
'percent'] .
'%';
113 if (empty($options[
'class'])) {
114 $options[
'class'] =
'';
116 $options[
'style'] .=
' ';
118 $options[
'class'] .=
'progress-bar progress-bar-' . $bar[
'context'];
120 echo
'<div ' . CHtml::renderAttributes($options) .
'>' . @$bar[
'content'] .
'</div>';
123 echo CHtml::closeTag(
'div');
127 return in_array($this->context, [