From 7fa1200b5e589a47884aa4d62630ce9099fccee1 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 30 Jan 2007 11:36:13 +0000 Subject: Add basic Scaffold view for Active Record --- .../protected/pages/Database/Scaffold.page | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 demos/quickstart/protected/pages/Database/Scaffold.page (limited to 'demos/quickstart/protected/pages/Database/Scaffold.page') diff --git a/demos/quickstart/protected/pages/Database/Scaffold.page b/demos/quickstart/protected/pages/Database/Scaffold.page new file mode 100644 index 00000000..36a0ec21 --- /dev/null +++ b/demos/quickstart/protected/pages/Database/Scaffold.page @@ -0,0 +1,99 @@ + + +

Active Record Scaffold Views

+

Active Record classes can be used together with + +and + +( +links both TScaffoldListView and TScaffoldEditView) to create +simple Create/Read/Update/Delete (CRUD) web applications.

+ +

The scaffold views are intended to assist in prototyping web application, +they are not designed to be as customiziable as more complex components such as +TDataGrid. The scaffold views provide +the following builtin functionality: +

+ + + +

Scaffold views are dependent on Active Records and currently supports +the following databases: Mysql, Sqlite and Postgres SQL. Support for other databases +can be considered when there are sufficient demand.

+ +

Setting up a Scaffold View

+

To use the scaffold view, we first define an Active Record +class that represents a table or view in the database. Consider the following +Active Record class that corresponds to the users +table as defined in the Active Record quickstart page. +

+ + +class UserRecord extends TActiveRecord +{ + public $username; + public $email; + + public static $_tablename='users'; +} + + +

The scaffold view classes are in the System.Data.ActiveRecord.Scaffold.* +namespace. +This namespace can be "imported" in the +Application Configuration +using the application.xml file or through the php code using the Prado::using() +method. The simplest way to provide CRUD functional is to use the + +where the RecordClass property value equals to an Active Record +class name. +

+ + +<com:TScaffoldView RecordClass="UserRecord" /> + + +

Todo...

+ +

Other views... list view

+ + +<com:TScaffoldListView RecordClass="UserRecord" /> + + +

edit view...

+ +<com:TScaffoldEditView RecordPk="user1" RecordClass="UserRecord" /> + + +

Combining list + edit views

+ + +<com:TScaffoldEditView ID="edit_view" RecordClass="UserRecord" /> +<com:TScaffoldListView EditViewID="edit_view" RecordClass="UserRecord" /> + + +

custom list view...

+ +<com:TScaffoldView RecordClass="UserRecord" > + <prop:ListView.List.ItemTemplate> + <%# $this->DataItem->username %> + <com:TLinkButton Text="Edit" CommandName="edit" /> + </prop:ListView.List.ItemTemplate> +</com:TScaffoldView/> + +

To be completed...

+ +

Address book example...

+ + + +
$Id$
\ No newline at end of file -- cgit v1.2.3