Quick Start

  1. Set up your database
  2. Install DB_DataObject_FormBuilder_Frontend and all of its required packages
  3. Set up DB_DataObject
  4. Run this simple script:
require_once('Pearified/DB/DataObject/FormBuilder/Frontend.php');
$frontend = new DB_DataObject_FormBuilder_Frontend();
$frontend->display();

Query Parameters

Query parameters are set manually in each controller and each sub-controller has its parent controller's parameters merged into it. This allows sub-controllers to

  • Create links that take into account their parents' parameters (database and table for instance for DB_DataObject_FormBuilder_Frontend)
  • Create links that go back to parent controllers

Configuration options

First and foremost, any FormBuilder options set up the the DataObjects will be automatically used when creating editing forms for the records.

Table display names

To set the names of the tables in the table list to something other than the bare table name, set the fb_formHeaderText property in the DataObject classes or the formHeaderText option in the formbuilder options below.

Overriding FormBuilder options

For the whole package

You can override the FormBuilder options in any table overall for the entire package.

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend', 'options');
$options = array(
    'tableOptions' => array(
             'movie' => array(
                'fbOptions' => array(
                    'fieldsToRender' => array('title', 'genre_id', 'enumTest'),
                    'userEditableFields' => array('title'),
                    'fieldsRequired' => array('enumTest'),
                    'selectAddEmpty' => array('enumTest'),
                    'excludeFromAutoRules' => array('genre_id'),
                    ),
              ),
     ),
 );

Per controller

You can also set these options per-controller:

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend_editrecord', 'options');
$options = array(
    'tableOptions' => array(
             'movie' => array(
                'fbOptions' => array(
                    'fieldsToRender' => array('title', 'genre_id', 'notes'),
                    'userEditableFields' => array('title', 'genre_id'),
                    ),
              ),
     ),
 );

Setting options

Any Controller option can be set either globally in the controller options or in the table options for a specific table. These options can also be set in either the Controller's specific options or in the main controller's options. Options set in the current controller's options array take precedence over options set in the main controller. Options set in tableOptions take precedence over global controller options.

Frontend options

These options are for the main Frontend controller.

'regenerate' allows you to turn off the schema regeneration feature.

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend', 'options');
$options = array('regenerate' => false);

'linkToTables' allows you to turn off the display of tables the current table links to (affects ShowTable and EditRecord). 'linkFromTables' allows you to turn off the display of tables the current table is linked from (affects ShowTable and EditRecord).

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend', 'options');
$options = array('linkFromTables' => false,
                 'linkToTables' => false);

You can also set 'linkFromTables' and 'linkToTables' to arrays to list the tables that are allowed to show up.

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend', 'options');
$options = array('linkFromTables' => array('movie', 'music'),
                 'linkToTables' => array('genre'));

ChooseTable options

'tablesToList' is an array of tables which will be listed.

ShowTable options

The ShowTable also has four extra options which can be set per-table. 'fields' can be set to set the fields to be displayed as columns in the DataGrid. 'edit' can be set to false to remove record editing. 'delete' can be set to false to remove record deletion. 'add' can be set to false to remove record addition.

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend_showtable', 'options');
$options = array(
    'tableOptions' => array(
             'movie' => array(
                'edit' => false,
                'fields' => array('title', 'genre_id', 'notes'),
              ),
             'genre' => array(
                'delete' => false,
                'add' => false,
              ),
     ),
 );

'linkToTables' and 'linkFromTables' can also be set here (see the Frontend configuration options). If set for this controller, it will override any setting set for Frontend.

DeleteRecords options

You can set 'deleteRecursive' to false to disallow recursive deletion.

$options =& PEAR::getStaticProperty('db_dataobject_formbuilder_frontend_deleterecords', 'options');
$options = array(
    //disables for all tables
    'deleteRecursive' => false,
    'tableOptions' => array(
             'movie' => array(
                //enables for only movie table
                'deleteRecursive' => true,
              ),
     ),
 );

EditRecord options

'linkToTables' and 'linkFromTables' can also be set here (see the Frontend configuration options). If set for this controller, it will override any setting set for Frontend.

AddRecord options

Setting 'createAnother' to false will turn off the ability to create multiple records in a row.

 
pear/db_dataobject_formbuilder_frontend/documentation.txt · Last modified: 2008/09/16 11:49 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki