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

Documentation is available at THidden.php

  1. <?php
  2. namespace Adianti\Widget\Form;
  3.  
  4. use Adianti\Widget\Form\AdiantiWidgetInterface;
  5. use Adianti\Widget\Form\TField;
  6.  
  7. /**
  8.  * Hidden field
  9.  *
  10.  * @version    7.4
  11.  * @package    widget
  12.  * @subpackage form
  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 THidden extends TField implements AdiantiWidgetInterface
  18. {
  19.     protected $id;
  20.     
  21.     /**
  22.      * Return the post data
  23.      */
  24.     public function getPostData()
  25.     {
  26.         $name str_replace(['[',']']['','']$this->name);
  27.         
  28.         if (isset($_POST[$name]))
  29.         {
  30.             return $_POST[$name];
  31.         }
  32.         else
  33.         {
  34.             return '';
  35.         }
  36.     }
  37.     
  38.     /**
  39.      * Show the widget at the screen
  40.      */
  41.     public function show()
  42.     {
  43.         // set the tag properties
  44.         $this->tag->{'name'}   $this->name;  // tag name
  45.         $this->tag->{'value'}  $this->value// tag value
  46.         $this->tag->{'type'}   'hidden';     // input type
  47.         $this->tag->{'widget''thidden';
  48.         $this->tag->{'style'}  "width:{$this->size}";
  49.         
  50.         if ($this->id and empty($this->tag->{'id'}))
  51.         {
  52.             $this->tag->{'id'$this->id;
  53.         }
  54.         else
  55.         {
  56.             $this->tag->{'id''thidden_' mt_rand(10000000001999999999);
  57.         }
  58.         
  59.         // shows the widget
  60.         $this->tag->show();
  61.     }
  62. }