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

Source for file Submit.php

Documentation is available at Submit.php

  1. <?php
  2. /**
  3.  * Formagic
  4.  *
  5.  * LICENCE
  6.  *
  7.  * This source file is subject to the new BSD license that is bundled
  8.  * with this package in the file LICENSE.txt.
  9.  * It is also available through the world-wide-web at
  10.  * http://formagic.weasle.de/licence.txt
  11.  * If you did not receive a copy of the license and are unable to
  12.  * obtain it through the world-wide-web, please send an email
  13.  * to licence@weasle.de so we can send you a copy immediately.
  14.  *
  15.  * @category    Formagic
  16.  * @package     Item
  17.  * @author      Florian Sonnenburg
  18.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  19.  * @license     http://formagic.weasle.de/licence.txt     New BSD License
  20.  * @revision    $Revision: 11 $
  21.  */
  22.  
  23. /**
  24.  * Formagic submit button item
  25.  *
  26.  * @category    Formagic
  27.  * @package     Item
  28.  * @author      Florian Sonnenburg
  29.  * @copyright   Copyright (c) 2007 Florian Sonnenburg
  30.  * @version     $Id: Submit.php 11 2007-08-12 20:02:57Z meweasle $
  31.  */
  32.  
  33.    /**
  34.      * Implementation of onCreate-handler
  35.      *
  36.      * @return void 
  37.      */
  38.     protected function _onCreate()
  39.     {
  40.         parent::_onCreate();
  41.         // $this->defaultValue = $this->_label;
  42.  
  43.         // can't be edited
  44.         $this->_isBlocked = true;
  45.  
  46.         // will not be member of submit values
  47.         // $this->isPostItem = false;
  48.         return true;
  49.     }
  50.  
  51.     /**
  52.      * HTML string representation of submit button
  53.      *
  54.      * @return string 
  55.      */
  56.     public function getHtml()
  57.     {
  58.         $str '<input type="submit" name="' $this->name . '" id="' $this->id .
  59.                 '" value="' $this->_label . '"' $this->_getAttributeStr('  />';
  60.         return $str;
  61.     }
  62.  
  63.     /**
  64.      * Override paren::getValue()
  65.      *
  66.      * Always set value of submit button to label; submit button has no label
  67.      * except from value property.
  68.      *
  69.      * @return string 
  70.      ***/
  71.     public function &getValue()
  72.     {
  73.         $res $this->isTriggered($this->_label : '';
  74.         return $res;
  75.     }
  76.  
  77.     /**
  78.      * Override parent::getLabel()
  79.      *
  80.      * Label is already defined by value property
  81.      *
  82.      * @return string 
  83.      ***/
  84.     public function getLabel()
  85.     {
  86.         return "";
  87.     }
  88.  
  89.     /**
  90.      * Returns true if submit button was triggered to access current page
  91.      *
  92.      * @return boolean 
  93.      */
  94.     public function isTriggered()
  95.     {
  96.         $res = isset($this->_caller->submitValues[$this->name]true false;
  97.         return $res;
  98.     }
  99.  
  100.     /**
  101.      * Hiding submit buttons results in removing it from form
  102.      *
  103.      * @return void 
  104.      */
  105.     public function hide()
  106.     {
  107.         parent::hide();
  108.         $this->disable();
  109.     }
  110.  
  111. }

Documentation generated on Thu, 23 Aug 2007 00:29:48 +0200 by phpDocumentor 1.4.0