Form Class Reference

List of all members.

Public Member Functions

 __construct ($id, $method, $action="", $dataform=FALSE)
 Constructor.
 addElement ($type, $name, $label, $value, $attrs, $tips="")
 Add an element to the form.
 addHidden ($name, $value)
 Add a hidden element.
 addHTML ($html)
 Add raw HTML to the form.
 setSubmitValue ($value)
 Set the value of the submit input control.
 showPermControls ()
 Set permission controls visible.
 showCancel ()
 Set cancel button visible.
 setValue ($name, $value)
 Set a value for an element.
 addFileUploadBox ($fieldname, $fieldcaption, $fieldtips, $filecode="")
 Get the file upload box.
 _getPermsBox ($permtype, $value="", $selgroups="0")
 Return the permissions box.
 setPerms ($readperm, $writeperm, $groupreadperm, $groupwriteperm)
 Set read/write permissions when showing permission controls.
 setForm ($value)
 Automagically set a new/edit form.
 setDefaultValue ($name, $value)
 Set default value for an input control.
 getHTML ()
 Get XHTML-rendered form.

Private Member Functions

 getFormHeader ()
 Return a form header.
 getFCKEditor ($name, $defaulttext="")
 Return an FCKeditor object.
 getRenderedElement ($label, $element, $tip)
 Get a rendered element of the form.
 getCancelButton ()
 Automatically get the cancel button, if visible.
 setContentPartForm ($tags, $values=NULL)
 Generate the content part of a form.
 setPropertiesPartForm ($id=0)
 Generate the properties part of a form.
 getGroupsCheckBoxes ($permtype, $selgroups)
 Return checkboxes to select user groups.

Private Attributes

 $id
 id
 $method
 form method
 $action
 form action
 $dataform
 it's a data form
 $groups = NULL
 used by getPermsBox() as a buffer
 $readperm
 read permission (permission controls)
 $writeperm
 write permission (permission controls)
 $groupreadperm
 group read permission (permission controls)
 $groupwriteperm
 group write permission (permission controls)
 $form = array()
 form structure
 $permvisible = FALSE
 permission controls visible
 $submit = LANG_CONFIRM
 submit input control value
 $cancelvisible = FALSE
 cancel button visible


Detailed Description

Automatic form generator

Definition at line 37 of file form.php.


Constructor & Destructor Documentation

Form::__construct ( id,
method,
action = "",
dataform = FALSE 
)

Constructor.

Create an object for automatic form rendering.

Parameters:
id form id
method form method { GET | POST }
action (optional) action, default to DEFAULT_PAGE
dataform (optional) TRUE = it's a data form

Definition at line 62 of file form.php.

References $action, $cfg, $dataform, $id, and $method.


Member Function Documentation

Form::getFormHeader (  )  [private]

Return a form header.

Returns:
string form header

Definition at line 77 of file form.php.

Referenced by getHTML().

Form::getFCKEditor ( name,
defaulttext = "" 
) [private]

Return an FCKeditor object.

Parameters:
name name of the input control
defaulttext default text to show
Returns:
string XHTML-rendered object

Definition at line 98 of file form.php.

Form::getRenderedElement ( label,
element,
tip 
) [private]

Get a rendered element of the form.

Parameters:
label description label
element XHTML-rendered element
tip editing tip
Returns:
string XHTML-rendered description + element

Definition at line 124 of file form.php.

Referenced by getHTML().

Form::getCancelButton (  )  [private]

Automatically get the cancel button, if visible.

Returns:
string XHTML-rendered cancel button

Definition at line 137 of file form.php.

References $cfg.

Referenced by getHTML().

Form::addElement ( type,
name,
label,
value,
attrs,
tips = "" 
)

Add an element to the form.

Parameters:
type type of element (button, file, header, hidden, image, password, reset, select, static, submit, text, textarea)
name name of the element
label description label
value default value for most type of elements - select: option list (array), use setDefaultValue() to set the default value
attrs additional attributes
tips edit tips

Definition at line 156 of file form.php.

Referenced by addHidden(), and addHTML().

Form::addHidden ( name,
value 
)

Add a hidden element.

Parameters:
name hidden control name
value hidden control value

Definition at line 174 of file form.php.

References addElement().

Form::addHTML ( html  ) 

