Sie sind auf Seite 1von 129

Copyright 2002-2013 SQL Maestro Group

User's guide
PHP Generator for MySQL
PHP Generator for MySQL Help I
2013 SQL Maestro Group
Table of Contents
Foreword 0
I Welcome to PHP Generator for MySQL 1
................................................................................................................................... 2 1 System Requirements
................................................................................................................................... 3 2 Installation
................................................................................................................................... 4 3 How can I purchase PHP Generator for MySQL?
................................................................................................................................... 5 4 License Agreement
................................................................................................................................... 7 5 About SQL Maestro Group
................................................................................................................................... 10 6 What's new
II Getting started 11
................................................................................................................................... 12 1 How to connect to MySQL
................................................................................................................................... 16 2 Projects
................................................................................................................................... 17 3 Command line options
................................................................................................................................... 18 4 Report sending
................................................................................................................................... 19 5 Shortcut keys
III Configuring datasources 20
................................................................................................................................... 22 1 Tables and views
................................................................................................................................... 23 2 Custom SQL queries
IV Customizing webpages 25
................................................................................................................................... 26 1 Page Editor
.......................................................................................................................................................... 26 Columns
......................................................................................................................................................... 27 Setting a lookup editor
......................................................................................................................................................... 30 View properties
......................................................................................................................................................... 33 Edit properties
......................................................................................................................................................... 43 Multi-level autocomplete editor
......................................................................................................................................................... 49 Inline Insert and Inline Edit
......................................................................................................................................................... 50 String templates
......................................................................................................................................................... 51 Uploading files to webserver
.......................................................................................................................................................... 54 Master-Detail Presentations
.......................................................................................................................................................... 58 Events
.......................................................................................................................................................... 67 Filter
.......................................................................................................................................................... 68 Page Properties
.......................................................................................................................................................... 69 Data Partitioning
.......................................................................................................................................................... 71 RSS
................................................................................................................................... 74 2 Project Options
V Webpages appearance 76
................................................................................................................................... 79 1 Color schemes
................................................................................................................................... 80 2 Header and Footer
II Contents
II
2013 SQL Maestro Group
................................................................................................................................... 81 3 Custom CSS
................................................................................................................................... 83 4 Using templates
VI Security settings 85
................................................................................................................................... 87 1 Hard-coded authorization
................................................................................................................................... 89 2 Table-based authorization
................................................................................................................................... 91 3 Database server authorization
................................................................................................................................... 92 4 Permission manager
................................................................................................................................... 95 5 Record-level security
VII Interface language 96
VIII Common generation options 98
IX Options 100
................................................................................................................................... 101 1 Application
.......................................................................................................................................................... 101 Page
.......................................................................................................................................................... 104 Generation defaults
.......................................................................................................................................................... 105 Display formats
.......................................................................................................................................................... 106 Output
................................................................................................................................... 108 2 Editors & Viewers
.......................................................................................................................................................... 108 General
.......................................................................................................................................................... 109 Display
.......................................................................................................................................................... 110 SQL highlight
.......................................................................................................................................................... 111 XML highlight
.......................................................................................................................................................... 112 PHP highlight
.......................................................................................................................................................... 113 Code Insight
.......................................................................................................................................................... 114 Code Folding
................................................................................................................................... 116 3 Appearance
.......................................................................................................................................................... 116 Bars and menus
.......................................................................................................................................................... 117 Trees and lists
.......................................................................................................................................................... 118 Edit controls
.......................................................................................................................................................... 119 Check boxes
.......................................................................................................................................................... 120 Buttons
.......................................................................................................................................................... 121 Page controls
.......................................................................................................................................................... 122 Group boxes
.......................................................................................................................................................... 123 Splitters
Index 125
PHP Generator for MySQL Help 1
2013 SQL Maestro Group
1 Welcome to PHP Generator for MySQL
PHP Generator for MySQL is a tool for creating database-driven web applications
visually. It allows you to generate high-quality PHP scripts for working with MySQL tables,
views and queries through the web. You needn't have any programming background to
use it.
Key features:
Support for updatable SQL queries
Master-detail presentations
Event-driven content management
Client-side data validation
Custom pagination (display partitioning)
Data export to PDF, XML, CVS, Excel and Word
Support for hard-coded, table-based, and database server user authentication
Record-level security
Flexible appearance customization
Multi-language support
23
54
58
69
85
95
76
96
Welcome to PHP Generator for MySQL 2
2013 SQL Maestro Group
1.1 System Requirements
Client environment
Pentium PC or higher;
Windows NT4/2000/XP/Vista/Windows 7/Windows 8;
256 MB RAM (512 MB recommended);
15 MB of free hard disk space;
SVGA-compatible video adapter;
Internet Explorer 9 or better.
Server environment
MySQL from 3.23 to 6.0;
Linux/Unix or Windows Web Server;
PHP 5.
PHP Generator for MySQL Help 3
2013 SQL Maestro Group
1.2 Installation
To install PHP Generator for MySQL on your PC:
download the PHP Generator for MySQL distribution package from the download page
at our site;
run setup.exe from the local folder and follow the instructions of the installation
wizard;
find the PHP Generator for MySQL shortcut in the corresponding program group of
the Windows Start menu after the installation is completed.
Welcome to PHP Generator for MySQL 4
2013 SQL Maestro Group
1.3 How can I purchase PHP Generator for MySQL?
Thank you for your interest in purchasing PHP Generator for MySQL Professional!
You can select licensing options and register PHP Generator for MySQL at its on-line
order page. It is possible to purchase on-line, by fax, mail, toll-free phone call, or place
a purchase order. We send the software activation key by email within 24 hours after
completion of the order process. If you have not received the activation key within this
period, please contact our sales department.
All our products and bundles are shipped with 12 months of free upgrades (minor and
major ones) or with 36 months of free upgrades for a quite small additional fee. After this
period you may renew your license for the next 12(36) months with a 50% discount.
PHP Generator for MySQL has a free 30-day trial. Upon purchasing the product you
confirm that you have tested it and you are completely satisfied with its current version.

To obtain technical support, please visit the appropriate section on our website or
contact us by email to support@sqlmaestro.com.
PHP Generator for MySQL Help 5
2013 SQL Maestro Group
1.4 License Agreement
Notice to users: carefully read the following legal agreement. The use of the software
provided with this agreement (the "SOFTWARE") constitutes your acceptance of these
terms. If you do not agree to the terms of this agreement, do not install and/or use this
software. The use of this software is conditioned upon the user's compliance with the
terms of this agreement.
License grant. SQL Maestro Group grants you a license to use one copy of the
version of this SOFTWARE on any single hardware product for as many licenses as you
purchase. "You" means a company, an entity or an individual. "Use" means storing,
loading, installing, executing or displaying the SOFTWARE. You may not modify the
SOFTWARE or disable any licensing or control features of the SOFTWARE except as an
intended part of the SOFTWARE's programming features. This license is not
transferable to any other company, entity or individual. You may not publish any
registration information (serial numbers, registration keys, etc.) or pass it to any other
company, entity or individual.
Ownership. The SOFTWARE is owned and copyrighted by SQL Maestro Group. Your
license confers no title or ownership of the SOFTWARE and should not be construed as
a sale of any rights for the SOFTWARE.
Copyright. The SOFTWARE is protected by the United States copyright law and
international treaty provisions. You acknowledge that no title to the intellectual
property in the SOFTWARE is transferred to you. You further acknowledge that title
and full ownership rights to the SOFTWARE will remain the exclusive property of SQL
Maestro Group and you will not acquire any rights to the SOFTWARE except as
expressly set forth in this license. You agree that any copies of the SOFTWARE will
contain the same proprietary notices which appear on and in the SOFTWARE.
License and distribution. An unregistered copy of the SOFTWARE ("UNREGISTERED
SOFTWARE") may be used for evaluation purposes. The UNREGISTERED SOFTWARE
may be freely copied and distributed to other users for their evaluation. If you offer
this UNREGISTERED SOFTWARE installation package for download, then you agree to:
replace existing version of the UNREGISTERED SOFTWARE installation package with the
new package immediately after a new version of the SOFTWARE is released by SQL
Maestro Group, or
delete an obsolete version of the UNREGISTERED SOFTWARE installation package
immediately upon written email notice by SQL Maestro Group.
A registered copy of the SOFTWARE ("REGISTERED SOFTWARE") allows you to use the
SOFTWARE only on a single computer and only by a single user at a time. If you wish to
use the SOFTWARE for more than one user, you will need a separate license for each
individual user. You are allowed to make one copy of the REGISTERED SOFTWARE for
back-up purposes.
Reverse engineering. You affirm that you will not attempt to reverse compile,
modify, translate, or disassemble the SOFTWARE in whole or in part.
Unauthorized use. You may not use, copy, rent, lease, sell, modify, decompile,
disassemble, otherwise reverse engineer, or transfer the SOFTWARE except as
provided in this agreement. Any such unauthorized use shall result in immediate and
Welcome to PHP Generator for MySQL 6
2013 SQL Maestro Group
automatic termination of this license.
No other warranties. SQL Maestro Group does not warrant that the SOFTWARE is
error-free. SQL Maestro Group disclaims all other warranties with respect to the
SOFTWARE, either express or implied, including but not limited to implied warranties of
merchantability, fitness for a particular purpose and noninfringement of third party
rights. Some jurisdictions do not allow the exclusion of implied warranties or limitations
on how long an implied warranty may last, or the exclusion or limitation of incidental or
consequential damages, so the above given limitations or exclusions may not apply to
you. This warranty gives you specific legal rights and you may also have other rights
which vary from jurisdiction to jurisdiction.
Limited warranty. This SOFTWARE is provided on an "AS IS" basis. SQL Maestro
Group disclaims all warranties relating to this SOFTWARE, whether expressed or
implied, including but not limited to any implied warranties of merchantability or fitness
for a particular purpose. Neither SQL Maestro Group nor anyone else who has been
involved in the creation, production, or delivery of this SOFTWARE shall be liable for
any indirect, consequential, or incidental damages arising out of the use or inability to
use such SOFTWARE, even if SQL Maestro Group has been advised of the possibility of
such damages or claims. The person using the SOFTWARE bears all risk as to the
quality and performance of the SOFTWARE.
Some jurisdictions do not allow limitation or exclusion of incidental or consequential
damages, so the above given limitations or exclusion may not apply to you to the extent
that liability is by law incapable of exclusion or restriction.
Severability. In the event of invalidity of any provision of this license, the parties
agree that such invalidity shall not affect the validity of the remaining portions of this
license.
No liability for consequential damages. In no event shall SQL Maestro Group or its
suppliers be liable to you for any consequential, special, incidental or indirect damages
of any kind arising out of the delivery, performance or use of the SOFTWARE, even if
SQL Maestro Group has been advised of the possibility of such damages. In no event
will SQL Maestro Group's liability for any claim, whether in contract, tort or any other
theory of liability, exceed the license fee paid by you, if any.
Entire agreement. This is the entire agreement between you and SQL Maestro Group
which supersedes any prior agreement or understanding, whether written or oral,
relating to the subject matter of this license.
Reserved rights. All rights not expressly granted here are reserved to SQL Maestro
Group.
PHP Generator for MySQL Help 7
2013 SQL Maestro Group
1.5 About SQL Maestro Group
SQL Maestro Group is a privately-held company producing high-quality software for
database administrators and developers. The united team of eminently qualified
developers is pleased to create new software products for commercial, academic and
government customers worldwide. We do our best to design and develop products that
remove complexity, improve productivity, compress time frames, and increase database
performance and availability. We are glad to realize that our products take usual chores
upon themselves, so that our customers could have more time left for their creative work.
The company was founded in 2002 as an essential partner for every business that is
trying to harness the explosive growth in corporate data. SQL Maestro Group employs an
international team concentrating their efforts on cutting-edge DBA tools development.
The slogan of our company is The Shortest Path to SQL. It is aimed to denote that we
set to create easy-to-use products meant for those who appreciate comfort, friendly
program interface and support when working with SQL servers.
We are pleased to facilitate your job.
We aim at being of considerable assistance to our clients.
We feel contented doing our beloved work.
At present, our company offers a series of Windows GUI admin tools for SQL
management, control and development of the following servers: MySQL, Microsoft SQL
Server, PostgreSQL, Oracle, SQL Anywhere, DB2, SQLite, Firebird, and MaxDB. We
also produce universal tools to be used for administering any database engine accessible
via ODBC driver or OLE DB provider. Such products may be the clear-cut decision for
those who constantly work with several database servers.
SQL Maestro is the premier Windows GUI admin
tool for database development, management, and
control.
It provides you with the ability to perform all the
necessary database operations such as creating,
editing, copying, extracting and dropping database
objects; moreover, you can build queries visually,
execute queries and SQL scripts, view and edit
data including BLOBs, represent data as diagrams,
export and import data to/from most popular file
formats, manage users and their privileges (if
possible), and use a lot of other tools designed for
making your work with your server comfortable and
efficient.
Welcome to PHP Generator for MySQL 8
2013 SQL Maestro Group
SQL PHP Generator is a powerful tool for creating
database-driven web applications visually. It allows
you to generate high-quality PHP scripts for
working with tables, views and queries through the
web. You needn't have any programming
background to use it.
SQL Data Wizard is a high-capacity Windows GUI
utility for managing your data.
It provides you with a number of easy-to-use
wizards for performing the required data
manipulation easily and quickly.The tool allows you
to convert any ADO-compatible database to the
Oracle database, export data from Oracle tables
and queries to most popular formats, import data
into the tables, and generate ASP.NET scripts for
the selected tables and queries.
SQL Code Factory is a premier GUI tool aimed at
the SQL queries and scripts development.
It allows you to manage SQL queries and scripts
using such useful features as code folding, code
completion and syntax highlighting, build query
visually, execute several queries at a time, execute
scripts from files, view and edit result data with
filtering, sorting and grouping abilities, export data
to as many as 14 file formats including Excel, RTF
and HTML, import data from Excel, CSV, XML and
text files, view and edit BLOBs in various way, build
diagrams based on Oracle data, and much more.
Service Center for MySQL is a multi-functional
Windows GUI utility for MySQL server maintenance
and data reservation.
It allows you to create tasks for backing your data
into a script, restoring data from a script,
analyzing, checking, repairing and optimizing
database tables. In addition to these functions,
Service Center for MySQL provides you with a
powerful task scheduler, an ability of using
scenarios and other useful features.
The software products are constantly optimized for the latest server versions support.
You can use the following contact information if necessary:
Our web-site www.sqlmaestro.com
Postal address: SQL Maestro Group
PHP Generator for MySQL Help 9
2013 SQL Maestro Group
140 Broadway, Suite 706
New York City, New York 10005
United States
Thank you for your interest to our company!
Welcome to PHP Generator for MySQL 10
2013 SQL Maestro Group
1.6 What's new
Please find out the latest PHP Generator for MySQL news at http://www.sqlmaestro.
com/products/mysql/phpgenerator/news/
PHP Generator for MySQL Help 11
2013 SQL Maestro Group
2 Getting started
To create a database-driven web application,
Connect to the database you want to work through the web;
Configure datasources to be available;
Customize data grids represented on web pages to be created;
Set other generation options such as webpages appearance and interface
language ;
Specify security settings to protect your data from an unauthorized access.

PHP Generator for MySQL allows you to save and restore all the options set during a
session. All the session parameters may be saved and loaded to/from a project file.
Loaded settings may be edited if necessary. To run a wizard with a project, follow
More... > Load Project on the first wizard step and enter the name of the project file,
recently used projects are also available from this popup menu. Find out more about
working with Projects .
12
20
25
98 76
96
85
16
Getting started 12
2013 SQL Maestro Group
2.1 How to connect to MySQL
Connection properties
Set the connection parameters for the database you want the PHP scripts to work with.
Script connection properties
Specify here connection parameters for MySQL server relatively to the webserver. For
example, if your webserver and MySQL server are installed on the same computer, set Host
as localhost.
PHP Generator for MySQL allows you to connect to MySQL servers directly, via Secure
SHell (SSH) tunnel or HTTP tunnel.
Direct connection
It is the most natural and the most preferable connection mode. Use it each time it is
possible. Most of hosting companies allow direct connections to databases. However in
most cases you have to go to your control panel and add your home/office computer
IP address or domain name to Access List - list of IP addresses allowed accessing from
outside.
SSH tunnel connection
If your MySQL server does not allow direct connections from your remote
workstations, you can establish connection to an allowed intermediate SSH server and
forward all MySQL commands through the Secure SHell (SSH) tunnel.
More about SSH tunnel connection
To establish connection to intermediate SSH server and forward all MySQL
commands through the secure tunnel, you need to:
1. Check I can connect to the server directly or via SSH tunneling.
2. Follow the Configure SSH options link to open the SSH Options window.
PHP Generator for MySQL Help 13
2013 SQL Maestro Group
3. Check Connect through the Secure Shell (SSH) tunnel and complete the
following fields:
Host name
Specify the host name or IP of your site. Note, that MySQL host name
always should be set relatively to the SSH server. For example, if both of
MySQL and SSH servers are located on the same computer, you should
specify localhost as Host name instead of server's external host name or IP
address.
Port number
Enter the port number for the SSH server.
4. Enter valid User name for the remote server and select the Authentication
method and set corresponding credentials.
Password-based
Set the password corresponding to the specified user.
Key-based
Specify the path to the Private key file with the corresponding Passphrase to
log in to the remote server.
Keyboard interactive
Keyboard authentication is the advanced form of password authentication,
aimed specifically at the human operator as a client. During keyboard
authentication zero or more prompts (questions) is presented to the user.
The user should give the answer to each prompt (question). The number and
Getting started 14
2013 SQL Maestro Group
contents of the questions are virtually not limited, so certain types of
automated logins are also possible.
HTTP tunnel connection
HTTP tunneling is a technique used in conditions of restricted network connectivity
including firewalled networks, networks behind proxy servers, and NATs. It is the
slowest way and is recommended to use if the others are impossible.
More about connection via HTTP tunnel
To connect to a remote server using an HTTP tunnel, you need to:
1. Upload the connection PHP script to your website. The script is named mysql_tunnel.
php and can be found under the installation folder, usually C:\Program Files\SQL
Maestro Group\PHP Generator for MySQL.
2. Select the I have to use HTTP tunneling radio button.
3. Enter the connection PHP script URL, e.g. www.yoursite.com/files/mysql_tunnel.php.
You can test the connection before the profile is created. Just use Test script using
default browser to open connection script in your browser, enter all the required
connection parameters and use the Test connection button.
4. In case using of a proxy server use Configure tunnelling options to open the HTTP
tunnelling options window and specify your proxy server connection parameters and
HTTP authentication.
Note: You are actually connecting to your database through the PHP script on the
server, so in most cases the host/server name is "localhost" unless the target server is
not installed on the same server as the Web server.
PHP Generator for MySQL Help 15
2013 SQL Maestro Group
Irrespectively of a connection mode you should specify common credentials as follows:
Host
The host name of the MySQL server.
Port number
The TCP/IP port to use if server is not localhost.
User name
The username used to connect to MySQL.
Password
The password for the user account on server.
Getting started 16
2013 SQL Maestro Group
2.2 Projects
PHP Generator for MySQL allows you to save and restore all the options set during a
session. You need not to specify all options each time you work with the application
anew; instead you can load all settings from a project and change them if necessary.
Projects are very useful when working with PHP Generator. If you will close the
application without saving a project, all carefully adjusted settings will be lost. To set
the same options next time, you'll need to repeat the process step by step again while
with a project all the session parameters can be restored in a few mouse clicks.
To create a project, configure datasources and click More > Save Project at any next
step (Ctrl+S) or More > Save Project as... (Ctrl+Shift+S). All the settings you have
made will be saved to a file.
To restore previously saved settings from a project, click More > Load Project at the
first wizard step. Recently used projects are available from the More > Recent Projects
popup menu.
PHP Generator for MySQL Help 17
2013 SQL Maestro Group
2.3 Command line options
PHP Generator for MySQL supports a number of command line options that make it
possible to fully automate PHP scripts creation. To generate the command line
automatically, load the project to be used or specify the generation options manually
and click More > Generate command line. The Command Line Builder allows you to save
the prepared line to clipboard or to a batch file.
The PHP Generator for MySQL command line syntax is as follows:
MyPHPGenerator[.exe] [<project_file_name>] [-o|output <output_directory>] [-
g|generate] [-h|help]
MyPHPGenerator[.exe]
The PHP Generator for MySQL program file.
<project_file_name>
The project with all the task's settings.
<output_directory> A directory where file are generated to.
-g|generate Generate without running the GUI application.
-h|help Show help information.
Examples
The examples below assume that you are entering the command lines in the PHP
Generator for MySQL program directory. Don't forget to enclose all paths and filenames
containing spaces in quotes.
myphpgenerator "C:\Templates\PHP_GENERATOR\MySQL\NBA_db.pgtm"
fbphpgenerator "C:\Templates\PHP_GENERATOR\Firebird\online_store.pgtf" -g -o
"C:\webserver\localhost"
16
Getting started 18
2013 SQL Maestro Group
2.4 Report sending
To send a report to SQL Maestro support team, use the corresponding PHP Generator for
MySQL feature. To invoke the window, click More > Send report... .
Check the corresponding options to include project file, schema, and specified number of
the table records, add the problem description and click Send record to get the prepared
report in your default email client. In case you have no browser installed save the
prepared report to a file with the corresponding option and send it manually to
support@sqlmaestro.com as email attachment.
PHP Generator for MySQL Help 19
2013 SQL Maestro Group
2.5 Shortcut keys
The following table describes the default shortcut keys in PHP Generator for MySQL.
Interface
Load project Ctrl+O
Save project Ctrl+S
Save project as... Ctrl+Shift+S
Next step Shift+N
Previous step Shift+B
Generate PHP scripts Shift+R
Exit Alt+F4
PHP Generator for MySQL help Shift+H
Configuring datasources 20
2013 SQL Maestro Group
3 Configuring datasources
PHP Generator for MySQL creates webpages aimed at interaction with MySQL tables,
views, and queries throw the web, so the number of generated webpage is equal to the
number of specified data objects.
Adding tables and views
To add a table or a view, open the Select object window with the corresponding
button.
Adding queries
To add a query, type the query text in the Query editor or load it from .sql file with
More > Load query from file... Moreover you can use queries stored a single .qrp file
(query repository). This feature may be extremely useful if you need to share a set of
the same queries between several different projects. To save/load queries to/from a
single file, use More > Save all queries as repository / Load query repository items from
the More button menu accordingly.
Primary keys
The wizard automatically inspects all data objects for unique identifiers that are
necessary for add, edit, and delete operations. It marks objects without primary key
constraints with No key columns label and asks a confirmation on moving to the next
step. It's recommended to specify a single column or a set of columns that uniquely
identifies each record in the view/query to expedite the work of the generated
application. It's optional but preferable.
Invalid queries
The wizard also automatically validates data objects. The Objects list displays the
names of invalid queries in red. Occasionally a valid SQL query that runs well is displayed
by PHP Generator for MySQL as invalid. This happens because the tool validates the
specified query with a query like this:
select * from
(
YOUR_SPECIFIED_QUERY_TEXT
) tb_alias
So SQL queries that contains the * sign or columns with the same names.
22
23
PHP Generator for MySQL Help 21
2013 SQL Maestro Group

By default, each script has settings defined by the application options . Of course,
you can change them later, but it's useful to setup the generation rules in accordance
with settings of the most webpages to reduce further adjustments.
101
Configuring datasources 22
2013 SQL Maestro Group
3.1 Tables and views
To specify source database objects for working through the web, pick the objects in the
Select objects tab. To choose several objects at a time, select them using Ctrl and
Shift keys, then click Mark selected.

PHP Generator for MySQL Help 23
2013 SQL Maestro Group
3.2 Custom SQL queries
To add a query within the editor, use the Create Query button or select the
corresponding popup menu item, then type the query name and text, and click OK.


Creating updatable datasets (For Professional Edition Only)
To get an updatable dataset based on an SQL query, you have to provide up to three
SQL queries: UPDATE, INSERT, and DELETE to be able to modify, add and remove
records accordingly. The first query provides an UPDATE statement for modifying existing
records; the second query provides an INSERT statement to add a new record to the
tables; and the third one provides a DELETE statement to remove the records. Each of
these queries can contain several parameterized statements that use parameters like :
field_name.
Example
Assume that we have the following SELECT statement:
SELECT
id,
Configuring datasources 24
2013 SQL Maestro Group
first_name,
last_name
FROM customer
WHERE last_name LIKE 'A%'
To create an updatable dataset based on this query, INSERT, UPDATE and DELETE
statements can be specified as follows:
INSERT INTO
customer
VALUES (:id, :first_name, :last_name);
UPDATE customer
SET id = :id,
first_name = :first_name,
last_name = :last_name
WHERE id = :OLD_id;
DELETE FROM customer
WHERE id = :id;
PHP Generator for MySQL Help 25
2013 SQL Maestro Group
4 Customizing webpages
Pages
This tab contains the list of webpages to be created. Each page is based on a
datasource defined on previous steps and is created with default settings defined by the
application options . Use the Edit button to edit settings of a concrete webpage with
the Page editor . To exclude a webpage from the navigation menu of generated
pages, uncheck the Include into menu option. Note, that the pages will be displayed at
the navigation menu on the generated pages in the same order as they are disposed in
the grid. To reorder the webpages, use the corresponding link of the popup menu. The
Reset and Reset all buttons allow you to setup webpages properties according to the
generation rules .
Details
This tab contains detail presentations for the page selected at the Pages tab. The
detail presentations are created according to the master-detail relationships (if Setup
details by foreign key option is enabled). Use the Reset and Reset all buttons to
setup detail pages properties according to the project options .
Project Options
To specify default setting to be applied to each generated page, follow the Setup
project options to configure default page settings link. This properties may be edited for
the concrete page within the Page Properties window.

101
26
104
54
104
74
74
68
Customizing webpages 26
2013 SQL Maestro Group
4.1 Page Editor
Columns
Use this tab to setup columns to be included into the result pages (List, View, Edit,
Insert, etc.), column captions, data representation on viewing and editing, lookup
options and more.
Details
Use this tab to adjust the page detail presentations and setup detail pages properties.
Events
Set here the fragments of PHP code to be executed before or after a record was added,
edited, deleted, etc.
Filter
Use this tab to reduce the number of records available at the generated page.
Use the Page Properties window to setup common page properties such as view/edit/
delete/filter/export abilities, pagination options, page header, and more.
The Data Partitioning wizard allows you to create a custom pagination i.e. split the
records on the generated page by a specified criteria.
4.1.1 Columns
For each datasource PHP Generator for MySQL creates a bunch of presentations: the
List presentation (data grid), the View presentation (on a record viewing), the Edit
presentation (on a record editing), etc. The Columns tab of Page Editor allows you to
adjust the presentations' appearance.
The General tab allows you to configure column properties for all the presentations. The
properties for a concrete presentation can be specified at the corresponding tab.
Include/exclude columns to/from a concrete presentation (List, View, Edit, etc.) using
corresponding boxes. Use Include into all presentations / Exclude from all presentations
command from the tab's popup menu to get the column listed/unlisted on all generated
pages.
To restore default column options, use the Reset column link from the tab's popup menu.
Specify the column caption and set a lookup editor for the column if necessary. By
default, PHP Generator for MySQL enables a lookup editor for columns linked by a foreign
key with a single column from another table (if Setup lookups by foreign key option is
enabled).
The View properties determine how the column is displayed on the List, View, Print
and Export pages.
The Edit properties define how the column is represented on the Edit and Insert
pages.
26
54
58
67
68
69
27
104
30
33
PHP Generator for MySQL Help 27
2013 SQL Maestro Group

The Inline Edit, Inline Insert properties determine whether the column will be
available for inline adding/editing and how it will be represented.
To reorder columns, use the grid's popup menu of a concrete presentation.

4.1.1.1 Setting a lookup editor
Lookup editors are used in case you want to select for a field a value that corresponds
to a pre-defined value e.g. a record of another dataset. PHP Generator for MySQL
provides you with two types of lookup editors: Radio group or Combo box. Select Radio
group as the column's Edit properties if the number of the column values is quite little.
Setting a lookup editor bound to a data source (table, view, query)
If you create a PHP script for taking orders, the 'Orders' table will generally have a field
hosting a number indicating the customer who made the order. Working directly with the
customer number is not the most natural way; most users will prefer to work with
customer names. However, in the database the customers' names are stored in a
different table to avoid duplicating the customer data for each order by the same
49
Customizing webpages 28
2013 SQL Maestro Group
customer. To get around such a situation, you can enable a lookup editor:
check the Use lookup box;
select the foreign table/view/query as Data Source;
specify the field with the same data as Link field;
set the field with data to appear in the lookup editor as Display field;
By default, PHP Generator for MySQL enables a combo box lookup editor for a column
linked by a foreign key with a single column from another table (if Setup lookups by
foreign key option is enabled).
To create a lookup editor represented data of several columns, create a query with all
the necessary data concatenated into a single column and specify the query as Data
Source. A complete example can be found below.
Example
Suppose we have three tables: 'employee' with a list of office employees, 'job' with
employees' job titles and salaries, and 'department' with a list of office departments.
See definitions here
CREATE TABLE employee (
EMP_NO integer NOT NULL PRIMARY KEY,
FIRST_NAME varchar(15) NOT NULL,
LAST_NAME varchar(20) NOT NULL,
JOB_CODE integer NOT NULL,
DEPT_NO integer NOT NULL
)
CREATE TABLE job (
JOB_CODE integer NOT NULL PRIMARY KEY,
JOB_TITLE varchar(25) NOT NULL,
SALARY real NOT NULL
)
CREATE TABLE department (
DEPT_NO integer NOT NULL PRIMARY KEY,
DEPARTMENT varchar(20) NOT NULL,
HEAD_DEPT integer,
MNGR_NO integer,
BUDGET real,
LOCATION integer,
PHONE_NO char(20)
)
To enable a lookup editor for the 'HEAD_DEPT' field of the 'department' table
representing first name, last name, and job title of the employee, follow the steps above
with the following query text:
SELECT
104
PHP Generator for MySQL Help 29
2013 SQL Maestro Group
e.EMP_NO as ID,
CONCAT(e.FIRST_NAME, ' ', e.LAST_NAME, ', ', j.JOB_TITLE) as FULL_NAME
FROM employee e,
job j
WHERE e.JOB_CODE = j.JOB_CODE
Setting a lookup editor bound to a custom value list
Customizing webpages 30
2013 SQL Maestro Group
To create a lookup editor bound to a custom value list i.e. to a list of values that are
not stored in a database table and cannot be retrieved by a query, process as follows:
Click the ellipsis button next to the "Edit properties";
Enter the list of the allowed values in pairs
an_allowed_value=value_to_be_represented separated by a comma (Example:
1=One,2=Two).
By default, PHP Generator for MySQL creates lookup editors described above for columns
based on enumeration data types.
4.1.1.2 View properties
This options group allows you to define the way the column data to be represented on
the List, View, Print and Export pages.
PHP Generator for MySQL Help 31
2013 SQL Maestro Group


Display properties
Select the type of data representation. By default, the format of the column's data is
the same as it is set at the Project options . To change the format of column data or/
and set such additional options of the representation like text alignment, height and
width of images, and others, use the corresponding dialog opened by the ellipsis button
next to the Display properties. Moreover, along with representation properties available
for editing within this dialog you can define your own properties with the Custom
attributes option. The option allows you to specify the content of standard HTML style
tag. For example, to set the background color of the column, enter style="background-
color:yellow" as Custom attributes. To implement more difficult data representation,
especially for conditional data formatting, it's recommended to use the
OnExtendedCustomDrawRow event .
Available
representa
tions
Additional options Result
Text It's possible to set such style attributes
as text alignment, and font options (bold,
italic). The Max length value is the max
number of signs to be visible on the
generated webpage. You can also allow
to replace CR+LF by <BR>, to use HTML
105
58
Customizing webpages 32
2013 SQL Maestro Group
and Word wrapping and specify several
format options to be applied to the
column data depending of data type
(Number, Percent, String, Currency).
DateTime Select the type of date time format.
Image If BLOB data will be represented as
images, specify the size of all the column
images with Resize type and Height and
Width fields. Image hints are set with
templates .
File
download
If BLOB data will be represented as file
downloads, set a Download file name and
a Content type using templates . The
Content type value is optional. To
change the download image, generate
the project and change the download.gif
file in the images folder.
Checkbox There are three display types of boolean
data: check box controls, custom images,
custom text values. Select the necessary
option and specify the custom
information (TRUE/FALSE captions or
images).
External
file,
External
image
To represent data in such a way, specify
the Source prefix and Source suffix.
Example
Suppose there is a 'product' column with
such data:
firebird_maestro,
sqlite_maestro,
There are image files with the following
paths:
D:\Images\firebird_maestro_62x62.jpg
D:\Images\sqlite_maestro_62x62.jpg
To represent these images at the
'product' column on the generated page,
Select External Image as View Properties
and set
Source prefix=D:\Images\
Source suffix=_62x62.jpg
50
50
PHP Generator for MySQL Help 33
2013 SQL Maestro Group
Display as hyperlink
To represent the column's data as hyperlink, check the Display as hyperlink option and
specify the HREF Template . Target controls where the new document is displayed
when a user follows the link.
_blank opens the new document in a new window.
_parent is used in the situation where a frameset file is nested inside
another frameset file. A link in one of the inner frameset
documents which uses "_parent" will load the new document where
the inner frameset file had been.
_self puts the new document in the same window and frame as the
current document. "_self" works the same as if you had not used
TARGET at all.
_top loads the linked document in the topmost frame... that is, the new
page fills the entire window.
Use the Header hint field to specify the the column caption's hint. By default, it is a
comment to the table/view column.
Fixed column width
To set a fixed width of the grid, check the Fixed width, specify the Width, and select
the Units.
Units Meaning
em The 'font-size' of the relevant font.
px (pixels) Relative to the viewing device.
in (inches) 1 inch is equal to 2.54 centimeters.
cm Centimeters
mm Millimeters
pt (points) The points used by CSS 2.1 are equal to 1/72nd of an inch.
pc (picas) 1 pica is equal to 12 points.
The Totals option allows you to enable a grid footer to display summaries (Sum,
Average, Count, etc) for all or selected grid columns.
4.1.1.3 Edit properties
Use the Edit properties to define the way the column data to be represented on the Edit
and Insert pages and set additional options within the dialog opened by the ellipsis
button next to the Edit properties.
Use Style custom attributes to specify the appearance of inserting data. For example,
to set the font color of the column, enter style="color: red;" as Custom attributes.
The Read only fields cannot be modified. However, a user can tab to it, highlight it, and
copy the text from it. Check the Required box if the field is mandatory. Set also the
Default value for the column (for adding new record only). PHP Generator for MySQL
supports some environment valiables such as CURRENT_USER_ID, CURRENT_USER_NAME,
UNIQUE_ID.
Additional format-specific options
Ava
ila
Additional
options
Editor appearance
50
Customizing webpages 34
2013 SQL Maestro Group
ble
edi
tor
s
Tex
t
Set the
Size of
the text
block. The
Max
length
value is
the max
number of
signs to
enter.
Co
mb
o
box
Enter the
list of the
allowed
values in
pairs
an_allowe
d_value=v
alue_to_b
e_represe
nted
separated
by a
comma
(Example:
1=One,2=
Two).
Specify
the most-
frequently
used
values to
be always
displayed
at the top
of the list.
To do
this, click
the ellipsis
button
next to
the Most
frequently
used
values
and add
PHP Generator for MySQL Help 35
2013 SQL Maestro Group
values
within the
correspon
ding
window.
You can
also
enable a
lookup
editor
based
that
contains
one or
more table
columns.
For this
purpose,
specify
Item
caption
template
.
Rad
io
gr
ou
p
Enter the
list of the
allowed
values in
the same
way as for
Combo box
editor.
Aut
oco
mpl
ete
edit
or
Use this
editor type
as lookup
editor to
work with
a quantity
of records.
Mul
ti-
leve
l
aut
oco
mpl
ete
edit
or
The
control is
based on
cascading
drop-
down lists
and allows
users to
select a
value from
a long list
step-by-
50
Customizing webpages 36
2013 SQL Maestro Group
step. For
example,
when we
select a
country in
the
Country
drop-
down list,
it will
populate
the City
drop-
down list
according
to the
country
selected,
and so
on. To
find out
more
instructio
ns use
the
correspon
ding topic
.
Specify
the levels
in the
dialog
opened by
the ellipsis
button.
To set a
new level,
enter the
level
caption,
parent
data
source (a
table that
contains
data to
be
displayed
on the
next level
of the
43
PHP Generator for MySQL Help 37
2013 SQL Maestro Group
editor),
and the
name of
the
column
the data
to be
displayed.
Key field
of the
parent
data
source
and child
field to
filter must
contain
the same
values.
Che
ck
box
The editor
is set for
boolean
columns by
default.
Che
ck
box
gro
up
Enter the
list of the
allowed
values in
the same
way as for
Combo box
editor.
Dat
eTi
me
Check off
the Show
time box
to
represent
the only
date. By
default,
the
format of
the
column's
data is
the same
as it is
set at the
Project
options
105
Customizing webpages 38
2013 SQL Maestro Group
. Use the
DateTime
format
field to
setup
format of
the
current
column.
Tim
e
This
editor is
used by
default for
columns
that store
time-of-
day
values.
Spin
edit
This
editor
type
allows you
to set the
constraint
s (Min
value,
Max value
) on the
entered
data.
Mas
k
edit
Use the
edit
control to
define an
edit box
that limits
the user
to a
specific
format
and
accepts
only valid
character
s. For
example,
you can
define an
edit box
for
telephone
PHP Generator for MySQL Help 39
2013 SQL Maestro Group
numbers
setting
999-999-
9999 as
the mask
of the
editor. In
this case
the
created
data
entry field
accepts
only
numeric
input and
if a user
then tries
to enter a
letter in
this edit
box, the
applicatio
n will not
accept it.

Tex
t
are
a
Define the
size of
area visible
text part
using the
Column
count and
Row count
fields.
Ht
ml
Wy
si
wy
g
Use the
editor to
provide
PHP
scripts'
users with
the ability
to directly
manipulate
the layout
of a HTML
data
stored in
the
column,
without
Customizing webpages 40
2013 SQL Maestro Group
having to
type or
remember
names of
layout
commands
.
Pas
swo
rd
Displays
the field as
a masked
textbox.
File
uplo
ad
If BLOB
data will
be edited
with such
editor,
you can
limit the
size of an
uploading
file with
the Use
file size
limitation
option and
the Max
file size
field. To
store
names,
types,
and sizes
of
uploaded
files,
specify
the proper
columns
as File
name
field, File
type field,
and File
size field
respective
ly.
PHP Generator for MySQL Help 41
2013 SQL Maestro Group
Ima
ge
uplo
ad
If BLOB
data will
be edited
as Image
uploads,
you can
limit the
size of an
uploading
file,
specify
columns
to store
names,
types,
and sizes
of
uploaded
files in the
same way
as for File
upload.
To limit
the size
of
uploaded
images,
use the
Use image
size
limitation
options,
and set
the
necessary
Max
width and
Max
height.
Upl
oa
d
file
to
fol
de
r,
Upl
oa
d
im
ag
To use
the
column to
store
paths to
uploaded
files,
setup the
Folder to
upload
and the
File name
using
Customizing webpages 42
2013 SQL Maestro Group
e
to
fol
de
r
templates
. To
use a
random
number as
filename,
check the
Generate
random
filename
box.
The
Generate
thumbnail
option
allows you
to save
resized
copies of
uploaded
images to
a
specified
catalog.
To do it,
check the
correspon
ding box,
specify
the Field
name the
thumbnail
path to
be saved
to, set
the Folder
to upload
and the
name of
the
created
file (It's
possible
to use
templates
or
random
file
names)
and
submit
50
50
PHP Generator for MySQL Help 43
2013 SQL Maestro Group
the resize
rules.
4.1.1.4 Multi-level autocomplete editor
The editor appearance
Multi-level autocomplete editor is based on cascading drop-down lists and allows users
to select a value from a long list step-by-step. The picture below shows how it works:
first we select a country from the Country drop-down list, then we select a city from
the list of cities related to the selected country and select an address from the list of
addresses in this city (for the second example).
The number of levels is not limited, so you can create any similar editor using the same
technique as described below.
Database schema requirements
To create a two-level editor, you need to have three tables: the first table is actually
the table that is the data source for the generated webpage (Address in the example
above). The column the multi-level editor is creating for must refer to the primary key
column of the second table. The second table is the parent table to the first table (in
our case it is City), and the third table is the parent table to the second one (Country).
The foreign key constraints are not required but highly recommended to enforce the
referential integrity at the database level.
To create a three-level editor, you need to have four tables linked with each other as
described above, and so on.
Example
Let's consider how to implement a three-level editor. Suppose we have the following
tables:
Customizing webpages 44
2013 SQL Maestro Group
Our goal is to create a three-level editor like this:
to allow users of the generated web app to select the customer address in the simplest
way.
1. Open the Page Editor for the page based on the Customer table, select the
Address_id column, and specify its lookup properties . If you have defined a foreign
key constraint for this column in the database and the Setup lookup by foreign key
option is enabled, these properties will be set automatically.
27
104
PHP Generator for MySQL Help 45
2013 SQL Maestro Group
2. Select Multi-level autocomplete editor as Edit properties for this column (see the
picture above), then press the ellipsis button. A dialog window will be opened.
Customizing webpages 46
2013 SQL Maestro Group
3. Now it's time to add the first level. Click Add level and enter values in the Add filter
dialog window as follows:
PHP Generator for MySQL Help 47
2013 SQL Maestro Group
Click OK to save the changes. The list of levels now looks as follows:
Customizing webpages 48
2013 SQL Maestro Group
4. Add the next level in the same way:
PHP Generator for MySQL Help 49
2013 SQL Maestro Group
Click OK in the Edit properties window to save all the settings and return to the Page
Editor.
4.1.1.5 Inline Insert and Inline Edit
The Inline Insert/Inline Edit features allow a user to add/edit the content of the
generated page quickly without having to switch modes or screens. All work is done on
the same interface which helps the user maintain context.
To enable the inline inserting/editing:
Make sure that the Insert (Edit) ability option is set as Inline at the Page
properties .
Specify the columns to be available for inline inserting (editing) at the Inline
Insert (Inline Edit) tab of the Page Editor .
If necessary define the way the column data to be represented on inserting/
editing. By default, it is represented as it is set at the Edit/Insert properties of
the General tab.
68
26
26
Customizing webpages 50
2013 SQL Maestro Group
4.1.1.6 String templates
String templates are used by PHP Generator for MySQL on setting HREF templates, hints,
etc. The strings may contain column names enclosed by %.
Examples:
1. Suppose a table 'team' stores various info about NBA teams. The table has 'caption'
column with such data:
maverics
PHP Generator for MySQL Help 51
2013 SQL Maestro Group
cavaliers
To create links to the team home pages:
http://www.nba.com/maverics/
http://www.nba.com/cavaliers/
set the HREF template
http://www.nba.com/%caption%/
2. Suppose there is a table 'employee' storing employee info. The table has 'first_name'
and 'last_name' columns with such data:
Forest Gump
Sara Connor
To add such hints to their photos on the generated webpage:
Forest Gump Photo
Sara Connor Photo
Specify the hint template:
%first_name% %last_name% Photo
4.1.1.7 Uploading files to webserver
There are two ways to store files on a webserver:
1. Store files directly in the database (in BLOB columns).
2. Store files on a disk. Database stores the paths to the files in this case.
Uploading files to be stored in a database
To allow the uploading of files and images to a BLOB column, select File Upload or Image
Upload at the column's Edit properties and Click the ellipsis button next to Edit properties
and set the additional parameters of the uploading.
Customizing webpages 52
2013 SQL Maestro Group
To limit the size of uploading files, check the Use file size limitation option and specify
the Max file size.
To store original names, types, and sizes of the uploaded files, specify the proper
columns as File name field, File type field, and File size field respectively. (Optional)
For image uploads you can limit the dimensions of uploaded images. For this purpose,
check the Use image size limitation options, and set the necessary Max width and Max
height.
Example
To allow uploading images which size is not greater than 200Kb, width is not greater
than 600px and height is not greater than 400px and to save the original file names to
the file_name column, specify the Edit properties as follows:
PHP Generator for MySQL Help 53
2013 SQL Maestro Group
Uploading files to be stored on a disk
To allow the generated PHP script to upload files to your webserver and save their paths
in your database, select Upload file to folder or Upload image to folder at the column's
Edit properties and click the ellipsis button next to Edit properties and set the additional
parameters of the uploading.
Specify the folder to upload and names for uploaded files: a random number or a new
name composed of original file name, original file extension and the size of original file.
Example:
Suppose we have files:
sqlite_maestro.exe (14563609 Bytes)
mysql_maestro.exe (27241901 Bytes)
Customizing webpages 54
2013 SQL Maestro Group
To upload them using the generated PHP script to the data/files/ folder as
sqlite_maestro (14563609).exe
mysql_maestro (27241901).exe
Specify the Edit properties as follows:

4.1.2 Master-Detail Presentations
Master-detail presentations allow you to navigate a webpage based on a specific table,
and at the same time for each selected record (master record) see the associated
records from other related tables (details). So, browsing the page representing product
information, you can see all the orders corresponding to the necessary products;
working with list of countries - to inspect cities of specific countries as on the picture
below.

You can also create nested master-detail presentations when you can see the "details
of details". On the picture below the webpage with a list of countries is represented, for
any country all the corresponding cities may be browsed with one click and at the same
time it's possible to see all addresses of customers living in specific cities.
PHP Generator for MySQL Help 55
2013 SQL Maestro Group
To add a master-detail relation within PHP Generator for MySQL means to provide each
record of the result webpage with an ability to browse all records associated with this
record on a separate Details page as well as with an ability to view the 20 first such
records on the result page directly. To open the corresponding Details page, follow the
full view link.
Database schema requirements
To create a two-level master-detail presentation, you need to have two tables with a
parent-child relationship. The foreign key constraints are not required but highly
recommended to enforce the referential integrity at the database level.
Realization
There are two ways to provide the result webpage with a master-detail presentation:
The tables are tables linked with a foreign key. In case the Setup details by foreign
key option is enabled, the detail relation will be set automatically.
104
Customizing webpages 56
2013 SQL Maestro Group
The foreign key constraint between theses tables haven't been defined.
1. Open the Page Editor for the page based on the master table and go to the Details
tab.
2. Click the Add... item of the tab's popup menu.
PHP Generator for MySQL Help 57
2013 SQL Maestro Group

3. Set the relation properties to the child table: select this table as Detail data source,
and specify the columns with similar data as Master field (select from the list of parent
table columns) and Detail field (select from the list of child table columns).
Customizing webpages 58
2013 SQL Maestro Group

4. After the fields are completed use the Add button and then click OK.
To specify the details appearance, use the Edit... item of the corresponding popup menu
and set options in a usual way .
To create a nested master-detail presentation, use the same technique as described
above (the case the foreign key constraint is not defined).
4.1.3 Events
Event is a fragment of PHP/Javascript code executed before or after a record was
added, edited, or deleted, etc. Therefore events allow you to define some actions that
will be activated when certain conditions are met. All events are grouped into 2
categories: Client side events and Server side events. Client side events are written on
Javascript and executed by browsers while Server side events are written on PHP and
executed by webserver.
Working with events
To add/edit an event handler, select the necessary event in the list and double-click the
Code column or use Ctrl+Enter. Then type PHP code in the Event Editor window.
To temporarily disable/enable an event, select the appropriate line in the list and
uncheck/check the corresponding Enabled box.
Using variables
PHP Generator for MySQL supports some environment variables (such as
CURRENT_USER_ID, CURRENT_USER_NAME, UNIQUE_ID) in events. To obtain a complete
26
PHP Generator for MySQL Help 59
2013 SQL Maestro Group
list of supported variables, uncomment the define('SHOW_VARIABLES', 1); line in the
generated settings.php file and open any generated web page. The following example
demonstrates how to use variables within the OnBeforeInsertRecord event.
Example:
$rowData['ip_address'] = $this->GetEnvVar('REMOTE_ADDR');
$userName = $this->GetEnvVar('CURRENT_USER_NAME');
if ($userName != 'admin')
$rowData['changed_by'] = $userName;
PHP Generator for MySQL supports the following events:
Client side events:
OnBeforePageLoad
Occurs before page loading. Allows you to declare functions and
global variables.
OnAfterPageLoad
Occurs after page has been fully rendered. This event does not get
triggered until all assets such as images have been completely
received and DOM hierarchy has been fully constructed.
OnInsertFormValidate
Occurs before submitting the insert form. This allows errors to be detected on the
client before the form is submitted, thus avoiding the round trip of information
necessary for server-side validation.
Parameters:
$fieldValues- associative array of values contains user input.
$errorInfo - object that provides interface (the SetMessage method) to set a
validation error message.
Example:
if (fieldValues['percents'] < 0 || fieldValues['percents'] > 100)
{
errorInfo.SetMessage('Percent value should be between 0 and 100.');
return false;
}

OnEditFormValidate
Occurs before submitting the edit form. This allows errors to be detected
on the client before the form is submitted, thus avoiding the round trip of
information necessary for server-side validation.
Parameters:
$fieldValues- associative array of values contains user input.
$errorInfo - object that provides interface (the SetMessage method) to
Customizing webpages 60
2013 SQL Maestro Group
set a validation error message.
Example:
if (fieldValues['percents'] < 0 || fieldValues['percents'] > 100)
{
errorInfo.SetMessage('Percent value should be between 0 and 100.');
return false;
}
OnInsertFormEditorValueChanged
Occurs on changing a value in the Insert form.
Parameters:
$sender - a control whose value has been changed
$editors - associative array of form controls
Example:
if (sender.getFieldName() == 'country_id')
{
editors['college_id'].enabled(sender.getValue() == 1);
if (sender.getValue() != 1)
editors['college_id'].setValue(null);
}
OnEditFormEditorValueChanged
Occurs on changing a value in the Edit form.
Parameters:
$sender - a control whose value has been changed
$editors - associative array of form controls
Example:
if (sender.getFieldName() == 'current_team_id')
{
if (sender.getValue() == '')
{
editors['current_number'].setValue('');
editors['current_number'].enabled(false);
}
else
{
editors['current_number'].enabled(true);
}
}
OnInsertFormLoaded
Occurs after the Insert form is loaded.
Parameters:
$editors - associative array of form controls
PHP Generator for MySQL Help 61
2013 SQL Maestro Group
OnEditFormLoaded
Occurs after the Edit form is loaded.
Parameters:
$editors - associative array of form controls
Server side events:
OnBeforePageExecute
PHP code to be included at the begin of created PHP file. The code is
executed only once and intended to create global objects, declare
functions, and include third-party libraries.
Example:
Suppose we decided to implement a syntax highlighting using the
GeSHi library somewhere in the generated application. To implement
such a feature, we need (among other things) to include the main
library file into the generated scripts:
include_once '../geshi/geshi.php';
OnCustomRenderColumn
Occurs before column rendering. Allows to replace cell content. It is
an extremely useful event for conditional rendering or embedding
third-party components to extend standard functionality.
Parameters:
$fieldName - field name of currently processed cell.
$fieldData - data of currently processed cell.
$rowData - associative array of values that corresponds to the
currently processed row.
$customText - a string to replace original cell content.
Example:
Suppose a table 'employee' has a column storing data
about the employee's sex in that way that '1'
corresponds to male and '2' to female. Our goal is to
represent the employees sex as 'M' and 'F' for men and
women accordingly. To do so, you could specify the
OnCustomRenderColumn event handler as follows:

if ($fieldName == 'sex') {
$customText = $rowData['sex'] == 1 ? 'M' : 'F';
$handled = true;
}
Customizing webpages 62
2013 SQL Maestro Group
OnCustomRenderPrintColumn
Occurs before column rendering on print page. Allow to replace cell
content. It is an extremely useful for conditional rendering or
embedding third-party components to extend standard functionality.
Parameters:
$fieldName - field name of currently processed cell.
$fieldData - data of currently processed cell.
$rowData - associative array of valued that corresponds to the
currently processed row.
$rowData - a string to replace original cell content.
OnCustomRenderExportColumn
Occurs before column rendering into Word, Excel, etc. Allow to
replace cell content. It is an extremely useful event for conditional
rendering.
Parameters:
$exportType - a string contains exporting format short name (word,
excel, pdf, csv, xml).
$fieldName - field name of currently processed cell.
$fieldData - data of currently processed cell.
$rowData - associative array of valued that corresponds to the
currently processed row.
$rowData - a string to replace original cell content.
OnCustomHTMLHeader
Occurs when generating the head section of the page. Use this event to provide
additional information for the HEAD section of the page (such as keywords,
author, or description).
Parameters:
$page - the page raised the event.
$customHtmlHeaderText - a string to place into the head section.
Example:
$customHtmlHeaderText = '<meta name="copyright" content="SQL Maestro Group"/>';
OnExtendedCustomDrawRow
Occurs when rendering a grid row (advanced features). It is an extremely
useful event for conditional formatting such as changing font color, font
styles, row background color, cell background color, etc.
Parameters:
$rowData - associative array of values that corresponds to the currently
processed row.
$cellStyles - associative array of styles. Each field name is associated with
PHP Generator for MySQL Help 63
2013 SQL Maestro Group
its style string.
$rowStyles - use this string to modify styles of a whole row.
This event (as well as OnCustomDrawRow) is used for conditional
formatting. The only difference between these two events is that
OnCustomDrawRow has a more understandable parameter list while
OnExtendedCustomDrawRow provides more flexible abilities.
Example:
Please find below an example of the conditional row formatting from our
online demo. We need to display winning team score in red and losing team
score in black; moreover, both scores should be in bold and displayed by a
16pt font.
$rowCellStyles['home_team_score'] = 'font-size: 16pt;font-weight: bold;';
$rowCellStyles['away_team_score'] = 'font-size: 16pt;font-weight: bold;';
if ($rowData['home_team_score'] > $rowData['away_team_score'])
$rowCellStyles['home_team_score'] .= 'color: #F65317;';
else
$rowCellStyles['away_team_score'] .= 'color: #000000;';
OnCustomRenderTotals
Occurs before total values rendering. Allows to replace default total
footer content. Enabling this event don't forget to enable the grid
footer in the View properties of the corresponding column.

Parameters:
$totalValue - total value of currently processed total.
$aggregate - string representation of total aggregate ('AVG', 'SUM',
'MIN', 'MAX', 'COUNT').
$columnName - column name of currently processed total.
&$customText - a string to replace total cell content.
&$handled - indicates whether the event handler executed. Set
$handled to true in the event handler to apply new content.
Example:
Suppose we need to change the text of the 'TOTAL_VALUE' column
grid footer.
Set if ($columnName == 'TOTAL_VALUE')
{
$customText = 'Total value average: ' . $totalValue . '$';
$handled = true;
}
Now we can compare the result webpages without using the event
and with the enabled one:
30
Customizing webpages 64
2013 SQL Maestro Group
OnGetCustomTemplate
This event handler occurs on opening a custom template and allows to use a custom
template instead of the default one. The basic principles of custom template usage are
shown in this article.
In PHP Generator creates a set of templates written on Smarty 2.0 to be used by the
prepared application in the certain situations. To change a webpage look in such
application, you need to specify a new template to be used and set it in this event. The
template file should be uploaded to the 'components/templates/custom_template'
directory.

Parameters:
$part - the part of the page to be affected by the template. Possible values are:
PagePart::Grid allows to change the appearance of table grid.
PagePart::GridRow allows to set the one row look.
PagePart::VerticalGrid allows to apply the template to data grid placed at edit form, view
form and insert form.
PagePart::PageList allows you to change the appearance of Navigation bar at the
webpage.
PagePart::Layout - allows to completely redesign the webpage look.
PagePart::RecordCard - data represented at the modal dialog
$mode - the current state of the webpage the template to be used. Possible values are:
PageMode::ViewAll allows to change the look of webpage representing table data.
PageMode::View allows to specify a custom template.
PageMode::Edit allows to modify the edit form of the table.
PageMode::Insert allows to modify the insert form.
PageMode::ModalView, PageMode::ModalEdit, PageMode::ModalInsert allow to change the
appearance of data on viewing, editing and inserting in a modal dialog.
$result - the path to the file to be used as template according to the components/
templates/custom_templates folder.
Example:
Suppose we need to use components/templates/custom_templates/staff_edit.tpl file as
a template for the edit form data.
if ($part == PagePart::VerticalGrid && $mode == PageMode::Edit) {
$result = 'staff_edit.tpl';
}
Now we can compare the result webpages without using the event and with the enabled
one:
PHP Generator for MySQL Help 65
2013 SQL Maestro Group
OnCustomDrawRow
Occurs when rendering a grid row (basic features). It is an extremely
useful event for conditional formatting such as changing font color,
font styles, row background color, cell background color, etc.
Parameters:
$rowData - associative array of values that corresponds to the
currently processed row.
$cellFontColor, $cellFontSize, $cellBgColor, $cellItalicAttr,
$cellBoldAttr - associative arrays of cell attributes.
This event (as well as OnExtendedCustomDrawRow) is used for
conditional formatting. The only difference between these two events
is that OnCustomDrawRow has a more understandable parameter list
while OnExtendedCustomDrawRow provides more flexible abilities.
Example:
Please find below an example of the conditional row formatting from
Customizing webpages 66
2013 SQL Maestro Group
our online demo. We need to display winning team score in red and
losing team score in black; moreover, both scores should be in bold
and displayed by a 16pt font.
$cellFontSize['home_team_score'] = '16pt';
$cellBoldAttr['home_team_score'] = true;
$cellFontSize['away_team_score'] = '16pt';
$cellBoldAttr['away_team_score'] = true;
if ($rowData['home_team_score'] > $rowData['away_team_score'])
$cellFontColor['home_team_score'] = '#F65317';
else
$cellFontColor['away_team_score'] = '#000000';
OnBeforeUpdateRecord
Occurs when the Update command is executed, but before the actual
update. This event is often used to cancel the update operation.
Parameters:
$rowData - associative array of values that corresponds to the
currently processed row.
$cancel - value indicating whether the operation should be canceled.
$message - message string that is displayed after the operation is
completed (or canceled)
Example:
$cancel = true;
$message = 'Updating is disabled.';
OnBeforeDeleteRecord
Occurs when the Delete command is executed, but before the actual
deletion. This event is often used to cancel the delete operation.
Parameters:
$rowData - associative array of values that corresponds to the
currently processed row.
$cancel - value indicating whether the operation should be canceled.
$message - message string that is displayed after the operation is
completed (or canceled)
Example:
$cancel = true;
$message = 'Deleting is disabled.';
OnBeforeInsertRecord
Occurs when the Insert command is executed, but before the actual
insertion. This event is often used to cancel the insert operation.
PHP Generator for MySQL Help 67
2013 SQL Maestro Group
Parameters:
$rowData - associative array of values that corresponds to the
currently processed row.
$cancel - value indicating whether the operation should be canceled.
$message - message string that is displayed after the operation is
completed (or canceled)
Example:
$cancel = true;
$message = 'Inserting is disabled.';
Events specified as project options will be used for all generated web pages.
4.1.4 Filter
To reduce the number of records available at the page, specify the Filter condition. This
condition corresponds to the WHERE clause of the query returned page data (you must
not add the WHERE keyword to beginning of the condition).
Example 1
There is a table with test questions of a Web programming course. To display only
questions of the 'Beginner' level (level_id = 2) concerning to PHP
(statement_language_id = 1), set the filter condition as follows:
Example 2
You can use subqueries in the filter expression. For example, to display the list of
channels that hosted even if a single game, specify the Filter condition as follows:
(channel.id > 0) AND channel.id IN
(
SELECT game.channel_id
FROM game
)
Customizing webpages 68
2013 SQL Maestro Group
4.1.5 Page Properties
The Page Properties window allows you to define the general properties of the generated
page. To invoke the window, use the corresponding button of Page Editor .
Common
Specify here the basic HTML elements such as Caption of the generated HTML page, File
name (if the file name extension is not specified, it will be the same as at the application
output options ). Short Caption is a text of the link representing the page at Navbar.
To add a text to be displayed at the top of the page, use the Page Header field or open
the Page Header window with the ellipsis button (for details see the screenshot below).

Default sort order
To set the default sort order of the generated page data, check the Default ordering
box, specify the name of the column the data to be sorted according with and select
the sort order.
Fixed width of the grid
To set a fixed width of the grid, check the Grid fixed width, specify the Width, and
select the Units.
Units Meaning
em The 'font-size' of the relevant font.
px (pixels) Relative to the viewing device.
in (inches) 1 inch is equal to 2.54 centimeters.
cm Centimeters
mm Millimeters
pt (points) The points used by CSS 2.1 are equal to 1/72nd of an inch.
pc (picas) 1 pica is equal to 12 points.
Creating RSS feeds
The Use RSS options group allows you to create an RSS feed based on the current
table.
Opening search page at first
26
106
71
PHP Generator for MySQL Help 69
2013 SQL Maestro Group
For tables storing a lot of data it's reasonable to allow users to work only with a
necessary piece of data. For this purpose, check the Open search page at first box and
the generated page will be opened with a search page.
The other properties are set in accordance with the project options . To change the
properties, check off the Use default options box and enter the new value in the
corresponding field.
4.1.6 Data Partitioning
The Data Partitioning wizard allows you to create a custom pagination i.e. split the
records on the generated page by a specified criteria.
Select the type of data partitioning on the first wizard step:
Range partitioning
Selects a partition by determining if the partitioning expression value is inside a
certain range.
List partitioning
A partition is assigned a list of values. If the partitioning expression value has one
of these values, the partition is chosen. For example, all rows where the column
'Country' is either Iceland, Norway, Sweden, Finland or Denmark could build a
partition for the 'Nordic countries'.
Custom partitioning
Create your own partitioning with fill partitions and build conditions functions.
To disable data partitioning, select None.
Example 1 (Range partitioning)
There is a table storing information about films such as title, release year, and length.
See definition here
CREATE TABLE film (
film_id integer NOT NULL,
title varchar(255) NOT NULL,
release_year integer,
length integer UNSIGNED,
/* Keys */
PRIMARY KEY (film_id)
);
To create a pagination by the film length, select Range partitioning at the first wizard
step, choose 'length' as partition expression and set the partitioning ranges as follows:
101
Customizing webpages 70
2013 SQL Maestro Group
Here you can see the result PHP script:
Example 2 (Custom partitioning)
Assume that a table 'customer' contains the 'last_name' column. Our goal is to group
customers by the first letter of their last name as displayed below.
PHP Generator for MySQL Help 71
2013 SQL Maestro Group
To get around such a situation, select Custom partitioning and define functions as
follows:
function GetPartitions($partitions)
{
$tmp = array();
$this->GetConnection()->ExecQueryToArray("
SELECT DISTINCT
left(c.last_name, 1) as first_letter
FROM customer c
ORDER BY first_letter", $tmp
);
foreach($tmp as $letter) {
$partitions[$letter['first_letter']] = $letter['first_letter'];
}
}

function GetPartitionCondition($partitionKey, &$condition)
{
$condition = "left(last_name, 1) = '$partitionKey'";
}
4.1.7 RSS
With PHP Generator for MySQL you can create full-fledged RSS feeds based on MySQL
tables. To create an RSS document, open the Page Properties dialog and complete the
Customizing webpages 72
2013 SQL Maestro Group
Use RSS options group.
Check the Use RSS box first and specify the following options:
Channel title
Defines the title of the channel.
Channel link
Defines the hyperlink to the channel.
Channel description
Describes the channel.
Item title template
Defines the title of the item.
Item link template
Defines the hyperlink to the item.
Item description template
Describes the item.
Item publication date field
This field is optional. Defines the last publication date for the content of the feed.
For more details see the RSS specification.
The screen below provides you with a simple example.
50
50
50
PHP Generator for MySQL Help 73
2013 SQL Maestro Group
Customizing webpages 74
2013 SQL Maestro Group
4.2 Project Options
PHP Generator for MySQL allows you to specify default settings to be applied to each
generated webpage. By default, most of these options have the same values as the
application options . All settings are grouped into several tabs.
Page
The Page tab allows to modify the appearance of webpages, specify the script abilities
such as data formats available for data export, data view mode, data edit mode, data
insert mode and also delete, search and filter abilities. By default these settings are set
in accordance with the Application options .
Display formats
These tab fields allow to adjust the display data formats in the way you need. By
default these settings are set in accordance with the Application options .
Advanced options
The tab allows you to specify whether PHP errors and warnings, environment variables
and executed queries will be shown, and to disable magic_quotes_runtime option.
Events
You can also specify event handlers to be executed after login, before update/
insert/delete records.
101
101
101
58
PHP Generator for MySQL Help 75
2013 SQL Maestro Group
Webpages appearance 76
2013 SQL Maestro Group
5 Webpages appearance
PHP Generator for MySQL allows you to setup the appearance of created webpages in
several ways:
Built-in color schemes
The simplest way to adjust the look and feel of the result application is to select
one of color schemes the software comes with.
A sample webpage generated using different color schemes.

Custom color scheme
This allows you to provide the application with a specific look and feel defining the
colors and font settings.
79
79
PHP Generator for MySQL Help 77
2013 SQL Maestro Group
A sample webpage generated with custom color scheme.

Header and Footer
These are fragments of HTML code that will be included into all the generated
pages. They can be customized within the appropriate window.

A sample webpage with specified header.
Custom CSS
It is also possible to define a custom style sheet to be applied after all pre-defined
CSS rules. This can be useful to define such things as size of controls, text
alignments, background images, and more.
80
81
Webpages appearance 78
2013 SQL Maestro Group
Events
Events are pieces of code that are run when an action is taken by the user. Such
events as OnBeforePageExecute , OnCustomRenderColumn , and
OnCustomDrawRow can be used to change the webpage appearance. Please
find some examples of using these and other events in our demo application and in
the Resources section at the product home page.
Using templates
While all the previously described methods allow you to define colors, fonts, text
alignments, and other display attributes of generated webpages, this one helps
you to redesign the webpages entirely i.e. define what controls are displayed on a
specific form, where they are displayed, and what they display.
58
61 61
65
83
PHP Generator for MySQL Help 79
2013 SQL Maestro Group
5.1 Color schemes
The color scheme of created application contains the information on basic style
definitions for all key HTML components: fonts, colors, backgrounds, borders, and
others. PHP Generator for MySQL comes with a number of built-in color schemes. To
use one of them, select the appropriate item from the "Color scheme" drop-down list.
To change default scheme settings according to your needs, click the Customize color
scheme button and modify the necessary variables within the Grid CSS window. To learn
more about the LESS syntax used in this window, please refer to the LESS manual.
The Preview window displays current appearance settings applied to a sample webpage.
Webpages appearance 80
2013 SQL Maestro Group
5.2 Header and Footer
To add an HTML markup to be displayed at the top and at the bottom of each page of
the generated web application, enter the appropriate code in the Header and Footer
text boxes accordingly.
Example: To add the header like one on the screen above, paste the following text in
the Header edit box:
<table width="600px" height="110px">
<tr>
<td>
<img src="images/mysql_logo.png" /></td>
<td>
<h2>MySQL Schema Browser</h2>
</td>
<td>
<div>
Created by <a href="http://www.sqlmaestro.com/products/mysql/
phpgenerator/">PHP Generator for MySQL.</a>
<br>Want to learn more? <br>
<a href="http://www.sqlmaestro.com/products/mysql/phpgenerator/
download/">Download the demo project!</a></div>
</td>
</tr>
</table>
PHP Generator for MySQL Help 81
2013 SQL Maestro Group
5.3 Custom CSS
The ability to use custom CSS allows you to set up such parameters of web pages as
size of controls, text alignment, and more. To define a custom style sheet that will be
applied after all the pre-defined rules, click the "Edit additional CSS" button and enter
the rules you need manually or load them from a .css file.
To determine a selector to apply the styles for, use any available inspect HTML tools
such as default Firefox developer tools, Firebug, Chrome developer tools, Internet
Explorer developer tools, and so on. Among other things these tools allows you to view
the current element's attributes and applied styles and experiment with new ones.
Example 1
Suppose we need to set the width of the Address Id drop-down list to 300 pixels.
First of all we need to locate this control on the page (at the screen below we
used Firefox developers tools).
As we can see, the tag of the control is select and its id is address_id_edit. So to
specify the necessary width of the Addredd Id control, we need to add the
following rule to the Custom CSS (the select#address_id_edit will also work, but it
is not necessary as each id attribute must have a unique value within a document
):
#address_id_edit {
width: 300px;
}
To change the width of all the drop-down lists in the application, add the following
lines:
select {
width: 300px;
}
Example 2
To change the text alignment of the control from the example 1, add the following
string:
#address_id_edit {
text-align: right;
}
Example 3
To add a background image to all generated webpages, add the following rule to
the custom CSS.
#content-block {
Webpages appearance 82
2013 SQL Maestro Group
background-image: url('path/to/background.jpg');
}
PHP Generator for MySQL Help 83
2013 SQL Maestro Group
5.4 Using templates
Applications created by PHP Generator for MySQL use Smarty, a typical representative
of the web template engines family. So in order to redesign a webpage, you need to
change the appropriate template. All templates used by the software are stored in the
components/templates subfolder of the output directory. Each folder in this catalog
contains template files to be used by the application in different cases: on editing,
printing, inserting, etc.
Using custom templates
To change the webpage appearance with custom templates, follow these steps:
Create a new template. Custom templates must be stored under the components/
templates/custom_templates folder which contents is not changing on re-generation
of the scripts. You must create this folder manually.
Instruct PHP Generator to use this template for the selected webpage with the
OnGetCustomTemplate event.
Customize the template according to your needs and preferences.
The detailed description of such customization is given in the appropriate article.
Another article learns how to add a chart component to a webpage using the way
described above. The demo application also shows some additional examples of using
custom templates.
Webpages appearance 84
2013 SQL Maestro Group
Changing existing templates
You can modify generated template files directly. The example of supplying of generated
pages with look and feel of an existing website illustrates this method in the appropriate
article. Since all the templates are rewritten each time you generate an application, you
have to add modified templates to the Excluded files list to prevent them from
overwriting.
98
PHP Generator for MySQL Help 85
2013 SQL Maestro Group
6 Security settings
Check the Enable security option to supply the generated application with a login page
to request user name and password when someone attempts to access your script. PHP
Generator for MySQL provides you with the following authorization types:
Hard-coded authorization
Select this option to incorporate the authorization procedure directly into the PHP
code of the generated application.
Table-based authorization
Select this option to authorize a user of the web application by a login/password
combination stored in a database table.
Database server authorization
Select this option to accomplish the authorization by MySQL server.
See also: User permissions , Record-level security
87
89
91
92 95
Security settings 86
2013 SQL Maestro Group
PHP Generator for MySQL Help 87
2013 SQL Maestro Group
6.1 Hard-coded authorization
To set the hard-coded authorization, fill in the Administrator login and Administrator
password fields and add as many additional users as you need. Check the Enable guest
access option to allow an anonymous user to access the generated app without
completing the authentication procedure.
Note: To allow guest access, specify also the corresponding guest's permissions .
Turn Enable MD5 password encryption 'ON' to store user passwords encrypted with the
MD5 algorithm.

To add an application user, open the Hard-coded authorization window with the Edit
additional users button and open the User editor by the corresponding button or the
corresponding link at the tab's popup menu.
92
Security settings 88
2013 SQL Maestro Group

Enter the user name and password, and check the necessary options to grant the
corresponding permissions to the user.

To learn how to specify permissions of the created users, see the User permissions
section.
92
PHP Generator for MySQL Help 89
2013 SQL Maestro Group
6.2 Table-based authorization
Setting a table-based authorization means to allow user access to the generated scripts
according to grants stored in a MySQL table. The user login information is stored in a
MySQL table too. The tables may be prepared earlier or created within PHP Generator.
If the table with login information exists,
specify it's name as Users table and the columns with user names and passwords to be
used for authentication as Login field and Password field and set the user ID field. To
use encrypted passwords, select the corresponding encryption algorithm in the Password
encryption field from the list of available algotithms (MD5, SHA1, PHPass algorithm,
SHA246, and Crypt) or enter the necessary hash algorithm to be used for the password
encryption.
If the table with login information does not exist,
click the Create new table... button to set the name of a table to be created and its
column names.
Now the table is ready to use. You can enter the login info using any available MySQL
management tool, such as MySQL Maestro.
The checked Enable guest access option allows users those names are not stored in the
Security settings 90
2013 SQL Maestro Group
table to work with generated script.
By default all users of result application have SELECT, UPDATE, INSERT, and DELETE
permissions. You can restrict their permissions with the Permissions manager .
To allow the record-level security at the generated application, specify User ID.
92
95
PHP Generator for MySQL Help 91
2013 SQL Maestro Group
6.3 Database server authorization
This kind of authorization forces you to create and manage users permissions with the
server facilities. To allow access without entering a password, you need have a guest
account on the server and specify the guest credentials at the corresponding fields.

Security settings 92
2013 SQL Maestro Group
6.4 Permission manager
Permission manager allows you to restrict user access to the generated application. To
open the window, press the Manage permissions... button. This is not applicable for the
database server authorization, in that case the grants should be set with the server
facilities.
Hard-coded authorization
All the permission information is stored in the prepared script and, to modify user grants,
you need to repeat the generation process. Use the checkboxes at the Permissions tab
to grant ADMIN, SELECT, UPDATE, INSERT, and DELETE permissions to the generated
application to users specified at the Hard-coded authorization window . The ADMIN
permission means that the user can accomplish all available operations and none
restrictions including record-level security are not applied for him. To set permission on a
specified table, use the Customize page level permission... button.
87
PHP Generator for MySQL Help 93
2013 SQL Maestro Group
Table-based authorization
All the information about user permission may be stored in the prepared script (as in the
case above), but it is recommended to store the info in a MySQL table. You can use for
this purpose an existing table or create a new one. In case you store user permission in
a table, you can manage them via administration panel and need not to regenerate PHP
scripts. One thing you need to note is that at least one user must have the ADMIN
permission in order to the administration panel will be generated.
Security settings 94
2013 SQL Maestro Group
Open the Storage tab of the Permission manager.
Specify the name of an existing table to be use to store user permission info and its
columns names or use create such table with the corresponding button.
Open the Permissions tab and set the user permissions to be applied to all pages of the
generated application.
If necessary, refine permissions for each users on each page of the application within
the window opened with the Customize page level permissions... button.
PHP Generator for MySQL Help 95
2013 SQL Maestro Group
6.5 Record-level security
Use the Record level permissions window to let each user access only to his own data.
The feature is available for table-based and hard-coded authorization types. To
implement the row level security to a webpage based on a table or a view,
make sure the table contains a column with owner information;
specify this column as the Owner field name and set the necessary permissions
for the record owner and for other users. In case of table-based authorization a
record will be displayed on the page if the owner field is equal to the ID of logged
used. If hard-coded authorization has been used the owner field means the name
of specified user .
87
Interface language 96
2013 SQL Maestro Group
7 Interface language
By default a web application created with PHP Generator for MySQL has English interface
but it can be localized (i.e. translated) for a number of languages. The text strings to be
used in the application's interface are stored in a localization file. To use a specific
language, select the corresponding file on the last wizard step. In case you use the
same file on a regular basis, it is recommended to specify it in the application output
options to enable it by default.
Using prepared localization files
PHP Generator for MySQL comes with a number of localization files that can be found
under the installation folder, usually C:\Program Files\SQL Maestro Group\PHP Generator
for MySQL or C:\Program Files (x86)\SQL Maestro Group\PHP Generator for MySQL if you
have a 64-bit operation system installed on your computer. The table below contains
currently available files and the corresponding interface languages:
lang.br.
php
Brazilian
lang.cs.
php
Czech
lang.de.
php
German
lang.dk.
php
Danish
lang.en.
php
English
lang.es.
php
Spanish
lang.fr.
php
French
lang.hu.
php
Hungarian
lang.it.
php
Italian
lang.nl.
php
Dutch
lang.pl.
php
Polish
lang.ru.
php
Russian
lang.se.
php
Swedish
lang.sk.
php
Slovak
lang.sl.
php
Slovenian
lang.sr.
php
Serbian
lang.tr.
php
Turkish
These files were sent to us by our customers and we are not responsible for their
quality. If none of these files is right for you, it is possible to customize the localization
106
PHP Generator for MySQL Help 97
2013 SQL Maestro Group
as described below. We will be very appreciated if you send us your custom file to be
enjoyed by all the PHP Generator for MySQL users.
Using a custom localization file
If none of supplied files is appropriate for your application, you can create the
localization yourself. For this purpose get a localization file the clearest for you, enter/
correct necessary captions with any text editor, and save it in the UTF-8 encoding
(this is very important for the correct displaying of captions in a web browser).
Example
Suppose we need to create a web application in Esperanto. First we need to define the
localization file that is the clearest for us. In our case it is lang.en.php. Let's open the
file with a text editor (we prefer Notepad++), translate all captions to Esperanto, select
the UTF-8 encoding and save it as lang.eo.php (eo is the two-char language code for
Esperanto). All we need to do is select this file at the last wizard step and generate the
application. The result is shown below.

