HTML_QuickForm
[ class tree: HTML_QuickForm ] [ index: HTML_QuickForm ] [ all elements ]

Source for file static.php

Documentation is available at static.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4.0                                                      |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Adam Daniel <adaniel1@eesus.jnj.com>                        |
  17. // |          Bertrand Mansion <bmansion@mamasam.com>                     |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: static.php,v 1.6 2003/06/16 13:06:26 avb Exp $
  21.  
  22. require_once("HTML/QuickForm/element.php");
  23.  
  24. /**
  25.  * HTML class for static data
  26.  * 
  27.  * @author       Wojciech Gdela <eltehaem@poczta.onet.pl>
  28.  * @access       public
  29.  */
  30.     
  31.     // {{{ properties
  32.  
  33.     /**
  34.      * Display text
  35.      * @var       string 
  36.      * @access    private
  37.      */
  38.     var $_text = null;
  39.  
  40.     // }}}
  41.     // {{{ constructor
  42.     
  43.     /**
  44.      * Class constructor
  45.      * 
  46.      * @param     string    $elementLabel   (optional)Label
  47.      * @param     string    $text           (optional)Display text
  48.      * @access    public
  49.      * @return    void 
  50.      */
  51.     function HTML_QuickForm_static($elementName=null$elementLabel=null$text=null)
  52.     {
  53.         HTML_QuickForm_element::HTML_QuickForm_element($elementName$elementLabel);
  54.         $this->_persistantFreeze = false;
  55.         $this->_type 'static';
  56.         $this->_text $text;
  57.     //end constructor
  58.     
  59.     // }}}
  60.     // {{{ setName()
  61.  
  62.     /**
  63.      * Sets the element name
  64.      * 
  65.      * @param     string    $name   Element name
  66.      * @access    public
  67.      * @return    void 
  68.      */
  69.     function setName($name)
  70.     {
  71.         $this->updateAttributes(array('name'=>$name));
  72.     //end func setName
  73.     
  74.     // }}}
  75.     // {{{ getName()
  76.  
  77.     /**
  78.      * Returns the element name
  79.      * 
  80.      * @access    public
  81.      * @return    string 
  82.      */
  83.     function getName()
  84.     {
  85.         return $this->getAttribute('name');
  86.     //end func getName
  87.  
  88.     // }}}
  89.     // {{{ setText()
  90.  
  91.     /**
  92.      * Sets the text
  93.      *
  94.      * @param     string    $text 
  95.      * @access    public
  96.      * @return    void 
  97.      */
  98.     function setText($text)
  99.     {
  100.         $this->_text $text;
  101.     // end func setText
  102.  
  103.     // }}}
  104.     // {{{ setValue()
  105.  
  106.     /**
  107.      * Sets the text (uses the standard setValue call to emulate a form element.
  108.      *
  109.      * @param     string    $text 
  110.      * @access    public
  111.      * @return    void 
  112.      */
  113.     function setValue($text)
  114.     {
  115.         $this->setText($text);
  116.     // end func setValue
  117.  
  118.     // }}}    
  119.     // {{{ toHtml()
  120.  
  121.     /**
  122.      * Returns the static text element in HTML
  123.      * 
  124.      * @access    public
  125.      * @return    string 
  126.      */
  127.     function toHtml()
  128.     {
  129.         return $this->_getTabs($this->_text;
  130.     //end func toHtml
  131.     
  132.     // }}}
  133.     // {{{ getFrozenHtml()
  134.  
  135.     /**
  136.      * Returns the value of field without HTML tags
  137.      * 
  138.      * @access    public
  139.      * @return    string 
  140.      */
  141.     function getFrozenHtml()
  142.     {
  143.         return $this->toHtml();
  144.     //end func getFrozenHtml
  145.  
  146.     // }}}
  147.     // {{{ onQuickFormEvent()
  148.  
  149.     /**
  150.      * Called by HTML_QuickForm whenever form event is made on this element
  151.      *
  152.      * @param     string    $event  Name of event
  153.      * @param     mixed     $arg    event arguments
  154.      * @param     object    $caller calling object
  155.      * @since     1.0
  156.      * @access    public
  157.      * @return    void 
  158.      * @throws
  159.      */
  160.     function onQuickFormEvent($event$arg&$caller)
  161.     {
  162.         switch ($event{
  163.             case 'updateValue':
  164.                 // do NOT use submitted values for static elements
  165.                 $value $this->_findValue($caller->_constantValues);
  166.                 if (null === $value{
  167.                     $value $this->_findValue($caller->_defaultValues);
  168.                 }
  169.                 if (null !== $value{
  170.                     $this->setValue($value);
  171.                 }
  172.                 break;
  173.             default:
  174.                 parent::onQuickFormEvent($event$arg$caller);
  175.         }
  176.         return true;
  177.     // end func onQuickFormEvent
  178.  
  179.     // }}}
  180.     // {{{ exportValue()
  181.  
  182.    /**
  183.     * We override this here because we don't want any values from static elements
  184.     */
  185.     function exportValue(&$submitValues$assoc = false)
  186.     {
  187.         return null;
  188.     }
  189.     
  190.     // }}}
  191. //end class HTML_QuickForm_static
  192. ?>

Documentation generated on Mon, 11 Mar 2019 14:16:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.