ea-Geiercode-base-smarty
[ class tree: ea-Geier ] [ index: ea-Geier ] [ all elements ]

Source for file function.eaSubmitButton.php

Documentation is available at function.eaSubmitButton.php

  1. <?php
  2. /**
  3.  * smarty function plugin to produce submit buttons
  4.  *
  5.  * LICENSE:
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * (at your option) any later version.
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
  13.  * GNU General Public License for more details.
  14.  * You should have received a copy of the GNU General Public License along
  15.  * with this program; if not, write to the Free Software Foundation, Inc.,
  16.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17.  *
  18.  * @package       ea-Geier
  19.  * @subpackage code/base/smarty
  20.  * @author       m2mtech <tech@m2m.at>
  21.  * @copyright  2007 m2m server software gmbh
  22.  * @license       http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
  23.  * @version       $Id: function.eaSubmitButton.php 77 2007-06-04 04:50:15Z m2mtech $
  24.  * @link       http://www.ea-geier.at/
  25.  */
  26.  
  27. /**
  28.  * Smarty {eaSubmitButton} plugin
  29.  *
  30.  * creates <input type="submit" /> fields from {eaSubmitButton} constructs
  31.  *
  32.  * - {eaSubmitButton name=NAME} ->
  33.  *     <input type="submit" name="NAME" ... class="submit" />
  34.  * - !existing {#NAME#} -> ...<input ... value="submit" />
  35.  * - existing {#NAME#}    -> ...<input ... value="{#NAME#}" />
  36.  * @param    array    function parameters
  37.  *                     - name    input name    mandatory
  38.  * @param    Smarty 
  39.  * @return    string 
  40.  */
  41. function smarty_function_easubmitbutton($params&$smarty){
  42.     // load escape function
  43.     require_once $smarty->_get_plugin_filepath('shared''escape_special_chars');
  44.     // ensure name parameter is available
  45.     if (!isset($params['name'])) {
  46.         $smarty->trigger_error("eaSubmitButton: 'name' missing"E_USER_NOTICE);
  47.         return '';
  48.     }
  49.     $name smarty_function_escape_special_chars($params['name']);    
  50.     $nameL strtolower($name);
  51.     $return '';
  52.     // dummylabel
  53.     $return .= '<label>&nbsp;</label>';
  54.     // button
  55.     $return .= '<input type="submit" name="' $name '" value="';
  56.     if ($value $smarty->get_config_vars($nameL)) $return .= $value;
  57.     else $return .= 'submit';
  58.     // class
  59.     $return.= '" class="submit" />';
  60.     return $return;
  61. }
  62.  
  63. ?>

Documentation generated on Sun, 09 Sep 2007 17:08:46 +0200 by phpDocumentor 1.3.1