Add raw HTML to the form.

Parameters:
html raw html to add

Definition at line 183 of file form.php.

References addElement().

Form::setSubmitValue ( value  ) 

Set the value of the submit input control.

Parameters:
value value to set

Definition at line 192 of file form.php.

Form::showPermControls (  ) 

Set permission controls visible.

Definition at line 199 of file form.php.

Form::showCancel (  ) 

Set cancel button visible.

Definition at line 206 of file form.php.

Form::setValue ( name,
value 
)

Set a value for an element.

Parameters:
name element name
value value to set

Definition at line 216 of file form.php.

Form::addFileUploadBox ( fieldname,
fieldcaption,
fieldtips,
filecode = "" 
)

Get the file upload box.

Parameters:
fieldname field name
fieldcaption field caption
fieldtips field tips
filecode file code used to preview and substitution
Returns:
XHTML-rendered file upload box

Definition at line 229 of file form.php.

Form::setContentPartForm ( tags,
values = NULL 
) [private]

Generate the content part of a form.

Parameters:
tags array of field tags
values (optional) array of content values

Definition at line 241 of file form.php.

Form::setPropertiesPartForm ( id = 0  )  [private]

Generate the properties part of a form.

Parameters:
id (optional) content id or 0 if new content

Definition at line 298 of file form.php.

Form::getGroupsCheckBoxes ( permtype,
selgroups 
) [private]

Return checkboxes to select user groups.

Parameters:
permtype permission type ['r'|'w']
selgroups selected groups
Returns:
string XHTML-rendered groups checkboxes

Definition at line 308 of file form.php.

Form::_getPermsBox ( permtype,
value = "",
selgroups = "0" 
)

Return the permissions box.

Parameters:
permtype permission type ['r'|'w']
value (optional) initial value
selgroups selected user groups (bitmask)
Returns:
string XHTML-rendered permissions box

Definition at line 336 of file form.php.

Form::setPerms ( readperm,
writeperm,
groupreadperm,
groupwriteperm 
)

Set read/write permissions when showing permission controls.

Parameters:
readperm read permission
writeperm write permission
groupreadperm group read permission
groupwriteperm group write permission

Definition at line 361 of file form.php.

Form::setForm ( value  ) 

Automagically set a new/edit form.

FIXME da sistemare

Parameters:
value array --> return an edit form
value --> type id for a new content
Returns:
TRUE if form successfully set

Definition at line 375 of file form.php.

Form::setDefaultValue ( name,
value 
)

Set default value for an input control.

Parameters:
$name input control name
$value default value to assign

Definition at line 410 of file form.php.

Form::getHTML (  ) 

Get XHTML-rendered form.

Returns:
string XHTML-rendered form

Definition at line 419 of file form.php.

References getCancelButton(), getFormHeader(), and getRenderedElement().


Member Data Documentation

Form::$id [private]

id

Definition at line 38 of file form.php.

Referenced by __construct().

Form::$method [private]

form method

Definition at line 39 of file form.php.

Referenced by __construct().

Form::$action [private]

form action

Definition at line 40 of file form.php.

Referenced by __construct().

Form::$dataform [private]

it's a data form

Definition at line 41 of file form.php.

Referenced by __construct().

Form::$groups = NULL [private]

used by getPermsBox() as a buffer

Definition at line 42 of file form.php.

Form::$readperm [private]

read permission (permission controls)

Definition at line 43 of file form.php.

Form::$writeperm [private]

write permission (permission controls)

Definition at line 44 of file form.php.

Form::$groupreadperm [private]

group read permission (permission controls)

Definition at line 45 of file form.php.

Form::$groupwriteperm [private]

group write permission (permission controls)

Definition at line 46 of file form.php.

Form::$form = array() [private]

form structure

Definition at line 47 of file form.php.

Form::$permvisible = FALSE [private]

permission controls visible

Definition at line 48 of file form.php.

Form::$submit = LANG_CONFIRM [private]

submit input control value

Definition at line 49 of file form.php.

Form::$cancelvisible = FALSE [private]

cancel button visible

Definition at line 50 of file form.php.


The documentation for this class was generated from the following file:
Generated on Fri Feb 22 11:19:48 2008 for CMSkey by  doxygen 1.5.3