|
|
|
File: C:/usr/local/lib/php/blueshoes-4.2/core/html/form/Bs_FormElement.class.php
BlueShoes Application Framework - Form
Bs_FormElement
Bs_Object | +-- Bs_FormElement
Form Element Class
|
public class Bs_FormElement extends Bs_Object
Form Element Class
basic implementation of an html form element. is never instanced alone,only extended by one of the following classes:- FormField - FormText- FormContainer - FormHtml- FormImage - FormPhp- FormLinedependencies: Bs_ObjPersisterForMySql
| Authors | andrej arn <andrej@arn.li> |
| Version | 4.0.$id$ |
| Copyright | blueshoes.org |
|
| |
|
Direct known subclasses: Bs_FormCode, Bs_FormContainer, Bs_FormField, Bs_FormHtml, Bs_FormImage, Bs_FormLine, Bs_FormText, Bs_DaFormPageControl
|
|
Methods inherited from Bs_Object |
| isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean |
|
|
|
|
|
Private Field Summary |
| string |
$persisterinstance of Bs_ObjPersisterForMySql to persist the settings. |
| int |
$persisterIDreserved var for the persister. don't fuck with this. |
| object [unknown] |
$_forma reference to the form object holding this form field. |
| string |
$namethe name of the element. must be unique for this form. |
| unknown |
$elementTypeone of |
| int |
$FormIDform id, means to which form this element belongs. |
| string |
$containerthe container to which this element belongs. |
| int |
$orderIdthe order number (in the container, if set) in that the element should be |
| mixed |
$elementStringFormatyou may want to not only spit out the element but spit it out with other things, like |
| array |
$persisterVarSettings |
| unknown |
$this |
|
|
|
Public Method Details |
Bs_FormElement |
|
public void Bs_FormElement( )
|
| |
Constructor.
|
| Returns |
void |
|
hasFormObject |
|
public bool hasFormObject( )
|
| |
tells if we have a reference to a form object where we can grab
some information.
|
| Returns |
bool |
|
setFormObject |
|
public bool setFormObject( object [unknown] &$form )
|
| |
set a reference to a form object.
|
| Parameter |
|
|
| Returns |
bool true on success, false on failure. |
|
getLevel |
|
public int getLevel( )
|
| |
returns the level this element belongs to.
throws null for unknown or not set.
|
| Returns |
int |
| Throws |
null |
|
getLanguageDependentValue |
|
public string getLanguageDependentValue( mixed $var, [ string $lang ] )
|
| |
returns the value of a [language dependant] [object] var for the current
or given language.
|
| Parameter |
|
| mixed |
$var |
|
|
(the var where the values are in. string or array (hash).) |
|
|
| string |
$lang |
= >>null<< |
|
(default is null. if not given then the lang setting of the form is used.) |
|
| Returns |
string |
| Throws |
NULL if var is not set [correctly]. |
|
|
Private Method Details |
getCaption |
|
private string getCaption( )
|
| |
Return the caption string (for the current language).
|
| Returns |
string the caption for this field. |
| See Also |
$this, $this |
|
getElement |
|
private void getElement( )
|
| |
Return some html code to display the element on a website in a form.
better overwrite this method.
|
| Returns |
void |
|
_doElementStringFormat |
|
private string _doElementStringFormat( string $elementString )
|
| |
does the sprintf() with the element if $this->elementStringFormat is used.
won't be used if the element is not sent to the browser, or sent in a hidden way.but is sent if for example an input field is disabled.
|
| Parameter |
|
| string |
$elementString |
|
|
the html element |
|
| Returns |
string |
|
_getParamValue |
|
private array _getParamValue( mixed $var )
|
| |
if you have a value that can look like
'howdy'array('hi', 'hello')array('en'=>array('hi','hello'), 'de'=>array('hallo'), 'fr'=>array('salut','bonjour'));and you only want the values that apply for this form (language), then use this function.uses getLanguageDependentValue()
|
| Parameter |
|
|
| Returns |
array @throw an empty array if var is not set [correctly]. |
|
|
Private Field Details |
$persister |
|
private string $persister
>>NULL<<
instance of Bs_ObjPersisterForMySql to persist the settings.
|
|
$persisterID |
|
private int $persisterID
>><<
reserved var for the persister. don't fuck with this.
|
|
$_form |
|
private object [unknown] $_form
>><<
a reference to the form object holding this form field.
this is needed for various information, like the language we're in.
|
|
$name |
|
private string $name
>><<
the name of the element. must be unique for this form.
note: for form fields the name can be like an array:foo['bar'] (not foo[bar])with that feature you can 'explode' fields too.a good example is the dsn db information. you wantto have the values in one var called dbDsn. but in the form youdon't want the explode-feature because every value (host, port ...)needs to be validated differently.
|
|
$elementType |
|
private unknown $elementType
>><<
one of
- field- container- image- line- text- html- php
|
|
$FormID |
|
private int $FormID
>><<
form id, means to which form this element belongs.
|
|
$container |
|
private string $container
>><<
the container to which this element belongs.
note: container may be of type Bs_FormContainer or Bs_DaFormPageControl.
|
|
$orderId |
|
private int $orderId
>><<
the order number (in the container, if set) in that the element should be
spitted out to the browser. the higher the number, the higher the priority.
|
|
$elementStringFormat |
|
private mixed $elementStringFormat
>><<
you may want to not only spit out the element but spit it out with other things, like
some html code on both sides. so if used, this is the format argument of the sprintffunction.example:here we add an image that'll be displayed after the element.$elementStringFormat = "%s <img src='someImage.gif'>";usually a string, can be a hash because it's language dependant.
|
|
$persisterVarSettings |
|
private array $persisterVarSettings
>>array('name' => array('mode'=>'lonely', 'metaType'=>'string', 'index'=>TRUE),
'elementType' => array('mode'=>'lonely', 'metaType'=>'string', 'index'=>TRUE),
'FormID' => array('mode'=>'lonely', 'metaType'=>'integer', 'index'=>TRUE),
'container' => array('mode'=>'stream'),
'orderId' => array('mode'=>'stream'),
'elementStringFormat' => array('mode'=>'stream')
)<<
|
|
$this |
|
private unknown $this
>><<
|
|
|
Private Constant Details |
BS_FORMELEMENT_VERSION
define( BS_FORMELEMENT_VERSION, >>4.0.$x$<< )
Case: default: case sensitive
|
|
|
|
|
|
| PHPDoc 1.0beta |