| apidoc |
| [ class tree: apidoc ] [ index: apidoc ] [ all elements ] |
|
Packages: DB_DataObject_FormBuilder Classes: |
[ Top ] $enumFields = array()[line 542] A simple array of fields names which should be treated as ENUMs. A select box will be created with the enum options. If you add this field to the linkElementTypes array and give it a 'radio' type, you will get radio buttons instead.The default handler for enums is only tested in mysql. If you are using a different DB backend, use enumOptionsCallback or enumOptions.
[ Top ] $enumOptions = array()[line 556] An array which holds enum options for specific fields. Each key should be a field in the current table and each value holds a an array of strings which are the possible values for the enum. This will only be used if the field is listed in enumFields.
[ Top ] $enumOptionsCallback = array()[line 548] A valid callback which will return the options in a simple array of strings for an enum field given the table and field names.
[ Top ] $fieldLabels =[line 442] Array of field labels. The key of the element is the field name. Use this if you want to keep the auto-generated elements, but still define your own labels for them.
[ Top ] $fieldsToRender =[line 449] Array of fields to render elements for. If a field is not given, it will not be rendered. If empty, all fields will be rendered (except, normally, the primary key).
[ Top ] $formHeaderText = null[line 333] Text for the form header. If not set, the name of the database table this form represents will be used.
[ Top ] $hidePrimaryKey = true[line 496] By default, hidden fields are generated for the primary key of a DataObject. This behaviour can be deactivated by setting this option to false.
[ Top ] $linkDisplayFields =[line 418] An array of the default fields to display when creating a select box
[ Top ] $linkDisplayLevel = 0[line 572] If this is set to 1 or above, links will be followed in the display fields and the display fields of the record linked to will be used for display.If this is set to 2, links will be followed in the linked record as well. This can be set to any number of links you wish but could easily slow down your application if set to more than 1 or 2 (but only if you have links in your display fields that go that far ;-)). For a more in-depth example, see the docs for linkDisplayFields.
[ Top ] $linkElementTypes = array()[line 531] Array to configure the type of the link elements. By default, a select box will be used. The key is the name of the link element. The value is 'radio' or 'select'. If you choose 'radio', radio buttons will be made instead of a select box.
[ Top ] $linkOrderFields =[line 423] An array of the default fields to order records by when creating a select box
[ Top ] $preDefElements =[line 482] Array of user-defined QuickForm elements that will be used for the fieldmatching the array key. If no match is found, the element for that field will be auto-generated. Make your element objects either in the preGenerateForm() method or in the getForm() method. Use HTML_QuickForm::createElement() to do this. If you wish to put in a group of elements in place of a single element, you can put an array in preDefElements instead of a single element. The name of the group will be the name of the replaced element.
[ Top ] $preDefGroups =[line 461] Array of groups to put certain elements in. The key is an element name, the value is the group to put the element in.
[ Top ] $preDefOrder =[line 469] Indexed array of element names. If defined, this will determine the order in which the form elements are being created. This is useful if you're using QuickForm's default renderer or dynamic templates and the order of the fields in the database doesn't match your needs.
[ Top ] $requiredRuleMessage = 'The field %s is required.'[line 351] Text that is displayed as an error message if a required field is left empty. Use %s to insert the field name.
[ Top ] $ruleViolationMessage = '%s: The value you have entered is not valid.'[line 342] Text that is displayed as an error message if a validation rule is violated by the user's input. Use %s to insert the field name.
[ Top ] $selectAddEmpty =[line 489] An array of the link fields which should have an empty option added to the select box. This is only a valid option for fields which link to another table.
[ Top ] $submitText = 'Submit'[line 428] Text for submit button
[ Top ] $textFields = array()[line 505] A simple array of field names indicating which of the fields in a particular table/class are actually to be treated as textareas. This is an unfortunate workaround that is neccessary because the DataObject generator script does not make a difference between any other datatypes than string and integer.When it does, this can be dropped.
[ Top ] $timeFields = array()[line 523] A simple array of field names indicating which of the fields in a particular table/class are actually to be treated time fields. This is an unfortunate workaround that is neccessary because the DataObject generator script does not make a difference between any other datatypes than string and integer.When it does, this can be dropped.
[ Top ] $tripleLinks =[line 604] Holds triple link data.The tripleLinks array can be used to display checkboxes for "triple-links". A triple link is set up with a table which links to three different tables. These will show up as a table of checkboxes The initial setting (table) is the same as for crossLinks. The field configuration keys (if you need them) are:
[ Top ] $userEditableFields =[line 455] Array of fields which the user can edit. If a field is rendered but not specified in this array, it will be frozen. Ignored if not given.
[ Top ] $validateOnProcess = false[line 362] If set to TRUE, the current DataObject's validate method is being called before the form data is processed. If errors occur, no insert/update operation will be made on the database. Use getValidationErrors() to retrieve the reasons for a failure.Defaults to FALSE.
[ Top ] $_appendForm = false[line 312] If false, FormBuilder will use the form object from $_form as a basis for the new form: It will just add elements to the existing form object, not generate a new one.If true, FormBuilder will generate a new form object, create all elements as needed for the given DataObject, then strip the elements from the exiting form object in $_form and add it to the newly generated form object.
[ Top ] $_form = false[line 287] If you want to use the generator on an existing form object, pass it to the factory method within the options array, element name: 'form' (who would have guessed?)
[ Top ] $_queryType = DB_DATAOBJECT_FORMBUILDER_QUERY_AUTODETECT[line 301] Used to determine which action to perform with the submitted data in processForm()
[ Top ] $_validationErrors = false[line 294] Contains the last validation errors, if validation checking is enabled.
[ Top ] Method DetailDB_DataObject_FormBuilder (Constructor) [line 667]
DB_DataObject_FormBuilder::DB_DataObject_FormBuilder() The class constructor.
Parameters:
[ Top ]
create [line 638]
DB_DataObject_FormBuilder::create() Factory method. As this is meant as an abstract class, it is the only supported method to make a new object instance. Pass the DataObject-derived class you want to build a form from as the first parameter. Use the second to pass additional options. Options can be:
Currently available driver classes:
Parameters:
[ Top ]
debug [line 2036]
DB_DataObject_FormBuilder::debug() Outputs a debug message, if the debug setting in the DataObject.ini file is set to 1 or higher.
Parameters:
[ Top ]
forceQueryType [line 2010]
DB_DataObject_FormBuilder::forceQueryType() You can force the behaviour of the processForm() method by passing one of the following constants to this method:
Parameters:
[ Top ]
getDataObjectSelectDisplayValue [line 1335]
DB_DataObject_FormBuilder::getDataObjectSelectDisplayValue() Returns a string which identitfies this dataobject. If multiple display fields are given, will display them all seperated by ", ". If a display field is a foreign key (link) the display value for the record it points to will be used. (Its display value will be surrounded by parenthesis as it may have multiple display fields of its own.) Will use display field configurations from these locations, in this order:
Parameters:
[ Top ]
getFieldLabel [line 1306]
DB_DataObject_FormBuilder::getFieldLabel() Returns the label for the given field name. If no label is specified, the fieldname will be returned with ucfirst() applied.
Parameters:
[ Top ]
getForm [line 1522]
DB_DataObject_FormBuilder::getForm() Returns a HTML form that was automagically created by _generateForm(). You need to use the get() method before calling this one in order to prefill the form with the retrieved data. If you have a method named "preGenerateForm()" in your DataObject-derived class, it will be called before _generateForm(). This way, you can create your own elements there and add them to the "fb_preDefElements" property, so they will not be auto-generated. If you have your own "getForm()" method in your class, it will be called instead of _generateForm(). This enables you to have some classes that make their own forms completely from scratch, without any auto-generation. Use this for highly complex forms. Your getForm() method needs to return the complete HTML_QuickForm object by reference. If you have a method named "postGenerateForm()" in your DataObject-derived class, it will be called after _generateForm(). This allows you to remove some elements that have been auto-generated from table fields but that you don't want in the form. Many ways lead to rome.
Parameters:
[ Top ]
getSelectOptions [line 1388]
DB_DataObject_FormBuilder::getSelectOptions() Returns an array of options for use with the HTML_QuickForm "select" element. It will try to fetch all related objects (if any) for the given field name and build the array. For the display name of the option, it will try to use the settings in the database.formBuilder.ini file. If those are not found, the linked object's property "fb_linkDisplayFields". If that one is not present, it will try to use the global configuration setting "linkDisplayFields". Can also be called with a second parameter containing the name of the display field - this will override all other settings. Same goes for "linkOrderFields", which determines the field name used for sorting the option elements. If neither a config setting nor a class property of that name is set, the display field name will be used.
Parameters:
[ Top ]
getValidationErrors [line 1737]
DB_DataObject_FormBuilder::getValidationErrors() Returns errors from data validation. If errors have occured, this will be an array with the fields that have errors, otherwise a boolean.
[ Top ]
populateOptions [line 1484]
DB_DataObject_FormBuilder::populateOptions() Populates public member vars with fb_ equivalents in the DataObject. [ Top ]
processForm [line 1783]
DB_DataObject_FormBuilder::processForm() This will take the submitted form data and put it back into the object's properties. If the primary key is not set or NULL, it will be assumed that you wish to insert a new element into the database, so DataObject's insert() method is invoked. Otherwise, an update() will be performed. <b>Careful:</b> If you're using natural keys or cross-referencing tables where you don't have
one dedicated primary key, this will always assume that you want to do an update! As there
won't be a matching entry in the table, no action will be performed at all - the reason
for this behaviour can be very hard to detect. Thus, if you have such a situation in one
of your tables, simply override this method so that instead of the key check it will try
to do a SELECT on the table using the current settings. If a match is found, do an update.
If not, do an insert. This method is perfect for use with QuickForm's process method. Example: If you wish to enforce a special type of query, use the forceQueryType() method. Always remember to pass your objects by reference - otherwise, if the operation was an insert, the primary key won't get updated with the new database ID because processForm() was using a local copy of the object! If a method named "preProcessForm()" exists in your derived class, it will be called before processForm() starts doing its magic. The data that has been submitted by the form will be passed to that method as a parameter. Same goes for a method named "postProcessForm()", with the only difference - you might have guessed this by now - that it's called after the insert/update operations have been done. Use this for filtering data, notifying users of changes etc.pp. ...
Parameters:
[ Top ]
useForm [line 1283]
DB_DataObject_FormBuilder::useForm() Sometimes, it might come in handy not just to create a new QuickForm object, but to work with an existing one. Using FormBuilder together with HTML_QuickForm_Controller or HTML_QuickForm_Page is such an example ;-) If you do not call this method before the form is generated, a new QuickForm object will be created (default behaviour).
Parameters:
[ Top ]
validateData [line 1721]
DB_DataObject_FormBuilder::validateData() Makes a call to the current DataObject's validate() method and returns the result.
[ Top ]
_array2date [line 1691]
DB_DataObject_FormBuilder::_array2date() Takes a date array as used by the QuickForm date element and turns it back into a string representation suitable for use with a database date field (format 'YYYY-MM-DD'). If second parameter is true, it will return a unix timestamp instead. //FRANK: Not at this point it wont Beware: For the date conversion to work, you must at least use the letters "d", "m" and "Y" in your format string (see "dateElementFormat" option). If you want to enter a time as well, you will have to use "H", "i" and "s" as well. Other letters will not work! Exception: You can also use "M" instead of "m" if you want plain text month names.
Parameters:
[ Top ]
_date2array [line 1640]
DB_DataObject_FormBuilder::_date2array() Takes a string representing a date or a unix timestamp and turns it into an array suitable for use with the QuickForm data element. When using a string, make sure the format can be handled by the PEAR::Date constructor! Beware: For the date conversion to work, you must at least use the letters "d", "m" and "Y" in your format string (see "dateElementFormat" option). If you want to enter a time as well, you will have to use "H", "i" and "s" as well. Other letters will not work! Exception: You can also use "M" instead of "m" if you want plain text month names.
Parameters:
[ Top ]
_explodeArrString [line 1195]
DB_DataObject_FormBuilder::_exlplodeArrString() Internal method, will convert string representations of arrays as used in .ini files to real arrays. String format example: key1:value1,key2:value2,key3:value3,...
Parameters:
[ Top ]
_generateForm [line 777]
DB_DataObject_FormBuilder::_generateForm() Builds a simple HTML form for the current DataObject. Internal function, called by the public getForm() method. You can override this in child classes if needed, but it's also possible to leave this as it is and just override the getForm() method to simply fine-tune the auto-generated form object (i.e. add/remove elements, alter options, add/remove rules etc.). If a key with the same name as the current field is found in the fb_preDefElements property, the QuickForm element object contained in that array will be used instead of auto-generating a new one. This allows for complete step-by-step customizing of your forms. Note for date fields: HTML_QuickForm allows passing of an options array to the HTML_QuickForm_date element. You can define your own options array for date elements in your DataObject-derived classes by defining a method "dateOptions($fieldName)". FormBuilder will call that method whenever it encounters a date field and expects to get back a valid options array.
Parameters:
[ Top ]
_getSelectOptions [line 1420]
Internal function to get the select potions for a table.
Parameters:
[ Top ]
_reorderElements [line 1224]
DB_DataObject_FormBuilder::_reorderElements() Changes the order in which elements are being processed, so that you can use QuickForm's default renderer or dynamic templates without being dependent on the field order in the database. Make a class property named "fb_preDefOrder" in your DataObject-derived classes which contains an array with the correct element order to use this feature.
[ Top ]
Documentation generated on Mon, 11 Mar 2019 13:57:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004. |