Common generation options 98
2013 SQL Maestro Group
8 Common generation options
At the last wizard step you can specify header and footer , set a localization file ,
and define security settings of the created application.
Access driver
There are several PHP drivers to communicate with database servers and PHP Generator
for MySQL allows you to select a driver to be used by the generated web application.
Note that the corresponding set of PHP functions should be available on your web
server. By default the driver is set in accordance with the application output options .
Output directory
Generated files will be created in the output directory stored on your computer. To see
the result of the process, open any prepared .php file with any browser. Note, that to
run PHP code you need to have PHP and Apache installed or to run any portable web
server. To place the result webpages to the Internet, copy the created directory to
your hosting.
Generation options
To make the repeated generating process more fast, it's recommended to avoid
repeated copying of non-changeable system files stored in components,
database_engine, images, libs folders. These files must be rewritten only in case they
were generated by the former version of PHP Generator for MySQL.
80 96
85
106
PHP Generator for MySQL Help 99
2013 SQL Maestro Group

Options 100
2013 SQL Maestro Group
9 Options
PHP Generator for MySQL allows you to customize the way it works within the Options
dialog. To open the dialog, use the More button and select Options at the drop-down
list.
The window allows you to customize the options grouped by the following sections:
Application
General PHP Generator for MySQL options: generation rules, default page options,
and display data formats.
Editors & Viewers
Customizing of all the SQL editors.
Appearance
Customizing program interface - bars, trees, menus, etc.
It is a good idea to check through these settings before you start working with PHP
Generator for MySQL. You may be surprised at all the things you can adjust and
configure!
101
108
116
PHP Generator for MySQL Help 101
2013 SQL Maestro Group
9.1 Application
The Application section allows you to customize common rules of PHP Generator for
MySQL behavior. The section consists of several tab; follow the links to find out more
about each of them.
Page
Generation defaults
Display formats
Output
9.1.1 Page
Page navigator
This options group allows you to specify the position on the webpage the page
navigation to be placed to. The available values are:
None - the prepared webpage represents all table records
Top, Bottom, Both - all table records are separated by pages according to the Records
per page value. The page navigation that lets users move freely between pages are
represented at the top, or bottom, or at the top and at the bottom of pages.
The default the navigational elements are the numbers of pages. Use Data Partitioning
to create a custom pagination.
To display data more correctly, it's recommended to define the Content encoding of
data (UTF-8 or ANSI).
Control buttons position
Select whether the Edit, View, Delete, and Copy buttons to be displayed on the left side
of the generated page or on the right one.
Visual effects enabled
If the option is 'OFF', all the javascript animation is disabled.
To enable the list of all created webpages to be displayed at the Navigation bar of
webpage and to allows the highlighting of rows at mouse over check the corresponding
options.
Check the Use images for actions option to enable control buttons. If the option is not
checked the actions are available via corresponding links.
To enable the Set NULL checkboxes on editing/inserting data, turn ON the according
option.
The position and alignment of the Navigation bar, Page Caption and Page header are also
can be modified. Use for this purpose the direction of page option.
Specify the default criteria for Simple search default filter.
The Use fixed grid header option allows to set the grid header will be represented at the
page on scrolling.
101
104
105
106
69
Options 102
2013 SQL Maestro Group
Check the Show line numbers option to add row numbering to the grid.
The Disable custom ordering option disallow users to sort data in the grid.
Use the Export tab to specify the available file formats the grid data may be exported to.
PHP Generator for MySQL Help 103
2013 SQL Maestro Group
The Abilities options define the interaction between generated scripts and users. Here you
can specify the way data manipulations such as View, Edit, Copy and Insert to be
available for execution on the generated page: the ability is disabled, available on a
separated page, performed inline or in a modal dialog. You can also provide the prepared
page with ability to delete rows, the multiple deletion of rows using checkboxes, add
quick search to find the specified criteria in the whole of grid data, add a filter row - an
additional grid row to set filter conditions to each column, and filter builder to specify any
difficult filter conditions.
Options 104
2013 SQL Maestro Group
9.1.2 Generation defaults
Use this tab to define the rules to be used for the page generation. These options allow
you to enable the setting of lookups and details by foreign keys, the editing of
autoincrement fields and inserting data into them, setting binary fields as images, and
allow setting the default field values on editing.

