pclib  2.9.5
Lightweight PHP framework
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
GridForm Class Reference

Just like grid, but you can use form tags: input, select, check, etc. More...

Inherits PCGrid.

Public Member Functions

 __construct ($path='', $sessName='')
 Constructor - load formgrid template. More...
 
 print_Element ($id, $sub, $value)
 This function is called for each template tag when it is printed. More...
 
 insert ($tab)
 Insert form values into dbtable $tab. More...
 
 update ($tab)
 Update records in database table $tab, using primary key (pk). More...
 

Data Fields

 $submitted = false
 This variable is set when formgrid has been submitted, in which case it contains name of pressed button.
 

Protected Member Functions

 getHttpData ()
 Return data sent through http. More...
 
 print_Primary ($id, $sub, $value)
 Print hidden input field with primary key value. More...
 

Protected Attributes

 $className = 'gridform'
 Name of the 'class' element.
 

Detailed Description

Just like grid, but you can use form tags: input, select, check, etc.

You can submit this and store to database with insert() and update() functions. Each row will be updated using primary key, which must be defined. Use "primary FIELDNAME" in elements. Whole page is updated at once and only one (active) page is submitted. Note that lot of form capabilities are not supported at now. No validation, file uploads etc. This is just alpha-version. See http://pclib.brambor.net/demo/gridform/ for some example.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $path = '',
  $sessName = '' 
)

Constructor - load formgrid template.

Parameters
string$tpl_fileFilename of template file
string$sessnameWhen set, object is stored in session as $sessname

Member Function Documentation

◆ getHttpData()

getHttpData ( )
protected

Return data sent through http.

Returns
array $data

◆ insert()

insert (   $tab)

Insert form values into dbtable $tab.

Parameters
string$tabdatabase table name
See also
form::insert()

◆ print_Element()

print_Element (   $id,
  $sub,
  $value 
)

This function is called for each template tag when it is printed.

Template element handler
Get element definition from Tpl->elements and write element value from Tpl->values into template.
Note
This function comes in form print_*() where "*" is usually TAGNAME which can be used in <?elements ?> section of template.
Parameters
string$idname of template tag {ID}
string$submodificator (second part) of template tag name {ID.sub}
mixed$valuevalue of element going from Tpl->values array

◆ print_Primary()

print_Primary (   $id,
  $sub,
  $value 
)
protected

Print hidden input field with primary key value.

Used for update.

Template element handler
Get element definition from Tpl->elements and write element value from Tpl->values into template.
Note
This function comes in form print_*() where "*" is usually TAGNAME which can be used in <?elements ?> section of template.
Parameters
string$idname of template tag {ID}
string$submodificator (second part) of template tag name {ID.sub}
mixed$valuevalue of element going from Tpl->values array

◆ update()

update (   $tab)

Update records in database table $tab, using primary key (pk).

Parameters
string$tabdatabase table name
See also
form::update()

The documentation for this class was generated from the following file: