forms

Library for work with forms and status.  Release: $Name: $

Edit by: $Author: mcbig $ Edit Date: $Date: 2007/01/02 16:13:12 $ Version: $Revision: 1.6 $

Summary
Library for work with forms and status.
This is array when first form was be generated.
Button class is Gui Object button usable in forms
Class constructor
sets buttons css class
Sets buttons css style.
Sets if the button is hide or not (true | false ).
Sets onclick javastript button event.
Returns button tag.
Submit button for forms.
Special submit button.
Reset button for forms.
Special reset button.
Special element, which could look like button.
Returns a tag.
Form class can generate form with some functions like be center on page as normal window.
html forms enctype.
forms name and forms div html-id
label which is on top of form
Action variable which is post with form.
Module variable which is post with form.
form has style visibility hidden/visible.
show control icons in top panel of form
text of close icon
text of hide icon
Creats Form with POST method for editing and sending data to server.
Returns form header with hidden inputs action and module.
Adds Button class object to forms container.
Returns FormButtons block so buttons definitions and end of form.
Returns full xhtml form with Header isFormBody and End.
Very very simple form to view message or text in div with Info class.
Adds Info Status to session StatusBar variable.
Adds Error Status to session StatusBar variable.
Adds Warning Status to session StatusBar variable.
Adds Debug Status to session StatusBar variable.
Get xhtml body typicaly for Form from file.

Variables

FormsReg

$GLOBALS['FormsReg']

This is array when first form was be generated.  It contains records of Form.lsCssId.  This is test, when you generate new form, cause more divs with the same Id or more forms with the same name is error.

Button

Button class is Gui Object button usable in forms

Summary
Class constructor
sets buttons css class
Sets buttons css style.
Sets if the button is hide or not (true | false ).
Sets onclick javastript button event.
Returns button tag.

Functions

Button

function Button($isName,  
$isLabel =  'Button',
$isType =  'button')

Class constructor

isNamehtml name of button, it could be unique in form.
isLabelbutton label
isTypehtml button type.  It could be: submit | reset | button

SetCssClass

function SetCssClass($isCssClass)

sets buttons css class

isCssClasscss class

SetCssStyle

function SetCssStyle($isCssStyle)

Sets buttons css style.  It is recommended to use class SetCssClass except the style.

isCssStylecss style

SetHide

function SetHide($ibHide)

Sets if the button is hide or not (true | false ).  Hiding is use by css style.

OnClick

function OnClick($isOnclick)

Sets onclick javastript button event.

isOnclickjavascript source code

Generate

function Generate()

Returns button tag.

ButtonOk

Submit button for forms.  It has predefined css class to b_ok

Functions

ButtonOk

function ButtonOk($isLabel)

ButtonOkNew

Special submit button.  It has predefined css class to b_okNew and onclick event.  After click to this button, hidden value newone in form is change to true and form is submited.

Functions

ButtonOkNew

function ButtonOkNew($isLabel,
$isFormCssId)
isFormCssIdforms css id Form::lsCssId

ButtonUndo

Reset button for forms.  It has predefined css class to b_Undo

Functions

ButtonUndo

function ButtonUndo($isLabel)

ButtonClose

Special reset button.  It has predefined css class to b_close and onclick event.  After click to this button, form is hiding and forms values are reset.  This button could be use, when form is showing via changing visibility.

Functions

ButtonClose

function ButtonClose($isLabel,
$isFormCssId)
isFormCssIdforms css id Form::lsCssId

ButtonLink

Special element, which could look like button.  In real, it is link tag with css class button.

Summary

Functions

ButtonLink

function ButtonLink($isLabel,
$isLink)
isLabeltext label or any html code, image tag for example
isLinkhref parametr for link tag

Generate

function Generate()

Returns a tag.

Form

Form class can generate form with some functions like be center on page as normal window.  It sends form to server with base values like action and module which can work with data etc.

TODO

this class use some hard buttons, so idea is AddButton method to adding buttons, and some another method for adds this hard buttons like as AddOkButton, AddUndoButton etc. with gettext support.  Like in Gui Framework.

Summary
html forms enctype.
forms name and forms div html-id
label which is on top of form
Action variable which is post with form.
Module variable which is post with form.
form has style visibility hidden/visible.
show control icons in top panel of form
text of close icon
text of hide icon
Creats Form with POST method for editing and sending data to server.
Returns form header with hidden inputs action and module.
Adds Button class object to forms container.
Returns FormButtons block so buttons definitions and end of form.
Returns full xhtml form with Header isFormBody and End.

Variables

lsEnctype

public $lsEnctype

html forms enctype.  Default value is text/plain.

lsCssId

public $lsCssId

forms name and forms div html-id

lsHeader

public $lsHeader

label which is on top of form

