Horde_Form::renderActive PHP Method

renderActive() public method

Renders the form for editing.
public renderActive ( Horde_Form_Renderer $renderer = null, Variables $vars = null, string $action = '', string $method = 'get', string $enctype = null, boolean $focus = true )
$renderer Horde_Form_Renderer A renderer instance, optional since Horde 3.2.
$vars Variables A Variables instance, optional since Horde 3.2.
$action string The form action (url).
$method string The form method, usually either 'get' or 'post'.
$enctype string The form encoding type. Determined automatically if null.
$focus boolean Focus the first form field?
    function renderActive($renderer = null, $vars = null, $action = '', $method = 'get', $enctype = null, $focus = true)
    {
        if (is_null($renderer)) {
            $renderer = $this->getRenderer();
        }
        if (is_null($vars)) {
            $vars = $this->_vars;
        }
        if (is_null($enctype) && !is_null($this->_enctype)) {
            $enctype = $this->_enctype;
        }
        $renderer->open($action, $method, $this->getName(), $enctype);
        $renderer->listFormVars($this);
        if (!empty($this->_name)) {
            $this->_preserveVarByPost('formname', $this->_name);
        }
        if ($this->_useFormToken) {
            $token = Horde_Token::generateId($this->_name);
            $GLOBALS['session']->set('horde', 'form_secrets/' . $token, true);
            $this->_preserveVarByPost($this->_name . '_formToken', $token);
        }
        if (count($this->_sections)) {
            $this->_preserveVarByPost('__formOpenSection', $this->getOpenSection());
        }
        /* Loop through vars and check for any special cases to
         * preserve. */
        $variables = $this->getVariables();
        foreach ($variables as $var) {
            /* Preserve value if change has to be tracked. */
            if ($var->getOption('trackchange')) {
                $varname = $var->getVarName();
                $this->preserveVarByPost($vars, $varname, '__old_' . $varname);
            }
        }
        foreach ($this->_hiddenVariables as $var) {
            $this->preserveVarByPost($vars, $var->getVarName());
        }
        $renderer->beginActive($this->getTitle(), $this->getExtra());
        $renderer->renderFormActive($this, $vars);
        $renderer->submit($this->_submit, $this->_reset);
        $renderer->end();
        $renderer->close($focus);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Renders the form for editing.
  *
  * @param Horde_Form_Renderer $renderer  A renderer instance, optional
  *                                       since Horde 3.2.
  * @param Variables $vars                A Variables instance, optional
  *                                       since Horde 3.2.
  * @param string $action                 The form action (url).
  * @param string $method                 The form method, usually either
  *                                       'get' or 'post'.
  * @param string $enctype                The form encoding type. Determined
  *                                       automatically if null.
  * @param boolean $focus                 Focus the first form field?
  */
 public function renderActive($renderer, $vars, $action, $method = 'get', $enctype = null, $focus = true)
 {
     if ($vars->get('old_datatype') === null) {
         $this->_addParameters($vars);
     }
     parent::renderActive($renderer, $vars, $action, $method, $enctype, $focus);
 }
All Usage Examples Of Horde_Form::renderActive