diff options
author | xue <> | 2006-01-30 03:40:28 +0000 |
---|---|---|
committer | xue <> | 2006-01-30 03:40:28 +0000 |
commit | f7b1db61531f9309dc9a1b9587449442a7ae5ed5 (patch) | |
tree | dba0fc0e23f841fef352ec3e8126b42d40d533d8 /demos/quickstart/protected/pages/Controls/Samples | |
parent | 939f16aea32e1c200896fb59fab43098cfb0e135 (diff) |
Added two repeater demos.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
4 files changed, 199 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.page b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.page new file mode 100644 index 00000000..8e469fde --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.page @@ -0,0 +1,47 @@ +<com:TContent ID="body">
+
+<h1>TRepeater Sample 1</h1>
+
+<com:TRepeater ID="Repeater" >
+
+<prop:HeaderTemplate>
+<table cellpadding="2">
+<tr style="color:white;background-color:black">
+ <th>ID</th>
+ <th>Name</th>
+ <th>Quantity</th>
+ <th>Price</th>
+ <th>Imported</th>
+</tr>
+</prop:HeaderTemplate>
+
+<prop:ItemTemplate>
+<tr style="background-color:green">
+<td><%#$this->Parent->DataItem['id']%></td>
+<td><%#$this->Parent->DataItem['name']%></td>
+<td><%#$this->Parent->DataItem['quantity']%></td>
+<td><%#$this->Parent->DataItem['price']%></td>
+<td><%#$this->Parent->DataItem['imported']?'Yes':'No'%></td>
+</tr>
+</prop:ItemTemplate>
+
+<prop:AlternatingItemTemplate>
+<tr style="background-color:silver">
+<td><%#$this->Parent->DataItem['id']%></td>
+<td><%#$this->Parent->DataItem['name']%></td>
+<td><%#$this->Parent->DataItem['quantity']%></td>
+<td><%#$this->Parent->DataItem['price']%></td>
+<td><%#$this->Parent->DataItem['imported']?'Yes':'No'%></td>
+</tr>
+</prop:AlternatingItemTemplate>
+
+<prop:FooterTemplate>
+<tr style="color:white;background-color:black;text-align:center;">
+<td colspan="5">Computer Parts Inventory</td>
+</tr>
+</table>
+</prop:FooterTemplate>
+
+</com:TRepeater>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php new file mode 100644 index 00000000..c88b8d9a --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php @@ -0,0 +1,41 @@ +<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ protected function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->getData();
+ $this->Repeater->dataBind();
+ }
+ }
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page new file mode 100644 index 00000000..174f132c --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page @@ -0,0 +1,55 @@ +<com:TContent ID="body">
+
+<h1>TRepeater Sample 2</h1>
+
+<com:TRepeater ID="Repeater" OnItemDataBound="dataBindRepeater2">
+
+<prop:HeaderTemplate>
+<table cellspacing="1" style="border-collapse: collapse;border:1px solid silver">
+<tr style="color:white;background-color:black">
+<th colspan="2">Regional Personnel</th>
+</tr>
+</prop:HeaderTemplate>
+
+<prop:ItemTemplate>
+<tr>
+<td style="background-color:silver"><%#$this->Parent->DataItem %></td>
+<td>
+ <com:TRepeater ID="Repeater2">
+
+ <prop:HeaderTemplate>
+ <table cellspacing="1" style="border-collapse: collapse;border:1px solid silver">
+ </prop:HeaderTemplate>
+
+ <prop:ItemTemplate>
+ <tr style="background-color:#E6FFE6;">
+ <td style="width:70px"><%#$this->Parent->DataItem['name'] %></td>
+ <td style="width:20px"><%#$this->Parent->DataItem['age'] %></td>
+ <td style="width:150px"><%#$this->Parent->DataItem['position'] %></td>
+ </tr>
+ </prop:ItemTemplate>
+
+ <prop:AlternatingItemTemplate>
+ <tr style="background-color:#F0F0F0;">
+ <td style="width:70px"><%#$this->Parent->DataItem['name'] %></td>
+ <td style="width:20px"><%#$this->Parent->DataItem['age'] %></td>
+ <td style="width:150px"><%#$this->Parent->DataItem['position'] %></td>
+ </tr>
+ </prop:AlternatingItemTemplate>
+
+ <prop:FooterTemplate>
+ </table>
+ </prop:FooterTemplate>
+
+ </com:TRepeater>
+</td>
+</tr>
+</prop:ItemTemplate>
+
+<prop:FooterTemplate>
+</table>
+</prop:FooterTemplate>
+
+</com:TRepeater>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php new file mode 100644 index 00000000..59d01f57 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php @@ -0,0 +1,56 @@ +<?php
+
+class Sample2 extends TPage
+{
+ protected function getMasterData()
+ {
+ return array('North','West','East','South');
+ }
+
+ protected function getDetailData($region)
+ {
+ static $data=array(
+ 'North'=>array(
+ array('name'=>'John','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Edward','age'=>35,'position'=>'Developer'),
+ array('name'=>'Walter','age'=>28,'position'=>'Developer'),
+ ),
+ 'West'=>array(
+ array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
+ array('name'=>'Ted','age'=>25,'position'=>'Developer'),
+ array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
+ ),
+ 'East'=>array(
+ array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
+ array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
+ ),
+ 'South'=>array(
+ array('name'=>'King','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Carter','age'=>22,'position'=>'Developer'),
+ ),
+ );
+ return $data[$region];
+ }
+
+ protected function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->getMasterData();
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function dataBindRepeater2($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->Repeater2->DataSource=$this->getDetailData($item->DataItem);
+ $item->Repeater2->dataBind();
+ }
+ }
+}
+
+?>
\ No newline at end of file |