lsAction

public $lsAction

Action variable which is post with form.  This is not action parameter of html form!  So you cen get this variable on new page wiht $_POST[‘action’].

lsModule

public $lsModule

Module variable which is post with form.  So you cen get this variable on new page wiht $_POST[‘module’].

lsVisibility

public $lsVisibility

form has style visibility hidden/visible.  Javascript can change this visibility

lbPanel

public $lbPanel

show control icons in top panel of form

lsClose

public $lsClose

text of close icon

lsHide

public $lsHide

text of hide icon

Functions

Form

function Form($isCssId,  
$isAction,  
$isModule,  
$isHeader =  '',
$ibPanel =  true)

Creats Form with POST method for editing and sending data to server.  Form is in div with id isCssId which is also form name.

isCssIdlsCssId
isActionlsAction
isModulelsModule
isHeaserlsHeader
ibPanellbPanel

Header

function Header()

Returns form header with hidden inputs action and module.  See lsAction and lsModule.  In header is also FormPanel if lbPanel is true.

Variable

Adds Button class object to forms container.

ioButtonButton class object

End

function End()

Returns FormButtons block so buttons definitions and end of form.

Generate

function Generate($isFormBody)

Returns full xhtml form with Header isFormBody and End.  You can’t add the same form (means with the same Id) twice.

Status

Summary
Very very simple form to view message or text in div with Info class.
Adds Info Status to session StatusBar variable.
Adds Error Status to session StatusBar variable.
Adds Warning Status to session StatusBar variable.
Adds Debug Status to session StatusBar variable.

Functions

Info

function Info($isMessage)

Very very simple form to view message or text in div with Info class.

InfoStatus

function InfoStatus($isMessage)

Adds Info Status to session StatusBar variable.  This variable is returned via PopStatus.

ErrStatus

function ErrStatus($isMessage)

Adds Error Status to session StatusBar variable.  This variable is returned via PopStatus.

WarStatus

function WarStatus($isMessage)

Adds Warning Status to session StatusBar variable.  This variable is returned via PopStatus.

DbgStatus

function DbgStatus($isMessage)

Adds Debug Status to session StatusBar variable.  This variable is returned via PopStatus.  Debug statis is addable only when gbDebug in config is true :)

Template

Summary
Get xhtml body typicaly for Form from file.

Functions

Template2FormBody

function Template2FormBody($isTemplateName)

Get xhtml body typicaly for Form from file.  File must exist in ./forms.  Tamplate for this files is template.html.  So, when you create some form, you can test to valid this file.

$GLOBALS['FormsReg']
This is array when first form was be generated.
function Button($isName,  
$isLabel =  'Button',
$isType =  'button')
Class constructor
function SetCssClass($isCssClass)
sets buttons css class
function SetCssStyle($isCssStyle)
Sets buttons css style.
function SetHide($ibHide)
Sets if the button is hide or not (true | false ).
function OnClick($isOnclick)
Sets onclick javastript button event.
function Generate()
Returns button tag.
function ButtonOk($isLabel)
function ButtonOkNew($isLabel,
$isFormCssId)
function ButtonUndo($isLabel)
function ButtonClose($isLabel,
$isFormCssId)
function ButtonLink($isLabel,
$isLink)
function Generate()
Returns a tag.
public $lsEnctype
html forms enctype.
public $lsCssId
forms name and forms div html-id
public $lsHeader
label which is on top of form
public $lsAction
Action variable which is post with form.
public $lsModule
Module variable which is post with form.
public $lsVisibility
form has style visibility hidden/visible.
public $lbPanel
show control icons in top panel of form
public $lsClose
text of close icon
public $lsHide
text of hide icon
function Form($isCssId,  
$isAction,  
$isModule,  
$isHeader =  '',
$ibPanel =  true)
Creats Form with POST method for editing and sending data to server.
function Header()
Returns form header with hidden inputs action and module.
function End()
Returns FormButtons block so buttons definitions and end of form.
function Generate($isFormBody)
Returns full xhtml form with Header isFormBody and End.
function Info($isMessage)
Very very simple form to view message or text in div with Info class.
function InfoStatus($isMessage)
Adds Info Status to session StatusBar variable.
function ErrStatus($isMessage)
Adds Error Status to session StatusBar variable.
function WarStatus($isMessage)
Adds Warning Status to session StatusBar variable.
function DbgStatus($isMessage)
Adds Debug Status to session StatusBar variable.
function Template2FormBody($isTemplateName)
Get xhtml body typicaly for Form from file.
Form class can generate form with some functions like be center on page as normal window.
function PopStatus()
Return buffer StatusBar from _SESSION and clear it.
$gbDebug
if true, all php errors, warnings and notices are printing to glass via PopStatus function.
Template of config.php.