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

Class: HTML_QuickForm_Renderer_Default

Source Location: /main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php

Class Overview

HTML_QuickForm_Renderer
   |
   --HTML_QuickForm_Renderer_Default

A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one


Author(s):

Variables

Methods


Child classes:

HTML_QuickForm_Renderer_QuickHtml
A renderer that makes it quick and easy to create customized forms.

Inherited Methods

Class: HTML_QuickForm_Renderer

HTML_QuickForm_Renderer::HTML_QuickForm_Renderer()
Constructor
HTML_QuickForm_Renderer::finishForm()
Called when visiting a form, after processing all form elements
HTML_QuickForm_Renderer::finishGroup()
Called when visiting a group, after processing all group elements
HTML_QuickForm_Renderer::renderElement()
Called when visiting an element
HTML_QuickForm_Renderer::renderHeader()
Called when visiting a header element
HTML_QuickForm_Renderer::renderHidden()
Called when visiting a hidden element
HTML_QuickForm_Renderer::renderHtml()
Called when visiting a raw HTML/text pseudo-element
HTML_QuickForm_Renderer::startForm()
Called when visiting a form, before processing any form elements
HTML_QuickForm_Renderer::startGroup()
Called when visiting a group, before processing any group elements

Class Details

[line 31]
A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one



Tags:

author:  Alexey Borzov <borz_off@cs.msu.su>
access:  public


[ Top ]


Class Variables

$_elementTemplate =  
        "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->\t{element}</td>\n\t</tr>"

[line 53]

Element template string



Tags:

access:  private

Type:   string


[ Top ]

$_formTemplate =  
        "\n<form{attributes}>\n<div>\n{hidden}<table border=\"0\">\n{content}\n</table>\n</div>\n</form>"

[line 61]

Form template string



Tags:

access:  private

Type:   string


[ Top ]

$_groupElements = array()

[line 109]

Array with HTML generated for group elements



Tags:

access:  private

Type:   array


[ Top ]

$_groupElementTemplate =  ''

[line 116]

Template for an element inside a group



Tags:

access:  private

Type:   string


[ Top ]

$_groupTemplate =  ''

[line 130]

HTML for the current group



Tags:

access:  private

Type:   string


[ Top ]

$_groupTemplates = array()

[line 95]

Array containing the templates for elements within groups



Tags:

access:  private

Type:   array


[ Top ]

$_groupWrap =  ''

[line 123]

HTML that wraps around the group elements



Tags:

access:  private

Type:   string


[ Top ]

$_groupWraps = array()

[line 88]

Array containing the templates for group wraps.

These templates are wrapped around group elements and groups' own templates wrap around them. This is set by setGroupTemplate().




Tags:

access:  private

Type:   array


[ Top ]

$_headerTemplate =  
        "\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #CCCCCC;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>"

[line 45]

Header Template string



Tags:

access:  private

Type:   string


[ Top ]

$_hiddenHtml =  ''

[line 137]

Collected HTML of the hidden fields



Tags:

access:  private

Type:   string


[ Top ]

$_html =

[line 38]

The HTML of the form



Tags:

access:  private

Type:   string


[ Top ]

$_inGroup =  false

[line 102]

True if we are inside a group



Tags:

access:  private

Type:   bool


[ Top ]

$_requiredNoteTemplate =  
        "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\" valign=\"top\">{requiredNote}</td>\n\t</tr>"

[line 69]

Required Note template string



Tags:

access:  private

Type:   string


[ Top ]

$_templates = array()

[line 77]

Array containing the templates for customised elements



Tags:

access:  private

Type:   array


[ Top ]



Class Methods


constructor HTML_QuickForm_Renderer_Default [line 144]

HTML_QuickForm_Renderer_Default HTML_QuickForm_Renderer_Default( )

Constructor



Tags:

access:  public


[ Top ]

method clearAllTemplates [line 466]

void clearAllTemplates( )

Clears all the HTML out of the templates that surround notes, elements, etc.

Useful when you want to use addData() to create a completely custom form look




Tags:

access:  public


[ Top ]

method finishForm [line 183]

void finishForm( object An &$form)

Called when visiting a form, after processing all form elements Adds required note, form attributes, validation javascript and form content.



Tags:

access:  public


Overrides HTML_QuickForm_Renderer::finishForm() (Called when visiting a form, after processing all form elements)

Parameters:

object An   &$form   HTML_QuickForm object being visited

[ Top ]

method finishGroup [line 353]

void finishGroup( object An &$group)

Called when visiting a group, after processing all group elements



Tags:

access:  public


Overridden in child classes as:

HTML_QuickForm_Renderer_QuickHtml::finishGroup()
Gets the html for the group element and adds it to the array by calling parent::finishGroup()

Overrides HTML_QuickForm_Renderer::finishGroup() (Called when visiting a group, after processing all group elements)

