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 TPageStep.php

Documentation is available at TPageStep.php

  1. <?php
  2. /**
  3.  * Page Step
  4.  *
  5.  * @version    3.0
  6.  * @package    widget
  7.  * @subpackage util
  8.  * @author     Matheus Agnes Dias
  9.  * @author     Pablo Dall'Oglio
  10.  * @copyright  Copyright (c) 2006-2014 Adianti Solutions Ltd. (http://www.adianti.com.br)
  11.  * @license    http://www.adianti.com.br/framework-license
  12.  */
  13. class TPageStep extends TElement
  14. {
  15.     protected $container;
  16.     protected $items;
  17.     protected $stepNumber = 1;
  18.     
  19.     /**
  20.      * Constructor
  21.      */
  22.     public function __construct()
  23.     {
  24.         parent::__construct('div');
  25.         $this->{'id''div_steps';
  26.         
  27.         $this->container = new TElement('ul');
  28.         $this->container->{'class''steps';
  29.         
  30.         parent::add$this->container );
  31.     }
  32.     
  33.     /**
  34.      * Add an item
  35.      * @param $title     Item title
  36.      * @param $completed Item is completed
  37.      * @param $action    Item action
  38.      */
  39.     public function addItem($title$action null)
  40.     {
  41.         $li new TElement('li');
  42.         $this->items$title $li;
  43.         $this->container->add$li );
  44.         
  45.         if ($action)
  46.         {
  47.             $span_title new TElement('a');
  48.             $span_title->{'href'}      $action->serialize(true);
  49.             $span_title->{'generator''adianti';
  50.         }
  51.         else
  52.         {
  53.             $span_title new TElement('span');
  54.         }
  55.         
  56.         $span_title->{'class''step-title';
  57.         $span_title->add$title );
  58.         
  59.         $span_step new TElement('span');
  60.         $span_step->{'class''step-number';
  61.         $span_step->add$this->stepNumber );
  62.         
  63.         $li->add$span_step );
  64.         $li->add$span_title );
  65.         
  66.         $this->stepNumber ++;
  67.     }
  68.     
  69.     /**
  70.      * Select current item
  71.      */
  72.     public function select($title)
  73.     {
  74.         $class 'complete';
  75.         
  76.         if ($this->items)
  77.         {
  78.             foreach ($this->items as $key => $item)
  79.             {
  80.                 $item->{'class'$class;
  81.                 
  82.                 if ($key == $title)
  83.                 {
  84.                     $item->{'class''active';
  85.                     $class '';
  86.                 }
  87.             }
  88.         }
  89.     }
  90. }