You can enable text area area for VARCHAR fields if their length is greater than Min
length value.
Specify here the Max visible length of text fields value. If the text length is greater than
this value, the residual text will be hidden under the More... link on the generated page.
Full text can be displayed in the special window in this case.
PHP Generator for MySQL Help 105
2013 SQL Maestro Group
9.1.3 Display formats
Use this tab's fields to adjust the display data formats in the way you need.
Options 106
2013 SQL Maestro Group
9.1.4 Output
Use this tab to specify default values for project output options .
PHP Driver
There are several PHP drivers to communicate with database servers and PHP Generator
for MySQL allows you to select a driver to be used by the generated web application.
Note that the corresponding set of PHP functions should be available on your web
server.
Localization file
Use this field to define the interface language to be used for the generated application
by default. Find out more on applications localization at the corresponding page .
You can also set here the output file extension and the default color scheme for the
generated pages.
98
96
PHP Generator for MySQL Help 107
2013 SQL Maestro Group
Options 108
2013 SQL Maestro Group
9.2 Editors & Viewers
The Editors & Viewers section allows you to set the parameters of viewing and editing
the SQL statements within PHP Generator for MySQL.
General
Display
SQL highlight
PHP highlight
XML highlight
Code Insight
Code Folding
9.2.1 General
If the Auto indent option is checked, each new indention is the same as the previous
when editing SQL text.
Insert mode
If this option is checked, insert symbols mode is default on.
Use syntax highlight
Enables syntax highlight in the object editor window.
Always show links
If this option is checked, hyperlinks are displayed in the editor window. To open a link
click it with the Ctrl button pressed.
Show line numbers
If this option is checked, line numbers are displayed in the SQL text editor window.
Use smart tabs
With this option on the number of tab stops is calculated automatically, depending on
the previous line tab.
Tab Stops
Defines the tab length, used when editing text.
Undo Limit
Defines the maximum number of changes possible to be undone.
108
109
110
112
111
113
114
PHP Generator for MySQL Help 109
2013 SQL Maestro Group
9.2.2 Display
You can disable/enable the right text margin and the gutter of the editor area, set the
position of the right text margin as Right margin, and the Gutter width.
Use the Editor font and Font size to define the font used in all program editors and
viewers. The panel below displays the sample of the selected font.
Options 110
2013 SQL Maestro Group
9.2.3 SQL highlight
Use the SQL highlight item to customize syntax highlight in all SQL editors and viewers.
Select the text element from the list, e.g. comment or SQL keyword and adjust its
foreground color, background color and text attributes according to your preferences.
PHP Generator for MySQL Help 111
2013 SQL Maestro Group
9.2.4 XML highlight
Use the XML highlight item to customize XML syntax highlight for the text representation
of BLOBs. Select the text element from the list, e.g. attribute or attribute value and
adjust its foreground color, background color and text attributes according to your
wishes.
Options 112
2013 SQL Maestro Group
9.2.5 PHP highlight
Select the text element from the list (e.g. Keyword, Comment, Identifier), and adjust its
foreground color, background color and text attributes according to your wishes.
PHP Generator for MySQL Help 113
2013 SQL Maestro Group
9.2.6 Code Insight
You can disable/enable the code completion with the corresponding option and also set
the time is appears as Delay, and case of words inserted automatically.
Options 114
2013 SQL Maestro Group
9.2.7 Code Folding
The Code Folding item group makes it possible both to view the whole text and to divide
it into logical parts (regions). Each part can be collapsed and extended. In extended
mode the whole text is displayed (set by default), in collapsed mode the text is hidden
behind one text line denoting the first line of the collapsed region.
PHP Generator for MySQL Help 115
2013 SQL Maestro Group
You can enable/disable code folding in SQL editors and viewers and customize the colors
of its items.
Options 116
2013 SQL Maestro Group
9.3 Appearance
The Appearance section allows you to customize the application interface style to your
preferences.
Use the Scheme name box to select the interface scheme you prefer: Office XP style,
Windows XP native style, etc. You can create your own interface schemes by
customizing any visual options (Bars and menus, Trees and lists, Edit controls, Check
boxes, Buttons, etc.) and clicking the Save As button. All the customized options are
displayed on the sample panel.
Bars and menus
Trees and lists
Edit controls
Check boxes
Buttons
Page controls
Group boxes
Splitters
9.3.1 Bars and menus
Use the Bars and menus item to customize PHP Generator for MySQL toolbars style and
menus animation.
The item allows you to select Bar style and menu animation from the corresponding
drop-down lists and to enable or disable such options as sunken border, F10 key for
opening menu, viewing full menus after delay, flat close buttons, gray-scale images.
116
117
118
119
120
121
122
123
PHP Generator for MySQL Help 117
2013 SQL Maestro Group
9.3.2 Trees and lists
Use the Trees and lists item to select various tree view options. Use the item to select
standard, flat or ultraflat styles, check or uncheck the hide selection, hide focus
rectangle and native style options.
Options 118
2013 SQL Maestro Group
9.3.3 Edit controls
Use the Edit controls item to customize the appearance of different PHP Generator for
MySQL edit controls. The tab allows you to select the edit controls border style, button
style and transparency, enable/disable hot tracks, shadows, native style and customize
edges. It is also possible to define samples for the text edit, button edit and combo box
controls.
PHP Generator for MySQL Help 119
2013 SQL Maestro Group
9.3.4 Check boxes
The Check boxes item allows you to customize the appearance of check boxes and radio
buttons. The tab allows you to customize the appearance of check boxes: set border
style, enable/disable hot tracks, shadows, native style. It is also possible to define
samples for check boxes and radio buttons.
Options 120
2013 SQL Maestro Group
9.3.5 Buttons
Use the Buttons item to customize PHP Generator for MySQL buttons. The tab allows
you to adjust the appearance of buttons and define sample buttons as well.
PHP Generator for MySQL Help 121
2013 SQL Maestro Group
9.3.6 Page controls
The Page controls item allows you to customize the style of all PHP Generator for MySQL
page controls. The tab allows you to select tab styles, enable/disable hot track, multi-
line pages and native style.
Options 122
2013 SQL Maestro Group
9.3.7 Group boxes
Use the Group boxes item to customize all PHP Generator for MySQL group boxes
according to your preferences. Use tab to apply styles for group boxes, enable/disable
native style and define samples.
PHP Generator for MySQL Help 123
2013 SQL Maestro Group
9.3.8 Splitters
Use the Splitters item to customize all PHP Generator for MySQL splitters according to
your preferences. Use the tab to select hot zone style (Windows XP task bar, Media
Player 8, Media Player 9, Simple or none) and specify the Hot zone drags a splitter
option.
Options 124
2013 SQL Maestro Group

PHP Generator for MySQL Help 125
2013 SQL Maestro Group
Index
- A -
Appearance Options
Bar and menus 116
Buttons 120
Check boxes 119
Edit controls 118
Group boxes 122
Page controls 121
Splitters 123
Trees and lists 117
- C -
Command line options 17
Connect to database 12
Connection options 12
- E -
Editor & Viewer Options
Code Folding 114
Code Insight 113
Display 109
General 108
PHP highlight 112
SQL highlight 110
XML highlight 111
EULA 5
- G -
Getting started 11
- I -
Installation instructions 3
- L -
License Agreement 5
- O -
Options 100
Appearance 116
Application 101
Editor & Viewers 108
Page 101
- P -
Page Editor
Columns 26
Data Partitioning 69
Edit properties 33
Events 58
Filter 67
Inline edit properties 49
Inline insert properties 49
Lookup options 27
Master- Detail Presentations 54
Multi-level autocomplete editor 43
Page properties 68
Templates 50
View properties 30
PHP Generator for MySQL
Installation 3
License agreement 5
Overview 1
Registration 4
System requirements 2
Projects 16
Purchase PHP Generator for MySQL 4
- R -
Registration 4
Report sending 18
- S -
System requirements 2
- W -
Webpage appearance 76
Index 126
2013 SQL Maestro Group
Webpage appearance 76
Color Scheme 79
Color Scheme Customization 79
Custom CSS 81
Custom templates 83
Header and Footer 80
Using templates 83
Working with PHP Generator for MySQL
Adding queries 23
Advanced generation options 98
Configuring datasources 20
Customizing content of webpages 25
Localization 96
Output folder 98
Page Editor 26
Project Options 74
Record-level security 95
Security options 85
Selecting tables and views 22
User permissions 92
Webpage appearance 76

Das könnte Ihnen auch gefallen