diff options
author | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
commit | 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch) | |
tree | e08bf04f0823650a231227ac3499121270172a23 /demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater | |
parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater')
-rw-r--r-- | demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php index f7c8d61c..ae765ee1 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php @@ -1,79 +1,79 @@ -<?php
-
-class Home extends TPage
-{
- protected function getProducts()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
- array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
- array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
- );
- }
-
- protected function getCategories()
- {
- return array(
- array('id'=>'CAT001','name'=>'Accessories'),
- array('id'=>'CAT002','name'=>'Input Devices'),
- array('id'=>'CAT003','name'=>'Drives'),
- array('id'=>'CAT004','name'=>'Barebone'),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->Products;
- $this->Repeater->dataBind();
- }
- }
-
- public function repeaterDataBound($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->ProductCategory->DataSource=$this->Categories;
- $item->ProductCategory->DataTextField='name';
- $item->ProductCategory->DataValueField='id';
- $item->ProductCategory->dataBind();
- $item->ProductCategory->SelectedValue=$item->DataItem['category'];
- }
- }
-
- public function saveInput($sender,$param)
- {
- if($this->IsValid)
- {
- $index=0;
- $products=$this->Products;
- $data=array();
- foreach($this->Repeater->Items as $item)
- {
- $item=array(
- 'id'=>$products[$index]['id'],
- 'name'=>$item->ProductName->Text,
- 'category'=>$item->ProductCategory->SelectedItem->Text,
- 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
- 'imported'=>$item->ProductImported->Checked,
- );
- $data[]=$item;
- $index++;
- }
- $this->Repeater2->DataSource=$data;
- $this->Repeater2->dataBind();
- }
- }
-}
-
+<?php + +class Home extends TPage +{ + protected function getProducts() + { + return array( + array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true), + array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true), + array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true), + array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false), + array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true), + array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false), + array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false), + array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true), + array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true), + array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false), + ); + } + + protected function getCategories() + { + return array( + array('id'=>'CAT001','name'=>'Accessories'), + array('id'=>'CAT002','name'=>'Input Devices'), + array('id'=>'CAT003','name'=>'Drives'), + array('id'=>'CAT004','name'=>'Barebone'), + ); + } + + public function onLoad($param) + { + parent::onLoad($param); + if(!$this->IsPostBack) + { + $this->Repeater->DataSource=$this->Products; + $this->Repeater->dataBind(); + } + } + + public function repeaterDataBound($sender,$param) + { + $item=$param->Item; + if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem') + { + $item->ProductCategory->DataSource=$this->Categories; + $item->ProductCategory->DataTextField='name'; + $item->ProductCategory->DataValueField='id'; + $item->ProductCategory->dataBind(); + $item->ProductCategory->SelectedValue=$item->DataItem['category']; + } + } + + public function saveInput($sender,$param) + { + if($this->IsValid) + { + $index=0; + $products=$this->Products; + $data=array(); + foreach($this->Repeater->Items as $item) + { + $item=array( + 'id'=>$products[$index]['id'], + 'name'=>$item->ProductName->Text, + 'category'=>$item->ProductCategory->SelectedItem->Text, + 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text), + 'imported'=>$item->ProductImported->Checked, + ); + $data[]=$item; + $index++; + } + $this->Repeater2->DataSource=$data; + $this->Repeater2->dataBind(); + } + } +} + ?>
\ No newline at end of file |