blueshoes php application framework and cms            core_html
[ class tree: core_html ] [ index: core_html ] [ all elements ]

Class: Bs_FormContainer

Source Location: /core/html/form/Bs_FormContainer.class.php

Class Overview

Bs_Object
   |
   --Bs_FormElement
      |
      --Bs_FormContainer

Form Container Class


Author(s):

Version:

  • 4.3.$Revision: 1.6 $ $Date: 2003/12/27 16:05:37 $

Copyright:

  • blueshoes.org

Variables

Methods


Child classes:

Bs_DaFormPageControl
DomApi PageControl Class

Inherited Variables

Inherited Methods

Class: Bs_FormElement

Bs_FormElement::Bs_FormElement()
Constructor.
Bs_FormElement::getCaption()
Return the caption string (for the current language).
Bs_FormElement::getCaptionForFormOutput()
returns the caption. here in Bs_FormElement it's the same getCaption() but in Bs_FormField which overwrites these methods it makes a difference.
Bs_FormElement::getElement()
Return some html code to display the element on a website in a form.
Bs_FormElement::getElementLayout()
returns the layout string for this element.
Bs_FormElement::getLanguageDependentValue()
returns the value of a [language dependant] [object] var for the current or given language.
Bs_FormElement::getLevel()
returns the level this element belongs to.
Bs_FormElement::getVisibility()
returns how this field/element should be visible and editable to the user.
Bs_FormElement::hasFormObject()
tells if we have a reference to a form object where we can grab some information.
Bs_FormElement::setFormObject()
set a reference to a form object.

Class: Bs_Object

Bs_Object::Bs_Object()
Bs_Object::getErrors()
Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack.
Bs_Object::getLastError()
Basic error handling: Get last error string from the global Bs_Error-error stack.
Bs_Object::getLastErrors()
Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors().
Bs_Object::persist()
Persists this object by serializing it and saving it to a file with unique name.
Bs_Object::setError()
Basic error handling: Push an error string on the global Bs_Error-error stack.
Bs_Object::toHtml()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::toString()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::unpersist()
Fetches an object that was persisted with persist()

Class Details

[line 22]
Form Container Class

dependencies: Bs_FormElement, Bs_Array, Bs_FormTemplateParser




Tags:

copyright:  blueshoes.org
pattern:  singleton: (pseudostatic)
access:  public
version:  4.3.$Revision: 1.6 $ $Date: 2003/12/27 16:05:37 $
author:  andrej arn <at blueshoes dot org>


[ Top ]


Class Variables

$caption =  NULL

[line 49]

the title for this group.

usually a string, can be a hash because it's language dependant.




Tags:

see:  $this->getCaption()
access:  public

Type:   mixed
Overrides:   Array


[ Top ]

$defaultOff =  FALSE

[line 137]

tells if the container content is hidden when the form loads.

default and not set = false.




Tags:

see:  var $mayToggle
access:  public

Type:   bool


[ Top ]

$formElements =

[line 40]

holding references to instances of Bs_FormElement.

like the clearing house in Bs_Form.




Tags:

var:  (hash, key is the name)

Type:   array


[ Top ]

$level =

[line 119]

a container can be assigned to another level. this is used for the multi-level form feature.

all elements (including form fields and sub-containers) of this container automatically inherit the level information of this container. they cannot be in a different level.

note I: if not set then it will be used in all levels. note II: the first level is level 1, not 0. note III: if you want to be able to assign a container to more than one level, code that feature, please. :)




Tags:

var:  (1-x)
see:  Bs_Form->level for a description.
access:  public

Type:   int


[ Top ]

$mayToggle =  FALSE

[line 128]

tells if the container content may be toggled (display/hide).

default and not set = false.




Tags:

see:  var $defaultOff
access:  public

Type:   bool


[ Top ]

$pseudoContainer =  FALSE

[line 68]

should it be displayed as real container with caption and borders? if not then the user won't see that these fields are grouped together.

this is useful to give the container a "level" (multilevel forms) etc.




Tags:

var:  (default is FALSE)
access:  public

Type:   bool


[ Top ]

$pseudoIfNada =  TRUE

[line 99]

make this container a "pseudocontainer" (hide border and caption) if there is nothing visible to show? default is TRUE.

if there are no fields (because this user does not have the right to see them) or because there are just no fields then the container won't show up with borders.

if there are fields but used invisible in this case then the borders will still show up because we dunno that the elements are invisible RIGHT NOW. this does not apply for real Bs_FormFieldHidden fields. they are detected. in the future i may change this, add some code, and detect this case aswell.

if the container has sub-containers then this will be ignored, because that would go too far. maybe will be implemented later. (it could be that the subcontainers themself have nothing to show...)

