Exemple #1
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->ignoreAttribute(array('MIN', 'MAX', 'VALUE', 'THEME'));
     $this->setAttribute('ROLE', 'progressbar');
     $this->addClass('progress-bar');
     $value = $this->hasAttribute('VALUE') ? $this->getAttribute('VALUE') : 0;
     $min = $this->hasAttribute('MIN') ? intval($this->getAttribute('MIN')) : 0;
     $max = $this->hasAttribute('MAX') ? intval($this->getAttribute('MAX')) : 100;
     $delta = $max - $min;
     $this->setAttribute('ARIA-VALUEMIN', $min);
     $this->setAttribute('ARIA-VALUEMAX', $max);
     $this->setAttribute('ARIA-VALUENOW', $value);
     $per = floor(100 / $delta * $value);
     $this->setAttribute('STYLE', "width: {$per}%;");
     if ($this->hasAttribute('THEME')) {
         switch ($this->getAttribute('THEME')) {
             case 'success':
                 $this->addClass('progress-bar-success');
                 break;
             case 'warning':
                 $this->addClass('progress-bar-warning');
                 break;
             case 'danger':
                 $this->addClass('progress-bar-danger');
                 break;
         }
     }
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('btn-group');
     $this->ignoreAttribute(array('SIZE', 'TYPE'));
     if ($this->hasAttribute('SIZE')) {
         $size = $this->getAttribute('SIZE');
         switch ($size) {
             case 'large':
             case 'lg':
                 $this->addClass('btn-group-lg');
                 break;
             case 'small':
             case 'sm':
                 $this->addClass('btn-group-sm');
                 break;
             case 'extra-small':
             case 'xs':
                 $this->addClass('btn-group-xs');
                 break;
         }
     }
     if ($this->hasAttribute('TYPE')) {
         $size = $this->getAttribute('TYPE');
         switch ($size) {
             case 'vertical':
                 $this->removeClass('btn-group');
                 $this->addClass('btn-group-vertical');
                 break;
             case 'justified':
                 $this->addClass('btn-group-justified');
                 break;
         }
     }
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('table-responsive');
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('btn-toolbar');
     $this->setAttribute('ROLE', 'toolbar');
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('panel-group');
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('page-header');
 }