Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TProgressBar.php

Documentation is available at TProgressBar.php

  1. <?php
  2. namespace Adianti\Widget\Util;
  3.  
  4. use Adianti\Widget\Base\TElement;
  5.  
  6. /**
  7.  * TProgressBar
  8.  *
  9.  * @version    7.4
  10.  * @package    widget
  11.  * @subpackage util
  12.  * @author     Ademilson Nunes
  13.  * @author     Pablo Dall'Oglio
  14.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  15.  * @license    http://www.adianti.com.br/framework-license
  16.  */
  17. class TProgressBar extends TElement
  18. {
  19.     private $value;
  20.     private $mask;
  21.     private $className;
  22.     
  23.     public function __construct(
  24.     {
  25.         parent::__construct('div');
  26.         $this->{'class''progress';
  27.         $this->{'id''tprogressbar_'.mt_rand(10000000001999999999);
  28.         $this->{'style''margin-bottom:0; text-shadow: none;';
  29.         $this->mask '{value}%';
  30.         $this->className 'info';
  31.     }
  32.     
  33.     /**
  34.      * set mask for progress bar value Ex: "{value}%"
  35.      */
  36.     public function setMask($mask)
  37.     {
  38.         $span new TElement("span");
  39.         $span->add($mask);
  40.         $this->mask $span;
  41.     }
  42.     
  43.     /**
  44.      * set style class
  45.      */
  46.     public function setClass($class)
  47.     {
  48.         $this->className $class;
  49.     }
  50.     
  51.     /**
  52.      * Set the value of progress bar
  53.      */ 
  54.     public function setValue($value)
  55.     {
  56.        $this->value $value;
  57.     }
  58.             
  59.     /**
  60.      * Shows the widget at the screen
  61.      */       
  62.     public function show()
  63.     {                   
  64.         $progressBar new TElement('div');
  65.         $progressBar->{'class'"progress-bar progress-bar-{$this->className}";
  66.         $progressBar->{'role''progressbar';
  67.         $progressBar->{'arial-valuenow'$this->value;
  68.         $progressBar->{'arial-valuemin''0';
  69.         $progressBar->{'arial-valuemax''100';
  70.         $progressBar->{'style''width: ' $this->value '%;';
  71.          
  72.         $value str_replace('{value}'$this->value$this->mask);
  73.          
  74.         $progressBar->add($value);
  75.         parent::add($progressBar);
  76.        
  77.         parent::show();
  78.     }
  79. }