Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Table of Contents
1. PHP Report Maker 9.................................................................................................................. 3
1.1 What's New ......................................................................................................................... 3
1.2 System Requirements ......................................................................................................... 9
1.3 Installation and Uninstallation .......................................................................................... 10
1.4 License and Ordering Information .................................................................................... 11
1.5 Technical Support ............................................................................................................. 11
1.6 Disclaimer of Warranty ..................................................................................................... 12
1.7 Third-party Tools ............................................................................................................... 12
1.8 Introduction to PHP and MySQL ...................................................................................... 14
1.9 Preparing Your Data .......................................................................................................... 22
1.10 Quick Start ...................................................................................................................... 24
1.11 Project Setup................................................................................................................... 29
1.11.1 Data Source Setup.................................................................................................... 29
1.11.2 PHP Settings ............................................................................................................. 36
1.11.3 HTML Settings .......................................................................................................... 41
1.11.4 Security Settings....................................................................................................... 46
1.11.5 Generate Settings .................................................................................................... 53
1.11.6 Table Setup .............................................................................................................. 56
1.11.7 Field Setup ............................................................................................................... 62
1.11.8 Chart Setup .............................................................................................................. 82
1.11.9 Gantt Chart Setup .................................................................................................... 89
1.11.10 Using Custom View ................................................................................................ 96
1.11.11 Detail and Summary Report Setup ...................................................................... 101
1.11.12 Crosstab Report Setup ......................................................................................... 106
1.11.13 Dashboard Setup.................................................................................................. 111
1.11.14 Compatibility Properties Setup ............................................................................ 114
1.11.15 Server Events and Client Scripts .......................................................................... 118
1.11.16 Custom Templates ............................................................................................... 145
1.11.17 Custom Files ......................................................................................................... 150
1.11.18 Custom Fields ....................................................................................................... 155
1.11.19 Linked Tables ....................................................................................................... 157
1.11.20 Multi-Language Project ........................................................................................ 162
PHP Report Maker is a powerful reporting tool that can generate dynamic PHP Web reports
from MySQL, PostgreSQL, Microsoft Access, Microsoft SQL Server and Oracle
database. You can instantly create live detail and summary reports or crosstabs reports
for your Websites. JavaScript (HTML 5) charts (column, bar, line, pie, area, doughnut,
multi-series and stacked chart) and Flash charts (Funnel, Candlestick and Gantt chart) are
supported. The generated Web pages are pure PHP, no server side or client-side component
is required. PHP Report Maker is designed for high flexibility, numerous options enable you
to generate the reports that best suits your needs. The generated codes are clean and easyto-customize. The PHP scripts can be run on Windows servers
(MySQL/PostgreSQL/Access/MSSQL/Oracle) or Linux/Unix servers
(MySQL/PostgreSQL/Oracle). PHP Report Maker can save you tons of time and is suitable for
both beginners and experienced developers alike.
Also See:
What's New in PHP Report Maker 9(See 1.1)
License and ordering(See 1.4)
Custom Fields
Add custom fields to a table or view with SQL expression.
Language_Load - For customizing the language phrases, fired after the language
file is loaded.
Format project file - Add indentation to XML nodes in the project file
Allow login by session variables - For use with User_CustomValidate server event
Session timeout period (minutes) - Specifies the session time-out period if the user
does not refresh or request a page
Session keep alive interval (seconds) - Specifies the interval to send Ajax request to
the server for keeping the session alive
Session time out countdown period (seconds) - Specifies the countdown period
before session ends
Use ADOdb driver for MySQL - Use the full ADOdb driver for MySQL instead of the
lite version (ewmysql.php)
Reduce image size only (image resize) - Specifies if enlarging image is preferred
(Migrated from previous Image Resize extension)
Always keep aspect ratio (image resize) - Specifies if aspect ratio should be kept
(Migrated from previous Image Resize extension)
More
Windows XP/2003/Vista/2008/2012/7/8/10
PHP Report Maker requires a few other system files. If you do not have latest version of
these files, you may experience ActiveX errors. To update your system, go the Microsoft
download pages listed below.
Service Pack 6 for Visual Basic 6.0: Run-Time Redistribution Pack (vbrun60sp6.exe)
Microsoft Windows Script 5.7 (Windows XP)
Microsoft Windows Script 5.7 (Windows Server 2003)
MSXML Parser 3.0
IIS Express (only required if you want to use IIS Express as testing web server)
If you use Microsoft Access, SQL Server or Oracle, PHP Report Maker requires the following
database drivers to connect to the database:
Microsoft Data Access Components (MDAC) 2.8 (for Microsoft Access and SQL
Server)
Microsoft Jet 4.0 Service Pack 8 (SP8) (for Microsoft Access <= 2003)
2007 Office System Driver: Data Connectivity Components (for Microsoft Access
2007)
Microsoft Access Database Engine 2010 Redistributable (for Microsoft Access 2010)
Microsoft SQL Server 2012 Native Client (X86 Package) (for Microsoft SQL Server
2005/2008/2012)
Oracle Client (for Oracle)
Server
Browser
PHP Report Maker 9 can co-exist with previous version of PHP Report Maker. You do NOT
need to uninstall previous version of PHP Report Maker if you don't want to.
Double-click on the downloaded installer to start the installation process. Follow the prompts
and change the settings whenever necessary.
To uninstall PHP Report Maker, go to [Control Panel]. Click [Add/Remove Programs]
and select [PHP Report Maker 9].
10
11
12
Horizontal Menu
Replaces the graphical extension for previous versions. Uses Bootstrap Navbar as horizontal
menu.
FusionCharts XT
Developer Website: http://www.fusioncharts.com/
FusionCharts XT is distributed under a special OEM license for PHP Report Maker.
PHP Report Maker does not support all charts in FusionCharts XT, see FusionCharts(See
1.15) for supported chart types. FusionCharts Free will still be used for Funnel Charts,
Candlestick Charts and Gantt Charts.
FusionCharts XT does NOT include PowerCharts XT, FusionWidgets XT and
FusionMaps XT.
PHP Report Maker does NOT support PowerCharts XT, FusionWidgets XT and
FusionMaps XT.
IMPORTANT NOTE: When you use PHP Report Maker with a registered license, you may
deploy FusionCharts to your websites together with PHP Report Maker generated scripts.
However, you may not rent, lease, lend or sublicense FusionCharts. If you use the
generated scripts and charts to build your web application as a product for public distribution
or commercial sale, you may not re-distribute FusionCharts with your product, you must
purchase your own OEM license for your product from the developer of FusionCharts.
13
What is MySQL?
MySQL is a relational database management system, or RDBMS. It has become the world's
most popular open source database because of its consistent fast performance, high
reliability and ease of use. PHP has MySQL extension which makes it really easy to access
data in MySQL.
14
upload_tmp_dir - If you want to use file upload, make sure this setting points to an existing
folder on your machine, e.g. upload_tmp_dir="C:\Windows\Temp"
If you're using NTFS on Windows, make sure that the user running the web server has
write permissions to this folder (e.g. make it readable and writable by Everyone). See the
section Configuring Permissions below.
Note
php_com_dotnet.dll - If you use MS Access or MS SQL Server (on Windows server), the COM
extension is required. As of PHP 5.3.15 / 5.4.5, the COM extension
15
The left hand side pane is Connections, the middle pane is Workspace and the right hand
side pane is Actions.
The Connections pane lists application pools and websites. The workspace pane consists of
two tabs at the bottom namely Features View and Content View. The Features View
allows you to work with the settings of the selected item from Connections pane whereas
the Content View displays all the child nodes (content) of the selected item.
Application pool is a group of IIS applications that are isolated from other application
pools. Each application pool runs in its own worker process. Any problem with that process
affects the applications residing in it and not the rest of the applications. You can configure
application pools individually.
16
Specify a name for the new pool to be created. Select .NET framework version that all the
applications from the pool will use. Also select pipeline mode. There are two pipeline modes
viz. integrated and classic. The integrated mode uses the integrated request processing
model whereas the classic mode uses the older request processing model. Click OK to create
the application pool.
Your new application pool will now be displayed in the Workspace pane. To configure the
application pool click on the "Advanced Settings" option under Actions pane. The following
figure shows many of the configurable properties of an application pool.
17
If you use 64-bit Windows, set Enable 32-Bit Applications to True. (See Running on 64bit Windows Operating System below.)
To create a new web site, select Web Sites node under Connections pane and then click on
"Add Web Site" under Actions pane. This opens a dialog as shown below:
18
Here, you can specify properties of the new web site including its application pool and
physical location.
Creating an IIS application or a Virtual Directory is quick and simple. Just right click on
the web site and choose either "Add Application" or "Add Virtual Directory" to open
respective dialogs (see below).
19
An existing Virtual directory can be marked as an IIS application by right clicking on it and
selecting "Convert to Application".
If you use IE, you may encounter the following error messages when you run PHP pages
with IIS 7:
An error occurred on the server when processing the URL. Please contact the system
administrator.
Go to Internet Options -> Advanced, disable Show friendly HTTP error messages.
20
Configuring Permissions
An important aspect of working with file upload to a folder on the Web server is to correctly
configure permissions.
When a Web application uses a file, the application must have Read permission to the file so
the application can access the data. Additionally, the application must have Write permission
to the folder that contains the file. Write permission is required because the file may be
created at run time.
If you use Linux/Unix, CHMOD your upload folder to "777" by using your FTP software.
To use an Access database in an PHP Web application, you must configure the folder that
contains the Access database to have both Read and Write permissions for the IIS user
account.
The default anonymous IIS user depends on IIS version. In IIS 5, it is
IUSR_<MachineName>. In IIS 6 and IIS 7 it can be NETWORKSERVICE or IUSR. In IIS 7.5
it depends on Application Pool, read Application Pool Identities for detail.
To set permissions in the folder (if you're using NTFS on Windows),
21
22
The main data is actually stored in the OrderDetails table, but we obtain the following
information using the joins between tables:
Company name - Use the OrderID field in the OrderDetails table to trace back to the
Orders table, then use the CustomerID in the Orders table to trace back to the Customers
table to get the CompanyName.
Product name - Use the ProductID field in the Order Details table to trace back to the
Products table to get the ProductName.
Category name - Use the ProductID field in the OrderDetails table to trace back to the
Products table to get the ProductName, then use the CatergoryID in the Products table to
trace back to the Categories table to get the CategoryName.
With the company name, product name and category name present in one single source the "Orders By Product" View, you can create reports and use them to group your data.
Otherwise, you can only group by OrderID or ProductID which are only integers and make
the report much less readable.
Notes
1. Make sure the data referenced by the foreign keys are unique or the grouping will be
wrong. For example, if you have 2 different CustomerID in your orders table but
they both have the same company name, these 2 companies will become
23
2. Filtering Data
The second thing to consider is filtering of the data. Always retrieve the least amount of data
from the database for best performance.
For example, if your data ranges across 3 years and you only need to see one year data in
your report each time, you can create a report and select the year at runtime (Run-time
refers to when you run the generated script. Run-time filtering is well supported for users to
see partial data that they are interested in), but this would mean that the PHP script will
need to handle 3 times the data needed to show initially. There is performance penalty if the
size of your data is large and it will take a longer time for the report page to show. You have
2 alternatives:
1. Use Extended Filter for the field and choose a default year, or
2. Create 3 views in your database for each year.
then your report for a particular year will load faster.
After you prepare the data, connect to the database using PHP Report Maker, then right click
the database pane or click [Edit] and then choose [Add Report (Detail/Summary)] or
[Add Report (Crosstab)] or [Add Report (Gantt)] to create a report.
Quick Start
PHP Report Maker connects to MySQL, extracts tables and fields information, and generates
PHP scripts instantly based on these information.
To generate scripts, you just need to follow the tabs and setup the options, that is:
[Database] -> [PHP] -> [HTML] -> [Security] -> [Generate]
However, if you are a first time user, we recommend you to generate a basic PHP application
and get to know how PHP Report Maker and PHP works first.
If you have not used PHP before, it is recommended that you read Introduction to PHP
and MySQL(See 1.8) first.
Note
To generate your first PHP project, you can skip the options and use default settings first. In
other words, you skip the intermediate steps and go directly to the [Generate] tab after
connecting to your data source, that is:
[Database] -> [Generate]
24
2. Click the [Connect] button to load the database information. Tables and fields
information will be loaded and displayed on the left hand side.
25
Note that in the database pane on left, there is a checkbox beside each table or view. The
checkbox determines if report for the table/view will be generated. As they are only source
tables that your reports to be based on, the checkbox for these tables/views are not checked
by default. However, as a quick start example, we use them direclty for simplicity.
Check at least one of them so we have something to generate for. Alternatively, you can
click on the [Tables] or [Views] or [Custom Views] or [Reports] node in the database
pane (or click [View] -> [Tables/Views] in the main menu) to go the Table Setup(See
1.11.6) page and select all tables.
26
27
To run PHP you need to setup a website or virtual directory (See Introduction to PHP and
MySQL(See 1.8)). If you are not familiar with web server, you can install IIS Express which
can be downloaded from Microsoft website. Then select [IIS Express] and [Browse after
generation] in PHP Report Maker.
4. Click the [Generate] button, the generation process will begin. After the web site is
generated successfully, a completion message will be displayed. The web site should then be
ready to run. Browse to the website and - voila! - you'll see PHP displaying the data in your
website.
As a quick start example, these are only reports in simplest form. After understanding how
PHP Report Maker works, you can go on to create more sophisticated reports, Detail and
Summary Report(See 1.11.11) or Crosstab Report(See 1.11.12) are just a few more steps
away. You can take advantage of various options provided by PHP Report Maker to present
your data. See Project Setup(See 1.11) for full details.
28
Database(See 1.11.1)
PHP(See 1.11.2)
HTML(See 1.11.3)
Security(See 1.11.4)
Generate(See 1.11.5)
To further control the functionality of the generated scripts, you can setup different options
for each table, field or chart:
29
(Also see Tutorial - Connecting Remote MySQL using PHP Report Maker Connection
Script(See 1.17.1))
While the direct connection method is quick and easy, some remote MySQL server may not
allow direct connection. PHP Report Maker provides an alternative simple way to connect
remote servers:
1. Upload the PHP connection script provided by PHP Report Maker to your site. Note
that:
a.
b.
The script is named "phpmaker.php" and can be found under your installed
folder, usually C:\Program Files (x86)\PHP Report Maker <n>\,
Always use the script shipped with your version of PHP Report
Maker. PHP Report Maker may not work with scripts shipped with
previous versions.
30
b.
c.
Click "Get Database List" and then "View Schema", you should be able to
view the schema of your database in XML properly. Now go back to PHP
Report Maker.
3. Enter the SAME connection information, select URL for connection method, enter the
URL of the script (e.g. http://servername/path/phpmaker.php), you can test the URL
by clicking the [Test] button,
31
2. PostgreSQL
Select PostgreSQL as database type.
32
Click the
Database path is relative to application root. Use slashes "/" as path delimiter, no
leading slash. e.g. If the application root of your website is C:\Inetpub\wwwroot\demo and
you enter "data/" in this textbox, the folder for the database will be
C:\Inetpub\wwwroot\demo\data. If you are not sure which folder is application root, please
read Creating Virtual Directories in IIS(See 1.8).
Note
Select Microsoft SQL Server (or Microsoft SQL Server 2005/2008/2012 if you
use SQL Server 2005/2008/2012 or later) as database type,
Enter the name or IP of the SQL server,
Enter the User ID and Password,
Select the database you want or just enter the name of your database,
33
Click the
The server name or IP should be valid on your production Web server also. Otherwise
you'll need to modify the generated connection information in ewrcfg*.php before you
upload it to your production server. For example, if you have a testing SQL Server installed
on the same computer, you can use "(local)" as server name when you connect to it with
PHP Report Maker. The generated scripts will then try to connect to a SQL Server on the
same computer as the production Web server, if this is not the case on the server, the
connection will fail. It is common that SQL Server is installed on a different server in
production environment.
Note
5. Oracle
NoteIf
you have installed Oracle client on your computer, this database type will be available
for selection. You can download Oracle client from the Oracle website. Make sure the path of
your Oracle client (e.g. oci.dll) is among the Path variable under Windows Environment
Variables -> System variable.
The Oracle service name should be valid on your production Web server also. Otherwise
you'll need to modify the generated connection string in ewrcfg*.php before you upload it to
your production server.
Note
34
35
(For Unix-based server only) If you put the PHP parser binary
somewhere outside of the web tree of files, for example, in
/usr/local/bin, you will have to put a line similar to:
#!/usr/local/bin/php as the first line of any file containing PHP tags.
(You will also need to make the file executable.)
36
No Cache
37
Server-side
validation
Client-side
validation
38
Records per
Number of records to be displayed on the list page of all tables.
page
Selectable
page sizes
Paging
section
style
Sort type
"NumericPages" or "NextPrev"
Paging
section at
top
Paging
section at
bottom
Export
Records can export to Print, Excel, Word, PDF or Email. HTML format is
used as a printer friendly version.
Use button dropdown - show the export links as a button with dropdown
menu. Default is showing the export links as a row of icons.
39
1. This extension is for registered users only, it requires some other PHP
extensions, read the note in the extension setup page (see Tools ->
Extensions(See 1.14)) for more information before use.
2. The extension supports images (jpg, gif and png only), but a temp
folder is required during export, the extension uses the File folder
(see above), make sure you specify an upload folder and set up the
write permssion.
3. This extension does not support styling cells.
If the report contain charts rendered by FusionCharts
(not FusionCharts Free), the chart will be converted to embedded images in
email content.
Export type - Determines what to export. The follows are supported:
Notes for Export to Email:
Comparison
Format
HTML P E
(Print D m Excel
)
F ail
Word
P
HTML
HT
(NOT
HTML D
ML
F
native)
HTML
(NOT
native)
Excel 5/2007
(native)
Images
Charts (as
images)
(Requires
FusionCharts)
Custom
Template(See
1.11.16)
40
Email Settings
SMTP server
SMTP server
port
SMTP server
username
User name for SMTP server authentication. If your SMTP server does not
require authentication, leave it blank.
SMTP server
password
Password for SMTP server authentication. If your SMTP server does not
require authentication, leave it blank.
Security
Protocol used by the SMTP server. Possible values are: SSL or TLS.
Leave this setting empty if your SMTP server does not use such
protocols.
Note
PHP Report Maker use PHPMailer to send email, make sure you upload the subfolder
"phpmailer" generated in the destination folder.
Note
41
Title
Charset
Charset setting used in the META tag of the site and for exporting data.
If you use Multi-Language (see PHP Settings(See 1.11.2)), this setting
must be utf-8.
Note
Font
Size
Default font size (pixel). Unit must be in pixel for working with Bootstrap (see
below).
Site icon
Icon of the site. For browsers to show your URL with an icon. Must be an .ico
file.
1. If you use Multi-Language (see PHP Settings(See 1.11.2)), use MultiLanguage Property Editor, see Tools(See 1.14) for details.
2. This setting is enabled in registered version only.
Theme
Provides over a dozen of themes for you to setup the look and feel of your project quickly.
42
You can change the various properties of the selected theme to suit your style. The property
name are self-explanatory.
Themes are intergrated with Bootstrap, you can customize Bootstrap properties directly in
the Theme tab, scroll down to find the Bootstrap variables which start with "@".
To export custom theme settings, click the [Export theme] button to export the theme to an
external xml file. To import custom theme settings from earlier saved xml files, click the
[Import theme] button.
Notes
43
Styles
Edit styles
A separate CSS stylesheet will be generated for each project. Click the
[Edit styles] button to open CSS editor.
Notes
When you edit the CSS styles in the editor, note the follows:
BEGIN_USER_STYLES
END_USER_STYLES
You MUST write your styles between these two comment
lines, styles outside this user styles section will be
44
You can see the effect of new settings immediately in the preview window at the bottom of
the HTML tab.
Other than choosing color from the palettes, the color picker can also pick color directly from
screen using the "eyedropper".
45
Login Name
Password
Table
Password Field
Login Options
46
Advanced Security
Advanced Security feature allows you to setup User ID, assign User Levels to users and
create a complete user registration system. To setup, click the [Advanced] button.
User ID
User ID Security secures data at record level. Protected tables must have an [User ID
Field] for identifying which user a record belongs to. The User ID field names can be
different in tables though. When User ID security is enabled, users can only access their own
data.
[Parent User ID Field] stores the parent User ID that the user belongs to. For example, a
parent user can be the manager that the employee reports to. You can select an Parent User
ID for users so the parent user can view the child users' records as his/her own.
47
User Level
User Level Security secures data at table level. Each user level is granted with specific
permissions to tables in the database.
There are 2 types of User Level security:
1. Static User Levels - the User Levels and the permissions are defined in this form and
the User Levels are not to be changed after script generation.
48
icon to delete an
2. Dynamic User Levels - the User Levels and the permissions are defined in 2 tables in
the database, the User Levels can still be changed with the generated scripts.
49
If you want PHP Report Maker to create these 2 tables in your database, click the [Create
tables] button, the following form will display for you to change the table/field names if
necessary. You can change the table/field names and then click OK to continue.
50
If you have projects created by previous versions of PHP Report Maker you may want to use
dynamic User Levels and migrate the previously defined static User Levels in the project to
the database. After selecting or creating the User Level and User Level Permission
tables/fields, just click the [Migrate] button to let PHP Report Maker do that for you.
Important Notes on Anonymous Users
1. From v9, the permissions for anonymous users are integrated in the User Level
security settings. See built-in user levels for anonymous users below.
There are three built-in user levels:
Anonymous - Anonymous user level is a built-in user level for the anonymous user (i.e.
users that have not logged in). The User Level ID of the anonymous user is -2.
Administrator - Administrator user level is a built-in user level that has all permissions plus
the privileges to modify User IDs and User Levels. Its permissions are same as that of the
hard-coded Administrator. The User Level ID of Administrator is -1.
Default - Default user level is built-in user level with user level = 0. Since User Level field is
an integer field, if you set a default value of 0 for this field, this user level will become the
default user level for the user after registration and before the Administrator assigning
another higher user level.
Important Notes on User Levels
1. Even you enable all permissions for an user defined User Level, the User Level will
NOT become same as this Administrator User Level. User defined User Levels will
not have the permissions to manage users.
2. It is possible to use single login and common Dynamic User Levels for multiple
projects provided that ALL projects use the same project name and same Advanced
Security tables (i.e. User Table, User Level Table and User Level Permission Table).
If all projects uses the same database and same Advanced Security tables, then the
latter condition is automatically fulfilled. However, if the projects use different
databases, you need to use Database_Connecting(See 1.11.15) server event to
change the connection info so the user can get the Dynamic User Levels from the
common Advanced Security tables correctly during login. For the projects not using
51
MD5 password
Case-sensitive password
52
Requires activation
Activated field
Specifiy the field in user table used for storing the status
of user. A boolean field is recommended, although an
integer field or a string field will also work.
Also See:
Tutorial - User ID Security(See 1.17.2)
Tutorial - Static User Level Security(See 1.17.3)
Tutorial - Dynamic User Level Security(See 1.17.4)
53
Destination folder
Output filename
Prefix/Infix/Suffix
Lowercase
Extension
Default page
Start page
Specify the first page that the default page (usually "index.php")
should redirect users to.
If this setting is left blank, user will be redirected to the List page
of the default table (see Table Setup(See 1.11.6)) or the first
table that the user have permssion to access.
If this setting is not blank, the default page will simply redirect
user to the page you specify, e.g. a page not generated by the
current project. If you start the site by the typical index.php,
leave this setting blank, do NOT enter index.php or there will be a
indefinite loop.
Specify the web server that you want to use to test the generated
site. For use with Browse after generation (see below). You
can choose IIS Express or Other. Requires IIS Express installed
on the same machine as PHP Report Maker.
IIS Express is a simpler and self-contained version of IIS that is
optimized for developers. IIS Express is free, does not require
administrative privileges to run and supports all Windows
platforms XP and above. It can be downloaded from
microsoft.com.
If you choose Other web server (e.g. you use IIS or Apache),
you need to specify Testing root URL (see below) also.
Browse after generationSpecify whether to open a browser to test the generated site
after script generation.
Testing root URL
Specify the URL of your testing site that maps to the Application
root folder (see above). For use with Browse after
54
After setting above, click the [Generate] button to generate scripts. PHP Report Maker
allows you select scripts to generate, just select the files you want to generate in the
[Output] column. If you want include PHP Report Maker scripts into your custom PHP
scripts, you may not want to generate header and footer in those pages. Then you can
enable [No header/footer] for those pages. Note that header includes the menu and the
project tite.
After selection, then click the [Generate] button.
If it is your first generation for the project or you have changed some project level
settings, you must select [Other files] to generate the non table-specific pages.
Note
If you modify settings for a table and want to re-generate script for that table only, you can
click [Unselect All], then select the files you want to re-generate and click the [Generate]
button to generate again.
You can also right-click the column header of [Output] or [No header/footer] to quickly
select all or unselect all items in the column.
55
If you need to abort script generation in the middle of the process, just click the [Cancel]
button under the progress bar that displayed during generation.
Also See:
Project File(See 1.13)
Compatibility Properties Setup (See 1.11.14)
After loading the database, the tables will be shown in the database pane on the left pane.
To access ALL setting for a table (including Table-specific Options), click the table node of
any table in the database pane and then click the [Table] tab to go to the Table Setup
page. This is the setup page for a single table.
56
You can also click on the [Tables] or [Views] or [Custom Views] or [Reports] node in
the database pane to go to the Tables Setup page which is a grid showing the most
frequently used settings for all tables. If you need to set these settings for multiple tables,
this page allow you to view and set them quickly. Note that this page does not include
Table-specific Options.
The Table Setup pages consists of two section. The upper section is a grid showing available
options of all tables. The lower section contain two panels, the [Table-specific Options]
panel and the [Report Settings] panel for the selected table.
57
For all checkbox or combobox columns, if you want to apply the setting to ALL tables or
views, you can choose your setting at the [Tables] or [Views] or [Custom Views] or
[Reports] row.
Note
If you prefer to view the tables in alphabetical order, click [Tools]->[Sort Tables
Alphabetically] (see Tools(See 1.14)).
You can still change the display order of the menu item by drag-and-drop. Select a table by
clicking the first column - [Table Name] column, then drag and drop to where you want.
Note that a table cannot be moved out of its parent node.
Note that changing the display order of table in this Table Setup page does not change the
display order of the tables in the menu. To change the display order of the menu item, click
[Tools]->[Menu Editor] (see Tools(See 1.14)).
Caption
Filter
Specify a filter (WHERE clause) for the table. Click the [...]
button in [Filter] column, the Filter Editor will popup. Enter your
filter, you can drag the field names from the left pane to the
editor, the SQL identifier quote characters will also be added for
you automatically.
58
Sort
Specify the sort fields (ORDER BY clause) for the table. Click the
[...] button in [Sort] column, the following dialog box will
popup. You can choose up to 6 fields, in either ascending or
descending order.
59
Default
Set a Table as the Default Table. The Default table is the first
table the user see when visiting your site. Select the table you
want in the [Default] column.
60
Table-specific Options
Same as the list page options as described in PHP Setup(See 1.11.2) except that the options
are table-specific, meaning you can have different list page options for different tables. To
use table-specific options, select a table in the grid, uncheck [Use global settings] in the
[Table-specific Options] panel, the panel will be enabled for you to setup.
Report Settings
Show Report
Show both report data (in HTML table) and charts (if any).
If you want the report to show charts only, uncheck this
setting.
Include Detail
Show Compact Summary ViewIf checked, the summary will be displayed as columns for
each group. If unchecked, the summary are displayed at
the bottom of each group (as in previous versions).
Notes
61
General
Report Page
Drill Down
General
Field Name Field Name (read only)
Data Type
Size
Expression
The expression for custom field (Custom Fields only). See also Custom
62
Caption to be displayed
Primary KeySpecify the primary key of the table. For use with showing BLOB field as image
only.
You should use the same primary key as declared in the database, do
not change it unless you are absolutely sure that the selected field(s) values
are unique. Otherwise a record cannot be located properly and unexpected
results may occur.
Important
Report Page
Show
Width
Wrap
Filter
Filter Opr 1
Filter Opr 2
Drill Down
Detail
Report
63
Select a report as detail report, then select the parameters. Select Source
Field from the current report and Target Field from the detail report. The
report will then build hyperlinks for the field values to pass the selected field
values from the current repor to the detail report.
To make the detail report shows meaningful details, you need to pass the
required parameters from the current report to the detail report. Select the
field values you need to pass, make sure they are sufficient for selecting the
relevant records in the detail report. See Tutorial - Drill Down Report(See
1.17.8).
Parameter
If checked, the current report can be used a detailed report and the selected
field is a parameter.
Normally you do not need to manually enable this setting, after you set up
detail report using the Drill Down setup form, PHP Report Maker will enable
this for the required fields in the detail report.
Note
You can change the field order defined in the database by simple drag-and-drop. Simply
click the Field Name column to select the field, then drag it to where you want. PHP Report
Maker will generate PHP and display records according to this order. (For Detail and
Summary Report only)
64
There are two types of View tag, Formatted Text and Image.
Formatted Text - View Tag to display the field value as formatted text with optional
hyperlink. Properties:
Style
Bold
Italic
Align
Format
None
No formatting
Currency
Date/Time
Number
Percent
String
Format the field value with specified PHP string function or custom
function
Truncate the field value at specified max. length and append "..." to the
end.
Note
This setting only applied to memo fields in list page and must be
65
Target
Prefix
Display the field as hyperlink with the href attribute set to the value of
this field. It can be the field itself.
Target attribite of the hyperlink. Possible values are: _top, _parent,
_self, or _blank. You can also enter your own.
Prefix added before the HREF field value. You can select one of the
follows:
-
You can also enter your own partial URL (preceding the HREF field
value)
This setting is a string to be quoted by double quotes, if you want
to use PHP variable, wrap it in "{" and "}". Since "{" can not be
escaped, this syntax will only be recognised when the "$" immediately
follows the "{". Read PHP Strings for more information on parsing
variable in string.
Note
mypage.php?id=
The value of the HREF field will be appended to the end of the your
prefix in the outputted HTML.
If you want pass a field value, you can enter: (no quotes)
mypage.php?myfield={$this->UrlEncode($this->MyField>CurrentValue)}&id=
If you need to pass parameters which should not be URL-encoded, for
example, if you use ew_Encrypt() to encrypt your parameter, you can
enter: (no quotes)
mypage.php?myfield={$this->Raw(ew_Encrypt($this>MyField->CurrentValue))}&id=
Suffix
Suffix added after the HREF field value. You can use this setting to
append additional URL parameters.
For example, you can enter: (no quotes)
&field2={$this->UrlEncode($this->Field2-
66
If your data stores information for above, just click the down arrow
button to open the setup form, enable one of them, then click the
Advanced tab to setup, then click OK to save your settings.
Notes
Custom View Tag is HTML, if you want to embed PHP code, use <?php
and ?>, if you want to use JavaScript, use <script
context, you can use CurrentPage() to get the current page object.
67
<?php
if (CurrentPage()->MyField->CurrentValue == "xxx") {
// Assume string field
echo "something";
} else {
echo "something else";
}
?>
Example 2
Output a custom link:
<div id="my_unique_id"></div>
<script type="text/javascript">
$("#my_unique_id").html($("#orig_MyTable_MyField").htm
l().replace("xxx", "yyy").concat("zzz")); // Replace
part of the old code by new code, and append something
at the end
</script>
Notes
Image - View Tag to display as Image using <img> tag. The field can be a BLOB field or a
field storing the file name of the image.
68
Height
Image
Resize
File Folder Specify the path of the image. This folder must be relative to the application
root(See 1.12).
If not specified, the global File Folder will be used, read PHP Settings(See
1.11.2).
This read-only property show the type of the field in the report,
possible values are:
Row Heading
Column Heading
Value
(Not shown)
69
Summary Value
If the field is Value field in the report, this property sets the
summary value, possible values are:
Grouping Interval
Year filter
AVG
COUNT
MAX
MIN
SUM
Year
Quarter
Month
Date
Date/Time
Comma Separated ValuesIf the field store comma separated values (e.g.
"value1,value2,value3") and you want to split them into
separate values for filtering, enable this setting.
Note
This read-only property show the type of the field in the report,
possible values are:
Group-level
Value
(Not shown)
70
Grouping Interval
Summary Values
Avg
Max
Min
Sum
Count
More than one summary values are allowed. Select Skip null/0
if you want to skip null and zeroes when calculating above
values.
Comma Separated ValuesIf the field store comma separated values (e.g.
"value1,value2,value3") and you want to split them into
71
Filters
Relative Days
Add the following options in the popup filter and Extended Filter:
Yesterday
Today
Tomorrow
Relative Day PeriodsAdd the following options in the popup filter and Extended Filter:
Relative Weeks
Add the following options in the popup filter and Extended Filter:
Relative Months
Last year
This year
Next year
Add the following options in the popup filter and Extended Filter:
Range
Last month
This month
Next month
Add the following options in the popup filter and Extended Filter:
Past / Future
Add the following options in the popup filter and Extended Filter:
Relative Years
Last 30 days
Last 14 days
Last 7 days
Next 7 days
Next 14 days
Next 30 days
Past
Future
Add [From] and [To] combobox in the popup filter for user to select
a range of field values to filter.
This option is only available for field with Filter (popup filter)
enabled in above grid, NOT applicable to Extended Filter.
Note
Default values
72
Notes
1. The optional Relative Days, Relative Day Periods, Relative Weeks, Relative
Months, Relative Years, Past/Future filters are only available for datetime field
with "Filter" enabled in above grid. These options are also not available when the
field is set as Column Headings in Crosstab Report.
2. If you enable a group of filters above but want to disable some of the filters under
the group, you can unregister them using Filters_Load server event, see the
example in Server Events and Client Scripts(See 1.11.15).
Extended Filters
Display as
Default value
73
Size
Size
Maxlength
Parent field #1
Parent field #2
Parent field #3
Parent field #4
Use dropdown
RADIO
74
75
Auto-Suggest
For use with filter displayed as TEXT, enable this to add AutoSuggest feature to the textbox. The dropdown list is built from
distinct values of the field in the report.
The number of options in the dropdown list is 10 by default, you can
adjust it by changing the Auto-Suggest maximum display entries
setting under Advanced Settings(See 1.14).
Force Selection
For use with filter displayed as TEXT with Auto-Suggest. Forces the
user to select an option from the dropdown list. If user enters other
search criteria in the textbox, it will not be accepted.
Filter
Order
Repeat columns
Date Interval
Default Year
Year
Quarter
Month
Day
Default year for the Date Interval combobox. Enter full year (yyyy),
e.g. 2008.
This setting can also be a valid PHP expression (e.g. a function)
which returns the year, e.g. date('Y')
Note
Default Quarter
Default quarter for the Date Interval combobox. Possible values are
1-4.
This setting can also be a valid PHP expression (e.g. a function)
which returns the quarter, e.g. ewr_CurrentQuarter()
Note
76
Default month for the Date Interval combobox. Possible values are
1-12.
This setting can also be a valid PHP expression (e.g. a function)
which returns the month, e.g. date('n')
Note
Default Day
Default day for the Date Interval combobox. Possible values are 131.
This setting can also be a valid PHP expression (e.g. a function)
which returns the day, e.g. date('j')
Note
Validate
Integer
Float
Range
Date(yyyy/mm/dd)
Date(mm/dd/yyyy)
Date(dd/mm/yyyy)
Time(hh:mm:ss)
Email
Credit card
GUID
US phone number
US zip code
US social security number
Regular Expression
Notes
77
/foobar/i
See Creating a Regular Expression for more information about the
pattern and flags.
Arguments (Server- Arguments for the PHP functions for validation. For Regular
side)
Expression and custom validation functions only.
This is PHP arguments, it should be comma separated (if more
than one) PHP expressions. e.g. If it is a string, it must be double
quoted.
Note
'/foobar/i'
See PHP function preg_match for more information about the pattern.
Use date/time
picker
You can manipulate fields in the Extended Search panel on the client
side quickly with "fields" jQuery plugin (see Server Events and Client
Scripts(See 1.11.15)).
Example 1
Set field values based on current field value
78
By default, the options are displayed as comma separated values of the display field values.
If you just want to change the display value separator from comma to other string, you can
use server events such as Page_Load (see Server Events and Client Scripts) to set the field
object's DisplayValueSeparator property, e.g. if the field name is "MyField",
79
Option Template
If you have enabled Use dropdown and added additional display values by Client Script,
you can display the values in your own HTML by Option Template, e.g. continuing above
example, you can add:
{{:lf}}
Option value
{{:df1}}
Display value #1
{{:df2}}
Display value #2
{{:df3}}
Display value #3
{{:df4}}
Display value #4
Notes
1. By default, only {{:lf}} and {{:df1}} have values and both have the same
value, if you want to use {{:df2}}, {{:df3}} and {{:df4}}, you must add your
additonal display values by Lookup_Selecting Server Event as described above.
2. Option template is in the format of JsRender template, refer to JsRender API for
more details.
80
$("#x_ProductID").change(function() {
var result = ewr_Ajax(ewrVar.MyCustomSql, $(this).val()); // Send
the encrypted SQL and client side input value to server side by Ajax
for execution and get the result
$("#sv_UnitPrice").val(result); // Set the result (manipulate it
first if necessary) to the target field
});
The function ewr_Ajax() reuses the generated script for Ajax (ewrajax*.php) so there
is no need to write server side handler. For synchronous requests, if the result is a
recordset, it is in the format of array of object. If the result is a row, it is in the format of
object. If the result is a single value, it is in the format of string, remember to convert it to
the proper data type before manipulation. The function also supports asynchronous request,
just pass a callback function as the third argument, but the result from the server side is not
processed and therefore is always in the format of array of object. See the source code of
ewr_Ajax() in the generated ewr*.js for details.
Note
81
$("#sv_ProductID").change(function() {
$.post(ewr_CurrentPage(), { "myajax": 1, "token": EWR_TOKEN,
"value": $(this).val() }, function(result) { // Post back your custom
data (with the synchronizer token)
$("#sv_UnitPrice").val(result); // Set the result (manipulate
it first if necessary) to the target field
});
});
Write a server side handler, check your custom data "myajax" in Page_Load server event
and return the required value. In this example, only a single value is required so
ewr_ExecuteScalar() (see Server Events and Client Scripts(See 1.11.15)) is used, e.g.
(PHP)
PHP Report Maker supports charting. It is possible to create more than one charts for each
report. (Note that negative values cannot be plotted.)
After loading the database, the database objects (tables, views, custom views and reports)
will be shown in the left pane (the database pane). Click on any database object to go to the
Chart Setup Page for that object at any time. The Chart Setup Page is next to the Field
Setup page, if the active page is Field Setup Page, click the [Chart] tab to switch to the
Chart Setup Page.
The Chart Setup pages consists of two section. The left section is a list showing all charts for
the report. The right section is a panel showing various properties of the selected chart.
82
General
83
Caption
Chart type
Column 2D Chart
Column 3D Chart
Pie 3D Chart
Pie 2D Chart
Line 2D Chart
Bar 2D Chart
Area 2D Chart
Doughnut 2D Chart
Candlestick (Flash chart)
Funnel Chart (Flash chart)
Multi-series Column 2D Chart
Multi-series Column 3D Chart
Multi-series Line 2D Chart
Multi-series Area 2D Chart
Multi-series Bar 2D Chart
Stacked Column 2D Chart
Stacked Column 3D Chart
Stacked Area 2D Chart
Stacked Bar 2D Chart
Multi-Series Column 2D Line Dual Y Chart
Multi-Series Column 3D Line Dual Y Chart
Doughnut 3D Chart
Multi-series Bar 3D Chart
Stacked Bar 3D Chart
Bar 3D Chart
Scroll Charts - Note that not all charts support scrolling,
only the Column 2D, Line 2D and Area 2D charts are
scrollable. To enable scrolling, go the [Advanced] tab (see
below) and set numVisiblePlot to a value larger than 0.
Show
Position
Top
Bottom
Left
Right
84
Specifies how to sort the data for charting. Possible values are:
Custom sort sequenceCustom sort the data for charting. You can enter comma separated
values, e.g. if Sort Type is X ASC or X DESC, the chart is sorted
by category labels, then you can enter your custom order by:
label1,label2,label3,...
If the labels contains comma, you can enter an array, e.g.
array("label1","label2","label3",...) or
["label1","label2","label3",...] (the latter syntax
requires PHP >= 5.4)
Width
Height
Background color
Show labels
Show values
Show hover
Show hovering box when the user moves the mouse cursor over the
data point. The hovering box shows the label and value of the data
point.
Transparency (%)
Color palette
Specify colors of the data points. You can customize your own color
palette by clicking [...] button and change the colors.
Alternatively, you can use FusionCharts' built-in palette
attribute, in such casesm set this setting as empty.
Note
Category field
Title 2
85
Summary Value
SUM
AVG
COUNT
MIN
MAX
Open field
The field that contains the "open" values of the chart. For
Candlestick charts only.
High field
The field that contains the "high" values of the chart. For
Candlestick charts only.
Low field
The field that contains the "low" values of the chart. For
Candlestick charts only.
Close field
The field that contains the "close" values of the chart. For
Candlestick charts only.
Name field
The field that contains the names of the vertical lines. Vertical lines
are only drawn if the field value is not empty. For Candlestick
charts only.
Series
Series type
Series Field - Values for all series are from the same field.
The series are defined by a field that contains the series
name.
Series Per Field - Values of each values are from different
columns of the source table.
Series field
Specify the field that contains the series name when Series type is
set as Series Field.
Series fields
Specify the field names of each series when Series type is set as
Series Per Field. Click the [...] button to open the setup from and
select the column for each series.
Drill Down
Detail Report
You can drill down the chart values (Y Axis) by setting up a detail
report.
To setup a detail report, click the [...] button to open the Drill Down
setup form. Select a report as detail report, then select the
parameters. Select Source Field from the current report and
Target Field from the detail report. The report will then build
hyperlinks for the field values to pass the selected field values from
the current report to the detail report.
86
Start value
The starting y-axis value for the trendline. Say, if you want to plot a
slanted trendline from value 102 to 109, the startValue would 102.
End value
The ending y-axis value for the trendline. Say, if you want to plot a
slanted trendline from value 102 to 109, the endValue would 109. If
you do not specify a value for endValue, it would automatically
assume the same value as startValue.
Color
Display value
If you want to display a string caption for the trend line by its side,
you can use this attribute. Example: displayValue='Last Month
High'. When you don't supply this attribute, it automatically takes
the value of startValue.
Thickness
Is trend zone
Show on top
Alpha
Tool Text
Value on right
Dashed
Dash length
Dash gap
Sets the gap between two consecutive dashes in trend lines (in
87
Show the trend line on the secondary y-axis. By default, the trend
line shows up on the primary y-axis.
Advanced
There are many other advanced chart properties for configuring the chart. Select your chart
and click the [Advanced] tab to setup.
Not all displayed advanced properties are supported by each chart type. Refer to
FusionCharts documentation for list of the supported advanced properties of each chart type.
Note
Notes
1. If a setting is a checkbox (boolean) and it is displayed as null (not checked and not
unchecked), that means it will use the chart's default value.
2. If a setting is a number and it is displayed as 0 in gray (it does not mean the real
zero, which will be displayed in black), that means it will use the chart's default
value.
3. The advanced chart setting exportEnabled is for exporting the chart only, see
FusionCharts documentation.
Grid Component
88
To enable Grid Component for your singe-series chart, scroll to the Grid Component
section under the Advanced table, enable useGridComponent property and then set the
related properties under it.
Also See:
FusionCharts(See 1.15)
Tutorial - Chart
(See 1.17.11)Tutorial - Drill Down Report(See 1.17.8) (See 1.17.11)
chart is implemented with FusionCharts Free which is Flash based. It may not
be displayed by mobile devices and it does not support export.
A Gantt chart is created from one existing table or view. If you need to display data from
more than one table or view, join them first using a view in your database, see Preparing
Your Data for Reports(See 1.9).
After loading the database, the database objects (tables, views, custom views and reports)
will be shown in the left pane (the database pane). To create a report, right click the
database pane and select [Add Report (Gantt)]. Alternatively, you can click [Edit] in the
main menu and then select [Add Report (Gantt)].
The Gantt Chart setup form will show up:
89
Source table (Task table)Source table of the chart. It must be the task table which must
at least have the following 4 fields, the field names can be
different from below though:
Your task table can have the following optional fields. The field
names in the table must be same as below, including
lettercase. Add the fields in your table as needed.
90
91
Fields
Task ID
Task name
The task name field of the Task table. The field should be a
string (varchar) field.
Start date
The start date field of the Task table. The field should be a
date/time field.
End date
The end date field of the Task table. The field should be a
date/time field.
From task ID (optional) Optional. A field with alphanumeric value (integer field
recommended) to specify a connector for the task (as end task).
The field should contain value of the start task ID from where
the connector will originate
This setting simplifies using single connector for each task (start
from the end of the specified task and end at the start of the
current task) and eliminates the need for a connector table. If
you need to use more than one connectors for ea ck task, you'll
need to use connector table (see below).
Milestone date (optional)Optional. A date/time field to specify a milestone of the task.
This setting simplifies using single milestone for each task and
eliminates the need for a milestone table. If you need to use
more than one milestones for ea ck task. You'll need to use
milestone table (see below).
Categories
Category 1
_YEAR
_QUARTER
_MONTH
_WEEK
_DAY
If you just want a text header, you can just enter your text
instead of selecting from the dropdown list.
92
Category 3 (Optional)
Advanced (Optional)
Process table
The vertical data table of the chart representing the tasks that
make up the project (for example, if the project is outfitting
your computer with new software, the major tasks involved
might be: conduct research, choose software, install software) is
called process names.
This table is optional. If each process has only one task only,
you do not need this table at all. This is only required if you
need multiple tasks for each process.
The field names in the table must be same as below,
including lettercase. Only the name and id field are required,
other fields are optional. Add the fields in your table as needed.
Each Gantt chart can have one data table, which can show
tabular information along side the process names. After
selecting the process table, you can click the [...] button and
select up to 6 fields from the process table.
Milestone table
93
Connector table
94
Trendline table
Trendlines can be used to show important dates on the chart like today or scheduled date etc.
This table is optional. This is only required if you need to draw
trendlines in the chart.
The field names in the table must be same as below,
including lettercase. Only the start field is required, other
fields are optional. Add the fields in your table as needed.
Press [OK] to finish setup. When a report is created, the field settings will be copied from
the source table. But from then on, the Report has its own field settings and is much like
other table in PHP Report Maker.
To edit a Report, right click the Report in the database pane and select [Edit Report].
Alternatively, you can select the Report first, then click [Edit] in the main menu and then
select [Edit Report].
Notes
1. After a report is created, a report works independently from the source table it
based on. Changing the structure of the source table does not change the report. If
you delete a field in the source table that is used by a report, the report will fail.
Also, a Report has its own field settings, changing field settings in the source table
does not change the field settings in related Reports.
2. Report supports User ID and User Level. (See Security(See 1.11.4))
Also See:
95
96
PHP Report Maker will give the new Custom View a temporary name, CustomView<n>,
where n is an integer. If you want to change the name, enter a new name in the [Custom
View name] edit box in the main toolbar.
It is recommended that the built-in visual query builder be used to build your SQL. The
query builder interface is intuitive and fully supports drag-n-drop, in most cases you don't
need to type the table or field names.
On the left hand side, the available tables are displayed in the table pane. On the right hand
side, there are three tabs: [Builder], [SQL] and [Result]. (The [Result] tab will only be
visible after you execute the SQL.)
Builder
To build your SQL, drag your tables from the table pane on the left to the builder area and
check the required fields.
To create a link between two objects (i.e. join them) you should select the field by which
you want to link an object with another and drag it to the corresponding field of another
object. After you finish dragging, a line will appear between the linked fields. The join type
created by default is INNER JOIN, i.e. only matching records of both tables will be included
in resulting dataset. To define other types of joins you should right click the link and select
the Edit... item from the drop down menu or simply double-click it to open the Link
Properties dialog. This dialog allows you to define join type and other link properties.
The easiest way to add a field to the list of query output fields is to check the checkbox at
the left of field name in the Query Building Area. To include all the fields of an object you
should click the checkbox at the left of the asterisk item of an object.
Note
You should select your fields explicitly, not using the * symbol.
97
"Expression" and "Where": These values are used when no grouping is specified.
The "Expression" value is set when this expression is used as output expression in
the SELECT clause and nothing else. The "Where" value is set automatically when
you define a criteria to this expression that results in including this expression to the
WHERE clause. Normally you shouldn't care about value of the Group By column
when you don't want to define grouping.
"Group by" and "Having": These values are similar to the previous two, but used
when you want to define grouping in your query. In this case you should set the
"Group by" value for all columns you want to group by. Specifying criteria for the
grouped columns will include these criteria in the HAVING clause. If you want to
include an expression ONLY in the HAVING clause you should set the "Having" value
in the Group By column for this expression.
Aggregate functions (Count, Sum, etc): By selecting one of these values you will
create an aggregate expression for the value indicated in the Expression column.
98
SQL
You can always click the [SQL] tab to check the SQL generated by the query builder, the
SQL editor is also syntax-highlighted to enhance the readability of the SQL.
The SQL tab is actually an SQL editor, you can type your SQL directly without using the
query builder here, or paste your SQL from elsewhere, or open a saved SQL script (*.sql)
from file.
Notes
1. If the SQL is not generated by the built-in query builder, there are chances that
query builder cannot parse the SQL and display it visually in the [Builder] tab.
However, this does not necessarily mean that the SQL is invalid, you can verify its
validity by executing it (see below) and check if it returns the data you want in the
[Result] tab. And you can create the Custom View directly by click the OK button
without switching to the [Builder] tab.
2. If you type your SQL directly, always use aliases (use "AS") for fields whenever
applicable. Otherwise, the alias will be assigned by the database and you will not be
able to refer to the field with a known and meaningful name.
Result
When you have finished your SQL, you can test the SQL by any one of the following ways:
(for "DIRECT" connection only)
Clicking the
[Execute] button in the toolbar
Pressing [F9] on your keyboard
Clicking [Query] in the menu and then [Execute]
99
The [Result] tab will become visible and display the result data. If the data is correct, the
Custom View setup is almost done.
Note: Executing the SQL is for testing the SQL only. The data displayed in the [Result] tab
will not show the memo fields and blob fields, they may be represented by "(MEMO)" and
"(BLOB)" only. This is not related to the data that will be displayed by the generated scripts.
Since a Custom View is based on an existing table, there is an option that the fields in the
Custom View use the same Field Setup(See 1.11.7) (Edit Tags, View Tags, etc.) as the
source table. If you want to copy field settings, check the checkbox [Copy field settings
from source table (when applicable)]; if not, uncheck it. Then you can press [OK] to
finish.
Note: "when applicable" means that if enabled, field settings will be copied from the
source table when a new Custom View is created, or when a new field is found after editing
a Custom View, and the field can be found from existing tables. (This is also why building a
SQL with the built-in query builder and not using * symbol are recommended, these ensure
that the SQL can be parsed and therefore the source table and source field can be found.)
When a Custom View is added, PHP Report Maker will load it and display it in the database
pane and Table Setup page under the [Custom Views] node. To view the SELECT
statement of the Custom View, right click the Custom View in database pane and select
[Object Properties]. Alternatively, you can select the Custom View first, then click
[Project] in the main menu and then select [Object Properties].
To edit a custom view, right click the Custom View in the database pane and select [Edit
Custom View]. Alternatively, you can select the Custom View first, then click [Edit] in the
main menu and then select [Edit Custom View].
When a Custom View is added or edited, PHP Report Maker will check the SQL. If the SQL is
invalid, the icon of the Custom View will have a cross on it like
, you can view the error in
the [Object Properties] window and then edit the Custom View to correct the SQL.
100
Important
1. After a Custom View is created, it works independently from the table(s) it based on.
Changing the structure of the source table(s) does not change the Custom View. If
you delete a field in the source table that is used by a Custom View, the Custom
View will fail. You should edit the Custom View to update the SELECT statement.
Also, a Custom View has its own field settings, changing field settings in the source
table does not change the field settings in related Custom Views.
2. During searching, sorting and grouping, PHP Report Maker generated codes need to
change the WHERE and/or ORDER BY clause of SQL for the list page dynamically.
For Custom Views, since there might be fields with aliases, it is necessary to use the
actual expressions of the aliases in order to ensure the result SQL works. For
example, if you have a field, "UnitPrice*12 AS TotalPrice" in your SQL, you cannot
sort using "ORDER BY TotalPrice", you need to use "ORDER BY UnitPrice*12".
Therefore, if your Custom View contain fields with aliases, it is important that the
SQL can be parsed correctly by PHP Report Maker. To make sure that, here are the
recaps:
a. It is recommended that the built-in visual query builder be used to build
your SQL.
b. You should select your fields explicitly, not using the * symbol.
c. If you type your SQL directly, always use aliases (use "AS") for fields
whenever applicable.
101
The Report Setup window has 4 tabs. Go through these tabs one by one to setup your
report.
General
PHP Report Maker will give the new Report a temporary name, Report<n>, where n is an
integer. If you want to change the name, enter a new name in the [Report name] edit box.
Then you can select a table, or a view, or a Custom View form the [Table or View]
combobox.
The field in the table will be displayed in the [Available fields] listbox, select fields you
want to display by moving them to the [Selected fields] listbox. It is recommended that
you select only the fields you required or the report page may be too wide to view without
scrolling.
This settings in this tab are mandatory.
Grouping Levels
102
You can optionally add up to 6 grouping levels and choose to show summary for each level.
Select the grouping field for each level in the comboboxes.
You can sort the values of the grouping fields in either ascending or descending order. After
selecting the grouping fields, press the buttons next to the comboboxes to change the sort
order.
To enable summary, check [Show Summary] next to the grouping fields. When any of the
[Show Summary] fields is selected, the [Summary Values] tab will appear for you to
setup the summary values later. (See below)
Sort Order
103
You can optionally sort records by up to 6 fields, in either ascending or descending order.
Select the sorting fields in the comboboxes. Press the button to change the sort order.
Summary Values
104
If any of the [Show Summary] checkboxes is selected in the [Grouping Levels] tab, this
tab will become visible. You can optionally select aggregate values for each selected numeric
field. Available summary values are [Sum], [Avg], [Min], [Max] and [Count]. These
summary values will be shown at the end of the grouping levels with [Show Summary]
enabled. You can optionally enable [Skip null/0] to skip null and zeroes when calculating
the summary values.
In this tab, you can also choose what to show:
[Detail and Summary] - Records belonged to each grouping level will be displayed under
the grouping level title, then followed by the summary.
[Summary Only] - Only the summary for each grouping level will be displayed. Other fields
(not grouping level) will not be displayed.
You can also optionally choose to [Show page summary] and/or [Show grand
summary] for all records at the end of the report. If [Show page summary] is enabled,
the summary for the records in the current page will be displayed at the end of the page. If
[Show grand summary] is enabled, the summary for all the records in the report will be
displayed at the end of the page.
If you choose [Summary Only], you can optionally choose [Show compact summary
view]. If enabled, the summary for each group will be diplayed as columns instead of at the
end of each group.
Press [OK] to finish setup. When a report is created, the field settings will be copied from
the source table. But from then on, the Report has its own field settings and is much like
other table in PHP Report Maker.
105
Important Notes
1. After a report is created, a report works independently from the source table it
based on. Changing the structure of the source table does not change the report. If
you delete a field in the source table that is used by a report, the report will fail.
Similarly, if the report is based on a Custom View and you change the SELECT
statement of the Custom View, the report may fail if a field in the report is missing.
However, in the latter case, when a Custom View is edited, PHP Report Maker will
check the validity of the SQL. If the SQL fails, both the Custom View and reports
that based on the Custom View will be displayed with a cross in the icon, like
and
. Also, a Report has its own field settings, changing field settings in the source
table does not change the field settings in related Reports.
2. Report supports User ID and User Level. (See Security(See 1.11.4))
Also See:
Security Setup(See 1.11.4)
Tutorial - Detail and Summary Report(See 1.17.7)
106
The Crosstab Report Setup window has 4 tabs. Go through these tabs one by one to setup
your report.
General
PHP Report Maker will give the new Report a temporary name, Report<n>, where n is an
integer. If you want to change the name, enter a new name in the [Report name] edit box.
Then you can select a table, or a view, or a Custom View form the [Table or View]
combobox.
This settings in this tab are mandatory.
Row Headings
107
Select the field that you want display the field values as row headings. You can optionally
select up to 6 fields. Select fields in the order you want information displayed in the row
headings. For example, you could sort and group values by Country and then State.
You can sort the values of the row heading fields in either ascending or descending order.
After selecting the fields, press the buttons next to the comboboxes to change the sort
order.
Check Show summary if you want to show sumary for each group.
Column Headings
108
Select the field that you want display the field values as column headings. For example, you
would select Employee Name to see each employee's name as a column heading.
You can sort the values of the column heading field in either ascending or descending order.
After selecting the fields, press the buttons next to the comboboxes to change the sort
order.
If the field is of date/time type, the [Grouping Interval] property sets the interval for the
field values, possible value are:
Year
Quarter
Month
Date
Date/Time
If the field is of date/time type, and the [Grouping Interval] is Quarter or Month, the
[Year filter] setting become available. If unchecked, quarters or months of different year in
the report will be displayed together. If checked, a combobox for the available years will be
added automatically to the report so user can select which year's data to display.
If you use Date or Date/Time, make sure the distinct values of date or date/time in
the source table are not too many or the number of columns may exceed that your database
can support. For example, if you have orders each day in a year and you should not use
Date as grouping interval or there will be 365 columns! In addition, even if your database
can support it, the user will still need to scroll horizontally to see the report.
Note
Value
109
Select the [Field] and the [Summary value] that you want to calculate for each column
and row intersection. For example, you could calculate the sum of the field Order Amount for
each employee (column) by country and state (row). Possible values of summary value are:
AVG
COUNT
MAX
MIN
SUM
If you want to include sums for each row, select [Includes row sums] for the report.
You can choose up to 4 summary values.
Finally, you can choose to [Show page summary] and/or [Show grand summary] for all
records at the end of the report. If [Show page summary] is enabled, the summary for
the records in the current page will be displayed at the end of the page. If [Show grand
summary] is enabled, the summary for all the records in the report will be displayed at the
end of the page. These options are enabled by default.
Press [OK] to finish setup. When a report is created, the field settings will be copied from
the source table. But from then on, the Report has its own field settings and is much like
other table in PHP Report Maker.
To edit a Report, right click the Report in the database pane and select [Edit Report].
Alternatively, you can select the Report first, then click [Edit] in the main menu and then
select [Edit Report]. Note that the source table of a report cannot be changed.
110
Important Notes
1. After a report is created, a report works independently from the source table it
based on. Changing the structure of the source table does not change the report. If
you delete a field in the source table that is used by a report, the report will fail.
Similarly, if the report is based on a Custom View and you change the SELECT
statement of the Custom View, the report may fail if a field in the report is missing.
However, in the latter case, when a Custom View is edited, PHP Report Maker will
check the validity of the SQL. If the SQL fails, both the Custom View and reports
that based on the Custom View will be displayed with a cross in the icon, like
and
. Also, a Report has its own field settings, changing field settings in the source
table does not change the field settings in related Reports.
2. Report supports User ID and User Level. (See Security(See 1.11.4))
Also See:
Security Setup
(See 1.11.4)Tutorial - Crosstab Report (See 1.17.7)
111
Type
Charts
Chart <n> Charts (from other reports) to be included in the Dashboard report
Width (px) Width of the chart (pixels) in the Dashboard report
Height
(px)
Press [OK] to finish setup. The Dashboard will appear under [Reports] in the Database
pane on the left.
To edit a Report, right click the Report in the database pane and select [Edit Report].
Alternatively, you can select the Report first, then click [Edit] in the main menu and then
select [Edit Report].
If you have selected Custom as the report type, you must provide a Custom Template.
Select the dashboard report in the Database pane, you'll see the Code (Server Events,
Client Scripts and Templates) tab on the right.
Select Custom Template > Table-Specific > Dashboard -> CustomTemplate and enter
your HTML as the template of the Dashboard report page.
112
Custom Template is HTML, if you want to embed PHP code, you need to use <?php and ?>
to enclose your code, if you want to use JavaScript, you need to use <script
<table>
<tr><td>{{{chart1}}}</td><td>{{{chart2}}}</td></tr>
<tr><td colspan="2">{{{chart3}}}</td></tr>
</table>
During script generation, {{{chart<n>}}} will be replaced by the actual chart content you
specify in the Charts setting.
Important Notes
1. The dashboard report requires the source reports' *info.php and *chart.php scripts,
when you generate or re-generate dashboard reports, make sure you have selected
those scripts.
2. After a report is created, if you rename or delete a source chart, the report will fail.
Make sure you updated the report settings after renaming or deleting a source chart.
3. Report supports User ID and User Level. (See Security(See 1.11.4))
113
Also See:
Tutorial - Dashboard Report (See 1.17.9)
different from the existing PHP application, do NOT use Compatibility Properties unless you
are sure that your header and footer work fine at different level. For example, if relative
paths are used in the header and footer, the paths will be translated to different paths when
the header or footer is included by scripts at different levels.
114
If you re-open the PHP Report Maker project in PHP Report Maker, click [Tools] ->
[Compatibility Properties] and you'll see that the compatibility properties has been setup.
If you change User Level settings in your PHP Report Maker project later, the imported
menu items in the PHPMaker project will NOT be updated automatically, you'll need to
repeat above again.
Note
115
Properties:
Project Name
116
Logout page
If compatibility properties is enabled but the path is empty, the file in the template will
still be generated by PHP Report Maker and used by other generated scripts as normal.
Note
117
Also See:
Tutorial - Compatibility Properties - Integrating with existing PHPMaker project(See 1.17.13)
118
The treeview shows the available server events and client scripts that you can add to your
project:
Server Events Server-side PHP procedures
Global
Table-SpecificThe set of events are table-specific, the events are applicable to the selected
table only
Other
The events are applicable to some common pages in the project only
The JavaScript are included in all pages with header and footer
Table-SpecificThe JavaScript are table-specific, they are included to pages for the selected
table only
Other
The JavaScript are included in some common pages in the project only
To add your custom scripts to the server events or client scripts, select an item in the
treeview, then enter your code in the editor.
The editor supports Find and Replace. Press Ctrl-F to open the Find dialog and press Ctrl-H
to open the Replace dialog.
You can click the [Reset] button to discard the existing code and reload template code for
the server event or client script.
Code Repository
PHP Report Maker now provides a Code Repository for easy reuse of your code across
projects and sharing with other users. Click the [Code Repository] button to open it,
categorized reusable code will be displayed:
119
You can add the code to the editor by clicking the [Add to Editor] button, or by doubleclicking the item, or simply drag the item to the editor. The reusable code is stored in XML
files which reside in s subfolder name "code" under the installation folder. The format of the
XML files is simple, there are 3 parts:
1. description - description of the reusable code
2. code - code to be inserted to editor
3. globalcode - common code to be inserted to Global Code (see below), this code will
only be inserted once into the project. For example , if your code is used several
times in your project and your code calls a helper function, it is unnecessary to
include the helper function several times. In this case you put your helper function in
the globalcode section, then the function will only be included one time.
There are a few example files in the "code" folder, you can copy and modify for your own
code and then save them under the "code" folder for reuse.
Server Events
In general, server events are fired in the following order:
Notes
120
The code you entered in this event will be placed in the header.php
before closing the <head> section. You can use this event to can
add your code in head section. Note: This is a global function.
Example
Include custom JavaScript and CSS stylesheet.
// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
// assume the scripts are generated with
121
// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
if (CurrentPageID() == "login") { // login page
// connect to the common database with the
common Advanced Security tables
$info["host"] = "localhost";
$info["user"] = "xxx";
$info["pass"] = "yyy";
$info["db"] = "common_db";
}
}
Database_Connected This event will be fired by all PHP pages after connecting to the
database. Note: This is a global function.
The argument is the connection object, you can use it to execute
your own statements.
Example
Call a stored procedure after connection.
function Database_Connected(&$conn) {
$conn->Execute("CALL MyStoredProcedure");
}
Language_Load
This event will be fired when the language file is loaded. You can
use it to change the language phrases if necessary. Note: This
event is a language class member.
Example
122
This event will be called by all PHP pages at the beginning of the
page. If the pages involves database connection, it will be called
after connecting to the database and before the Page_Load event.
Note: This is a global function, NOT page class member.
Page_Rendering
This event will be called by all PHP pages before outputting HTML
for the page. Note: This is a global function, NOT page class
member.
Page_Unloaded
This event will be called by all PHP pages at the end of the page. If
the pages involves database connection, it will be called before
closing database connection and after the Page_UnLoad event.
Note: This is a global function, NOT page class member.
Global Code
User_CustomValidate For use with security. (See Security Settings(See 1.11.4)) This
event is fired before default user validation. You can use this event
to validate the user yourself. The arguments are the user name and
password the user entered. Return TRUE if the username and
password pass your custom validation. Note: This event is a
security class member.
From v6, default validation will continue after this event is
fired. If you return TRUE, the user will always pass the default
validation and get the User ID and User Level, if any. If you return
FALSE, the default validation proceeds as normal. If you use
Advanced Security, you still need the user table to store user
information such as User ID and User Level, although the password
field value can be empty or any value if you return TRUE.
Note
Example 1
Login user by Windows user name.
123
124
This event is fired for custom menu items before it is added to the
menu. The menu item info is passed to the event as an instance of
the cMenuItem object (see below). Return FALSE if you don't want
to show the menu item. If you return TRUE, the menu item will be
added to the menu, but it does not mean that it will be always
displayed. A menu item will be displayed only if its Allowed
property is TRUE. When the menu item is passed to this event, the
Allowed property is set based on the User Level Security of the
project, you can however change it by setting $Item->Allowed as
TRUE or FALSE as needed. Note: This is a global function.
Example
Only show a menu item after the user has logged in
function MenuItem_Adding(&$Item) {
//var_dump($Item);
// Return False if menu item not allowed
if ($Item->Text == "Download") {
return IsLoggedIn();
} else {
return TRUE;
}
}
Menu_Rendering
This event is fired before the menu is rendered. You can manipulate
the menu items in this event. The argument is the menu object.
(See Menu Object below.) Note: This is a global function.
Example 1
Add an additional menu item to the menu for logged in users only.
function Menu_Rendering(&$Menu) {
if ($Menu->IsRoot) { // Root menu
$Menu->AddMenuItem(10000, "MyMenuName",
"MyMenuText", "MyPage.php", -1, "", IsLoggedIn());
$Menu->MoveItem("Logout", $Menu->Count() 1); // Move to last
}
}
Example 2
Remove all the default menu items and use your own menu items.
function Menu_Rendering(&$Menu) {
if ($Menu->IsRoot) { // Root menu
125
This event is fired before the chart XML is built. You can still change
the chart properties using this event. Note: This event is a chart
class member.
The chart object instance contains all the information about the
chart to be rendered. It is an instance of the crChart class, refer to
ewrfn*.php for members of the object.
126
function Chart_DataRendered($node) {
if ($node->getAttribute("value") == "xxx") //
Note that getAttribute() returns string
$node->setAttribute("color", "FF0000"); //
Note: Use hex color codes without "#"
}
Chart_Rendered
This event is fired after the chart XML is built and before the XML is
outputted. You can still modify the XML using this event. Note:
This event is a chart class member.
The chart object instance contains all the information about the
chart to be rendered. It is an instance of the crChart class, refer to
ewrfn*.php for members of the object. You can get the XML
document by $this->XmlDoc and manipulate it by by PHP 5
DOMDocument, then save it back to the chartxml argument for
output. Refer to FusionCharts(See 1.15) documentation for chart
attributes.
The parameters is:
chartxml - the XML (string) to be outputted. You can also directly
manipulate it as string by string functions.
Example
Set chart subcaption by code
function Chart_Rendered(&$chartxml) {
$doc = $this->XmlDoc; // Get the DOMDocument
object
$doc->documentElement>setAttribute('subCaption', 'My SubCaption'); //
Modify the XML
$chartxml = $doc->saveXML(); // Output the XML
to $chartxml
}
Table-Specific -> Report Page (Note: These events are members of the page class)
127
html
excel
word
pdf
email
function Page_Load() {
$item = @$this->ExportOptions->Items["pdf"];
if ($item)
$item->Visible = FALSE;
}
Page_Render
This event will be called before outputting HTML for the page. You
can use this event to make some last minute changes to the page
before it is outputted.
Page_Unload
Page_Selecting
function Page_Selecting(&$filter) {
ewr_AddFilter($filter, "Field1 = 1234"); // Add
your own filter expression
}
Page_FilterLoad
This event allows you to add custom filter to the popup and
extended filter of the fields. (Previously named as Filters_Load or
CustomFilter_Load.)
Example 1
Add 'StartsWithA' filter to a string field.
You can use the ewr_RegisterFilter() function to add your custom
filter, the parameters of the event are:
128
function GetStartsWithAFilter($FldExpression) {
return $FldExpression . " LIKE 'A%'";
}
Then you can enter event code as below:
function Filters_Load() {
ewr_RegisterFilter($this->MyStringField,
'StartsWithA', 'Starts With A',
'GetStartsWithAFilter'); // Register your custom
filter with your function
ewr_UnregisterFilter($this->MyDateField,
'LastTwoWeeks'); // Unregister the built-in filter
"Last two weeks"
}
Example 2
Alternatively, If you don't write a function in Global Code, you can
use Page_Filtering server event, e.g.
function Filters_Load() {
ewr_RegisterFilter($this->MyStringField,
'StartsWithA', 'Starts With A'); // Register your
custom filter without function, leave the
implementation in Page_Filtering event
}
Also see the example for Page_Filtering event below.
Page_FilterValidated This event will be called after the search criteria is assigned to the
field objects. You can modify the search criteria in this event.
This event is a member of the table class. There is no arguments for
this event. To change the search criteria, change the SearchValue,
SearchOperator, SearchCondition, SearchValue2, SearchOperator2
property of the field object.
Example
function Page_FilterValidated() {
$this->MyField1->SearchValue = "your search
criteria"; // Filter value
}
Page_Filtering
This event will be called before the search criteria is saved for the
session. The argument of the event is the part of WHERE clause
built from the filter and/or Extended Filters. You can modify the
WHERE clause in this event.
129
Example
If you have registered a custom filter using Filters_Load event
(see above), you can implement your filter here, e.g. referring to
example 2 for Filters_Load above,
130
This event will be called before inserting HTML page breaks (DIV tag
by default) for print/export. You can use this event to change the
HTML code. The parameters are:
break - Boolean. Specify to insert code or not
content - HTML code as page break
Row_Rendering
This event will be called before rendering (e.g. applying the View
Tag settings) a record.
Row_Rendered
function Row_Rendered() {
// Use var_dump to view the arguments for
development or debugging, e.g.
//var_dump($this->RowAttrs, $this->Trademark,
$this->Trademark->CellAttrs, this->Trademark>ViewAttrs);
// Change the row color
if ($this->Trademark->ViewValue == "BMW") {
$this->RowAttrs["style"] = "color: red;
background-color: #ccffcc";
}
// Change the cell color
if ($this->Cyl->CurrentValue == 4) {
$this->Cyl->CellAttrs["style"] =
"background-color: #ffcccc";
131
== 6) {
=
== 8) {
=
132
This event is fired before the email is sent. You can customize the
email content using this event. Email_Sending event has the
following parameters:
Email - the email object instance which contain all the information
about the email to be sent. It is an instance of the crEmail class,
refer to ewrfn*.php for members of the object.
Args - an array which contains additional information. By default it
is empty.
Return FALSE in the event if you want to cancel the email sending.
Example
Use a field value of the the new record in the email
This event is fired before the message stored in the session variable
is shown.
The first argument $msg is the message to be shown, the second
argument $type is the type of the message.
Example
Replace an error message by custom message
133
function Form_CustomValidate(&$CustomError) {
global $orders;
if (intval($this->Qty->SearchValue) <= 0) {
// Return error message in CustomError
$CustomError = "Quantity must be larger
than 0.";
return FALSE;
} else {
return TRUE;
}
}
Lookup_Selecting
134
function UserID_Filtering(&$filter) {
ewr_AddFilter($filter, "MyUserIDField2 = " .
CurrentUserInfo("MyUserIDField2InUserTable")); //
Assume the field is of integer type
}
Other -> Login Page
Page_Load
Page_Unload
Message_Showing
Form_CustomValidateThis event is fired after the normal form validation. You can use this
event to do your own custom validation.
A parameter CustomError is passed to the event, add your error
message and return False if the form values do not pass your
validation.
Other -> Logout Page
Page_Load
Page_Unload
Client Scripts
In general, each page has two blocks of JavaScripts:
Client Script - the first block of JavaScript to be included at the beginning of the page, you
can put your JavaScript variables and functions there. The View Tag (for display) and Edit
Tag (for input) of the fields supports Custom Attributes (See Field Setup(See 1.11.7)) so you
can add your own attributes to work with your own JavaScript included here.
Startup Script - the second block of JavaScript to be included at the end of the page, you
can put code here to "start up" your JavaScript.
Note
In the following table, the <fieldname> in code represents the field variable name. In
general, if the field name is alphanumeric, field variable name is same as the field name.
Otherwise, spaces are replaced by underscores, and other non alphanumeric characters are
replaced by their hexadecimal string representation of their unicode value. If the variable is
a reserved word or starts with a digit, it will be prepended with an underscore. If in doubt,
135
The script will be placed in the header and therefore included in all
pages with header.
This event is NOT related to the No header/footer setting in
the Generate form (see Generate Settings(See 1.11.5)). Even if No
header/footer is enabled, this event will also be fired.
Note
Startup Script
The script will be placed in the footer and therefore included in all
pages with footer.
This is a very useful event which is fired for all pages with footer,
you can almost do everything by changing the document DOM of
those pages.
This event is NOT related to the No header/footer setting in
the Generate form (see Generate Settings(See 1.11.5)). Even if No
header/footer is enabled, this event will also be fired.
Note
$("#ewHeaderRow").html('<img src="path/mylogo.png"
alt="xxx">');
Global Code
The script will be placed after the header. This may contain your
JavaScript variables and functions for the page. You can also use
this event to subscribe a custom event.
Example 1
Subscribe the "rendertemplate" event for Custom Template(See
1.11.16).
$(document).ajaxSend(function(event, jqxhr,
settings) {
var data = settings.data;
//console.log(data); // Uncomment to view data
in browser console
136
The script will be placed before the footer. This is a very useful
event which you can almost do everything by changing the
document DOM.
PHPMaker provides a jQuery plugin .fields() for you to easily
get/set the form values in client side events such as Startup Script
and Form_CustomValidate (see below)
137
.row()
.toNumber()
.toDate()
.toJsDate()
Example 1
Add onchange event to the field named "Field1" in Add/Edit page
to change other fields by jQuery plugin .fields()
$("#sv_Field1").change(function() { // Assume
Field1 is a text input
if (this.value == "xxx") {
$(this).fields("FieldA").value("yyy"); //
Set value to FieldA
} else {
$(this).fields("FieldB").value("zzz"); //
Set value to FieldB
}
});
Example 2
Add onclick event to a field (checkbox) by jQuery
$("input[name='sv_MyField[]']").click(function() {
if (this.checked) { // Checkbox is checked
// Do something
} else { // Not checked
// Do something else
}
});
138
139
This event is fired when the JavaScript chart object has finished
loading the XML data and before rendering.
The event arguments are :
chart - This JavaScript chart object
chartid - This ID of the chart
Chart_Rendered
This event is raised when the JavaScript chart object has finished
rendering. This call is made only once per loaded chart SWF (even if
new data is supplied to it). It can be used to invoke any further
JavaScript methods on chart.
The event arguments are :
chart - This JavaScript chart object
chartid - This ID of the chart
Startup Script
Form_CustomValidateThis function is called after the normal form validation. You can use
this event to do your own custom validation. The form object can be
accessed by the parameter fobj. Return False if the form values do
not pass your validation.
It is recommended that you develop your server event and client scripts in the
generated script so you can edit and test it immediately. When you finish your custom
script, copy it to PHP Report Maker custom script editor and save it.
Note
140
141
Description
Example
Conn([$dbname])
Security()
142
Description
Example
only)
Language()
Get current
user name.
$username =
CurrentUserName();
CurrentUserID()
$userid =
CurrentUserID();
CurrentUserLevel()
CurrentUserInfo($fieldname)
CurrentPageID()
if (CurrentPageID() ==
Get current
"crosstab") {
page ID. A
...your code...
page ID
}
identifies the
page type, it
can be "rpt",
"summary",
"crosstab", etc.
143
Description
Example
CurrentPage()
Get current
page object.
$page = CurrentPage();
CurrentLanguageID()
Get current
language ID.
$langid =
CurrentLanguageID();
IsLoggedIn()
IsAdmin()
ew_Execute($sql [,$dbname])
Execute
UPDATE,
INSERT, or
DELETE
statements.
ew_ExecuteRow($sql [,$dbname])
ewr_Execute("UPDATE
MyTable SET...
WHERE...");
$value =
ewr_ExecuteScalar("SELECT
query, and
returns the
MyField FROM MyTable
first column of WHERE...");
the first row.
ReportDbHelper([$dbname])
144
Custom Templates
By default reports are exported in tabular format. Custom Template enables you to rearrange data in the report in your own way for better printing with browsers or exporting to
other format.
Notes
1. Custom Template currently supports Simple reports and Detail and Summary
reports only. (Crosstab reports are NOT supported.)
2. Do not confuse Custom Template (which is a table level setting within a project)
with customizing the whole template zip file. If you want to customize the general
layout of the generated site or customize something for all tables and all projects,
you should customize the template zip file, see Customizing Template.
How it Works
If a Custom Template is provided, PHP Report Maker splits the original code in many small
client side templates. A client side template is HTML code enclosed by <script
type="text/html"> and </script>. Since browsers do not know how to execute "text/html"
scripts, they simply ignore it. So it is possible to re-assemble HTML from the small client side
templates by JavaScript based on your provided Custom Template. In other words, it is
simply re-arrangement of existing HTML parts in browser.
During script generation, PHP Report Maker converts your Custom Template to a client side
template and outputs JavaScript to render the template. The client side template is rendered
by JsRender (see Third-Party Tools(See 1.7)) which is a third-party JavaScript template
engine optimized for high-performance pure string-based rendering. The generated scripts
only use its "template composition" feature to render HTML from other external templates,
your Custom Template can however make use of its JsRender API to do a lot of other things.
(Note that JsRender is still in beta, if you use its features directly, be aware that there may
be some breaking changes in the future.)
145
{{{field}}}
Field value
{{{caption field}}}
Field caption
{{{value field}}}
{{{sum|avg|min|max|cnt field}}}
{{{count}}}
{{{row_cnt}}}
{{{pagesum|pageavg|pagemin|pagemax|pagecnt
field}}}
{{{current_filters}}}
JsRender Tags
The FIRST ROW of the data for the report will also be passed to the Custom Template, you
can use JsRender tags enclosed by {{ and }} (double curly brackets) to show them in your
Custom Template. Remember that PHP Report Maker Custom Template Tags uses {{{ and
}}} (triple curly brackets) while JsRender tags use double curly brackets. Custom Template
Tags will be converted to JsRender tags during script generation, while JsRender tags will be
146
{{:field}}
Field value
{{>field}}
Notes
1. The first row data is unformatted raw data from the database. If you want to format
the data, you can use Client Script of the page (see Server Events and Client
Scripts(See 1.11.15)) to subscribe the "rendertemplate" event and format the data.
2. See JsRender API for complete information of JsRender tags.
How to Use
To enter your Custom Template for a table, follow the following steps:
1. Select the table in the database pane,
2. Select the Code tab (which contains Server Events, Client Scripts and
Templates),
3. Scroll down the treeview or collapse the Server Events and Client Scripts node,
select a template node under Custom Templates,
Template Name
Description
CustomTemplateHeader
CustomTemplateGroupFooter<n> This is the group footer for the nth group (where n =
1-6). This section is not used in simple reports.
CustomTemplateFooter
4.
Custom Template let you customize the layout of the data originally placed in
the main HTML table of the page, it cannot customize other parts of the page.
Note
147
148
Then just generate and run your scripts in your browser as usual.
Important Notes
1. Keep your Custom Template as simple as possible. For printer friendly version,
the outputted HTML is rendered by the browser itself, browser can understand
complex HTML. However, for other export format, the outputted HTML is to be
rendered by other applications such as Word, Excel, DOMPDF and email client, they
may not be able to render your complex HTML properly, so always keep your
template simple.
2. Remember that Custom Template is rearrangement of existing some HTML
fragments in the page, all other code is still the same, the fields in the Custom
Template should be the same as the original script. The available fields are
same as the original script, if you try to include other fields in the table or from other
table by Custom Template, it will NOT work without writing your own code.
3. Custom Template is HTML, if you want to embed PHP code, you need to use <?php
and ?> to enclose your code, if you want to use JavaScript, you need to use
<script type="text/javascript"> and </script>.
4. DO NOT use $this in your PHP code. There is no $this in the context, you can
however use CurrentPage() to get the current page object.
5. Avoid using JavaScript in the template. If you need to use JavaScript, try to put your
JavaScripts in Client Scripts and Startup Scripts of the page (see Server Events and
Client Scripts(See 1.11.15)). If you have to use JavaScript in the template, DO NOT
using document.write() because the script will be extracted from the template
and be executed at the end of the template, you can however use a DIV with unique
id and write to its innerHTML.
6. CustomTemplateBody is the template for a record. Your Custom Template needs
NOT to be a HTML table, but if it is, then CustomTemplateHeader and
CustomTemplateFooter must at least contains <table> and </table>
respectively, and you need to provide the <tr> and <td> tags in these templates.
7. If you use images in your Custom Template, you must put your images under the
project's File folder (see PHP Settings(See 1.11.2) > General Options -> File
Folder). Note that Export to Excel/Word (not by PHPExcel/PHPWord) does NOT
support images, and exporting by PHPExcel/PHPWord does not support Custom
Template (see PHP Settings(See 1.11.2) > General Options -> Export).
8. Before the Custom Template is applied, the jQuery event "rendertemplate" will be
fired, you can use Client Script of the page (see Server Events and Client
Scripts(See 1.11.15)) to subscribe this event and pass additional data to the Custom
Template.
149
Also See:
Tutorial - Custom Template(See 1.17.10)
How to Use
To create a Custom File, simply right click the database pane or click Edit in the main menu,
then select Add File, the following form will show:
File Name
150
Caption
Destination folder:
C:\Users\Administrator\Documents\mycompany.co
m\project1
and you want to generate your Custom File in the
destination folder, you should enter "project1/" (no
quotes).
Do NOT use parent path ".." or the file will be
generated outside the application root leading to
some unexpected results.
Note
After entering above properties, click OK button to save. The Custom File will show up in the
database pane under the Custom Files node:
151
To edit the Custom File properties, right click the Custom File in the database pane and
select Edit File.
To delete a Custom File, right click the Custom File in the database pane and select Delete
File.
To enter content for the file, select the Custom File in the database pane , then select the
Code tab (which contains Server Events, Client Scripts and Custom Templates) in the
right pane.
Scroll down the treeview or collapse the Server Events and Client Scripts node, select the
Custom Templates -> Table-Specific -> Custom File -> Content node, then you can
enter or paste your content in the editor:
152
Then just save your project generate and run your scripts in your browser as usual.
Although it is convenient to save your own files in the project, you should avoid
saving all the contents in the project or the project will become so large that the
performance of the UI will be affected. If the file content is large, you can put the content in
an external file and then include it in the Custom File. If the number of files is large, put the
minimum number of files in the project by Custom Files only, you can generate a blank
Custom File and duplicate it as containers for other files, then just add menu items to the
project by the Menu Editor for those external files.
Important
Examples
Example 1 - Include an external file instead of saving the page content in the project.
153
Example 3 - Add multiple Bootstrap Panels in the page as a dashboard page. Use database
helper to execute SQLs and display data as HTML table.
To use the database helper, click Tools -> Advanced Settings (see Tools(See 1.14))
and enable Generate database helper and make sure you generate the file named
ewrdbhelper<version>.php. The database helper is generated in the destination folder of the
project. If Includes common files is enabled, it is auto-loaded so there is no need to
explicitly include the script.
Note
<?php
$dbhelper =& ReportDbHelper(); // Create instance of the database
helper by ReportDbHelper("<dbvar>") or by class name (e.g.
cr<dbvar>_db) where <dbvar> is database variable name
?>
<div class="panel panel-default">
<div class="panel-heading">Out of stock products</div>
<?php
$sql = "SELECT DISTINCT " .
"`categories`.`CategoryName` AS `CategoryName`," .
"`products`.`ProductName` AS `ProductName`," .
"`products`.`QuantityPerUnit` AS `QuantityPerUnit`" .
" FROM `categories` JOIN `products` ON (`categories`.`CategoryID`
= `products`.`CategoryID`)" .
" WHERE " .
"`products`.`UnitsInStock` <= 0";
echo $dbhelper->ExecuteHtml($sql, array("fieldcaption" => TRUE,
"tablename" => array("products", "categories"))); // Execute a SQL and
show as HTML table
?>
</div>
<div class="panel panel-default">
<div class="panel-heading">Discontinued products</div>
<?php
$sql = "SELECT DISTINCT " .
"`categories`.`CategoryName` AS `CategoryName`," .
"`products`.`ProductName` AS `ProductName`," .
"`products`.`QuantityPerUnit` AS `QuantityPerUnit`," .
"`products`.`UnitsInStock` AS `UnitsInStock`" .
" FROM `categories` JOIN `products` ON (`categories`.`CategoryID`
= `products`.`CategoryID`)" .
" WHERE " .
"`products`.`Discontinued` = '1'";
echo $dbhelper->ExecuteHtml($sql, array("fieldcaption" => TRUE,
"tablename" => array("products", "categories"))); // Execute a SQL and
show as HTML table
?>
</div>
The result:
154
Note
Other than ExecuteHtml(), there are a few other useful methods in the database
helper class, refer to the source code of the file rpt-db.php in the template for details. You
can also extend the database helper class (e.g. in server side Global Code, see Server
Events and Client Scripts(See 1.11.15)) and add your own methods.
1. The SQL expression must be a valid SQL expression for the database based on the
fields of the table/view. Otherwise, the Custom Field cannot be created.
2. If no SQL expression is entered, the Custom Field will be a blank field and you need
to write your own Server Events and/or Client Scripts to handle the value of the
Custom Field.
155
How to Use
To add a Custom Field to a table/view, simply right click on any database table/view (in the
database pane) or click Edit in the main menu, then select Add Custom Field, the following
form will show:
Field name of the Custom Field. Note that the field name cannot be the same as
any fields/Custom Fields in the table/view
Caption
To edit the Custom Field, right click the Custom Field and select Edit Custom Field.
To delete the Custom Field, right click the Custom Field and select Delete Custom Field.
156
MyTable
If it works, your SQL expression is valid, then you can enter your SQL Expression and
CustomField to create your Custom Field and use them as Expression and Field Name in
the Add Custom Field dialog said above.
157
Enter your database connection information and click the [Connect] button to load the
database information. The list of tables/views of the selected database will be displayed.
158
Select the tables/views you need and click [OK]. The selected tables/views will be added to
the project as a Linked Table and will appear under the [Linked Tables] node of the database
pane. You can then manipulate the Linked Table as a regular table/view.
Note that if the database related with the Linked Table being deleted no longer has any
other Linked Tables associated, you may want to remove this database from the project as
well.
To do that, right click the database pane or click [Edit] in the main menu, then select [Add
Linked Table]
159
Select the database you want to remove from the dropdown selection, and click the
[Remove Database] button. Click "OK" to confirm deletion.
160
Change the connection information if necessary and then press the [Synchronize] button.
If you create a Linked Table and then rename the table in your database, the Linked
Table will fail, synchronizing with the database will NOT fix it since if a table is a renamed
table cannot be determined. You need to delete the old Linked Table and create a new one.
Note
161
Multi-Language Project
Important
1. Multi-Language project must use utf-8 for everything. The charset of the
project must be "utf-8".
2. The data in your database must be stored in unicode, otherwise your data will
not be displayed properly.
3. If you have to customize the template and put unicode characters directly in the
template instead of using language file, always use utf-8 encoding and enable the
Advanced Setting UTF-8 output files (see Customizing Template(See 1.16) and
Tools(See 1.14)).
4. Only the English language file is provided by our products, you'll need to prepare the
language files for other languages yourself. You may also check our website and see
if there are any user submitted language files. If you want to share your language
files with others (without any conditions), you can submit your language file to us
too.
Value Language
Value Language
Value
Arabic
ar
German (Austria)
de-AT Portuguese
pt
Bengali
bn
German
(Switzerland)
de-CH
Bulgarian
bg
Greek
el
Hebrew
iw
Hindi
hi
Catalan
zh-CN
Chinese
zh-
pt-BR
ca
Chinese
(Simplified)
Portuguese (Brazil)
162
Romanian
ro
Russian
ru
Serbian
sr
TW
Hungarain
hu
Slovak
sk
Croatian
hr
Indonesian
id
Slovenian
sl
Czech
cs
Italian
it
Spanish
es
Danish
da
Japanese
ja
Spanish (Latin
America)
es419
Dutch
nl
Kannada
kn
Swedish
sv
English (UK)
en-GB Korean
Tamil
ta
Telugu
te
Thai
th
Turkish
tr
Ukrainian
uk
Urdu
ur
Vietnamese
vi
ko
English (US)
en
Latvian
lv
Estonian
et
Lithuanian
lt
Filipino
fil
Malay
ms
Finnish
fi
Malayalam
ml
French
fr
Marathi
mr
Norwegian
no
de
Persian
fa
Gujarati
gu
Polish
pl
The name is for displaying the language name in the user interface (which does not
support unicode), it should contain alphanumeric characters, underscore and spaces
only.
The desc is for displaying the language name in generated scripts, it can be in the
encoding of the XML file.
For example, if you want to make language file for Traditional Chinese, you may
rename the file as chinese.xml and modify the node as:
<locale>
<phrase id="locale" value=""/><!-- *** system locale for this
language -->
<phrase id="use_system_locale" value="0"/><!-- *** change to "0"
to disable system locale and use the following settings *** -->
<phrase id="decimal_point" value=","/>
<phrase id="thousands_sep" value="."/>
<phrase id="mon_decimal_point" value="."/>
<phrase id="mon_thousands_sep" value=","/>
163
3. You can edit or even add your own phrases. Just open the language file with any
text or XML editor, edit/add your <phrase> nodes. Make sure you provide an unique
id to each phrase. The id must be alphanumerical only.
The phrases are not limited to text, you can also use HTML, e.g.
164
165
Some text properties support Multi-Language. This editor allows you to enter your
property values for each language. Supported properties are:
Table/Field Captions
Field Error Message
Chart Caption
Chart X Axis Title
Chart Y Axis Title
Chart Primary Y Axis Title
Chart Secondary Y Axis Title
Menu Text
Site Title and Footer Text
To edit these properties, click [Tools] -> [Multi-Language Property Editor] to open the
editor. Alternatively, you can also click the small button next to above properties in the user
interface to open.
166
Select a property in the Property pane on the left to edit, then enter your properties in
unicode. For example, you can copy and paste from Word.
The editor supports import/export of the phrases (of the mutli-language properties only, not
including the phrases in the language files):
Click the export button to export the phrases to a XML file so you can edit the file with text
or XML editor or share the file with other project. Click thie import button to choose the XML
file that you want to import so you can quicky use edited phrases or easily reuse other
project's XML file.
Previously saved properties are displayed in bold font. Once you use this editor to save
your unicode text, the saved unicode property values will always be used prior to the original
property values (in the general user interface) . The original property value will only be used
if unicode property value of the language cannot be found. If you want to edit the property,
always go back to this editor. After editing and saving unicode properties, remember
to re-generate the languages file and upload them again.
Note
167
In this case, the Root Relative Path is therefore the parent folder of the script, i.e. "..". The
scripts will use this relative path to find the application root.
It is recomended that you set the [Application root folder] to the root folder of your
Website where is accessed by http://www.mycompany.com/.
On your testing server, you may work with multiple projects and test your projects one
folder level lower at http://localhost/<projectname>/ (cf. http://<projectname>/). In this
168
2. Document root
If Root Relative Path is empty, the script checks the following variables:
$_SERVER["APPL_PHYSICAL_PATH"].
If you use IIS on Windows (e.g. you are using PHP with MS Access or SQL Server on
Windows), this variable should return the physical path of the application root of your web
site, read Creating Virtual Directories in IIS(See 1.8) in Introduction to PHP and
MySQL(See 1.8).
If Root Relative Path is empty, the script checks the following variables:
$_SERVER["DOCUMENT_ROOT"] or $_ENV["DOCUMENT_ROOT"].
If you use Apache, it is usually the physical path of your Website root. e.g. On Linux, it may
return
/home/username/public_html which can be accessed by http://www.mycompany.com/
You can put your generated scripts in your Website root, or you can put the generated
scripts in a subfolder under your website root, e.g.
/home/username/public_html/scripts which can be accessed by
http://www.mycompany.com/scripts/
When you generate scripts, you still need to specify the [Application root folder] and the
[Destination folder] based on your folder structure so that the relative location of the two
folders is correct.
3. Script Path
If both Root Relative Path and Document Root are empty, the script will use the path of the
current script.
4. Custom Path
The above three approaches should handle most cases. If in some special cases they don't
return the path you want, you can modify the function ewr_AppRoot() in phprptfn.php
(template) or ewrfn*.php (generated script). You can simply customize the template and
specify your real server path directly. For example,
Windows:
function ewr_AppRoot() {
return 'C:\Inetpub\wwwroot\MyWebRoot\'; // replace with your real
server path directly, include the trailing path delimiter
}
169
function ewr_AppRoot() {
return '/home/username/public_html/'; // replace with your real
server path directly, include the trailing path delimiter
}
Remember that you must also check the value of the constant EW_ROOT_RELATIVE_PATH,
make sure it correctly points to your application folder relative to the script folder. Using
above example, you specify that the application root is "C:\Inetpub\wwwroot\MyWebRoot",
if your scripts are placed in "C:\Inetpub\wwwroot\MyWebRoot\MyScripts\", then
EW_ROOT_RELATIVE_PATH should be "..".
TIP: You can call the PHP function phpinfo() (i.e. <?php phpinfo(); ?>) to view your
server information, including the server paths. Alternatively, in the generated scripts (that
includes phpfn<version>.php), you can call the function ewr_WritePaths() (i.e. <?php
Auto Backup
When you save a project, the old version will be saved to the subfolder <Documents
folder>\<product name>\Backup folder first, you can recover older versions of your project
from the backup folder in case of corrupted projects or other accidental losses. Note that
only the latest 10 versions will be kept, older versions will be deleted.
The Documents folder is your personal folder in which you can store your personal
files. For example, in Windows XP, the actual location of the Documents folder is
C:\Documents and Settings\<user name>\My Documents by default, where C is the drive in
which Windows is installed, and <user name> is the currently logged-on user. In Windows
Vista (or later), the folder is C:\Users\<user Name>\Documents.
Note
Project Name
Each project has a project name. By default the file name (without extension) of the project
file is used as project name. Before you name your project file when saving it for the first
170
If you need to change the project name, use Advanced Settings(See 1.14).
Project ID
Each project has a project ID which is a GUID (globally unique identifier). The value of a
GUID is represented as a 32-character hexadecimal string, such as {095F6728-DF53-4763A372-D8F2EAC959F2}. It is used to identify the project and the scripts generated by it.
Each script generated by the project has the project ID. An XML file named <GUID>.xml is
also generated for each project in the subfolder named by the project name under the
application root(See 1.12). The XML file contains some project information and is used to
share with other projects (e.g. PHPMaker project) with the same project name. So do not
reveal the project ID to public and do not change the project ID unless absolutley necessary.
If you really need to, use Advanced Settings(See 1.14).
If you use Dynamic User Level (see Advanced Security(See 1.11.4)), the project ID is also
used in the User Level Permission table as a prefix of the table name so that the table
names from different projects will not clash.
Also See:
Object Properties(See 1.16.3)
1.14 Tools
Tools
171
Synchronization
During the course of project development, it is common that you have altered your database
schema. To save the effort of doing the customization from scratch again, PHP Report Maker
provides you with the ability to synchronize your project data with the database. The
synchronization process can be invoked in the following situations:
Languages
If you want to use multi-language project, make sure you have enabled Multi-Language in
the [PHP]->[General] tab (see PHP Settings(See 1.11.2)), then click [Tools] ->
[Languages] to select the languages you want to use in the project. If more than one
language is selected, a combobox will appear on the top of the generated scripts for user to
select language.
172
After selecting the languages, select a Default Language in the [PHP]->[General] tab
(see PHP Settings(See 1.11.2)).
Read Multi-Language Project(See 1.11.20) for details.
Extensions
Click [Tools]->[Extensions] to enable or disable these extensions. If the extension has
advanced settings (NOT every extension has it), you'll see the [Advanced] tab after
selecting the extension. Click the [Advanced] to configure advanced settings for the
extension.
173
Advanced Settings
Advanced Settings are some advanced general settings for PHP Report Maker, or some
rarely changed settings for the project, or custom defined settings for use during code
generation. Click [Tools] -> [Advanced Settings] to change these settings:
174
General
175
Project
Project name
176
Debug
177
login.php?username=xxx&password=yyy
(where "yyy" is a plain text password)
For example, this allows user login by using PHP
cURL from your own scripts.
For security, you should pass an encrypted
password whenever possible. In fact, usually
you can retrieve an encrypted password (e.g. a
md5 hashed password) from other web
application only, if it is same as the encrypted
password for your project (e.g. MD5 password
is enabled in the project, or the project uses the
same user table), then you can pass an
additional URL parameter encrypted=1 to let
the scripts know how to compare the passwords,
e.g.
login.php?username=xxx&password=xyz&e
ncrypted=1 (where "xyz" is an encrypted
178
$_SESSION[EWR_PROJECT_NAME .
"_Username"] = "xxx"; // where
EW_PROJECT_NAME is the constant of
your project name (see above) and
"xxx" is user name
$_SESSION[EWR_PROJECT_NAME .
"_Password"] = "yyy"; // where "yyy"
is a plain text password
For security, you should pass an encrypted
password whenever possible. In fact, usually
you can retrieve an encrypted password (e.g. a
md5 hashed password) from other web
application only, if it is same as the encrypted
password for your project (e.g. MD5 password
is enabled in the project, or the project uses the
same user table), then you can pass an
additional session variable to let the scripts
know how to compare the passwords, e.g.
$_SESSION[EWR_PROJECT_NAME .
"_Username"] = "xxx"; // where "xxx"
is user name
$_SESSION[EWR_PROJECT_NAME .
"_Password"] = "xyz"; // where "xyz"
is an encrypted password
$_SESSION[EWR_PROJECT_NAME .
"_Encrypted"] = TRUE;
Remove XSS
179
Language files
180
Oracle charset
Oracle compare
Oracle sort
Reduce image size only (image resize) Do not resize if image is smaller than the resize
dimension.
181
182
Use css-flip
None - no placeholder
Caption - use field caption (see Field
Setup)(See 1.11.7) as placeholder
attribute value (default)
183
The settings are defined in the settings.xml located at the "src" folder. If you are an
advanced user who customize templates, you can also add your own settings to the
"Project" section. Open the settings.xml with a text or XML editor, add a <setting> node
under the "Project" section. Make sure you provide an unique id to the setting. Supported
data type is "String", "Integer" and "Boolean". If not specified, default is "String". The
setting value can be retrieved in the template during code generation (NOT during runtime
of the generated script) using the PROJ.GetV(id) method. Also read Template Tags(See
Note
184
Select the [Source table] and the [Target table] (e.g. the query/view), click OK to copy
the table settings. If a field in the target table has the same name as that in the source
table, field settings will also be copied.
This feature copies setting without validation. If settings from the source table/field are
not applicable to the target table/field, errors may result. Check the settings after copying.
Note
Select the [Source table] and the [Target table] (e.g. the query/view), the fields of the
target table will be listed in the left column, you can then select the respective source fields
(from the specified source table) in the right column and click OK to copy the field settings.
This feature copies setting without validation. If settings from the source table/field are
not applicable to the target table/field, errors may result. Check the settings after copying.
Note
185
1. Re-arranging the table display order by drag-and-drop in the Table Setup page is
still supported, so the display order will NOT be re-sorted automatically after
synchronizing the project with your database even there are new tables added to the
database. Use this tool to sort again if necessary.
2. Only tables are sorted, the display order of the fields in the user interface or in the
generated scripts will NOT be affected by this tool.
3. The display order of the menu items in the generated scripts is still controlled by the
Menu Editor, using this tool will NOT affect the menu items.
Compatibility Properties
See Compatibility Properties Setup(See 1.11.14).
Menu Editor
PHP Report Maker allow you to modify the menu in the generated site, to open the menu
editor, click [Tools] -> [Menu Editor] in the main menu or click the "Menu Editor" icon in
the toolbar.
186
Edit item
Post
Cancel
Refresh
187
Move Down
Import items from PHP Report Maker projectImport menu items from PHP Report
Maker project
Delete imported menu items
Multi-Language
You can show/hide the menu items by checking/unchecking the checkboxes beside the menu
item text. If a parent menu item is hidden, all the child items will also be hidden.
If you want to use special characters in the menu caption, use HTML entities such as
"&#euro;", or you can enter unicode caption using Multi-Language Property Editor, see
Multi-Language Property Editor above.
If your custom menu items requires login, uncheck [Allow Anonymous User]. For other
(non custom) menu items, this setting is same as the List/Search/View permission for
Anonymous User in Advanced Security. (See Security Settings(See 1.11.4).)
After modifying, make sure you click [OK] to save the changes.
By default, the menu is vertical.
Registered user can use the Horizontal Menu(See 1.7) extension, click [Tools] ->
[Extensions] to enable the graphical extension, then click [Advanced] tab to set the
menu options.
188
Grouped menu items is supported. Grouped menu items are to be set up in the same way as
a sub menu. You can check the title menu item in the Group Title column of the Menu
Editor:
189
Since horizontal menu cannot display menu groups like vertical menu, group title
should not be enabled for root level menu items in horizontal menu. If enabled, they will be
only be displayed as normal submenus. However, since submenu is vertical, you can use
group title for menu items in submenus.
Note
1.15 FusionCharts
FusionCharts XT
FusionCharts XT is a comprehensive JavaScript (HTML5) charting library for both web and
mobile.
In the evaluation version of PHP Report Maker, only the evaluation version of FusionCharts
is included. There is no feature limitation in the evaluation version of FusionCharts, except
that the charts are watermarked.
Registered users of PHP Report Maker are entitled to use the benefit of the
FusionCharts extension with licensed version of FusionCharts. Registered users will be
provided info to download the extension.
PHP Report Maker does NOT support all charts in FusionCharts, it supports the following
chart types only. Refer to the developer's website for documentation:
http://www.fusioncharts.com/developers/documentation.
Notes
Column Chart
Both 2D & 3D, with 3D-lighting and gradients. Also, glass effect column
chart supported.
190
Pie Chart
Both 2D & 3D, with 3D-lighting and gradients. Also, interactive slicing
and rotation are supported.
Bar Chart
191
Line Chart
2D
Doughnut Chart
Both 2D & 3D, with 3D lighting and gradients. Also, interactive slicing
and rotation are supported.
192
Area Chart
2D
MultiSeries/Stacked
Charts
2D Line and 2D Area Charts. Both 2D & 3D Bar and Column charts,
with 3D lighting and gradients
193
194
195
196
Dual Y Axis
Combination
Charts
2D/3D Column (primary Y Axis) & Line (secondary Y Axis). Support for
3D lighting effect and gradient fills. Scrollable charts available (see
below).
197
Scrollable charts
198
199
Notes
FusionCharts Free
FusionCharts XT does NOT include PowerCharts XT, FusionWidgets XT and
FusionMaps XT by the same developer. FusionCharts Free was a Flash-based (NOT
JavaScript/HTML5) product, it has been already discontinued and is no longer supported by
the developer. PHP Report Maker continues to use FusionCharts Free to provide backward
compatibility for Funnel Charts, Candlestick Charts and Gantt Charts. Refer to the
developer's website for documentation: http://www.fusioncharts.com/goodies/fusionchartsfree.
Notes
200
Funnel Chart
Candlestick Chart
FusionCharts XT and FusionCharts Free are not developed by the author of PHP
Report Maker and are not part of PHP Report Maker, read Third-part Tools(See 1.7) for more
information. NO technical support will be provided.
Note
201
Also See:
Third Party Tools(See 1.7)
Tutorial - Chart (See 1.17.11)
If you prefer to work with the unzipped template but you have not generated any files yet,
do once first. Then you can modify the unzipped files under the subfolder named "Script".
For example, if the template archive is named as "default.zip", it will be unzipped to the
folder <document folder>\<product name>\Templates\default.zip\, you can modify files
under the subfolder "Script" under it.
The customized files will not be zipped back to the template archive automatically. It
you want to transfer or share your template, you need to zip the template files back to a
template archive yourself. When you zip the template files, make sure you zip the files and
subfolders in the unzipped folder, not the unzipped folder itself. Otherwise there will be one
level different. Using above example, you should add the files and subfolders under
<document folder>\<product name>\Templates\default.zip\ to the template archive, NOT
the whole folder.
Note
202
Control File
The core of the template file is a control file named control.xml. It is an XML file containing
all the necessary instructions for the generation process. During generation the code
generator will parse the control.xml and follows the instructions to generate the output files
one by one. If you want to add an output file, you need to add a <control> tag in the control
file. If the file is to be included in other file(s), you may need to add <session> tags in
control.xml also. See Control File(See 1.16.1) for details.
Language File
All the phrases in the template are separated into a single XML language file for easy
translation to other languages and sharing. If you want to translate a template, this should
be the only file you need to translate.
Language files are placed in the subfolder "languages" under the installed folder. The files
are used for all templates.
See Multi-Language Project(See 1.11.20) for more information on making a language file.
File Encoding
The template files and output files are in ASCII encoding by default. Since the phrases are
separated into XML language files in utf-8 encoding, ASCII encoding will suit most cases as
the scripts contain code only. When you customize a template, it is recommended you use
the language file also. If you have to put unicode characters directly in the template files,
you must always use utf-8 and save the file in utf-8 encoding with the byte order mark (EF
BB BF), and enable the Advanced Setting UTF-8 output Files (see Tools(See 1.14)) to
make the code generator output files in utf-8 encoding.
General Layout
To change the general layout, just modify the file "rpt-template.php" in the template. This
file will be generated as header and footer.
Subfolders
Subfolders are defined in control.xml, if you want to add and copy additional subfolders, you
also need to add a <control> tag in the control file(See 1.16.1).
203
Extensions
Integrating third-party tools can be done by extensions. An extension is modification of
template to make the template supports additional feature(s) implemented in the extension.
Extensions may add or change code sessions in the template.
An extension has the same structure as template and you can modify them in exactly the
same way as modifying the main template.
Extensions files (in zipped format) must be placed under the subfolder "extensions" of the
installation folder. Each extension must have a XML description file so the product can load it
in the user interface for selection. You can open an XML file in the "extensions" subfolder to
see the content, which is self-explanatory. Unzip the extension and see how it is
implemented.
Read Tools(See 1.14) on how to select extensions for a project before generation.
An extension is NOT a template, do NOT select an extension as a template for
generation.
Note
Note that all extensions are provided as examples on how to customize and extend the
template only, the third party tools used in them are not developed by the author of PHP
Report Maker and are not part of PHP Report Maker, NO TECHNICAL SUPPORT WILL BE
PROVIDED. Also see Third-party Tools(See 1.7) for more information on the third-party
tools.
204
Also See:
Control File(See 1.16.1)
Template Tags(See 1.16.5)
Object Properties(See 1.16.3)
Using User Code(See 1.16.4)
Third-party Tools(See 1.7)
Tools(See 1.14)
1. <product>
The top level is the product level identified by the <product> tag. (The tag name "product"
will be replaced by unique product name identifier in respective products.) It gives a brief
description of the template and serves for product and version information purpose. The
changes in this tag will be checked every time you generate scripts with a template.
Syntax:
205
Attributes
Description
date
version
desc
language
author
2. <control>
The next level is the control level identified by the <control> tag. Each <control> specify an
output file or a set of output files that will be generated by the code generator.
Syntax:
<control
id="control_id"
type="control_type"
ofile="output_file_name"
oext="output_file_extension"
ifiles="input_files"
space="True/False"
ofolder="output_file_folder"
cond="conditions">
...
</control>
AttributesDescription
ofile
oext
type
Control type:
"table" - table-related files:
For example, the scripts that will perform "list", "view", "add", "edit" and "delete"
functions for the table. The output of this type is a set of file, one for each table.
"other" - include files:
206
ifiles
ofolder
space
cond
action
3. <session>
The third level is the session level (identified by the <session> tag). For each <control>,
there can be multiple sessions that will constitute the output. Each session can be a specific
segment from the input files or an include statement.
Syntax:
<session
type="session_type"
value="session_value"
/>
207
Session type:
"key" - output the code segment identified by the key from the list of input files
"include" - create an include statement
value
Session value:
type="other"
key value of code segment (identified by session tags in input files)
type="include"
include file name
action
Conditions
Condition checking is used extensively in templates to control the code generation process.
Codes will only be generated if the condition specified is met.
The syntax of condition checking is as follow:
condition1[,condition2...]
Condition format:
Object_Type/Object_Property/Operator/Value1[|Value2...]
Object Type and Object Property:
See Object Properties(See 1.16.3) for details
Operator:
EQ = equal
NE = not equal
GT = greater than
GE = greater than or equal to
LT = less than
LE = less than or equal to
IN = contain value
NI = not contain value
Value:
value for comparison
(Note that single/double quotes are NOT required for string type values.)
Description
ew_SetDb(tablename) (v9+)
208
ew_DbType(dbid) (v9+)
ew_IsAutoSuggest(fld) (v8+)
ew_UseForLabel(fld) (v8+)
ew_HasUserTable() (v8+)
ew_IsNotEmpty(val) (v6+)
ew_IsEmpty(val) (v6+)
ew_FormObj(ctlid) (v6+)
ew_SqlSelect(sSelectLimit, sDistinct,
sSelect, sFrom) (v6+)
ew_CustomScriptRowCnt() (v8+)
ew_CustomScriptRowCntVar() (v8+)
ew_CustomScriptGroupVar() (v7+)
ew_CustomScriptRowVar() (v7+)
209
ew_GetJsScript(html)
ew_RemoveJsScript(html)
ew_GetFieldHtmlTag(f) (v6+)
ew_NullIfFunction(fld) (v6+)
ew_CastFieldForLike(fld, type, dtfmt) (v6+) Return SQL that cast non-string field for LIKE
statement
Parms
fld - field SQL
type - field type
dtfmt - date format
ew_ContainText(Str, Find)
ew_HasTagValue(fld, val)
ew_FldTagValues(fld)
ew_SplitTagValues(str)
210
ew_SummaryValueName(id)
ew_SummaryViewValueName(id)
ew_CssInherit(parm)
ew_AddSquareBrackets(varname, fld)
ew_PageObj()
ew_GetPageObjByCtrlId(ctlid) (v6+)
ew_GetCtrlById(id) (v6+)
ew_Val(v)
ew_JsVal(v)
ew_RandomKey()
ew_FolderPath(id)
ew_GetFileNameByCtrlID(id)
ew_RelFolder(f)
211
ew_OutputRelPath(f) (v8+)
ew_DestRelPath(f) (v8+)
ew_AppRootRelPath(f) (v8+)
ew_EscapeString(sSrc, sEsc)
ew_DoubleQuote(str, cnt)
ew_Quote(str)
ew_Quote2(str)
ew_SQuote(str)
ew_UnQuote(str)
ew_GetFieldType(fType)
212
ew_DbGrpSql(grptype, grpint)
ew_BoolFieldTagValues(ftype, tagvalues)
ew_SQLPart(sSQL, sId)
ew_RecPerPageList(sList, iRec)
ew_ChartCount(Pos)
ew_FieldSqlName(fld)
ew_QuotedName(name)
ew_TableName(tbl)
213
ew_IsPopupFilter(f) (v6+)
ew_IsFieldDrillDown(f) (v6+)
ew_FieldDrillDownUrl(f) (v6+)
ew_IsChartDrillDown(cht) (v6+)
ew_ChartDrillDownUrl(cht) (v6+)
ew_DateSql(f) (v6+)
2. Overridable Functions
USAGE: SYSTEMFUNCTIONS.<FunctionName>
Function Name
Description
Charset()
FavIcon()
CssFile()
GetScript(scripttype,codetype,scriptname)
GetServerScript(codetype,scriptname)
214
ScriptExist(scripttype,codetype,scriptname)
ServerScriptExist(codetype,scriptname)
ClientScriptExist(codetype,scriptname)
CustomTemplateExist() (v7+)
GetCustomTemplate() (v7+)
ParseTemplate(template,templateid) (v7+)
RenderCustomTemplate() (v7+)
GetTemplateScript(CodeType,ScriptName) (v7+)
GetCustomViewTemplate(fld) (v7+)
215
PHPCgiPath()
NoCache()
IncludeFile(id,parm)
ConnectionString()
Security()
ScriptSummaryViewRefer()
ScriptViewRefer()
ScriptGroupView()
ScriptGroupSummaryView()
ScriptView()
ScriptSummaryView(id)
ScriptViewNo(cv, vv)
ScriptViewText(cv, vv)
ScriptViewFormat(parm)
216
ScriptViewValues(cv, vv)
ScriptViewTextarea(cv, vv)
ScriptViewHidden(cv, vv)
ScriptViewFile(cv, vv)
ScriptViewHref(cv, vv)
FieldSummaryGroupView()
FieldGroupView()
FieldSummaryView(id, lvl)
FieldView()
FieldViewHref(ctl, vv)
FieldSearch()
FieldSearch2()
FieldSearchLookup(autopostback)
217
FieldSearchCheckbox(ctl, autopostback)
FieldSearchSelect(ctl, autopostback)
FieldSearchAjax(ctl, autopostback)
FieldEditText(ctl, val)
FieldOperator()
FieldOperator2()
FieldSearchCondition()
GroupByFieldNames()
218
ParmFieldNames()
JsValidator()
JsValidatorCall(ctl)
JsDefaultMsg()
PhpValidator()
PhpValidatorCommon(fld, msg)
PhpDefaultMsg()
RowFieldNames()
ColumnFieldNames()
SummaryFieldNames()
CrosstabSql(sqlpart)
CrosstabYearSql()
DistinctColumnSql(sqlpart)
219
ReportSql(sqlpart)
ConnectionString(db) (v9.0+)
DatabaseConnection(db) (v9.0+)
I. Objects
Project
Description
CTRL
Control Object
PROJ
Project Object
CUSTOMSCRIPTS (v4+)
MENULIST (v3+)
MenuList Object
DB
Database Object
TABLE
Table Object
CHART
Chart Object
220
Field Object
LANGUAGE (v4+)
Language Object
PROJ.LINKDBS (v9+)
You can view the object properties by opening your Project File(See 1.13) with a text
editor. Project file is an XML file, each object is represented by an XML node in the project
file. The object properties are saved as attributes of the node. The property name is same as
the attribute name.
Note
II. Properties
You can use the standard dot notation to access properties of the objects.
Example
<!--##=PROJ.ProjName##-->
This line will write the project name in the output file.
CTRL Object
The CTRL Object points to the current control in control.xml that is being generated.
Property
Description
Data Type
CtrlId
String
CtrlType
PROJ Object
The PROJ Object points to the current project. You can access the current project properties
by PROJ.PropertyName.
Property
Description
Data Type
ProjID (v5.1+)
Project ID (GUID)
String
ProjName
Project Name
String
ProjVar
Project variable
String
MultiLanguage (v4+)
Boolean
DefaultLanguageFile
(v4+)
String
LanguageFiles (v4+)
221
String
Boolean
AppHeader
String
AppFooter
String
AppLogin
String
AppLogout
String
AppDefault
String
AppCssFolder
String
AppChartCssFile
String
AppCompatVersion
(v4+)
Compatible version
Integer
CodePage (v4+)
Code Page
Long
Cache
Allow Cache
Boolean
CharSet
Character Set
String
CSS
String
OutputNameType
String
OutputNameExt
String
OutputNameLCase
Boolean
BodyTitle
String
BodyFont
Body Font
String
BodySize
Body Size
String
BodyBgColor
String
BodyTextColor
String
BodyLnkColor
String
BodyVLnkColor
String
BodyALnkColor
String
BodyLeftMargin
Integer
BodyTopMargin
Integer
222
DocType (v5+)
Document Type
(NONE,HTML,XHTML,HTML5)
String
String
HeaderColor (v3+)
String
HeaderLogo (v3+)
String
HeaderHeight (v3+)
Integer
MenuColor (v3+)
String
FooterColor (v3+)
String
String
FooterText (v3+)
String
TblWidth
Table width
String
TblPadding
Table padding
Integer
TblBorder
Table border
Integer
TblSpacing
Table spacing
Integer
TblBgColor
String
TblHdrFontColor
String
TblHdrColor
String
TblAltColor
Boolean
TblAltColor1
String
TblAltColor2
String
Template
String
Destination
String
SecType
Security type:
"None" - no security
"Hard Code" - use hard coded administrator
login / password
String
"Use Table" - use security table
"Both" - use security table & hard coded
administrator login / password
SecLoginID
Administrator login id
String
SecPasswd
Administrator password
String
SecTbl
String
SecLoginIDFld
String
SecPasswdFld
String
223
Boolean
SecRegisterActivate
Boolean
String
SecSenderEmail
String
SmtpServer
String
SmtpServerPort
Long
SmtpSecureOption
(v6+)
String
MemoCRLFReplace
Boolean
TestWebServer (v6+)
Integer
DefaultDateFormat
Integer
DateSeparator
String
SetLocale
Boolean
Locale
Locale (PHP)
String
CGI
Use CGI
Boolean
CGIPath
CGI path
String
Ext
File extension
String
DefaultPage
Default page
String
UseMySqli
Boolean
StartPage (v6+)
Start page
String
XMLEncoding
String
RptColColor
String
RptGrpColor1
String
RptGrpColor2
String
224
String
RptGrpColor4
String
String
String
String
String
RptPageTotalColor
String
RptGrandTotalColor
String
PagerBackColor
String
FooterBackColor
String
UploadPath (v4+)
String
CssStyles
String
AutoSync
Boolean
String
AutoBrowse
Boolean
BodyStyle
Body Style
String
OtherGen
Boolean
OtherGenList (v4+)
String
OtherExpanded (v4+)
Boolean
OtherOverwrite
(deprecated in v4+)
Boolean
PromptOnOverwrite
(deprecated in v4+)
Prompt on Overwrite
Boolean
DynamicLoadDB
Boolean
MD5Password
Boolean
Boolean
ServerValidate
Boolean
ClientValidate
Boolean
RecPerPage
Integer
RecPerPageList
225
String
Printer friendly
Boolean
ExportHtml
Export to html
Boolean
ExportWord
Export to word
Boolean
ExportExcel
Export to excel
Boolean
ExportEmail (v4+)
Export to email
Boolean
ExportPDF (v5+)
Export to PDF
Boolean
ExportType (v4+)
Export type:
"PAGE" = export current page
"ALL" = export all records
String
SortType
Sort type
0 - no sort
1 - single column sort
2 - multi-column sort
Integer
PagerStyle
Pager style:
1 - numeric pager
2 - nextprev pager
Integer
TopPageLink
Pager on top
Boolean
Boolean
LinkOnLeft
Links on left
Boolean
RepeatColumns (v4+)
Integer
AppRootFolder
String
String
RecipientEmail (v4+)
Receiver email
String
SMTPServerUsername
(v4+)
String
SMTPServerPassword
(v4+)
String
FavIcon (v4+)
String
LoginOption (v4+)
String
226
Boolean
Boolean
Description
Data Type
ScriptType
String
ScriptCodeType
String
ScriptName
Script name
String
ScriptCtrlID
Script control id
String
ScriptL1Key
String
ScriptL2Key
String
ScriptCode
String
MenuList Object
The MenuList Object contains the menu items defined in the current project. It has the
following properties.
Property
Description
Data Type
Count
Integer
Item(i)
The ith item in the
Array of menu items
menu, which contains
the following properties
Item Object
MenuID
Menu id
Integer
MenuText
String
MenuParentID
Menu parent id
Integer
MenuGroup (v5+)
Menu group
Boolean
MenuExtUrl
String
227
Integer
Menu url
String
MenuType (v4+)
String
MenuCustomUrl
Boolean
MenuLevel
Menu level
Integer
MenuShow
Boolean
MenuDisplayOrder
Integer
DB Object
The DB Object points to the current database. You can access the current database
properties by DB.PropertyName.
Property
Description
Data Type
DBSeq (v9.0+)
Database sequence
Integer
DBID (v9.0+)
Database id
String
DBName
Database Name
String
DBVar (v8+)
Database variable
String
DBType
Database Type
String
DBPath
Database Type
String
DBPhyPath
String
DBUID
User ID
String
DBPwd
Password
String
DBQuoteS
String
DBQuoteE
String
DBConnstr
DB Connection String
String
DBADOVer
ADO Version
String
DBDBMSName
DBMS Name
String
DBDBMSVer
DBMS Version
String
DBOLEDBVer
OleDb Version
String
DBProviderName
Provider Name
String
228
Provider Version
String
DBSchema
Schema Name
String
MaxUploadSize
Integer
SecUserLevelFld
String
SecDefault
String
SecuUserIDFld
String
SecuParentUserIDFld
UseDynamicUserLevel
(v3+)
Boolean
UserLevelTbl (v3+)
String
UserLevelIdFld (v3+)
String
String
UserLevelPrivTbl (v3+)
String
UserLevelPrivTblNameFld
User Level Permission Table Name Field
(v3+)
String
UserLevelPrivUserLevelFld
User Level Permission User Level Field
(v3+)
String
UserLevelPrivPrivFld
(v3+)
String
TABLE Object
The TABLE Object points to the current table. You can access the current table properties by
TABLE.PropertyName.
Property
Description
Data Type
TblSchema (v4+)
String
TblName
Table name
String
TblType
Table type
String
(TABLE/VIEW/CUSTOMVIEW/REPORT/LINKTABLE)
TblKey
Table key
String
TblGen
Boolean
229
TblGenList (v4+)
TblList
Boolean
TblCaption
Table caption
String
TblExtSearchFldPerRow
(v8+)
Integer
TblVar
String
TblDefault
Boolean
TblFilter
Table filter
String
TblUserIDFld
String
TblSecurity
String
TblOverwrite (deprecated
Overwrite table scripts
in v4+)
Boolean
TblLoaded
Boolean
Table is loaded
TblRptShowSummaryView
Show summary view
(v5+)
Boolean
TblRptShowDetails
Boolean
TblRptShowGrandTotal
Boolean
OutputFolder (v8+)
String
IncludeFiles (v8+)
Boolean
TblReportType
Report type:
"rpt" - simple report
"summary" - summary report
"crosstab" - crosstab report
String
TblShowReport
Show report
Boolean
TblRptShowPageTotal
Boolean
TblRowSum
Boolean
TblCustomSQL
String
TblCustomError
String
TblRptSrc
Boolean
TblUseGlobal
Boolean
TblRecPerPage
Integer
TblRecPerPageList
String
230
Printer friendly
Boolean
TblExportHtml
Export to html
Boolean
TblExportWord
Export to word
Boolean
TblExportExcel
Export to excel
Boolean
TblExportEmail (v4+)
Export to email
Boolean
TblExportPDF (v5+)
Export to PDF
Boolean
TblExportType (v4+)
Export type:
"PAGE" = export current page
"ALL" = export all records
String
TblSortType
Sort type
0 - no sort
1 - single column sort
2 - multi-column sort
Integer
TblPagerStyle
Pager style:
1 - numeric pager
2 - nextprev pager
Integer
TblTopPageLink
Pager on top
Boolean
Boolean
TblLinkOnLeft
Links on left
Boolean
TblShowBlankListPage
Boolean
TblUserLevelPriv (v6+)
Boolean
Boolean
LinkTableName (v9.0+)
LinkTableType (v9.0+)
String
CrosstabSummaryFields
(v9.0+)
String
CrosstabSummaryTypes
(v9.0+)
CHART Object
231
String
Description
Data Type
ChartSeq
Integer
ChartName
Chart name
String
ChartVar
String
ShowChart
Boolean
String
String
ChartXFldName
String
ChartYFldName
String
ChartSeriesYAxis (v4+)
String
ChartNameFldName
(v4+)
String
ChartSeriesFldName
String
ChartSeriesFldOrder
(v4+)
String
ChartSummaryType
(v3+)
String
ChartType
Chart type:
(Single series)
1 - Column 2D
2 - Pie 2D
3 - Bar 2D
4 - Line 2D
5 - Column 3D
6 - Pie 3D
7 - Area 2D
8 - Dougnut 2D
(Multi series)
9 - Column 2D
10 - Column 3D
11 - Line 2D
12 - Area 2D
13 - Bar 2D
(Stacked)
Integer
232
ChartHtml5 (v5+)
Boolean
ChartWidth
Integer
ChartHeight
Integer
ChartBgColor
Background color
String
ChartCaption
Chart caption
String
ChartChartBgColor
String
String
ChartNumGridLines
Integer
ChartGridColor
String
ChartXAxisName
String
Boolean
ChartYAxisName
String
ChartPYAxisName (v4+)
String
ChartSYAxisName
(v4+)
Boolean
ChartYAxisMinValue
Long
ChartYAxisMaxValue
Long
ChartShowNames
Boolean
ChartShowValues
Boolean
ChartShowHover
Boolean
ChartAlpha
Integer
233
ChartColorPalette
ChartSortType
Integer
ChartPosition
Chart position:
1 - top
2 - left
3 - right
4 - bottom
Integer
ChartDrillTable (v6+)
String
ChartDrillSourceFields
(v6+)
String
ChartDrillTargetFields
(v6+)
String
FIELD Object
The FIELD Object points to the current field. You can access the current field properties by
FIELD.PropertyName.
Property
Description
Data Type
FldName
Field name
String
FldAlias
String
FldSourceName
String
FldSourceTable
String
FldSourceField
String
FldType
Integer
FldTypeName
String
NativeDataType
Integer
FldSQL (v9.0+)
String
FldIsCustom (v9.0+)
Boolean
FldSupport
Field is supported
Boolean
234
Field Size
Integer
FldUniqueIdx
Boolean
FldZeroLen
Boolean
FldReq
Boolean
FldIsPrimaryKey
Boolean
FldAutoIncrement
Boolean
FldAttribute
Long
FldMin (v4+)
Variant
FldMax (v4+)
Variant
FldErrMsg (v4+)
String
FldValidate (v4+)
Validate format
String
String
String
FldPopCalendar
Boolean
FldGenerate
Boolean
FldList
Boolean
FldSearch
Boolean
FldExtendedBasicSearch
Boolean
FldFilterDropDown
Boolean
FldDateSearch
String
FldDateSearchDefaultYear
String
String
String
FldDateSearchDefaultDay
String
235
Boolean
FldSrchOpr
String
FldSrchOpr2
String
FldDefault
Variant
FldDefault2 (v4+)
Variant
FldDefaultSearch (v5+)
Variant
FldCaption
Field caption
String
FldVar
Field variable
String
FldViewTag
String
FldViewThumbnail (v4+)
Boolean
FldHtmlTag (v3+)
FldSelectType (v6+)
FldTagLnkOrderType (v6+)
String
FldTagAType
Href type
String
FldTagATarget
String
FldTagAPrefix
String
FldTagASuffix
String
FldBold
Boolean
FldItalic
Boolean
FldAlign
Field alignment
String
FldFmtType
String
236
FldDtFormat
Integer
FldNumDigits
Integer
FldIncLeadDigit
Integer
FldUseParen
Integer
FldGpDigits
Integer
FldHrefFld
String
FldStrFunc
String
FldMemoMaxLength
Integer
FldSelectFilter (v6+)
String
FldQuoteS
String
FldQuoteE
String
FldColumnWidth
String
FldColumnWrap
Boolean
FldGroupByType
String
FldGroupByInterval
FldRowID
FldColumnID
FldColumnDateType
String
FldColumnDateSelect
Boolean
237
Integer
FldSummaryID
Integer
FldSummaryType
String
FldFilterName
String
FldUseRange
Boolean
FldGroupBy
Integer
FldGroupByShowSummary
Boolean
FldOrderBy
Integer
FldOrder
String
FldRptAggSum
Boolean
FldRptAggAvg
Boolean
FldRptAggMin
Boolean
FldRptAggMax
Boolean
FldRptAggCnt (v6+)
Boolean
FldRptSkipNull (v6+)
Boolean
FldRepeatColumns (v4+)
Integer
FldUploadPath (v4+)
String
FldResizeQuality (v4+)
Integer
FldSelectForceSelection
(v6+)
Boolean
FldMemoCRLFReplace
Boolean
FldViewTemplate (v7+)
String
FldDrillParameter (v6+)
Boolean
FldDrillTable (v6+)
String
238
FldDrillSourceFields (v6+)
String
FldDrillTargetFields (v6+)
String
FldOptionTemplate (v9.0+)
String
FldDropdown (v9.0+)
Boolean
Integer
Integer
LANGUAGE Object
Method
Description
Data Type
Phrase (deprecated in
v4+)
PROJ.LINKDBS Object
The PROJ.LINKDBS Object contains the collection of all link databases defined in the current
project. The object can be accessed via PROJ.LINKDBS as follows.
239
HKEY_CURRENT_USER\Software\<product name>\<version>\Settings\General
Value name: UserCode
Using User Code requires knowledge in JavaScript. If you are not familiar with the
scripting language, refer to the JavaScript Fundamentals and JavaScript Reference. In most
cases you only need to use the most basic string functions.
Note
SYSTEMFUNCTIONS.FieldView.modifiers.push(function() {
alert(this.result); // View the old value
});
Step 2 - Generate scripts, view the generated code, copy the code you want to replace,
modify it as you need.
Step 3 - Replace it.
240
SYSTEMFUNCTIONS.FieldView.modifiers.push(function() {
var oldvalue = this.result; // Get old value
alert(oldvalue); // View the old value
var newvalue = <your code here>; // Modify the oldvalue or write
your own code
this.result = newvalue; // Overwrite value
});
var <Ext> = {
FieldEdit_Prefix: function(ctl, ctlid) {
return "...";
}
FieldEdit_Suffix: function(ctl, ctlid) {
return "...";
}
}
241
Also See:
Customizing Template
(See 1.16)Template Tags(See 1.16.5)
Object Properties(See 1.16.3)
System Functions(See 1.16.2)
1. Session Tags
Syntax:
<!--##session session_name##-->
...session content here...
<!--##/session##-->
Note
242
2. Script Block
To generate codes according to the project settings, there are many script blocks in each
session. Each script block is enclosed by special start and end tags.
Syntax:
<!--##
...Script here...
##-->
The scripting language used in the script block is JScript provided by Windows Script. To
customize template, you need to know JScript.
In a script block, you can create variables and constants, use conditional statements, do
looping, write procedures, etc. You can also access all settings in the project within the
script block. (See Object Properties(See 1.16.3) for details.) With script blocks, you can
generate virtually any codes you want.
Example
3. Function Block
Function block output an object property as string or output a string return by a function.
Syntax:
<!--##=...##-->
Note the "=" symbol immediately after the start tag.
The function can be a built-in system function or an user function defined in user code file
(see Using User Code(See 1.16.4)). You can refer to the System Functions(See 1.16.2) list
for functions that you can call or override.
Format
Syntax:
<!--##=Object.Property##-->
Example 1 - Accessing object property
<!--##=PROJ.ProjName##-->
This line will write the project name in the output file.
Example 2 - Calling a function
243
Also See:
Template Object Propeties(See 1.16.3)
System Functions(See 1.16.2)
Using User Code(See 1.16.4)
1.17 Tutorials
244
b.
Enter the connection information, click [Get Database List], a combobox populated
with the available databases should be shown. Select the Database you want to connect,
click [View Schema]
245
c.
If you can view the schema of database in XML like the follows, the script is working
properly. PHP Report Maker will talk to this script similarly and get the database schema
over HTTP.
246
247
248
2. Setting up Security
Click on the [Security] tab, there are two sections for the login process:
Administrator Login
If you tick this option, a hard-coded Administrator account will be generated which has all
access right to all tables/views.
Use Existing Table
Tick this option to set up the user access levels. You should select the security table and the
corresponding Login Name and Password fields.
249
To set up the user ID, click on the [Advanced] button. A popup window will appear.
3. Setting up User ID Field
You can set up the [User ID] Field and [Parent User ID] as follow:
As the caption suggests, the User ID Field is a field to identify users. The field values for
each user must be unique. So typically the primary key of the User Table is used as User ID
Field.
To identify the records owned by a user, the records must also have a field to store the User
ID value. Therefore, all protected tables must have an User ID field, the field names can be
250
In this example, we set the Parent User ID Field as the "ReportsTo" field.
4. PHP Script Generation
Click the [Generate] button and PHP Report Maker will generate the required PHP scripts
automatically.
5. Running the PHP Application
Login as employee #1 using "nancy" and user name and "1234" as password. Go to the
"Orders" table. As we have used User ID security for the table, we can only access employee
#1 (nancy)'s records.
If you now log out and login again as employee #3 using "janet" as user name and "1234"
as password, you can only access employee #3 (janet)'s records:
251
But if you now lo gout and login again as employee #2 using "andrew" as user name and
"1234" as password, you can only access employee #1(nancy), #3 (janet), #4(margaret),
#5(steven) and #8(laura)'s records because "andrew" is the parent user of them, all these
users report to "andrew".
in the header, you can filter the records for your child
252
Notes
Also see:
Advanced Security - User Level Security(See 1.17.3)
253
254
To set up the user levels, click on the [Advanced] button. A popup window will appear.
Click on the [User Levels] button. Select the User Level Field.
The User Level field must be of integer data type. Non integer fields will not be
seen in the User Level Field combobox.
Important
255
Click
finish.
to add a new user level. Enter the description, and default permissions. Click OK to
For each user level, you can set refine the permission for different tables/views. Click OK to
finish.
256
Now we logout and then login again as employee #1 using "nancy" as user name and "1234"
as password.
According to the user level defined by us, users with "Sales" user level has view permission
to the "Orders" table only. In the menu, you'll see no links to other reports.
257
If you try to go to other reports by typing the URL directly in your browser, you're not
allowed to view it and you'll be redirected back to a report that you have permission.
There are two types of Advanced Security implemented in PHP Report Maker - User ID
Security and User Level Security. User ID Security secures data at record level; User Level
Security secures data at table level. They can work independently or work together. (See
Advanced Security - User ID Security) (See 1.17.2)
Note
Also See:
Advanced Security - User ID Security(See 1.17.4)
Advanced Security - Dynamic User Level Security(See 1.17.4)
258
Dynamic User Level Security stores the User Level information in the database, so you need
to add 2 tables to your database - User Level Table and User Level Permission Table
which must have the following fields, note the data types, User Level ID and the Permission
fields must be of integer type, the field names can be different though:
259
You can create these 2 tables in the database yourself or you can use PHP Report Maker to
create these 2 tables for you, please see below.
260
To use dynamic User Levels, switch to the [Dynamic User Levels] and check [Enable
Dynamic User Levels].
If you want PHP Report Maker to create these 2 tables in your database, click the [Create
tables] button, the following form will display for you to change the table/field names if
necessary. You can change the table/field names and then click OK to continue.
261
If you have projects created by previous versions of PHP Report Maker you may want to use
dynamic User Levels and migrate the previously defined static User Levels in the project to
the database. After selecting or creating the User Level and User Level Permission
tables/fields, just click the [Migrate] button to let PHP Report Maker do that for you.
You'll need to specify the User Level Table and the User Level Permission Table and the
related fields. (If you use PHP Report Maker to create the tables, PHP Report Maker will set
up the tables/fields automatically also.)
User Level Table - the table for storing the User Levels
User Level ID Field - the ID of an User Level, this field must be integer type
User Level Name Field - the name of an User Level, this field should be string field
A typical User Level Table should contain data like this:
262
263
Now we logout and then login again as employee #1 using "nancy" as user name and "1234"
as password.
According to the user level defined by us, users with "Sales" user level has view permission
to the "Orders" table only. In the menu, you'll see no links to other reports.
If you try to go to other reports by typing the URL directly in your browser, you're not
allowed to view it and you'll be redirected back to a report that you have permission.
There are two types of Advanced Security - User ID Security and User Level Security.
User ID Security secures data at record level; User Level Security secures data at table
level. They can work independently or work together. (See Advanced Security - User ID
Security) (See 1.17.2)
Note
Also see:
Advanced Security - User ID Security(See 1.17.4)
Advanced Security - Static User Level Security(See 1.17.3)
Before reading this tutorial, please read Using Custom View(See 1.11.10) first.
In this tutorial we will show you how to create a Custom View. We will use the demo
database for demonstration.
We will build a SELECT statement which can show the customer's company name, the
product name and total price of an order item. Four tables, "OrderDetails", "Orders",
"Customers" and "Products" table.
264
265
266
Click [SQL] tab and edit the SELECT statement in the SQL editor directly, add a calculated
field in the SELECT clause:
Change the name of the custom view from the temporary name "CustomView1" to that you
want, in this example, we use "Order Details Extended".
On the toolbar, there is a checkbox labelled [Copy field settings from source table
(when applicable)]. We keep this checked so the Field level setup (e.g. View Tag settings)
will be copied from the field's source table.
Click [OK] to finish. The custom view is added under [Custom Views] in database pane.
Select the Custom View in the database pane to generate scripts for it.
267
Select the
[Format]
Select the
Select the
[Format]
field "Unit Price", in the [View Tag] panel, select "Currency" for
and then change the [No. of digits after decimal] to "2".
field "Discount", in the [View Tag] panel, select "Percent".
field "Extended Price", in the [View Tag] panel, select "Currency" for
and then change the [No. of digits after decimal] to "2".
268
In this tutorial we will show you how to create a Detail and Summary Report in PHP Report
Maker. We will use the demo database for demonstration.
We will use the view "order_details_extended" to create a report which shows the order
items in orders of each customer:
269
270
Click the [Grouping Levels] tab, since we want to group the order items by company and
then by order, we select "CompanyName" and then "OrderID" as grouping level. (If you
want to sort in group-level fields in descending order, click the button next to the field to
switch the order.)
Check [Show summary] for both levels (the [Summary Values] tabs become visible).
271
Click the [Sort Order] tab, since we want to sort the order items by product name, we
select "ProductName" as sorting field. (If you want to sort in descending order, click the
button next to the field to switch the order.)
272
Now click the [Summary Values] tab. We want to see total price and average quantity of
order item in an order, so we check [Avg] for the field "Quantity" and check [Sum] for the
field "Extended Price".
We want to see details of each order item, so we use the default option [Details and
summary]. We also leave [Show grand summary] checked as default because we want
to know the total price and average quantity of order item for all orders.
273
If you want to show summary only (that is, only show the grouping fields and summary
values), you can select [Summary only] and [Show compact summary view].
Click [OK] to finish.
The report will be added in database pane. Click the report to go to the Field Setup page,
you can optionally enable filters for some fields in the [Filter] column.
3. PHP Script Generation
Go to the [Generate] tab, click the [Generate] button and PHP Report Maker will generate
the required PHP scripts automatically.
4. Running the PHP Application
Browse the generated site, go to the "Sales by Customer" report to see the result.
Summary values are shown at the end of each level. The grand summary is also shown at
the end of report.
274
In step 2 above, if you have selected [Summary only] and [Show compact summary
view], the compact report will only show the grouping fields and summary values:
275
Also See
Tutorial - Drill Down Report (See 1.17.8)
Before reading this tutorial, please read Crosstab Report Setup(See 1.11.12) first.
In this tutorial we will show you how to create a Crosstab Report in PHP Report Maker. We
will use the demo database for demonstration.
As explained in Preparing Your Data for Reports(See 1.9), PHP Report Maker can create a
report query from a single table, but an individual table may not contains data suitable as
the data source for a crosstab query. If you need more than one table to get the result you
want, which is almost always the case, you must design a view (MySQL 5) specifically for
crosstab presentation.
In this example, we use the view "orders by products" to generate a crosstab report that
shows quarterly sales by product for different years.
276
277
Click the [Row Headings] tab, since we want to group the order items by category name
and then by product name, we select "CategoryName" and then "ProductName" as row
headings. We also want to see the summary for each category so we check the [Show
summary] checkbox for the field "CategoryName".
278
Click the [Column Headings] tab, since we show the order date (quarterly) as column
headings, we select "OrderDate" as [Field] and select "Quarter" as [Interval].
When we prepare the data by creating the view, we can filter the orders to a particular year
by using a WHERE clause, in that case, the report will be for that particular year only.
In this example, however, we did not filter the data in the view, the data includes orders for
more than one years. If your group by "Quarter", orders in the same quarter but different
years will be grouped together. That is usually not what you want, so we enable the [Year
filter] feature, PHP Report Maker can create a combobox of the years according to the data
and display data for a year at a time.
The [Year filter] option is only available if the row heading field is of date/time type,
and the [Grouping Interval] is Quarter or Month.
Note
279
Now click the [Value] tab. We want to see the total order amount by product, so we select
"Amount" as the [Field] and select "SUM" as [Summary value].
Click [Include row sums] to let the report calculation sum of the each row, that is, the
total amount of the quarters.
Since there are quite a few products, the report will not be displayed in one single page
(depends on the [Record per page] setting), we select [Show page summary] to make
the report show the summary of the orders displayed in the current page only. Moreover, we
check [Show grand summary] so we'll always see the summary of all orders too.
280
281
Also See
Tutorial - Drill Down Report (See 1.17.8)
282
Above report does not show the order details in each order. Now we create a detail report so
user can click the sum of Extended Price (the last column) to see the order details of each
company or each order.
283
Note that this time we only use one grouping level as we do not need to show the company
name:
284
285
286
click the [...] button to open the Drill Down setup form, select the just created report "Sales
by Order" as detail report. To enable the detail report to show order details, we need to pass
the "CompnayName" and "OrderID" field values from the main report to the detail report, so
we map the field as follows:
The field names of source field and target fields can be different, but they must contain
the same set of field values so records in the detail table can be properly filtered.
Note
287
288
Click the "Extended Price (SUM)" for each Order ID, you'll see the order details:
Click the "Extended Price (SUM)" for each customer, you'll see the order details of each
order of the customer:
289
Click the Grand Total of "Extended Price (SUM)", you'll see all the order details:
290
291
Now we create another chart as a drill down chart. We can reuse the underlying view of the
report, that is the view orders_by_product, we create a chart for it as the following:
292
The Drill Down setup form will be displayed. We select the view orders_by_product as
detail report and we pass the Category (X) Axis value, in this example, category name, to
the detail report:
293
Generate scripts again, click the bars in the chart under the crosstab report Quarterly
Orders by Product and you'll see the drill down chart:
Before reading this tutorial, please read Dashboard Report Setup(See 1.11.13) first.
A Dashboard report allows you select any charts you have created in your project and show
them in one single Dashboard report page, with links back to the original reports. Using this
feature, you can enable users of your system to quickly understand the key indicators of
your system with the visually rich charts.
294
a.
b.
c.
d.
e.
f.
g.
The Report Setup window will show up, enter the report name, here we will use the
default "Dashboard1".
Then select the report type (Vertical/Horizontal/Custom). If you want to display
the charts in simple vertical and horizontal layout, just choose Vertical or
Horizontal.
In this example, we will use our own custom template, so we choose Custom. Later,
we'll write our custom template.
Here we choose the charts for the Dashboard Report first. In this example, we select
the Dow Jones Industrial Index Chart ("dj1|Chart1") and the Order By Categories
Chart ("Quarterly Orders By Product|OrdersByCategory").
Click [OK] to finish. You should find the new report appears under the Reports
node of the Database pane.
To specify the custom template for the new Dashboard report, Select the Dashboard
report in the Database pane,
Go to the [Code (Server Events, Client Scripts and Templates)] tab on the
right, scroll down to find Custom Template > Table-Specific > Dashboard ->
CustomTemplate,
Enter your custom template in HTML. In this example, we use a simple template:
<div class="chart1">{{{chart1}}}</div>
<div class="chart2">{{{chart2}}}</div>
295
296
Click on the chart to go to the original report where the chart is from.
297
In this tutorial we will show you how to create a Custom Template for exporting an order
from a report. We will use the demo project for demonstration.
The Custom Template support simple or Detail and Summary reports only. We'll create an
export template for a report similar to the Detail and Summary report created in Tutorial Detail and Summary Report(See 1.17.6). Refer to the tutorial to create another view, the
only difference is that we'll show some customer information in the export version, so we
add some more fields from the customers table in the view:
Then we create the same Detail and Summary Report as in above tutorial, we name it as,
say, "Sales By Customers 2". Note that there are 2 grouping fields:
298
When you select the fields, you do not need to select above additional fields (ContactName,
ContactTitle, Address, City, Region, PostalCode, Country, and Phone) that you don't
normally show in the report. Alternatively, you can unselect them in the Show column of
Field Setup(See 1.11.7) page after you have created the report.
We also enable Extended Filter for the OrderID so we can select an order from the report
before we export it:
299
300
Each template refers to a different part of the report, you can enter your own HTML for
them. (See Custom Template Tags(See 1.11.16) for the meanings of the tags with triple
curly brackets.)
Template Name
CustomTemplateHeader
301
<tr>
<td>{{{ProductName}}}</td>
<td>{{{UnitPrice}}}</td>
<td>{{{Quantity}}}</td>
<td>{{{Discount}}}</td>
<td>{{{Extended_Price}}}</td>
</tr>
CustomTemplateGroupFooter2 <tr>
CustomTemplateFooter
<br>
<p>Some additional information here.</p>
After entering the sample codes in the corresponding templates above, click [OK] to finish.
3. PHP Script Generation
Go to the [Generate] tab, click the [Generate] button and PHP Report Maker will generate
the required PHP scripts automatically.
4. Running the PHP Application
Browse the generated site, go to "Sales by Customer 2" report, select an order in the
Extended Filter panel, we'll see:
302
1.17.11 Chart
Note
Before reading this tutorial, please read Chart Setup(See 1.11.8) first.
In this tutorial we will show you how to create a chart to present report data in PHP Report
Maker. We'll continue to use the Crosstab Report we created in the Crosstab Report
tutorial(See 1.17.7) and create a chart to show the total order amount by product category.
303
There are many other advanced chart properties for you to configure the chart, click
[Advanced] tab to setup:
Not all displayed advanced properties are supported by each chart type. Refer to
FusionCharts documentation for list of the supported advanced properties of each chart type.
Note
304
In this example, we rotate the category names (rotateLabels) and use slanted labels
(slantLabels) on the X axis so they won't overlap each other.
3. PHP Script Generation
Go to the [Generate] tab, click the [Generate] button and PHP Report Maker will generate
the required PHP scripts automatically.
4. Running the PHP Application
Click the "Reports" menu button and select "Quarterly Orders by Product" (or select the submenu "Orders By Category") to run the report and see the chart.
305
Also See
Tutorial - Drill Down Report (See 1.17.8)
In this tutorial we will show you how to create a Gantt chart in PHP Report Maker. We will
use the demo database for demonstration.
In this example we start by creating the simplest Gantt chart from just one table - the task
table. We create the table as follows:
306
307
Since we need to define which process a task belongs to, so we need the processId field.
Note that field name MUST be "processId", including the lettercase. In fact, other than the
Task ID, Task name, Start date, End date, From task ID and Milestone date field, all
other field names and lettercase (for example, the color and hoverText field in above
table) must be the same as listed in Gantt Chart Setup(See 1.11.9). The field length for
color fields is 6 only because we DO NOT need to assign a "#" at the beginning of the hex
color code for the color fields.
We create a process table as follows:
308
Again, the field names and lettercase (id and name field) must be the same as listed in
Gantt Chart Setup(See 1.11.9).
Then we create another Gantt chart as follows:
309
If a process table is used, you can add a data table, which can show tabular information
along side the process names. After selecting the process table, you can click the [...]
button and select up fields from the process table.
310
The field caption of the field in the process table will be used as the column header.
The widths of the columns are auto-adjusted by the chart. However, you can also
explicitly specify them by server event, see example below.
Note
Connectors
Task connectors are used to connect various task bars on the chart, to indicate the flow of
process. Using task connectors, we can show the dependency of one task over another, or
the general flow of the entire set of tasks.
1. Adding a Single Connector per Task
PHP Report Maker supports a singe connector for each task (start from the end of the
specified task and end at the start of the current task) without using a connector table.
Using above example, right the Gantt chart in the database pane, select [Edit Report], and
select the [From Task ID] field as follows:
311
The From task ID field contains value of the start task ID from where the connector will
originate.
Generate again and see the result:
312
Note the connectors in above chart. Other than the limitation that there can be only one
connector per task, the connectors are also assumed to be joined from the end position of
the start task. If you want more connectors per task or more control on the connectors, you
can use connector table.
2. Adding Multiple Connectors per Task
If you need to use more than one connectors for each task, you'll need to use connector
table. In this example, we create a simple connector table as follows:
Again, the field names and lettercase must be the same as listed in Gantt Chart Setup(See
1.11.9).
Right click the Gantt chart in the database pane, select [Edit Report], and select the new
table as the [Connector table] setting.
313
314
Milestones
Milestones are important checkpoints or interim goals for a project. You can represent them
using stars, diamonds etc on Gantt Chart.
1. Adding a Single Milestone per Task
PHP Report Maker supports a singe milestone for each task without using a milestone
table.
Using above example, right the Gantt chart in the database pane, select [Edit Report], and
select the [Milestone date] field as follows:
315
The milestone date field should be a datetime field containing the date of the milestone.
Generate again and see the result:
316
Again, the field names and lettercase must be the same as listed in Gantt Chart Setup(See
1.11.9).
Right the Gantt chart in the database pane, select [Edit Report], and select the table as
the [Connector table].
317
318
Trendlines
Trendlines can be used to show important dates on the chart - like today or scheduled date
etc. If you need to add trendlines to the chart, you'll need to use a trendline table.
We create a trendline table as follows:
Again, the field names and lettercase must be the same as listed in Gantt Chart Setup(See
1.11.9).
Right the Gantt chart in the database pane, select [Edit Report], and select the table as
the [Trendline table].
319
320
1. If you are not familiar with server events, please read Server Events and Client
Scripts(See 1.11.15) first.
2. Using server event to customize Gantt chart requires basic to intermediate
knowledge in PHP classes and PHP DOM functions for manipulating XML.
There are 2 server events you can use to customize the chart:
1. Chart_Rendering Event
This event is fired before the chart XML is built. You can still change the chart properties
using this event, the parameters is:
$chart - the chart object instance which contain all the information about the chart to be
rendered. It is an instance of the crGantt class, if you use this event to customize the Gantt
chart, you need to be familiar with the Gantt chart class (crGantt), refer to generated
ganttfn.php for members of the class.
There are various methods in the Gantt chart class you can use to customize the chart,
please refer to the source code of the class crGantt generated in ganttfn.php.
Example - Adding a trendline by code instead of using Trendline table
Note
This example is for Gantt chart only, it is NOT applicable to other chart types.
321
Before reading this tutorial, please read Compatibility Properties Setup(See 1.11.14)
first.
In this tutorial we will show you how to put scripts generated by PHP Report Maker together
with scripts generated by PHPMaker. We'll use security in both projects and demonstrate
how you can make them compatible with each other.
To make PHPMaker and PHP Report Maker projects work together, there are 3 requirements:
1. The projects share the same web folder. In general, the projects share the same
application root and destination folder.
2. The projects share the same project name.
3. If Advanced Security is used, they shares the same Advanced Security settings,
including the User ID field, Parent User ID field, User Level field and User Levels.
Project name in PHP Report Maker or PHPMaker is used in session variable to distinguish
projects. For example, if the project name of your PHPMaker project is named as "project1",
the session variable of the logged in status is session variable "project1_status". If your
project name of your PHP Report Maker project is named as "project2", when users browse
from PHPMaker generated pages to PHP Report Maker generated pages, you will be
322
323
If you open your report project again in PHP Report Maker and click [Tools] ->
[Compatibility Properties], you should see that PHPMaker has changed some settings for
compatibility:
1. The project name has been set as the same as that of PHPMaker project,
2. [Enable compatibility properties] is enabled,
3. The file names of the shared files has been setup. If they are not correct, enter the
file name of the header, footer, login, logout and default pages in your PHPMaker
project.
324
325