if the container uses a template then this setting will be ignored aswell. because there could be text, whatever in the layout for this container. we can't tell.

note: the elementStringFormat will be ignored if this feature kicks in because of nada. this may not be desired in every situation, but it certainly makes sense.




Tags:

since:  bs4.3 (before the empty containers where shown normally.)
access:  public

Type:   bool


[ Top ]

$templatePath =  NULL

[line 180]

the absolute path to the template(s). if not given then getAbsolutePath() . '../templates/' will be used which kinda sucks. so you better set that...



Tags:

see:  var $useTemplate
access:  public

Type:   string


[ Top ]

$templateString =  NULL

[line 170]

a hardcoded template. if set (and $useTemplate is TRUE) then this one will be used.

has priority over $templatePath.

it may not be empty like "". if you want to set an empty template to have no content in the container, set a space or no-braking-space &nbsp; or disable the container.




Tags:

since:  bs4.5
see:  var $useTemplate
access:  public

Type:   string


[ Top ]

$useCheckboxAsCaption =  FALSE

[line 59]

if set and *this container* has such a checkbox field, the var $caption is ignored, the checkbox plus it's caption is used instead, and the $text of the checkbox is printes as text in the first paragraph of this container. nice feature. should be documented in a howto.



Tags:

var:  useCheckboxAsCaption
access:  public

Type:   string


[ Top ]

$useTemplate =  FALSE

[line 155]

if we should use a template when an appropriate one is available. FALSE unless set to TRUE.

since bs4.5 you can use $templateString to hardcode a layout instead of using a file (and $templatePath).

to see how templates are named see the phpdoc of Bs_FormTemplateParser->loadTemplate().

note: you can code endless loops if your template uses the container element itself. it crashed my apache 1.3x on windows 2k workstation.




Tags:

var:  useTemplate
see:  vars $templateString, Bs_FormContainer::$templatePath
access:  public

Type:   bool


[ Top ]



Class Methods


constructor Bs_FormContainer [line 186]

Bs_FormContainer Bs_FormContainer( )

Constructor.



[ Top ]

method addElement [line 384]

bool addElement( object &$element)

add an instance of a form element object to this container.

it cannot be added to the clearing house here cause the container may not be attached to the form yet.




Tags:

return:  true on success, false on failure.
access:  public


Parameters:

object   &$element   an instance of a form element.

[ Top ]

method getElement [line 213]

string &getElement( [int $level = null])

Return some html code to display the element on a website in a form.

calls itself recursively.




Tags:

return:  (some html code, may be an empty string.)
access:  public


Overridden in child classes as:

Bs_DaFormPageControl::getElement()
Return some html code to display the element on a website in a form.

Overrides Bs_FormElement::getElement() (Return some html code to display the element on a website in a form.)

Parameters:

int   $level   (if set then only container of that level (or undefined level) will be used.)

[ Top ]

method getEndTag [line 369]

void getEndTag( )



[ Top ]

method getLevel [line 541]

int getLevel( )

returns the level this container belongs to.

throws null for unknown or not set.

overwrites and uses parent method.




Tags:

throws:  null
access:  public


Overrides Bs_FormElement::getLevel() (returns the level this element belongs to.)

[ Top ]

method getSaveToDbArray [line 564]

array getSaveToDbArray( [array $hash = array()])

called by Bs_Form->getSaveToDbArray(), look there for further information.

calls itself recursively.




Tags:

see:  Bs_Form->getSaveToDbArray()
access:  public


Parameters:

array   $hash   default is array(). used internally for the recursive loop.

[ Top ]

method getStartTag [line 337]

void getStartTag( )



[ Top ]

method hasFileFieldElement [line 510]

bool hasFileFieldElement( )

tells if this container holds a file field element.

called recursively.




Tags:

access:  public


[ Top ]

method orderElements [line 482]

void orderElements( )

orders the elements based on the orderId var.

if an element has no orderId then it's orderId will be set to "one lower than the previous". this way we keep the order of elements as they were added.




Tags:

see:  var $formElements
access:  public


[ Top ]

method persist [line 594]

bool persist( )

persist the element settings.



Tags:

return:  true on success
throws:  bs_exception on error (db exception)


Overrides Bs_Object::persist() (Persists this object by serializing it and saving it to a file with unique name.)

[ Top ]

method seedClearingHouse [line 447]

array seedClearingHouse( [$ret $ret = array()], [mixed $root = null], [mixed $firstCall = TRUE])

called by Bs_Form->seedClearingHouse() so look there.

calls itself recursively. does not move pointers inside $this->formElements.




Tags:

return:  (hash)
access:  public


Parameters:

$ret   $ret   default is array(). used internally.

[ Top ]


Documentation generated on Mon, 29 Dec 2003 21:09:23 +0100 by phpDocumentor 1.2.3