Guest User

TProgressBar

a guest
Mar 9th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Description of TProgressBar
  4.  *
  5.  * @author ademilson Nunes
  6.  */
  7. class TProgressBar extends TElement
  8. {
  9.     private $value;
  10.    
  11.     public function __construct()
  12.     {
  13.         parent::__construct('div');
  14.         $this->class = 'progress';
  15.         $this->id = 'bar_' . uniqid();          
  16.     }
  17.    
  18.    
  19.     public function setValue($value)
  20.     {
  21.        $this->value = $value;
  22.     }
  23.            
  24.     /**
  25.      * Shows the widget at the screen
  26.      */      
  27.     public function show()
  28.     {                  
  29.          $progressBar = new TElement('div');
  30.          $progressBar->class = 'progress-bar';
  31.          $progressBar->role = 'progressbar';
  32.          $progressBar->{'arial-valuenow'} = $this->value;
  33.          $progressBar->{'arial-valuemin'} = '0';
  34.          $progressBar->{'arial-valuemax'} = '100';
  35.          $progressBar->style='width: ' . $this->value . '%;';
  36.          $progressBar->add($this->value . '%');
  37.          parent::add($progressBar);
  38.        
  39.         parent::show();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment