Class jFormsBase

Description

base class of all form classes generated by the jform compiler

  • abstract:

Located in /forms/jFormsBase.class.php (line 34)


	
			
Variable Summary
Method Summary
jFormsBase __construct (string $sel,  &$container, [boolean $reset = false], jFormsDataContainer $container)
void addControl ($control $control)
boolean check ()
jFormsBuilderBase getBuilder (string $buildertype, string $action, array $actionParams)
jFormsControl getControl (string $name)
array getControls ()
string getData (string $name)
array getDatas ()
array getErrors ()
array getReset ()
array getSubmits ()
boolean hasUpload ()
string id ()
void initControlFromDao (string $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfil = ''])
void initFromDao (string $daoSelector, [string $key = null], [string $dbProfil = ''])
void initFromRequest ()
void saveAllFiles ([string $path = ''])
void saveControlToDao (string $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfil = ''])
boolean saveFile (string $controlName, [string $path = ''], [string $alternateName = ''])
mixed saveToDao (string $daoSelector, [string $key = null], [string $dbProfil = ''])
void setData (string $name, string $value)
void setErrorOn (string $field, string $mesg)
void setReadOnly ([boolean $r = true])
Variables
boolean $_builders = array() (line 78)

content list of available form builder

  • access: protected
jFormsDataContainer $_container = null (line 72)

the data container

  • access: protected
array $_controls = array() (line 42)

List of all form controls

array of jFormsControl objects

jFormsControl $_reset = null (line 58)

Reset button

string $_sel (line 84)

the form selector

  • access: protected
array $_submits = array() (line 50)

List of submit buttons

array of jFormsControl objects

array $_uploads = array() (line 66)

List of uploads controls

array of jFormsControl objects

Methods
Constructor __construct (line 91)
  • access: public
jFormsBase __construct (string $sel,  &$container, [boolean $reset = false], jFormsDataContainer $container)
  • string $sel: the form selector
  • jFormsDataContainer $container: the data container
  • boolean $reset: says if the data should be reset
  • &$container
addControl (line 577)

add a control to the form

  • access: protected
void addControl ($control $control)
  • $control $control: jFormsControl
check (line 141)

check validity of all data form

  • return: true if all is ok
  • access: public
boolean check ()
getBuilder (line 500)
  • access: public
jFormsBuilderBase getBuilder (string $buildertype, string $action, array $actionParams)
  • string $buildertype: the type name of a form builder
  • string $action: action selector where form will be submit
  • array $actionParams: parameters for the action
getContainer (line 460)
  • access: public
jFormsDataContainer getContainer ()
getControl (line 472)
  • since: jelix 1.0
  • access: public
jFormsControl getControl (string $name)
  • string $name: the control name you want to get
getControls (line 465)
  • return: of jFormsControl objects
  • access: public
array getControls ()
getData (line 447)
  • return: the data value
  • access: public
string getData (string $name)
  • string $name: the name of the control/data
getDatas (line 456)
  • return: form data
  • access: public
array getDatas ()
getErrors (line 415)

return list of errors found during the check

  • see: jFormsBase::check
  • access: public
array getErrors ()
getReset (line 482)
  • return: of jFormsControl objects
  • access: public
array getReset ()
getSubmits (line 477)
  • return: of jFormsControl objects
  • access: public
array getSubmits ()
hasUpload (line 492)
  • access: public
boolean hasUpload ()
id (line 487)
  • return: the formId
  • access: public
string id ()
initControlFromDao (line 297)

set data from a DAO, in a control

The control must be a container like checkboxes or listbox with multiple attribute. The form should contain a formId

The Dao should map to an "association table" : its primary key should be composed by the primary key stored in the formId (or the given primarykey) + the field which will contain one of the values of the control. If this order is not the same as defined into the dao, you should provide the list of property names which corresponds to the primary key in this order : properties for the formId, followed by the property which contains the value.

  • see: jDao
  • access: public
void initControlFromDao (string $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfil = ''])
  • string $controlName: the name of the control
  • string $daoSelector: the selector of a dao file
  • mixed $primaryKey: the primary key if the form have no id. (optional)
  • mixed $primaryKeyNames: list of field corresponding to primary keys (optional)
  • string $dbProfil: the jDb profil to use with the dao
initFromDao (line 158)

set form data from a DAO

  • see: jDao
  • access: public
void initFromDao (string $daoSelector, [string $key = null], [string $dbProfil = ''])
  • string $daoSelector: the selector of a dao file
  • string $key: the primary key for the dao. if null, takes the form ID as primary key
  • string $dbProfil: the jDb profil to use with the dao
initFromRequest (line 102)

set form data from request parameters

  • access: public
void initFromRequest ()
saveAllFiles (line 551)

save all uploaded file in the given directory

  • access: public
void saveAllFiles ([string $path = ''])
  • string $path: path of the directory where to store the file. If it is not given, it will be stored under the var/uploads/_modulename~formname_/ directory
saveControlToDao (line 360)

save data of a control using a dao.

The control must be a container like checkboxes or listbox with multiple attribute. If the form contain a new record (no formId), you should call saveToDao before in order to get a new id (the primary key of the new record), or you should get a new id by an other way. then you must pass this primary key in the third argument. If the form has already a formId, then it will be used as a primary key, unless you give one in the third argument.

The Dao should map to an "association table" : its primary key should be the primary key stored in the formId + the field which will contain one of the values of the control. If this order is not the same as defined into the dao, you should provide the list of property names which corresponds to the primary key in this order : properties for the formId, followed by the property which contains the value. All existing records which have the formid in their keys are deleted before to insert new values.

  • see: jDao
  • access: public
void saveControlToDao (string $controlName, string $daoSelector, [mixed $primaryKey = null], [mixed $primaryKeyNames = null], [string $dbProfil = ''])
  • string $controlName: the name of the control
  • string $daoSelector: the selector of a dao file
  • mixed $primaryKey: the primary key if the form have no id. (optional)
  • mixed $primaryKeyNames: list of field corresponding to primary keys (optional)
  • string $dbProfil: the jDb profil to use with the dao
saveFile (line 521)

save an uploaded file in the given directory. the given control must be an upload control of course.

  • return: true if the file has been saved correctly
  • access: public
boolean saveFile (string $controlName, [string $path = ''], [string $alternateName = ''])
  • string $controlName: the name of the upload control
  • string $path: path of the directory where to store the file. If it is not given, it will be stored under the var/uploads/_modulename~formname_/ directory
  • string $alternateName: a new name for the file. If it is not given, the file while be stored with the original name
saveToDao (line 213)

save data using a dao.

it call insert or update depending the value of the formId stored in the container

  • return: the primary key of the new record in a case of inserting
  • see: jDao
  • access: public
mixed saveToDao (string $daoSelector, [string $key = null], [string $dbProfil = ''])
  • string $daoSelector: the selector of a dao file
  • string $key: the primary key for the dao. if null, takes the form ID as primary key
  • string $dbProfil: the jDb profil to use with the dao
setData (line 431)
  • access: public
void setData (string $name, string $value)
  • string $name: the name of the control/data
  • string $value: the data value
setErrorOn (line 422)

set an error message on a specific field

  • access: public
void setErrorOn (string $field, string $mesg)
  • string $field: the field name
  • string $mesg: the error message string
setReadOnly (line 408)

method not implemented...

  • deprecated: since 1.0.4
  • access: public
void setReadOnly ([boolean $r = true])
  • boolean $r

Documentation generated on Wed, 07 Sep 2011 13:47:22 +0200 by phpDocumentor 1.4.3