From c7d41e5bea4a5f96979a08da9cc9f79355edfe70 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 16 Jul 2006 06:19:36 +0000 Subject: Update Time Tracker demo. --- .../protected/pages/Tutorial/TestSecond.page | 116 --------------------- 1 file changed, 116 deletions(-) delete mode 100644 demos/sqlmap/protected/pages/Tutorial/TestSecond.page (limited to 'demos/sqlmap/protected/pages/Tutorial/TestSecond.page') diff --git a/demos/sqlmap/protected/pages/Tutorial/TestSecond.page b/demos/sqlmap/protected/pages/Tutorial/TestSecond.page deleted file mode 100644 index 706b5220..00000000 --- a/demos/sqlmap/protected/pages/Tutorial/TestSecond.page +++ /dev/null @@ -1,116 +0,0 @@ - - -

Playtest second!

-

Now that we have a passing test, we want to display some results as web pages. -The following examples utilize the Prado framework to display and manipulate -the database through SQLMap. Since SQLMap framework and Prado framework solve -different problems, they are both fairly independent, they can be used -together or separately.

- -

SQLMap and Prado

-

To setup Prado, we need to create the follow files and directory structure -under our example/WebView directory.

- -assets/ % application public assets - -protected/pages/Home.page % default page -protected/pages/Home.php % default page class -protected/runtime/ % run time data - -protected/application.xml % application configuration - -index.php % application entry point - - -

The application.xml and assets directory are not necessary but we -will make use of them later. The application.xml is used to define some -directory aliases and override the data source definitions in the -sqlmap.config. This is because SQLite database files are defined -relatively, otherwise we don't need to override the data source definitions. -The example application.xml is shown below, defining path aliases and override SQLite database -location.

- - - - - - - - - - - - - - - - - - - -

The entry point to a Prado application in this example is index.php -and generally contains the following code.

- - -<?php -error_reporting(E_ALL); -require_once('/path/to/prado/framework/prado.php'); -$application=new TApplication; -$application->run(); -?> - - -

Now we are ready to setup a page to display our list of people. -The following sample shows the Prado code for our display page. The key -piece is the TDataGrid. We save the file as Home.page.

- - - - - - Person - - -<com:TForm> -

Person List

- <com:TDataGrid id="personList"> - <com:TBoundColumn DataField="BirthDate" - HeaderText="Birth Date"/> - </com:TDataGrid> -</com:TForm> - - -
- -

Of course, we still need to populate that TDataGrid. The following code -shows the PHP for Home.php. The operative method is loadData(). -The rest is supporting code.

- - -<?php -Prado::using('Example.Models.Person'); -class Home extends TPage -{ - private function loadData() - { - $sqlmap = $this->Application->getModule('SQLMap')->getClient(); - $this->personList->DataSource = $sqlmap->queryForList('SelectAll'); - $this->personList->dataBind(); - } - - public function onLoad($param) - { - if(!$this->IsPostBack) - $this->loadData(); - } -} -?> - - -

If we run this now, we'll get a list like the one shown the figure below.

- class="figure" /> -
Figure 3: A quick-and-dirty Person List
- -
\ No newline at end of file -- cgit v1.2.3