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

Source for file function.formutil_getpassedvalue.php

Documentation is available at function.formutil_getpassedvalue.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2004, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: function.formutil_getpassedvalue.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @author Robert Gasch
  10.  * @package Zikula_Template_Plugins
  11.  * @subpackage Functions
  12.  */
  13.  
  14. /**
  15.  * pnml: same as pnml() but with the added option to assign the result to a smarty variable
  16.  *
  17.  * @author   Robert Gasch
  18.  * @version  $Id: function.formutil_getpassedvalue.php 24342 2008-06-06 12:03:14Z markwest $
  19.  * @param    assign      The smarty variable to assign the retrieved value to
  20.  * @param    html        Wether or not to pnVarPrepHTMLDisplay'ize the ML value
  21.  * @param    key         The key to retrieve from the input vector
  22.  * @param    default     The default value to return if the key is not set
  23.  * @param    source      The input source to retrieve the key from
  24.  * @param    noprocess   If set, no processing is applied to the constant value
  25.  *
  26.  */
  27. function smarty_function_formutil_getpassedvalue ($params&$smarty)
  28. {
  29.     if ((!isset($params['key']|| !$params['key']&& 
  30.         (!isset($params['name']|| !$params['name'])) // use name as an alias for key for programmer convenience
  31.       $smarty->trigger_error('v4b_get_passed_value: attribute key (or name) required');
  32.       return false;
  33.     }
  34.  
  35.     $assign    = isset($params['assign'])    $params['assign']    null;
  36.     $key       = isset($params['key'])       $params['key']       null;
  37.     $default   = isset($params['default'])   $params['default']   null;
  38.     $html      = isset($params['html'])      $params['html']      null;
  39.     $source    = isset($params['source'])    $params['source']    null;
  40.     $noprocess = isset($params['noprocess']$params['noprocess'null;
  41.  
  42.     if (!$key{
  43.         $key = isset($params['name']$params['name'null;
  44.     }
  45.  
  46.     $val FormUtil::getPassedValue ($key$default$source);
  47.  
  48.     if ($noprocess{
  49.         $val $val;
  50.     elseif ($html{
  51.         $val DataUtil::formatForDisplayHTML($val);
  52.     else {
  53.         $val DataUtil::formatForDisplay($val);
  54.     }
  55.  
  56.     if ($assign{
  57.         $smarty->assign ($assign$val);
  58.     else {
  59.         return $val;
  60.     }
  61. }

Documentation generated on Fri, 18 Jul 2008 21:45:19 +0200 by phpDocumentor 1.4.1