Documente Academic
Documente Profesional
Documente Cultură
User's guide
Table of Contents
Foreword
2 Installation
...................................................................................................................................
3 How can
...................................................................................................................................
I purchase PHP Generator for MySQL?
4 License...................................................................................................................................
Agreement
5 About SQL
...................................................................................................................................
Maestro Group
6 What's...................................................................................................................................
new
10
11
II Getting started
1 How to...................................................................................................................................
connect to MySQL
12
2 Projects
...................................................................................................................................
16
3 Command
...................................................................................................................................
line options
17
4 Report...................................................................................................................................
sending
18
5 Shortcut
...................................................................................................................................
keys
19
20
22
2 Custom
...................................................................................................................................
SQL queries
23
25
IV Customizing webpages
1 Page Editor
...................................................................................................................................
26
Columns
.......................................................................................................................................................... 26
Setting a lookup
.........................................................................................................................................................
editor
27
View properties
......................................................................................................................................................... 31
Edit properties
......................................................................................................................................................... 34
Multi-level autocomplete
.........................................................................................................................................................
editor
44
Inline Insert.........................................................................................................................................................
and Inline Edit
50
String templates
......................................................................................................................................................... 51
Uploading .........................................................................................................................................................
files to webserver
52
Master-Detail ..........................................................................................................................................................
Presentations
55
Events
.......................................................................................................................................................... 59
Global Events
......................................................................................................................................................... 60
OnAfterLogin
......................................................................................................................................... 61
OnBeforeUpdateRecord
......................................................................................................................................... 62
OnBeforeInsertRecord
......................................................................................................................................... 62
OnBeforeDeleteRecord
......................................................................................................................................... 63
Client Side.........................................................................................................................................................
Page Events
63
OnBeforePageLoad
......................................................................................................................................... 64
OnAfterPageLoad......................................................................................................................................... 64
OnInsertFormValidate
......................................................................................................................................... 65
OnEditFormValidate
......................................................................................................................................... 65
Contents
II
OnInsertFormEditorValueChanged
......................................................................................................................................... 66
OnEditFormEditorValueChanged
......................................................................................................................................... 67
OnInsertFormLoaded
......................................................................................................................................... 69
OnEditFormLoaded
......................................................................................................................................... 70
Server Side.........................................................................................................................................................
Page Events
71
OnBeforePageExecute
......................................................................................................................................... 72
OnCustomRenderColumn
......................................................................................................................................... 72
OnCustomRenderPrintColumn
......................................................................................................................................... 75
OnCustomRenderExportColumn
......................................................................................................................................... 75
OnCustomHTMLHeader
......................................................................................................................................... 76
OnExtendedCustomDrawRow
......................................................................................................................................... 76
OnCustomRenderTotals
......................................................................................................................................... 78
OnGetCustomTemplate
......................................................................................................................................... 79
OnCustomDrawRow
......................................................................................................................................... 83
OnAfterUpdateRecord
......................................................................................................................................... 84
OnAfterDeleteRecord
......................................................................................................................................... 85
OnAfterInsertRecord
......................................................................................................................................... 85
OnBeforeUpdateRecord
......................................................................................................................................... 85
OnBeforeDeleteRecord
......................................................................................................................................... 86
OnBeforeInsertRecord
......................................................................................................................................... 86
Filter
.......................................................................................................................................................... 87
Page Properties
.......................................................................................................................................................... 88
Data Partitioning
.......................................................................................................................................................... 89
RSS
.......................................................................................................................................................... 91
2 Project...................................................................................................................................
Options
V Webpages appearance
94
96
1 Color schemes
...................................................................................................................................
99
2 Header
...................................................................................................................................
and Footer
100
3 Custom
...................................................................................................................................
CSS
101
4 Using...................................................................................................................................
templates
103
VI Security settings
105
1 Hard-coded
...................................................................................................................................
authorization
107
2 Table-based
...................................................................................................................................
authorization
109
3 Database
...................................................................................................................................
server authorization
111
4 Permission
...................................................................................................................................
manager
112
5 Record-level
...................................................................................................................................
security
115
116
118
120
IX Options
1 Application
...................................................................................................................................
121
Page
.......................................................................................................................................................... 121
Generation defaults
.......................................................................................................................................................... 124
Display formats
.......................................................................................................................................................... 125
II
III
2 Editors
...................................................................................................................................
& Viewers
129
General
.......................................................................................................................................................... 129
Display
.......................................................................................................................................................... 130
SQL highlight.......................................................................................................................................................... 131
XML highlight
.......................................................................................................................................................... 132
PHP highlight.......................................................................................................................................................... 133
Code Insight.......................................................................................................................................................... 134
Code Folding.......................................................................................................................................................... 135
3 Appearance
...................................................................................................................................
137
Index
146
Master-detail presentations
Record-level security
Multi-language support
23
55
59
115
116
96
89
105
1.1
System Requirements
Client environment
Pentium PC or higher;
Server environment
MySQL from 3.23 to 6.0;
Linux/Unix or Windows Web Server;
PHP 5.
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.
1.3
To obtain technical support, please visit the appropriate section on our website or
contact us by email to support@sqlmaestro.com.
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
1.5
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.
of
using
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:
10
1.6
What's new
Please find out the latest PHP Generator for MySQL news at http://www.sqlmaestro.
com/products/mysql/phpgenerator/news/
Getting started
11
Getting started
To create a database-driven web application,
12
Configure datasources
to be available;
116
20
118
25
to be created;
96
and interface
105
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 16 .
2014 SQL Maestro Group
12
2.1
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.
Getting started
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. PHP Generator for MySQL accepts keys in ssh.
com or OpenSSH formats. To convert a private key from PuTTY's format to
one of the formats supported by our software, use the PuTTYgen utility that
can be freely downloaded from the PuTTY website.
Keyboard interactive
Keyboard authentication is the advanced form of password authentication,
13
14
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.
Getting started
15
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 database
server is not installed on the same computer as the Web server.
16
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.
Getting started
2.3
17
<project_file_name>
The project
<output_directory>
-g|generate
-h|help
16
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"
18
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.
Getting started
2.5
Shortcut keys
The following table describes the default shortcut keys in PHP Generator for MySQL.
Interface
Load project
Save project
Save project as...
Next step
Previous step
Generate PHP scripts
Exit
PHP Generator for MySQL help
Ctrl+O
Ctrl+S
Ctrl+Shift+S
Shift+N
Shift+B
Shift+R
Alt+F4
Shift+H
19
20
Configuring datasources
PHP Generator for MySQL creates webpages aimed at interaction with MySQL tables,
views, and queries throw the web. Each webpage contains a grid with data of according
datasource supplied with abilities to view, edit, filter, sort, delete, and others.
Adding tables and views
To add a table or a view, open the Select object
button.
22
Adding queries
To add a query, type the query text in the Query editor 23 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.
Invalid queries
The wizard automatically validates objects and displays names of invalid queries in red.
The basic rules of queries usage in PHP Generator projects are covered in the
corresponding topic 23 .
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 127 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.
Configuring datasources
21
By default, each script has settings defined by the application options 121 . 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.
22
3.1
Configuring datasources
3.2
23
This happens because the software uses similar queries for internal needs. In case such
SQL expression is not valid, the wizard marks the query as invalid and displays its name
in red.
To meet this requirement, make sure that all the columns in the result dataset have
unique aliases. For example, the following query works fine itself, but returns a dataset
with two columns named id:
SELECT
table1.*,
table2.*
FROM table1, table2
WHERE table1.id = table2.id;
This is the reason the wizard marks this query as invalid. To solve the problem, provide
these columns with unique aliases:
SELECT
table1.id as table1_id,
table2.id as table2_id
FROM table1, table2
WHERE table1.id = table2.id;
24
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;
Customizing webpages
25
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 121 . Use the Edit button to edit settings of a concrete webpage with
the Page editor 26 . 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 124 .
Details
This tab contains detail presentations 55 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 124 is enabled). Use the Reset and Reset all buttons to
setup detail pages properties according to the project options 94 .
Project Options
To specify default setting 94 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 88 window.
26
4.1
Page Editor
Columns 26
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 55
Use this tab to adjust the page detail presentations and setup detail pages properties.
Events 59
Set here the fragments of PHP code to be executed before or after a record was added,
edited, deleted, etc.
Filter 87
Use this tab to reduce the number of records available at the generated page.
Use the Page Properties 88 window to setup common page properties such as view/edit/
delete/filter/export abilities, pagination options, page header, and more.
The Data Partitioning 89 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 27 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 124 is
enabled).
The View 31 properties determine how the column is displayed on the List, View, Print
and Export pages.
The Edit
pages.
34
properties define how the column is represented on the Edit and Insert
Customizing webpages
27
The Inline Edit, Inline Insert 50 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. The order
of columns at the General tab remains
unchanged as it is possible to have different column order for different presentation.
4.1.1.1
28
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
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 124 is enabled).
Using Filter condition
Filter condition allows you to reduce the list of values represented in the lookup editor
with a specified criterion. This condition corresponds to the WHERE clause applied to the
data source (you must not add the WHERE keyword to beginning of the condition). The
following operators can be used in this clause: =,<> (!=), >, <, >=, <=, BETWEEN, LIKE,
IN. It is also possible to use predefined variables like %CURRENT_USER_NAME%.
Example 1
To enable a lookup editor with a list of USA cities (the corresponding value of
"country_id" is 103) named like Da*, specify the following condition: country_id = 103
AND city LIKE 'Da%'
Example 2
Suppose we have a table that contains a column 'owner' with owner information. To set
a lookup editor with the list of values owned by the current user, specify the filter
condition as follows: owner = %CURRENT_USER_NAME%
Setting a lookup editor represented data of several columns
To create such lookup editor, 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
FIRST_NAME
varchar(15)
LAST_NAME
varchar(20)
JOB_CODE
integer NOT
DEPT_NO
integer NOT
)
Customizing webpages
29
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
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
30
the
list
of
the
allowed
values
in
pairs
Customizing webpages
an_allowed_value=value_to_be_represented
31
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
Use the View options to define the way the column data are represented on generated
webpages.
32
Use Display properties to set the type of data representation and format options (text
alignment, image size, and so on). The available representations with the corresponding
format options are shown in the table below. Format options are specified within the
corresponding dialog opened by the ellipsis button next to the Display properties. By
default, the format is the same as it is set at the Project options 125 .
Along with available format options you can define your own ones with the Custom
attributes option. This option allows you to specify the content of standard HTML style
tag applied to the column data. For example, to set the font color and size of the
column, enter style="color:red;font-size:20px;" as Custom attributes. To implement
more difficult data representation, especially for conditional data formatting, it's
recommended to use the OnExtendedCustomDrawRow 76 event.
Available
representations
Text
Additional options
Result
Customizing webpages
Select the
format.
type
of
date time
Image
File download
Checkbox
External
External
image
file,
'product'
33
34
Source prefix=D:\Images\
Source suffix=_62x62.jpg
Display as hyperlink
To represent the column's data as hyperlink, check the Display as hyperlink option and
specify the HREF Template 51 . Target controls where the new document is displayed
when a user follows the link.
_blank
_parent
_self
_top
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
em
px
in
cm
mm
pt
pc
Meaning
The 'font-size' of the relevant font.
(pixels) Relative to the viewing device.
(inches) 1 inch is equal to 2.54 centimeters.
Centimeters
Millimeters
(points) The points used by CSS 2.1 are equal to 1/72nd of an inch.
(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.
Customizing webpages
Additional
options
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 mostfrequently
used
values to
be always
displayed
at the top
of the list.
To
do
this, click
the ellipsis
button
next
to
the Most
frequently
Editor appearance
35
36
used
values
and
add
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
51 .
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.
Customizing webpages
Mul
tileve
l
aut
oco
mpl
ete
edit
or
The
control is
based on
cascading
dropdown lists
and allows
users
to
select
a
value from
a long list
step-bystep. For
example,
when we
select
a
country in
the
Country
dropdown list,
it
will
populate
the
City
dropdown list
according
to
the
country
selected,
and
so
on.
To
find
out
more
instructio
ns
use
the
correspon
ding topic
44 .
Specify
the levels
in
the
dialog
opened by
the ellipsis
button.
To set a
new level,
enter the
level
37
38
caption,
parent
data
source (a
table that
contains
data
to
be
displayed
on
the
next level
of
the
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.
Customizing webpages
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 125
. 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-ofday
values.
Spin
edit
This
editor
type
allows you
to set the
constraint
s
(Min
value,
Max value
) on the
entered
data.
39
40
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
numbers
setting
999-9999999
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.
Customizing webpages
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
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
41
42
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.
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,
Customizing webpages
and
set
the
necessary
Max
width and
Max
height.
Upl
oa
d
file
to
fol
de
r,
Upl
oa
d
im
ag
e
to
fol
de
r
To
use
the
column to
store
paths to
uploaded
files,
setup the
Folder to
upload
and
the
File name
using
templates
51 .
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
43
44
thumbnail
path
to
be saved
to,
set
the Folder
to upload
and
the
name
of
the
created
file
(It's
possible
to
use
templates
51
or
random
file
names)
and
submit
the resize
rules.
4.1.1.4
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
2014 SQL Maestro Group
Customizing webpages
45
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:
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 27 . If you have defined a foreign
key constraint for this column in the database and the Setup lookup by foreign key 124
option is enabled, these properties will be set automatically.
46
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
47
3. Now it's time to add the first level. Click Add level and enter values in the Add filter
dialog window as follows:
48
Click OK to save the changes. The list of levels now looks as follows:
Customizing webpages
49
50
Click OK in the Edit properties window to save all the settings and return to the Page
Editor.
4.1.1.5
Make sure that the Insert (Edit) ability option is set as Inline at the Page
properties
88
Specify the columns to be available for inline inserting (editing) at the Inline
Insert (Inline Edit) tab of the Page Editor
26
26
tab.
Customizing webpages
4.1.1.6
51
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
52
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
Customizing webpages
53
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:
54
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
55
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.
56
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 124 option is enabled, the detail relation will be set automatically.
Customizing webpages
57
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.
58
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
59
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 26 .
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
PHP Generator for MySQL allows you to supply the generated applications with an
additional functionality with the help of event handlers. Event handlers are fragments of
PHP/Javascript code executed at the appointed time. This feature provides you with
wide opportunities: for example, you can equip webpages with tracking of user activity,
completely redesign any created page, supply the application with the power of thirdpart libraries, etc.
All evens supported by PHP Generator for MySQL may be divided by the scope the
events are fired on (possible options are all generated webpages (global events) or a
certain webpage (page-specific events)); and by the side the event handlers are
executed on: the webserver (written on PHP) or browsers (written on Javascript).
Global Events
60
63
71
60
26
Project Options
94
Global Events
Handlers of global events contain pieces of PHP code that are not specific for any page
i.e. these events are fired on all the generated webpages.
OnAfterLogin
61
OnBeforeUpdateRecord
OnBeforeInsertRecord
OnBeforeDeleteRecord
62
62
63
To specify a handler for a global event, open the project options 94 window, select the
appropriate node in the tree, and enter your code. The Events tab of the dialog allows
you to temporarily disable a certain event.
Customizing webpages
61
4.1.3.1.1 OnAfterLogin
This event occurs after a user is successfully logged in into the application.
Signature:
function
OnCustomHTMLHeader
($userName,
$connection)
Parameters:
$userName
$connection
Example:
Let's show how to use this event for tracking the user activity. The code snippet below
inserts a new record containing user name and the connection time into the 'log' table.
$connection->ExecSQL("INSERT INTO log(user_name,
VALUES ('$userName', CURRENT_TIMESTAMP)");
log_date)
62
4.1.3.1.2 OnBeforeUpdateRecord
This event occurs when the Update command is executed, but before the actual
update. It is often used to cancel the update operation.
Signature:
function
OnBeforeUpdateRecord
Parameters:
$page
$rowData
$cancel
$message
$tableName
Example 1:
To prevent data from updating, place the following code to the event body.
$cancel = true;
$message = 'Updating is disabled.';
Example 2:
You can also restrict data changes with this event handler. The code below prevents
the update of the 'city' table by a user logged as guest.
$userName
=
$page->GetEnvVar('CURRENT_USER_NAME');
if (($tableName == "`city`") &&
($userName = guest))
{
$message = 'No update possible because the guest has no permission to change this table.';
$cancel = true;
}
62
, OnBeforeDeleteRecord
63
, OnBeforeUpdateRecord
4.1.3.1.3 OnBeforeInsertRecord
This event occurs when the Insert command is executed, but before the actual
insertion. It is often used to cancel the insert operation.
Signature:
function
OnBeforeUpdateRecord
Parameters:
$page
$rowData
Customizing webpages
$cancel
$message
$tableName
63
Example:
To disallow adding of new records, place the following code to the event body.
$cancel = true;
$message = 'Inserting is disabled.';
62
, OnBeforeDeleteRecord
63
, OnBeforeInsertRecord
4.1.3.1.4 OnBeforeDeleteRecord
This event occurs when the Delete command is executed, but before the actual
deletion. It is often used to cancel the delete operation.
Signature:
function
OnBeforeDeleteRecord
Parameters:
$page
$rowData
$cancel
$message
$tableName
Example:
To protect records from deletion, add the following lines to this event body.
$cancel = true;
$message = 'Deleting is disabled.';
62
, OnBeforeInsertRecord
62
, OnBeforeDeleteRecord
64
64
64
OnInsertFormValidate
OnEditFormValidate
65
65
OnInsertFormEditorValueChanged
OnEditFormEditorValueChanged
OnInsertFormLoaded
OnEditFormLoaded
66
67
69
70
71
4.1.3.2.1 OnBeforePageLoad
This event occurs before page loading. It allows you to declare functions and global
variables. Use the event to include one or several files of a third-party library into the
generated pages.
Example
To get the details of the first master record expanded on opening of a certain page of
the generated application, define the expandFirstDetail function within the
OnBeforePageLoad event handler as follows:
function expandFirstDetail() {
if
($('table.pgui-grid').data('grid-class')){
var grid = $('table.pgui-grid').data('grid-class');
var $row =
$('table.pgui-grid tr.pg-row').first();
grid.expandDetails($row);
return true;
}
else {
setTimeout(expandFirstDetail, 100);
}
}
64
event handler.
To see this example in action, visit the Players page of our demo application.
4.1.3.2.2 OnAfterPageLoad
This event occurs after page has been fully rendered. It does not get triggered until all
assets such as images have been completely received and DOM hierarchy has been fully
constructed.
Example 1:
To get details of the first record expanded on the webpage opening, specify Javascript
code as follows:
function expandFirstDetail() {
if ($('table.pgui-grid').data('grid-class')) {
var grid = $('table.pgui-grid').data('grid-class');
var $row =
$('table.pgui-grid tr.pg-row').first();
grid.expandDetails($row);
return true;
}
else {
Customizing webpages
65
setTimeout(expandFirstDetail, 100);
}
}
expandFirstDetail();
It is also possible to specify the function above within the OnBeforePageLoad 64 event
handler. In this case the OnAfterPageload event handler should contain only the function
call:
expandFirstDetail();
4.1.3.2.3 OnInsertFormValidate
This event occurs before submitting of an insert form. It allows you to detect errors on
the client side before the form is submitted to the server to avoid the round trip of
information necessary for server-side validation.
Signature:
function
OnInsertFormValidate
(fieldValues,
errorInfo)
Parameters:
fieldValues
errorInfo
Example 1:
The code below demonstrates the verification of the percent number on the record
inserting.
if (fieldValues['percents'] < 0 || fieldValues['percents'] > 100)
{
errorInfo.SetMessage('Percent value should be between 0 and 100.');
return false;
}
Example 2:
The following code is used in the NBA demo project to ensure that home and away
teams are different for an inserted game:
if
{
(fieldValues['home_team_id']
==
fieldValues['away_team_id'])
65
4.1.3.2.4 OnEditFormValidate
This event occurs before submitting an edit form. It allows you to detect errors on the
client before the form is submitted to the server to avoid the round trip of information
necessary for server-side validation.
Signature:
function
OnEditFormValidate
(fieldValues,
errorInfo)
66
Parameters:
fieldValues
errorInfo
Example 1:
To validate the 'percents' value and show a warning message in case of erroneous input,
use the following code:
if (fieldValues['percents'] < 0 || fieldValues['percents'] > 100)
{
errorInfo.SetMessage('Percent value should be between 0 and 100.');
return false;
}
Example 2:
The following code is used in the NBA demo project to ensure that home and away
teams are different for an edited game:
if
{
(fieldValues['home_team_id']
==
fieldValues['away_team_id'])
65
4.1.3.2.5 OnInsertFormEditorValueChanged
OnInsertFormEditorValueChanged
(sender,
editors)
Parameters:
sender
editors
Example 1:
The code below allows you to select a college only for players from U.S. (see this in
action). See how it looks on the webpage at the screen below.
if
{
(sender.getFieldName()
==
'country_id')
editors['college_id'].enabled(sender.getValue()
if (sender.getValue() != 1)
editors['college_id'].setValue(null);
==
1);
Customizing webpages
67
Example 2:
Another example from the insert and edit forms of the Players page (see this in action).
This piece of code allows you to select player number only if a player's team is already
selected (in other words, players who do not belong to a team cannot have numbers).
if
{
(sender.getFieldName()
==
'current_team_id')
if (sender.getValue() == '')
{
editors['current_number'].setValue('');
editors['current_number'].enabled(false);
}
else
{
editors['current_number'].enabled(true);
}
}
67
4.1.3.2.6 OnEditFormEditorValueChanged
OnEditFormEditorValueChanged(sender,
Parameters:
2014 SQL Maestro Group
editor)
68
sender
editors
Example 1:
The code below allows you to select a college only for players from U.S. (see this in
action). See how it looks on the webpage at the screen below.
if
{
(sender.getFieldName()
==
'country_id')
editors['college_id'].enabled(sender.getValue()
if (sender.getValue() != 1)
editors['college_id'].setValue(null);
==
1);
Example 2:
Another example from the insert and edit forms of the Players page (see this in action).
This piece of code allows you to select player number only if a player's team is already
selected (in other words, players who do not belong to a team cannot have numbers).
if
{
(sender.getFieldName()
==
'current_team_id')
if (sender.getValue() == '')
{
editors['current_number'].setValue('');
editors['current_number'].enabled(false);
}
else
{
editors['current_number'].enabled(true);
}
}
Customizing webpages
69
66
4.1.3.2.7 OnInsertFormLoaded
OnInsertFormLoaded(editor)
Parameters:
editors
Example:
This piece of code targets two things:
1) Player number is cleared and the appropriate control becomes disabled for players
that do not belong to a team.
2) Player's college is cleared and the appropriate control becomes disabled if player's
country is not USA (country code == 1).
editors['college_id'].enabled(editors['country_id'].getValue()
if (editors['country_id'].getValue() != 1)
editors['college_id'].setValue(null);
if
{
(editors['current_team_id'].getValue()
==
editors['current_number'].setValue('');
editors['current_number'].enabled(false);
}
else
{
editors['current_number'].enabled(true);
}
'')
==
1);
70
70
4.1.3.2.8 OnEditFormLoaded
Parameters:
editors
Example:
This piece of code targets two things:
1) Player number is cleared and the appropriate control becomes disabled for players
that do not belong to a team.
2) Player's college is cleared and the appropriate control becomes disabled if player's
country is not USA (country code == 1).
editors['college_id'].enabled(editors['country_id'].getValue()
if (editors['country_id'].getValue() != 1)
editors['college_id'].setValue(null);
if
{
(editors['current_team_id'].getValue()
==
==
1);
'')
editors['current_number'].setValue('');
editors['current_number'].enabled(false);
}
else
Customizing webpages
71
{
editors['current_number'].enabled(true);
}
69
72
OnCustomRenderColumn
72
OnCustomRenderPrintColumn
75
OnCustomRenderExportColumn
OnCustomHTMLHeader
76
OnExtendedCustomDrawRow
OnCustomRenderTotals
78
OnGetCustomTemplate
79
OnCustomDrawRow
75
76
83
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
list of supported variables, turn ON the "Show environment variables" option in the
Project options dialog, re-generate the code and then open any of produced web pages
in the browser. The following example demonstrates how to use variables within the
OnBeforeInsertRecord 86 event handler.
2014 SQL Maestro Group
72
$rowData['ip_address']
=
$this->GetEnvVar('REMOTE_ADDR');
$userName
=
$this->GetEnvVar('CURRENT_USER_NAME');
if ($userName != 'admin')
$rowData['changed_by'] = $userName;
63
4.1.3.3.1 OnBeforePageExecute
This event handler contains PHP code to be included at the begin of generated pages.
This code is executed only once and intended to create global objects, declare
functions, include third-party libraries, and so on.
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, so the event
handler should be specified as follows:
include_once
'../geshi/geshi.php';
4.1.3.3.2 OnCustomRenderColumn
This event occurs before column rendering and allows you to completely replace the cell
content. It is an extremely useful event for conditional rendering or embedding thirdparty components to extend standard functionality.
Signature:
function
OnCustomRenderColumn
Parameters:
$fieldName
$fieldData
$rowData
$customText
$handled
Example 1:
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
73
Example 2:
The code below is used in our demo project to show the number of overtime periods
played in the game.
if ($fieldName == 'overtime_count')
{
if ($fieldData > 0)
$customText = $fieldData . ' OT';
else
$customText = '-';
$handled = true;
}
The screenshot demonstrates the result of this event fired on the Games webpage.
Example 3:
The code below is used in our demo project to add flag images to the "Country" column.
if
{
($fieldName
==
'current_team_id')
if (!isset($fieldData))
{
$customText = 'Free agent';
$handled = true;
}
}
elseif ($fieldName == 'country_id')
{
$countriesPics = array (
1 => 'us',
2 => 'fr',
3 => 'br',
4 => 'it',
6 => 'sp',
8 => 'ar',
11 => 'li',
15 => 'ru',
18 => 'gr',
20 => 'ge'
);
$customText =
'<div style="width: 80px; text-align: left;">' .
'<img src="countries/'.$countriesPics[$rowData['country_id']].'.png">' .
' ' . $fieldData .
'</div>';
$handled = true;
}
74
Example 4
This example demonstrates the applying of the syntax highlighting provided by the Geshi
library. We use this library to highlight SQL syntax in strings stored in the 'Body' column.
if ($fieldName == 'Body')
{
$source = $rowData['Body'];
$language = 'sql';
$formatted_sql = SqlFormatter::format($source, false);
$geshi = new GeSHi($formatted_sql, $language);
$customText =
'<div align="left">'.$geshi->parse_code().'</div>';
$handled = true;
}
Customizing webpages
75
, OnCustomRenderExportColumn
75
75
4.1.3.3.3 OnCustomRenderPrintColumn
This event occurs before column rendering on the print page and allows you to replace
cell content. It is an extremely useful for conditional rendering or embedding third-party
components to extend standard functionality.
Signature:
function
OnCustomRenderPrintColumn
Parameters:
$fieldName
$fieldData
$rowData
$customText
$handled
72
, OnCustomRenderExportColumn
75
4.1.3.3.4 OnCustomRenderExportColumn
This event occurs before column rendering into Word, Excel, etc. and allows you to
replace cell content. It is an extremely useful event for conditional rendering.
Signature:
function
OnCustomRenderExportColumn
Parameters:
$fieldName
$fieldData
76
$rowData
$customText
$handled
72
, OnCustomRenderPrintColumn
75
4.1.3.3.5 OnCustomHTMLHeader
This event occurs when the head section of the page is generating. Use it to provide
additional information for the HEAD section of the page (such as keywords, author, or
description).
Signature:
function
OnCustomHTMLHeader
($page,
&$customHtmlHeaderText)
Parameters:
$page
$customHtmlHeader
Text
Example:
The following code demonstrates how to use this event to add metadata to the
generated webpage.
$customHtmlHeaderText
'<meta
name="copyright"
content="SQL
Maestro
Group"/>';
4.1.3.3.6 OnExtendedCustomDrawRow
This event occurs when rendering a grid row and allows you to change the row and/or
cell styles directly. It is an extremely useful event for conditional formatting such as
changing font color, font styles, row background color, cell background color, etc. The
specified styles are applied to <tr> and <td> tags accordingly.
Signature:
function
OnExtendedCustomDrawRow
Parameters:
$rowData
$rowCellStyles
$rowStyles
This event (as well as OnCustomDrawRow 83 ) 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.
Customizing webpages
77
Example 1:
The code below is used in our online demo to display the winning team score in red and
the 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:
$rowCellStyles['away_team_score'] = 'font-size: 16pt;font-weight:
if ($rowData['home_team_score'] > $rowData['away_team_score'])
$rowCellStyles['home_team_score'] .= 'color: #F65317;';
else
$rowCellStyles['away_team_score'] .= 'color: #000000;';
bold;';
bold;';
The screenshot demonstrates the result of the event fired on the Games webpage.
Example 2
The code below is used in our online demo to highlight fields representing player's height
depending on the value.
$height = $rowData['height'];
$color = '#fffff';
if ($height > 200)
$color = '#f79646';
elseif ($height > 185)
$color = '#fac090';
elseif ($height > 170)
$color = '#fde9d9';
$rowCellStyles['height'] = "background-color:
$color;
font-weight:
bold;";
78
4.1.3.3.7 OnCustomRenderTotals
This event occurs before total values rendering and allows you to replace the default
total footer content. To use it, enable the grid footer in the View properties 31 of the
corresponding column.
Signature:
function
OnCustomRenderTotals
($totalValue,
$aggregate,
$columnName,
&$customText,
&$handled)
Parameters:
$totalValue
$aggregate
$columnName
$customText
$handled
Example 1:
The code below changes the caption of the 'amount' column footer and gives it strong
importance.
if ($columnName == 'amount')
{
$customText = '<strong>Total: $' . $totalValue . '</strong>';
$handled = true;
}
This picture demonstrates the difference between a webpage generated with default
footer and a webpage with the OnCuStomRenderTotals event specified in this way:
Customizing webpages
79
Example 2:
The code below is used in our online demo on the 'Teams' page to display the year of
foundation of the oldest team on the page in more convenient form.
if ($columnName == 'year_founded') {
$customText = 'MIN: ' . intval(str_replace(',', '', $totalValue));
$handled = true;
}
4.1.3.3.8 OnGetCustomTemplate
This event occurs on opening a custom template and allows to use a custom template
instead of the default one.
Signature:
function
OnCustomRenderColumn
($part,
$mode,
&$result,
&$params)
Parameters:
$part
$mode
$result
$params
PHP Generator creates a set of templates written on Smarty 2.0 to be used by the
prepared application in the certain situations. The basic principles of custom template
usage are shown in this article. To change any webpage look, you need to:
80
Page Part
Default template
Parameters
navigation bar
page_list.tpl
PagePart::PageList
Any PageMode
webpage layout
common/layout.tpl
PagePart::Layout
Any PageMode
table grid
list/grid.tpl
PagePart::Grid
PageMode::ViewAll
single row
list/single_row.tpl
PagePart::GridRow
PageMode::ViewAll
View form
view/grid.tpl
PagePart::RecordCard
PageMode::View
Edit form
edit/grid.tpl
PagePart::VerticalGrid
PageMode::Edit
Insert form
insert/grid.tpl
PagePart::VerticalGrid
PageMode::Insert
view/record_card_view.tpl PagePart::VerticalGrid
All Pages
List page
PageMode::ModalView
Edit modal dialog
edit/vertical_grid.tpl
PagePart::VerticalGrid
PageMode::ModalEdit
insert/vertical_grid.tpl
PagePart::Grid
PageMode::
ModalInsert
To instruct PHP Generator to use a customized template file for a certain webpage,
specify the following code in the page's OnGetCustomTemplate event handler (of course
you should replace YourPart and YourMode to the appropriate values from the table
above).
2014 SQL Maestro Group
Customizing webpages
81
Example 1:
Suppose we need to use components/templates/custom_templates/staff_edit.tpl file as
a template for the edit form of a webpage.
if ($part == PagePart::VerticalGrid && $mode == PageMode::Edit) {
$result = 'staff_edit.tpl';
}
Now we can compare the result webpages without using this event and with the enabled
one:
Example 2:
One event can include several templates to be applied to different state and page parts
of the selected webpage. The following code is used in our online demo:
if ($part == PagePart::Grid && $mode == PageMode::ViewAll)
82
$result =
if ($part ==
$result =
if ($part ==
$result =
'games_grid.tpl';
PagePart::VerticalGrid && $mode == PageMode::Edit)
'games_edit.tpl';
PagePart::RecordCard && $mode == PageMode::View)
'games_view.tpl';
Example 3
This example shows how to fill a SELECT input with names of all MySQL databases
available at the server.
1. Specify the OnGetCustomTemplate event handler as follows:
// set the template file
if ($part == PagePart::Grid && $mode == PageMode::ViewAll) {
$result = 'custom_grid.tpl';
//
DATABASES',
//
//
$queryResult);
Example 4
This example shows the use of the superglobal $_GET array values in a custom template.
1. Specify the OnGetCustomTemplate event handler as follows:
2014 SQL Maestro Group
Customizing webpages
83
This event occurs on rendering a grid row. It is an extremely useful event for conditional
formatting such as changing font color, font styles, row background color, cell
background color, etc. This event (as well as the OnExtendedCustomDrawRow 76 one) 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.
Signature:
function
OnCustomDrawRow
($rowData,
&$cellFontColor,
&$cellFontSize,
&$cellBgColor,
Parameters:
$rowData
$cellFontColor
$cellFontSize
$cellBgColor
$cellItalicAttr
$cellBoldAttr
NB. Array keys should contain the real column names in the data source (table, view, or
query). Don't use the column's caption instead!
Example 1:
Suppose we need to
2014 SQL Maestro Group
&$cellItalicAt
84
represented in cursive. This column in the data source is named 'address_id' and the
column's caption is "Address".
true;
Example 2:
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.
$cellFontSize['home_team_score']
$cellBoldAttr['home_team_score']
=
=
'16pt';
true;
$cellFontSize['away_team_score']
$cellBoldAttr['away_team_score']
=
=
'16pt';
true;
if
This event occurs when the Update command is executed, and after the actual update.
This event is often used to execute actions after update operation.
Signature:
function
OnAfterUpdateRecord
($page,
&$rowData,
$tableName)
Parameters:
$page
$rowData
$tableName
85
, OnBeforeUpdateRecord
85
Customizing webpages
85
4.1.3.3.11 OnAfterDeleteRecord
This event occurs when the Delete command is executed, and after the actual deletion.
This event is often used to execute actions after delete operation.
Signature:
function
OnAfterDeleteRecord
($page,
&$rowData,
$tableName)
Parameters:
$page
$rowData
$tableName
85
, OnBeforeDeleteRecord
86
4.1.3.3.12 OnAfterInsertRecord
This event occurs when the Insert command is executed, and after the actual insertion.
This event is often used to execute actions after insert operation.
Signature:
function
OnAfterInsertRecord
($page,
&$rowData,
$tableName)
Parameters:
$page
$rowData
$tableName
85
, OnBeforeInsertRecord
86
4.1.3.3.13 OnBeforeUpdateRecord
This event occurs when the Update command is executed against a specific table, but
before the actual update. It is often used to cancel the update operation.
Signature:
function
OnBeforeUpdateRecord
($page,
&$rowData,
&$cancel,
&$message,
Parameters:
$page
$rowData
$cancel
$tableName)
86
$message
$tableName
Example:
The code below unconditionally disables the modification of records.
$cancel = true;
$message = 'Updating is disabled.';
86
, OnAfterUpdateRecord
84
4.1.3.3.14 OnBeforeDeleteRecord
This event occurs when the Delete command is executed against a specific table, but
before the actual deletion. It is often used to cancel the delete operation.
Signature:
function
OnBeforeDeleteRecord
($page,
&$rowData,
&$cancel,
&$message,
$tableName)
Parameters:
$page
$rowData
$cancel
$message
$tableName
Example:
The code below unconditionally disables the deletion of records.
$cancel = true;
$message = 'Deleting is disabled.';
86
, OnAfterDeleteRecord
85
4.1.3.3.15 OnBeforeInsertRecord
This event occurs when the Insert command is executed against a specific table, but
before the actual insertion. It is often used to cancel the insert operation.
Signature:
function
OnBeforeInsertRecord
($page,
&$rowData,
&$cancel,
&$message,
$tableName)
Parameters:
$page
Customizing webpages
$rowData
$cancel
$message
$tableName
87
Example 1:
The code below unconditionally disables the insertion of new records.
$cancel = true;
$message = 'Inserting is disabled.';
Example 2:
$rowData['ip_address']
=
$this->GetEnvVar('REMOTE_ADDR');
$userName
=
$this->GetEnvVar('CURRENT_USER_NAME');
if ($userName != 'admin')
$rowData['changed_by'] = $userName;
4.1.4
86
, OnAfterInsertRecord
85
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
2014 SQL Maestro Group
88
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
)
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 26 .
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 126 ). 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).
Meaning
The 'font-size' of the relevant font.
(pixels) Relative to the viewing device.
(inches) 1 inch is equal to 2.54 centimeters.
Centimeters
Millimeters
Customizing webpages
pt
pc
89
(points) The points used by CSS 2.1 are equal to 1/72nd of an inch.
(picas) 1 pica is equal to 12 points.
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.
90
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:
Customizing webpages
91
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
92
51
Customizing webpages
93
94
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 121 . To open this dialog window, follow the Setup project options to
configure default page settings link at the Customizing webpages 25 wizard step
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 121 .
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 121 .
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 events 60 to be executed on all generated page after successful
login, before update/insert/delete operations.
Customizing webpages
95
96
Webpages appearance
PHP Generator for MySQL allows you to setup the appearance of created webpages in
several ways:
Built-in color schemes 99
The simplest way to adjust the look and feel of the result application is to select
one of color schemes the software comes with.
Webpages appearance
97
98
Events 59
Events are pieces of code that are run when an action is taken by the user. Such
events
as
OnBeforePageExecute 72 ,
OnCustomRenderColumn 72 ,
and
OnCustomDrawRow 83 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 103
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.
Webpages appearance
5.1
99
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.
100
5.2
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>
Webpages appearance
5.3
101
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 {
2014 SQL Maestro Group
102
background-image: url('path/to/background.jpg');
}
Webpages appearance
5.4
103
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.
104
Security settings
105
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 107
Select this option to incorporate the authorization procedure directly into the PHP
code of the generated application.
Table-based authorization 109
Select this option to authorize a user of the web application by a login/password
combination stored in a database table.
Database server authorization 111
Select this option to accomplish the authorization by MySQL server.
112
, Record-level security
115
106
Security settings
6.1
107
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
112
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.
108
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.
112
Security settings
6.2
109
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.
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
2014 SQL Maestro Group
110
115
Security settings
6.3
111
112
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 107 . 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.
Security settings
113
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.
114
Security settings
6.5
115
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,
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
107
116
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 126 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
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/
Interface language
117
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.
118
100
116
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 126 .
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.
119
120
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 121
General PHP Generator for MySQL options: generation rules, default page options,
and display data formats.
Editors & Viewers 129
Customizing of all the SQL editors.
Appearance 137
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!
Options
9.1
121
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
121
Generation defaults
Display formats
Output
9.1.1
124
125
126
Page
Page navigator
Use this options group to define the number of records represented on the generated
page and the positioning of the navigational elements. The default navigational elements
are the numbers of pages. Use Data Partitioning 89 to create a custom pagination.
To display data more correctly, it's recommended to define the Content encoding of
data (UTF-8 or ANSI).
Content encoding
Specify the UTF-8 encoding to create a Unicode application.
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.
Page list mode
This option value determines whether the application navigation to be expanded,
collapsed or 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.
122
The Use fixed grid header option allows to set the grid header will be represented at the
page on scrolling.
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.
Apply filter automatically
This option allows you to define whether the filter condition specified in the Filter row
will be applied automatically, i.e. without using the Enter button. The Time interval
value determines the number of milliseconds passed from the last keystroke to the time
the filter is applied.
Use the Export tab to specify the available file formats the grid data may be exported to.
Options
123
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.
124
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.
Options
9.1.3
Display formats
Use this tab's fields to adjust the display data formats in the way you need.
125
126
9.1.4
Output
Use this tab to specify default values for project output options
118
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 116 .
You can also set here the output file extension and the default color scheme for the
generated pages.
Options
9.1.5
127
Confirmations
This tab allows you to disable/enable application confirmations. Check corresponding
options to enable necessary confirmation dialogs such as key column notification, exit
from application confirmation and others.
128
Options
9.2
129
9.2.1
129
130
SQL highlight
131
PHP highlight
133
XML highlight
132
Code Insight
134
Code Folding
135
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.
130
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
9.2.3
131
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.
132
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
9.2.5
133
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.
134
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
9.2.7
135
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.
136
You can enable/disable code folding in SQL editors and viewers and customize the colors
of its items.
Options
9.3
137
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
139
Check boxes
140
Buttons
Group boxes
9.3.1
138
141
Page controls
Splitters
137
142
143
144
138
9.3.2
Options
9.3.3
139
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.
140
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
9.3.5
141
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.
142
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, multiline pages and native style.
Options
9.3.7
143
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.
144
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
145
146
Index
-IInstallation instructions
-A-
-L-
Appearance Options
Bar and menus 137
Buttons
141
Check boxes
140
Edit controls
139
Group boxes 143
Page controls
142
Splitters
144
Trees and lists
138
License Agreement
Options 120
Appearance 137
Application
121
Editor & Viewers 129
Page 121
-P-
-E-
-GGetting started
11
Global Events 60
OnAfterLogin 61
OnBeforeDeleteRecord 63
OnBeforeInsertRecord 62
OnBeforeUpdateRecord 62
-O-
-C-
59, 63
59, 71
Page Editor
Columns 26
Data Partitioning 89
Edit properties
34
Events 59
Filter
87
Inline edit properties 50
Inline insert properties 50
Lookup options 27
Master- Detail Presentations 55
Multi-level autocomplete editor 44
Page properties 88
Templates 51
View properties 31
Page Events executed at Client Side 63
OnAfterPageLoad 64
OnBeforePageLoad 64
OnEditFormEditorValueChanged 67
OnEditFormLoaded 70
OnEditFormValidate 65
OnInsertFormEditorValueChanged 66
OnInsertFormLoaded 69
OnInsertFormValidate 65
Page Events executed at Server Side 71
OnAfterDeleteRecord 85, 86
OnAfterUpdateRecord 84
OnBeforePageExecute 72
OnCustomDrawRow 83
2014 SQL Maestro Group
Index
-RRegistration 4
Report sending 18
-SSystem requirements
-WWebpage appearance 96
Color Scheme 99
Color Scheme Customization 99
Custom CSS
101
Custom templates
103
Header and Footer 100
Using templates
103
Working with PHP Generator for MySQL
Adding queries 23
Advanced generation options 118
Configuring datasources 20
Customizing content of webpages 25
Localization
116
Output folder 118
Page Editor
26
Project Options
94
Record-level security 115
Security options
105
Selecting tables and views 22
2014 SQL Maestro Group
User permissions
112
Webpage appearance 96
147