Parameters:

object An   &$group   HTML_QuickForm_group object being visited

[ Top ]

method renderElement [line 281]

void renderElement( object An &$element, bool $required, string $error)

Renders an element Html Called when visiting an element



Tags:

access:  public


Overridden in child classes as:

HTML_QuickForm_Renderer_QuickHtml::renderElement()
Gets the html for an element and adds it to the array by calling parent::renderElement()

Overrides HTML_QuickForm_Renderer::renderElement() (Called when visiting an element)

Parameters:

object An   &$element   HTML_QuickForm_element object being visited
bool   $required   Whether an element is required
string   $error   An error message associated with an element

[ Top ]

method renderHeader [line 211]

void renderHeader( object An &$header)

Called when visiting a header element



Tags:

access:  public


Overrides HTML_QuickForm_Renderer::renderHeader() (Called when visiting a header element)

Parameters:

object An   &$header   HTML_QuickForm_header element being visited

[ Top ]

method renderHidden [line 310]

void renderHidden( object An &$element)

Renders an hidden element Called when visiting a hidden element



Tags:

access:  public


Overridden in child classes as:

HTML_QuickForm_Renderer_QuickHtml::renderHidden()
Gets the html for a hidden element and adds it to the array.

Overrides HTML_QuickForm_Renderer::renderHidden() (Called when visiting a hidden element)

Parameters:

object An   &$element   HTML_QuickForm_hidden object being visited

[ Top ]

method renderHtml [line 322]

void renderHtml( object An &$data)

Called when visiting a raw HTML/text pseudo-element



Tags:

access:  public


Overrides HTML_QuickForm_Renderer::renderHtml() (Called when visiting a raw HTML/text pseudo-element)

Parameters:

object An   &$data   HTML_QuickForm_html element being visited

[ Top ]

method setElementTemplate [line 383]

void setElementTemplate( string $html, [string $element = null])

Sets element template



Tags:

access:  public


Parameters:

string   $html   The HTML surrounding an element
string   $element   (optional) Name of the element to apply template for

[ Top ]

method setFormTemplate [line 442]

void setFormTemplate( string $html)

Sets form template



Tags:

access:  public


Parameters:

string   $html   The HTML surrounding the form tags

[ Top ]

method setGroupElementTemplate [line 418]

void setGroupElementTemplate( string $html, string $group)

Sets element template for elements within a group



Tags:

access:  public


Parameters:

string   $html   The HTML surrounding an element
string   $group   Name of the group to apply template for

[ Top ]

method setGroupTemplate [line 405]

void setGroupTemplate( string $html, string $group)

Sets template for a group wrapper

This template is contained within a group-as-element template set via setTemplate() and contains group's element templates, set via setGroupElementTemplate()




Tags:

access:  public


Parameters:

string   $html   The HTML surrounding group elements
string   $group   Name of the group to apply template for

[ Top ]

method setHeaderTemplate [line 430]

void setHeaderTemplate( string $html)

Sets header template



Tags:

access:  public


Parameters:

string   $html   The HTML surrounding the header

[ Top ]

method setRequiredNoteTemplate [line 454]

void setRequiredNoteTemplate( string $html)

Sets the note indicating required fields template



Tags:

access:  public


Parameters:

string   $html   The HTML surrounding the required note

[ Top ]

method startForm [line 169]

void startForm( object An &$form)

Called when visiting a form, before processing any form elements



Tags:

access:  public


Overrides HTML_QuickForm_Renderer::startForm() (Called when visiting a form, before processing any form elements)

Parameters:

object An   &$form   HTML_QuickForm object being visited

[ Top ]

method startGroup [line 336]

void startGroup( object An &$group, bool $required, string $error)

Called when visiting a group, before processing any group elements



Tags:

access:  public


Overrides HTML_QuickForm_Renderer::startGroup() (Called when visiting a group, before processing any group elements)

Parameters:

object An   &$group   HTML_QuickForm_group object being visited
bool   $required   Whether a group is required
string   $error   An error message associated with a group

[ Top ]

method toHtml [line 155]

string toHtml( )

returns the HTML generated for the form



Tags:

access:  public


Overridden in child classes as:

HTML_QuickForm_Renderer_QuickHtml::toHtml()
returns the HTML generated for the form

[ Top ]

method _prepareTemplate [line 232]

string _prepareTemplate( string $name, mixed $label, bool $required, string $error)

Helper method for renderElement



Tags:

return:  Html for element
see:  HTML_QuickForm_Renderer_Default::renderElement()
access:  private


Parameters:

string   $name   Element name
mixed   $label   Element label (if using an array of labels, you should set the appropriate template)
bool   $required   Whether an element is required
string   $error   Error message associated with the element

[ Top ]


Documentation generated on Thu, 12 Jun 2008 13:18:40 -0500 by phpDocumentor 1.4.1