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

Source for file block.pnform.php

Documentation is available at block.pnform.php

  1. <?php
  2. /**
  3.  * Form plugin
  4.  *
  5.  * @copyright (c) 2006, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: block.pnform.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @author Jorn Wildt
  10.  * @package Zikula_Template_Plugins
  11.  * @subpackage Blocks
  12.  */
  13.  
  14. /**
  15.  * Smarty function to wrap pnFormRender generated form controls
  16.  * with suitable form tags
  17.  *
  18.  */
  19. function smarty_block_pnform($params$content&$render)
  20. {
  21.   if ($content)
  22.   {
  23.     $encodingHtml (array_key_exists('enctype'$params" enctype=\"$params[enctype]\"'');
  24.     $action htmlspecialchars(pnGetCurrentURI());
  25.     $classString '';
  26.     if (isset($params['cssClass'])) {
  27.         $classString "class=\"$params[cssClass]\" ";
  28.     }
  29.  
  30.     $render->pnFormPostRender();
  31.  
  32.     $out  =  "<form id=\"pnFormForm\" {$classString}action=\"$action\" method=\"post\"{$encodingHtml}>";
  33.     $out .= $content;
  34.     $out .= "\n<div>\n" $render->pnFormGetStateHTML("\n"// Add <div> for XHTML validation
  35.     $out .= $render->pnFormGetIncludesHTML("\n";
  36.     $out .= $render->pnFormGetAuthKeyHTML("
  37. <input type=\"hidden\" name=\"pnFormEventTarget\" id=\"pnFormEventTarget\" value=\"\" />
  38. <input type=\"hidden\" name=\"pnFormEventArgument\" id=\"pnFormEventArgument\" value=\"\" />
  39. <script type=\"text/javascript\">
  40. <!--
  41. function pnFormDoPostBack(eventTarget, eventArgument)
  42. {
  43.   var f = document.getElementById('pnFormForm');
  44.   if (!f.onsubmit || f.onsubmit()) 
  45.   {
  46.     f.pnFormEventTarget.value = eventTarget;
  47.     f.pnFormEventArgument.value = eventArgument;
  48.     f.submit();
  49.   }
  50. }
  51. // -->
  52. </script>
  53. </div>\n";
  54.     $out .= "</form>\n";
  55.     return $out;
  56.   }
  57. }

Documentation generated on Fri, 18 Jul 2008 21:43:09 +0200 by phpDocumentor 1.4.1