Tutorial

OpenBiz Tutorial
Open Business software framework
Sep. 2003
Note: this tutorial is for openbiz 1.1.x and lower version. Please use it as
a reference document for openbiz 2.0
OpenBiz Introduction
What is OpenBiz?

OpenBiz is an open php business software
framework
How can OpenBiz help?



Build data-oriented complicated web
application in an easy way
Build your application by constructing
metadata file, not by coding
Easily extending for special requirements
Build your application
Data model design

Database schema
BizObj design – business logic unit


What properties in the BizObj
What functions provided by the BizObj
BizForm design – presentation unit

Map BizObj properties and functions on UI
BizView design – presentation container


Contain multiple BizForm
Define relationship between BizForm
HTML Template design – GUI
Data model design
Entity Relationship Graph


Modeling business data into database table
schema
Please refer to database design book for details
Create tables in database



Create tables/indexes using GUI tools or scripts
Specify “Prefix” in id_table for each table so that
SYSID of new record will be auto-generated as
“Prefix”+sequence format. i.e. PLY_101
Add your database connection information to
config.xml. i.e. replace the “Default” database
Data model design (example)
event
{SYSID,
NAME,
HOST,
LOCATION
…}
regist
{SYSID,
PLAYER_ID,
EVENT_ID,
FEE}
player
{SYSID,
NAME,
EMAIL,
PHONE
…}
A registration system modeling
BizObj design
Each BizObj is based on a database table –
base table
Properties in the BizObj



Map a field from a base table column
Map a field from a foreign table column
Does a field need pick data from other BizObj?
Functions provided by the BizObj


Basic functions are provided by OpenBiz
Implement special functions by extending BizObj
BizObj design (example)
BORegist - base table = regist
Properties






Id  regist.SYSID
Player Id  regist.PLAYER_ID
Player Name  player.NAME (foreign table)
Event Id  regist.EVENT_ID
Event Name  event.NAME (foreign table)
Fee  regist.FEE
Functions – BizObj provides enough
functions, no special requirement
BizObj design (example cont.)
Add BORegist BizObj in OpenBiz Objects Browser
BizObj design (example cont.)
XML metadata file for BORegist BizObj
Use Edit Attributes frame:
1.
Click Table icon to select a table
2.
Click Column icon to select a table column
3.
Click BizObj icon to select a BizObj
4.
Click BizField icon to select a BizField
Fill Attribute value
BizForm design
BizForm is the UI proxy of BizObj – base BizObj

A BizForm can have difference presentation mode
(default, edit, query) associated with templates
Map a field control from BizObj field



Map a field control from base BizObj field
Does a field need pick data from other BizForm?
Is the field editable, visible?
Add functions on BizForm


Map functions provided by BizForm class to buttons.
Implement special functions by extending BizForm
BizForm design (example)
FMRegist - base BizObj = BORegist


Default mode uses list Template
Edit, query mode uses group Template
Map BizObj fields to UI






Registration Id  [Id]
Player Id  [Player Id] Noneditable
Player Name  [Player Name] Noneditable, Need select field
data from Player BizForm
Event Id  [Event Id] Noneditable
Event Name  [Event Name] Noneditable, Need select field
data from EventPopup (a popup view contains FMEvent
BizForm)
Fee  [Fee] Need select field from 2 values $15, $20.
BizForm design (example cont.)
Add function buttons on UI toolbar








Search button  SearchRecord()
Go button  RunSearch()
New button  NewRecord()
Edit button  EditRecord()
Copy button  CopyRecord()
Delete button  DeleteRecord()
Save button  SaveRecord()
Cancel button  CancelRecord()
Add Navigation button on UI Navbar


Go Previous Button  MovePrev()
Go Next Button  MoveNext()
BizForm design (example cont.)
Add FMRegist BizForm in OpenBiz Objects Browser
BizForm design (example cont.)
XML metadata file for FMRegist BizForm
Use Edit Attributes frame:
1.
Click BizField icon to select a BizField of the Bizobj defined in root element
2.
Click BizForm icon to select a BizForm
Fill Attribute value
BizView design
BizView is the container of BizForms and
other HTML controls

Page layout is defined in templates
Define the relationship between BizForms


A BizForm can help subforms that depend on its
current data
A BizForm can depend on the current data of
other BizForm
BizView design (example)
What can a user do on the view?


Add/edit a new player
Add/edit registered event for a player
What should a user see on the view?


A player BizForm
A registration BizForm
What the relationship between Forms

The registration form depends on the current data
of the player form
BizView design (example cont.)
List of players
(FMPlayer BizForm)
SubCtrls="FMRegist"
Dependency
List of registered events of the player
(FMRegist BizForm)
Dependency="reg_plyid=FMPlayer.ply_id"
UI name of FMRegist
“Player Id”
UI name of FMPlayer
“Player Id”
BizView design (example cont.)
Create a BOPlayer BizObj




Id  players.SYSID
Name  players.NAME
Email  players.EMAIL
Phone  players.PHONE
Create a FMPlayer BizForm





Player Id  [Id]
Player Name  [Name] Sortable
Player Email  [Email]
Player Phone  [Phone]
Add function buttons and templates as FMRegist
BizView design (example cont.)
Redesign FMRegist


Because FMRegist depends on FMPlayer,
the player shown on FMPlayer is same as
the player shown on FMRegist. It’s
reasonable to hide Player Name in
FMRegist
Hide Player Name in FMRegist
 Player Name  [Player Name] Noneditable,
Hidden
BizView design (example cont.)
Add RegistView BizView in OpenBiz Objects Browser
BizView design (example cont.)
XML metadata file for RegistView BizView
Use Edit Attributes frame:
1.
Click BizForm icon to select a BizForm
2.
Click Text icon to input long text
Fill Attribute value
HTML Template design
Typical templates


Table template – a HTML table contains multiple
BizForm records
Group template – a HTML group contains single
BizForm record
Other templates


Tree template (todo)
Special templates
All templates must has format <form
id={$name} name={$name}>…</form>
HTML Template design (cont.)
Data output from BizForm.Render




{$title}, {$name} as value
{$toolbar}, {$navbar} as array
{$columns} as array – field labels/headers
In table format
 {$cells} as 2D array – fields values of multi-records
 {$selRow} as array – current selected row flags

In array format
 {$controls} as array – fields values of a record
These output variables can be used in your
template files

Please refer to http://smarty.php.net/ for details
HTML Template design (cont.)
Design UI theme of your application


Build color theme using CSS
Build button theme
GUI templates included in OpenBiz




Gray
Ocean (todo)
Land (todo)
Rose (todo)
Summary
Development steps with OpenBiz
Requirements
Data model
Create BizObj
User Interface
Create BizForm
Create BizView
Create Templates