Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Grey: "We're a two-person company, it's just me an my wife. I'm the technical guru, and she handles the business operations. I have to know a lot about MySQL, but that's much too technical for her. I have frequently had to setup CGI scripts (I code in Perl) so she can manage some of our tables (suppliers, manufacturers, etc).

I discovered PHP Generator a couple of days ago, tried the free version,and within a few hours I had purchased the Pro version (as well as SQL Maestro for MySQL).

Today I am completing the conversion of the last of my custom table managers to PHP Generator. This is eliminating several thousand lines of code that I don't have to support any more!

Thanks for this fantastic product".

Kirby Foster: "Nice software. Small, lightweight, works well. I evaluated lots of software before deciding that your software worked the best for what I do. Both Maestro for MySQL and PHP Generator have saved me lots of time".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

OnGetCustomFormLayout

This event allows you to customize the layout for View, Edit, and Insert forms. Live Demo. Video Tutorial.

 

Signature:

function OnGetCustomFormLayout($mode, FixedKeysArray $columns,

                               FormLayout $layout)      

 

Parameters

$mode

The form mode. Possible values are "edit", "inline_edit", "insert", "inline_insert", and "view".

$columns

The associative array of columns displayed in the form.

$layout

An instance of the FormLayout class.

 

 

Layout structure

The layout has the following hierarchical structure: layout -> groups -> rows -> columns. This means you can add groups to the layout, rows to groups, and columns to rows.

 

Layout mode

By default all forms are horizontal i.e. the control label is placed on the left of the editor (for vertical forms the label is placed on the top of the editor). To create a vertical form, use the following call:

 

$layout->setMode(FormLayoutMode::VERTICAL);

 

Adding a group

To add a new group to the layout, use the addGroup method of the FormLayout class:

 

function addGroup($name = null, $width = 12);

 

This function returns an instance of the FormLayoutGroup class that can be later used to add rows to the new group (see below). Width is provided in relative units, possible values are integers from 1 to 12.

 

Adding rows to a group

To add a new row to a group, use the addRow method of the FormLayoutGroup class (see above):

 

function addRow();

 

This function has no parameters and returns an instance of the FormLayoutRow class that can be later used to add controls to the new row (see below).

 

Adding controls to a row

To add a new control to a row, use the addCol method of the FormLayoutRow class (see above):

 

function addCol($column, $inputWidth = null, $labelWidth = null);

 

This function also returns an instance of the FormLayoutRow class to allow method chaining. Here $column is an element of the $columns array and $inputWidth and $labelWidth are relative widths of the editor and its label accordingly ($labelWidth can be used only for horizontal forms).

 

Examples

All the examples below can be seen live in our Feature Demo.

 

Example 1

This example shows how to create a simple group with 2 rows and 2 controls in each row (all controls have equal width):

 

$displayGroup = $layout->addGroup('Display');

$displayGroup->addRow()

    ->addCol($columns['display_type'], 6)

    ->addCol($columns['display_size'], 6);

$displayGroup->addRow()

    ->addCol($columns['display_resolution_x'], 6)

    ->addCol($columns['display_resolution_y'], 6);

 

Example 2

This example shows how to create a group and place 3 editors in the same row:

 

$storageGroup = $layout->addGroup('Storage', 12);

$storageGroup->addRow()

    ->addCol($columns['storage_min'], 4)

    ->addCol($columns['storage_max'], 4)

    ->addCol($columns['storage_external'], 4);

 

Example 3

This example shows how it is possible to place 2 groups in a row:

 

$hardwareGroup = $layout->addGroup('Hardware', 6);

$hardwareGroup->addRow()->addCol($columns['chipset'], 12);

$hardwareGroup->addRow()->addCol($columns['cpu'], 12);

$hardwareGroup->addRow()->addCol($columns['gpu'], 12);

 

$softwareGroup = $layout->addGroup('Software', 6);

$softwareGroup->addRow()->addCol($columns['os_basic'], 12);

$softwareGroup->addRow()->addCol($columns['os_upgradable'], 12);

$softwareGroup->addRow()->addCol($columns['web_browser'], 12);



Prev Return to chapter overview Next