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 | |
| parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) | |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls')
27 files changed, 1090 insertions, 1090 deletions
| diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php index 4a4e23ca..e3afdaae 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php @@ -1,20 +1,20 @@ -<?php
 -
 -// $Id$
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender, $param)
 -	{
 -		if($param instanceof TCommandEventParameter)
 -			$sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
 -		else
 -			$sender->Text="I'm clicked";
 -	}
 -
 -	public function buttonCallback($sender, $param)
 -	{
 -		$sender->Text .= ' using callback';
 -	}
 -}
 -
 +<?php + +// $Id$ +class Home extends TPage +{ +	public function buttonClicked($sender, $param) +	{ +		if($param instanceof TCommandEventParameter) +			$sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}"; +		else +			$sender->Text="I'm clicked"; +	} + +	public function buttonCallback($sender, $param) +	{ +		$sender->Text .= ' using callback'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php index f0543695..5a73a6f4 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php @@ -1,16 +1,16 @@ -<?php
 -// $Id$
 -class Home extends TPage
 -{
 -	public function checkboxClicked($sender,$param)
 -	{
 -		$sender->Text= $sender->ClientID . " clicked";
 -	}
 -
 -	public function checkboxCallback($sender, $param)
 -	{
 -		$sender->Text .= ' using callback';
 -	}
 -}
 -
 +<?php +// $Id$ +class Home extends TPage +{ +	public function checkboxClicked($sender,$param) +	{ +		$sender->Text= $sender->ClientID . " clicked"; +	} + +	public function checkboxCallback($sender, $param) +	{ +		$sender->Text .= ' using callback'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php index 3644721e..b9060163 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php @@ -1,26 +1,26 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	protected function collectSelectionResult($input,$output)
 -	{
 -		$indices=$input->SelectedIndices;
 -		$result='';
 -		foreach($indices as $index)
 -		{
 -			$item=$input->Items[$index];
 -			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
 -		}
 -		if($result==='')
 -			$output->Text='Your selection is empty.';
 -		else
 -			$output->Text='Your selection is: '.$result;
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	protected function collectSelectionResult($input,$output) +	{ +		$indices=$input->SelectedIndices; +		$result=''; +		foreach($indices as $index) +		{ +			$item=$input->Items[$index]; +			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)"; +		} +		if($result==='') +			$output->Text='Your selection is empty.'; +		else +			$output->Text='Your selection is: '.$result; +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php index 102afcb0..c668c86d 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function validator1_onvalidate($sender, $param)
 -	{
 -		$param->IsValid = $this->textbox1->Text == 'Prado';
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function validator1_onvalidate($sender, $param) +	{ +		$param->IsValid = $this->textbox1->Text == 'Prado'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php index ada1ee6e..43d645ab 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php @@ -1,37 +1,37 @@ -<?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),
 -		);
 -	}
 -
 -	public function buttonClicked($sender, $param)
 -	{
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?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), +		); +	} + +	public function buttonClicked($sender, $param) +	{ +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php index 3831582d..10a37e0a 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php @@ -1,86 +1,86 @@ -<?php
 -
 -class Sample2 extends TPage
 -{
 -	protected function getData()
 -	{
 -		return array(
 -			array(
 -				'ISBN'=>'0596007124',
 -				'title'=>'Head First Design Patterns',
 -				'publisher'=>'O\'Reilly Media, Inc.',
 -				'price'=>29.67,
 -				'instock'=>true,
 -				'rating'=>4,
 -			),
 -			array(
 -				'ISBN'=>'0201633612',
 -				'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
 -				'publisher'=>'Addison-Wesley Professional',
 -				'price'=>47.04,
 -				'instock'=>true,
 -				'rating'=>5,
 -			),
 -			array(
 -				'ISBN'=>'0321247140',
 -				'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
 -				'publisher'=>'Addison-Wesley Professional',
 -				'price'=>37.49,
 -				'instock'=>true,
 -				'rating'=>4,
 -			),
 -			array(
 -				'ISBN'=>'0201485672',
 -				'title'=>'Refactoring: Improving the Design of Existing Code',
 -				'publisher'=>'Addison-Wesley Professional',
 -				'price'=>47.14,
 -				'instock'=>true,
 -				'rating'=>3,
 -			),
 -			array(
 -				'ISBN'=>'0321213351',
 -				'title'=>'Refactoring to Patterns',
 -				'publisher'=>'Addison-Wesley Professional',
 -				'price'=>38.49,
 -				'instock'=>true,
 -				'rating'=>2,
 -			),
 -			array(
 -				'ISBN'=>'0735619670',
 -				'title'=>'Code Complete',
 -				'publisher'=>'Microsoft Press',
 -				'price'=>32.99,
 -				'instock'=>false,
 -				'rating'=>4,
 -			),
 -			array(
 -				'ISBN'=>'0321278658',
 -				'title'=>'Extreme Programming Explained : Embrace Change',
 -				'publisher'=>'Addison-Wesley Professional',
 -				'price'=>34.99,
 -				'instock'=>true,
 -				'rating'=>3,
 -			),
 -		);
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack && !$this->IsCallBack)
 -		{
 -			$this->DataGrid->DataSource=$this->Data;
 -			$this->DataGrid->dataBind();
 -		}
 -	}
 -
 -	public function toggleColumnVisibility($sender,$param)
 -	{
 -		foreach($this->DataGrid->Columns as $index=>$column)
 -			$column->Visible=$sender->Items[$index]->Selected;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?php + +class Sample2 extends TPage +{ +	protected function getData() +	{ +		return array( +			array( +				'ISBN'=>'0596007124', +				'title'=>'Head First Design Patterns', +				'publisher'=>'O\'Reilly Media, Inc.', +				'price'=>29.67, +				'instock'=>true, +				'rating'=>4, +			), +			array( +				'ISBN'=>'0201633612', +				'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software', +				'publisher'=>'Addison-Wesley Professional', +				'price'=>47.04, +				'instock'=>true, +				'rating'=>5, +			), +			array( +				'ISBN'=>'0321247140', +				'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design', +				'publisher'=>'Addison-Wesley Professional', +				'price'=>37.49, +				'instock'=>true, +				'rating'=>4, +			), +			array( +				'ISBN'=>'0201485672', +				'title'=>'Refactoring: Improving the Design of Existing Code', +				'publisher'=>'Addison-Wesley Professional', +				'price'=>47.14, +				'instock'=>true, +				'rating'=>3, +			), +			array( +				'ISBN'=>'0321213351', +				'title'=>'Refactoring to Patterns', +				'publisher'=>'Addison-Wesley Professional', +				'price'=>38.49, +				'instock'=>true, +				'rating'=>2, +			), +			array( +				'ISBN'=>'0735619670', +				'title'=>'Code Complete', +				'publisher'=>'Microsoft Press', +				'price'=>32.99, +				'instock'=>false, +				'rating'=>4, +			), +			array( +				'ISBN'=>'0321278658', +				'title'=>'Extreme Programming Explained : Embrace Change', +				'publisher'=>'Addison-Wesley Professional', +				'price'=>34.99, +				'instock'=>true, +				'rating'=>3, +			), +		); +	} + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack && !$this->IsCallBack) +		{ +			$this->DataGrid->DataSource=$this->Data; +			$this->DataGrid->dataBind(); +		} +	} + +	public function toggleColumnVisibility($sender,$param) +	{ +		foreach($this->DataGrid->Columns as $index=>$column) +			$column->Visible=$sender->Items[$index]->Selected; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php index 9768ca31..5e2fb355 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php @@ -1,190 +1,190 @@ -<?php
 -
 -class Sample3 extends TPage
 -{
 -	private $_data=null;
 -
 -	protected function getData()
 -	{
 -		if($this->_data===null)
 -			$this->loadData();
 -		return $this->_data;
 -	}
 -
 -	protected function loadData()
 -	{
 -		// We use viewstate keep track of data.
 -		// In real applications, data should come from database using an SQL SELECT statement.
 -		// In the following tabular data, field 'ISBN' is the primary key.
 -		// All update and delete operations should come with an 'id' value in order to go through.
 -		if(($this->_data=$this->getViewState('Data',null))===null)
 -		{
 -			$this->_data=array(
 -				array(
 -					'ISBN'=>'0596007124',
 -					'title'=>'Head First Design Patterns',
 -					'publisher'=>'O\'Reilly Media, Inc.',
 -					'price'=>29.67,
 -					'instock'=>true,
 -					'rating'=>4,
 -				),
 -				array(
 -					'ISBN'=>'0201633612',
 -					'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
 -					'publisher'=>'Addison-Wesley Professional',
 -					'price'=>47.04,
 -					'instock'=>true,
 -					'rating'=>5,
 -				),
 -				array(
 -					'ISBN'=>'0321247140',
 -					'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
 -					'publisher'=>'Addison-Wesley Professional',
 -					'price'=>37.49,
 -					'instock'=>true,
 -					'rating'=>4,
 -				),
 -				array(
 -					'ISBN'=>'0201485672',
 -					'title'=>'Refactoring: Improving the Design of Existing Code',
 -					'publisher'=>'Addison-Wesley Professional',
 -					'price'=>47.14,
 -					'instock'=>true,
 -					'rating'=>3,
 -				),
 -				array(
 -					'ISBN'=>'0321213351',
 -					'title'=>'Refactoring to Patterns',
 -					'publisher'=>'Addison-Wesley Professional',
 -					'price'=>38.49,
 -					'instock'=>true,
 -					'rating'=>2,
 -				),
 -				array(
 -					'ISBN'=>'0735619670',
 -					'title'=>'Code Complete',
 -					'publisher'=>'Microsoft Press',
 -					'price'=>32.99,
 -					'instock'=>false,
 -					'rating'=>4,
 -				),
 -				array(
 -					'ISBN'=>'0321278658 ',
 -					'title'=>'Extreme Programming Explained : Embrace Change',
 -					'publisher'=>'Addison-Wesley Professional',
 -					'price'=>34.99,
 -					'instock'=>true,
 -					'rating'=>3,
 -				),
 -			);
 -			$this->saveData();
 -		}
 -	}
 -
 -	protected function saveData()
 -	{
 -		$this->setViewState('Data',$this->_data);
 -	}
 -
 -	protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
 -	{
 -		// In real applications, data should be saved to database using an SQL UPDATE statement
 -		if($this->_data===null)
 -			$this->loadData();
 -		$updateRow=null;
 -		foreach($this->_data as $index=>$row)
 -			if($row['ISBN']===$isbn)
 -				$updateRow=&$this->_data[$index];
 -		if($updateRow!==null)
 -		{
 -			$updateRow['title']=$title;
 -			$updateRow['publisher']=$publisher;
 -			$updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
 -			$updateRow['instock']=TPropertyValue::ensureBoolean($instock);
 -			$updateRow['rating']=TPropertyValue::ensureInteger($rating);
 -			$this->saveData();
 -		}
 -	}
 -
 -	protected function deleteBook($isbn)
 -	{
 -		// In real applications, data should be saved to database using an SQL DELETE statement
 -		if($this->_data===null)
 -			$this->loadData();
 -		$deleteIndex=-1;
 -		foreach($this->_data as $index=>$row)
 -			if($row['ISBN']===$isbn)
 -				$deleteIndex=$index;
 -		if($deleteIndex>=0)
 -		{
 -			unset($this->_data[$deleteIndex]);
 -			$this->saveData();
 -		}
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack && !$this->IsCallBack)
 -		{
 -			$this->DataGrid->DataSource=$this->Data;
 -			$this->DataGrid->dataBind();
 -		}
 -	}
 -
 -	public function itemCreated($sender,$param)
 -	{
 -		$item=$param->Item;
 -		if($item->ItemType==='EditItem')
 -		{
 -			// set column width of textboxes
 -			$item->BookTitleColumn->TextBox->Columns=40;
 -			$item->PriceColumn->TextBox->Columns=5;
 -		}
 -		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
 -		{
 -			// add an aleart dialog to delete buttons
 -			$item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
 -		}
 -	}
 -
 -	public function editItem($sender,$param)
 -	{
 -		$this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function saveItem($sender,$param)
 -	{
 -		$item=$param->Item;
 -		$this->updateBook(
 -			$this->DataGrid->DataKeys[$item->ItemIndex],	// ISBN
 -			$item->BookTitleColumn->TextBox->Text,			// title
 -			$item->PublisherColumn->TextBox->Text,			// publisher
 -			$item->PriceColumn->TextBox->Text,				// price
 -			$item->InStockColumn->CheckBox->Checked,		// instock
 -			$item->RatingColumn->DropDownList->SelectedValue		// rating
 -			);
 -		$this->DataGrid->EditItemIndex=-1;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function cancelItem($sender,$param)
 -	{
 -		$this->DataGrid->EditItemIndex=-1;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function deleteItem($sender,$param)
 -	{
 -		$this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
 -		$this->DataGrid->EditItemIndex=-1;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?php + +class Sample3 extends TPage +{ +	private $_data=null; + +	protected function getData() +	{ +		if($this->_data===null) +			$this->loadData(); +		return $this->_data; +	} + +	protected function loadData() +	{ +		// We use viewstate keep track of data. +		// In real applications, data should come from database using an SQL SELECT statement. +		// In the following tabular data, field 'ISBN' is the primary key. +		// All update and delete operations should come with an 'id' value in order to go through. +		if(($this->_data=$this->getViewState('Data',null))===null) +		{ +			$this->_data=array( +				array( +					'ISBN'=>'0596007124', +					'title'=>'Head First Design Patterns', +					'publisher'=>'O\'Reilly Media, Inc.', +					'price'=>29.67, +					'instock'=>true, +					'rating'=>4, +				), +				array( +					'ISBN'=>'0201633612', +					'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software', +					'publisher'=>'Addison-Wesley Professional', +					'price'=>47.04, +					'instock'=>true, +					'rating'=>5, +				), +				array( +					'ISBN'=>'0321247140', +					'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design', +					'publisher'=>'Addison-Wesley Professional', +					'price'=>37.49, +					'instock'=>true, +					'rating'=>4, +				), +				array( +					'ISBN'=>'0201485672', +					'title'=>'Refactoring: Improving the Design of Existing Code', +					'publisher'=>'Addison-Wesley Professional', +					'price'=>47.14, +					'instock'=>true, +					'rating'=>3, +				), +				array( +					'ISBN'=>'0321213351', +					'title'=>'Refactoring to Patterns', +					'publisher'=>'Addison-Wesley Professional', +					'price'=>38.49, +					'instock'=>true, +					'rating'=>2, +				), +				array( +					'ISBN'=>'0735619670', +					'title'=>'Code Complete', +					'publisher'=>'Microsoft Press', +					'price'=>32.99, +					'instock'=>false, +					'rating'=>4, +				), +				array( +					'ISBN'=>'0321278658 ', +					'title'=>'Extreme Programming Explained : Embrace Change', +					'publisher'=>'Addison-Wesley Professional', +					'price'=>34.99, +					'instock'=>true, +					'rating'=>3, +				), +			); +			$this->saveData(); +		} +	} + +	protected function saveData() +	{ +		$this->setViewState('Data',$this->_data); +	} + +	protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating) +	{ +		// In real applications, data should be saved to database using an SQL UPDATE statement +		if($this->_data===null) +			$this->loadData(); +		$updateRow=null; +		foreach($this->_data as $index=>$row) +			if($row['ISBN']===$isbn) +				$updateRow=&$this->_data[$index]; +		if($updateRow!==null) +		{ +			$updateRow['title']=$title; +			$updateRow['publisher']=$publisher; +			$updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$')); +			$updateRow['instock']=TPropertyValue::ensureBoolean($instock); +			$updateRow['rating']=TPropertyValue::ensureInteger($rating); +			$this->saveData(); +		} +	} + +	protected function deleteBook($isbn) +	{ +		// In real applications, data should be saved to database using an SQL DELETE statement +		if($this->_data===null) +			$this->loadData(); +		$deleteIndex=-1; +		foreach($this->_data as $index=>$row) +			if($row['ISBN']===$isbn) +				$deleteIndex=$index; +		if($deleteIndex>=0) +		{ +			unset($this->_data[$deleteIndex]); +			$this->saveData(); +		} +	} + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack && !$this->IsCallBack) +		{ +			$this->DataGrid->DataSource=$this->Data; +			$this->DataGrid->dataBind(); +		} +	} + +	public function itemCreated($sender,$param) +	{ +		$item=$param->Item; +		if($item->ItemType==='EditItem') +		{ +			// set column width of textboxes +			$item->BookTitleColumn->TextBox->Columns=40; +			$item->PriceColumn->TextBox->Columns=5; +		} +		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem') +		{ +			// add an aleart dialog to delete buttons +			$item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;'; +		} +	} + +	public function editItem($sender,$param) +	{ +		$this->DataGrid->EditItemIndex=$param->Item->ItemIndex; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function saveItem($sender,$param) +	{ +		$item=$param->Item; +		$this->updateBook( +			$this->DataGrid->DataKeys[$item->ItemIndex],	// ISBN +			$item->BookTitleColumn->TextBox->Text,			// title +			$item->PublisherColumn->TextBox->Text,			// publisher +			$item->PriceColumn->TextBox->Text,				// price +			$item->InStockColumn->CheckBox->Checked,		// instock +			$item->RatingColumn->DropDownList->SelectedValue		// rating +			); +		$this->DataGrid->EditItemIndex=-1; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function cancelItem($sender,$param) +	{ +		$this->DataGrid->EditItemIndex=-1; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function deleteItem($sender,$param) +	{ +		$this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]); +		$this->DataGrid->EditItemIndex=-1; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php index eb1a0e5b..46c7dc81 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php @@ -1,21 +1,21 @@ -<?php
 -
 -Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample2');
 -
 -class Sample4 extends Sample2
 -{
 -	protected function sortData($data,$key)
 -	{
 -		$compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
 -		usort($data,$compare) ;
 -		return $data ;
 -	}
 -
 -	public function sortDataGrid($sender,$param)
 -	{
 -		$this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?php + +Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample2'); + +class Sample4 extends Sample2 +{ +	protected function sortData($data,$key) +	{ +		$compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); +		usort($data,$compare) ; +		return $data ; +	} + +	public function sortDataGrid($sender,$param) +	{ +		$this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression); +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php index 95bf9a0e..dc4a4dd6 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php @@ -1,79 +1,79 @@ -<?php
 -
 -Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1');
 -
 -class Sample5 extends Sample1
 -{
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostback && ! $this->IsCallback)
 -		{
 -			$this->DataGrid->DataSource=$this->Data;
 -			$this->DataGrid->dataBind();
 -		}
 -	}
 -
 -	public function changePage($sender,$param)
 -	{
 -		$this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function pagerCreated($sender,$param)
 -	{
 -		$param->Pager->Controls->insertAt(0,'Page: ');
 -	}
 -
 -	public function changePagerPosition($sender,$param)
 -	{
 -		$top=$sender->Items[0]->Selected;
 -		$bottom=$sender->Items[1]->Selected;
 -		if($top && $bottom)
 -			$position='TopAndBottom';
 -		else if($top)
 -			$position='Top';
 -		else if($bottom)
 -			$position='Bottom';
 -		else
 -			$position='';
 -		if($position==='')
 -			$this->DataGrid->PagerStyle->Visible=false;
 -		else
 -		{
 -			$this->DataGrid->PagerStyle->Position=$position;
 -			$this->DataGrid->PagerStyle->Visible=true;
 -		}
 -	}
 -
 -	public function useNumericPager($sender,$param)
 -	{
 -		$this->DataGrid->PagerStyle->Mode='Numeric';
 -		$this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
 -		$this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
 -		$this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function useNextPrevPager($sender,$param)
 -	{
 -		$this->DataGrid->PagerStyle->Mode='NextPrev';
 -		$this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
 -		$this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -
 -	public function changePageSize($sender,$param)
 -	{
 -		$this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
 -		$this->DataGrid->CurrentPageIndex=0;
 -		$this->DataGrid->DataSource=$this->Data;
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?php + +Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1'); + +class Sample5 extends Sample1 +{ + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostback && ! $this->IsCallback) +		{ +			$this->DataGrid->DataSource=$this->Data; +			$this->DataGrid->dataBind(); +		} +	} + +	public function changePage($sender,$param) +	{ +		$this->DataGrid->CurrentPageIndex=$param->NewPageIndex; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function pagerCreated($sender,$param) +	{ +		$param->Pager->Controls->insertAt(0,'Page: '); +	} + +	public function changePagerPosition($sender,$param) +	{ +		$top=$sender->Items[0]->Selected; +		$bottom=$sender->Items[1]->Selected; +		if($top && $bottom) +			$position='TopAndBottom'; +		else if($top) +			$position='Top'; +		else if($bottom) +			$position='Bottom'; +		else +			$position=''; +		if($position==='') +			$this->DataGrid->PagerStyle->Visible=false; +		else +		{ +			$this->DataGrid->PagerStyle->Position=$position; +			$this->DataGrid->PagerStyle->Visible=true; +		} +	} + +	public function useNumericPager($sender,$param) +	{ +		$this->DataGrid->PagerStyle->Mode='Numeric'; +		$this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text; +		$this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text; +		$this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function useNextPrevPager($sender,$param) +	{ +		$this->DataGrid->PagerStyle->Mode='NextPrev'; +		$this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text; +		$this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} + +	public function changePageSize($sender,$param) +	{ +		$this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text); +		$this->DataGrid->CurrentPageIndex=0; +		$this->DataGrid->DataSource=$this->Data; +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php index c62a239d..b77fe63c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php @@ -1,132 +1,132 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	private $_data=null;
 -
 -	protected function getData()
 -	{
 -		if($this->_data===null)
 -			$this->loadData();
 -		return $this->_data;
 -	}
 -
 -	protected function loadData()
 -	{
 -		// We use viewstate keep track of data.
 -		// In real applications, data should come from database using an SQL SELECT statement.
 -		// In the following tabular data, field 'id' is the primary key.
 -		// All update and delete operations should come with an 'id' value in order to go through.
 -		if(($this->_data=$this->getViewState('Data',null))===null)
 -		{
 -			$this->_data=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'=>false),
 -				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'=>true),
 -				array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
 -			);
 -			$this->saveData();
 -		}
 -	}
 -
 -	protected function saveData()
 -	{
 -		$this->setViewState('Data',$this->_data);
 -	}
 -
 -	protected function updateProduct($id,$name,$quantity,$price,$imported)
 -	{
 -		// In real applications, data should be saved to database using an SQL UPDATE statement
 -		if($this->_data===null)
 -			$this->loadData();
 -		$updateRow=null;
 -		foreach($this->_data as $index=>$row)
 -			if($row['id']===$id)
 -				$updateRow=&$this->_data[$index];
 -		if($updateRow!==null)
 -		{
 -			$updateRow['name']=$name;
 -			$updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
 -			$updateRow['price']=TPropertyValue::ensureFloat($price);
 -			$updateRow['imported']=TPropertyValue::ensureBoolean($imported);
 -			$this->saveData();
 -		}
 -	}
 -
 -	protected function deleteProduct($id)
 -	{
 -		// In real applications, data should be saved to database using an SQL DELETE statement
 -		if($this->_data===null)
 -			$this->loadData();
 -		$deleteIndex=-1;
 -		foreach($this->_data as $index=>$row)
 -			if($row['id']===$id)
 -				$deleteIndex=$index;
 -		if($deleteIndex>=0)
 -		{
 -			unset($this->_data[$deleteIndex]);
 -			$this->saveData();
 -		}
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$this->DataList->DataSource=$this->Data;
 -			$this->DataList->dataBind();
 -		}
 -	}
 -
 -	public function editItem($sender,$param)
 -	{
 -		$this->DataList->SelectedItemIndex=-1;
 -		$this->DataList->EditItemIndex=$param->Item->ItemIndex;
 -		$this->DataList->DataSource=$this->Data;
 -		$this->DataList->dataBind();
 -	}
 -
 -	public function cancelItem($sender,$param)
 -	{
 -		$this->DataList->SelectedItemIndex=-1;
 -		$this->DataList->EditItemIndex=-1;
 -		$this->DataList->DataSource=$this->Data;
 -		$this->DataList->dataBind();
 -	}
 -
 -	public function updateItem($sender,$param)
 -	{
 -		$item=$param->Item;
 -		$this->updateProduct(
 -			$this->DataList->DataKeys[$item->ItemIndex],
 -			$item->ProductName->Text,
 -			$item->ProductQuantity->Text,
 -			$item->ProductPrice->Text,
 -			$item->ProductImported->Checked);
 -		$this->DataList->EditItemIndex=-1;
 -		$this->DataList->DataSource=$this->Data;
 -		$this->DataList->dataBind();
 -	}
 -
 -	public function deleteItem($sender,$param)
 -	{
 -		$this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
 -		$this->DataList->SelectedItemIndex=-1;
 -		$this->DataList->EditItemIndex=-1;
 -		$this->DataList->DataSource=$this->Data;
 -		$this->DataList->dataBind();
 -	}
 -
 -	public function selectItem($sender,$param)
 -	{
 -		$this->DataList->EditItemIndex=-1;
 -		$this->DataList->DataSource=$this->Data;
 -		$this->DataList->dataBind();
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	private $_data=null; + +	protected function getData() +	{ +		if($this->_data===null) +			$this->loadData(); +		return $this->_data; +	} + +	protected function loadData() +	{ +		// We use viewstate keep track of data. +		// In real applications, data should come from database using an SQL SELECT statement. +		// In the following tabular data, field 'id' is the primary key. +		// All update and delete operations should come with an 'id' value in order to go through. +		if(($this->_data=$this->getViewState('Data',null))===null) +		{ +			$this->_data=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'=>false), +				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'=>true), +				array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false), +			); +			$this->saveData(); +		} +	} + +	protected function saveData() +	{ +		$this->setViewState('Data',$this->_data); +	} + +	protected function updateProduct($id,$name,$quantity,$price,$imported) +	{ +		// In real applications, data should be saved to database using an SQL UPDATE statement +		if($this->_data===null) +			$this->loadData(); +		$updateRow=null; +		foreach($this->_data as $index=>$row) +			if($row['id']===$id) +				$updateRow=&$this->_data[$index]; +		if($updateRow!==null) +		{ +			$updateRow['name']=$name; +			$updateRow['quantity']=TPropertyValue::ensureInteger($quantity); +			$updateRow['price']=TPropertyValue::ensureFloat($price); +			$updateRow['imported']=TPropertyValue::ensureBoolean($imported); +			$this->saveData(); +		} +	} + +	protected function deleteProduct($id) +	{ +		// In real applications, data should be saved to database using an SQL DELETE statement +		if($this->_data===null) +			$this->loadData(); +		$deleteIndex=-1; +		foreach($this->_data as $index=>$row) +			if($row['id']===$id) +				$deleteIndex=$index; +		if($deleteIndex>=0) +		{ +			unset($this->_data[$deleteIndex]); +			$this->saveData(); +		} +	} + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$this->DataList->DataSource=$this->Data; +			$this->DataList->dataBind(); +		} +	} + +	public function editItem($sender,$param) +	{ +		$this->DataList->SelectedItemIndex=-1; +		$this->DataList->EditItemIndex=$param->Item->ItemIndex; +		$this->DataList->DataSource=$this->Data; +		$this->DataList->dataBind(); +	} + +	public function cancelItem($sender,$param) +	{ +		$this->DataList->SelectedItemIndex=-1; +		$this->DataList->EditItemIndex=-1; +		$this->DataList->DataSource=$this->Data; +		$this->DataList->dataBind(); +	} + +	public function updateItem($sender,$param) +	{ +		$item=$param->Item; +		$this->updateProduct( +			$this->DataList->DataKeys[$item->ItemIndex], +			$item->ProductName->Text, +			$item->ProductQuantity->Text, +			$item->ProductPrice->Text, +			$item->ProductImported->Checked); +		$this->DataList->EditItemIndex=-1; +		$this->DataList->DataSource=$this->Data; +		$this->DataList->dataBind(); +	} + +	public function deleteItem($sender,$param) +	{ +		$this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]); +		$this->DataList->SelectedItemIndex=-1; +		$this->DataList->EditItemIndex=-1; +		$this->DataList->DataSource=$this->Data; +		$this->DataList->dataBind(); +	} + +	public function selectItem($sender,$param) +	{ +		$this->DataList->EditItemIndex=-1; +		$this->DataList->DataSource=$this->Data; +		$this->DataList->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php index 0ba728c6..5b16af2c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php @@ -1,60 +1,60 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack && !$this->IsCallback)
 -		{
 -			$this->resetClicked(null,null);
 -		}
 -	}
 -
 -	protected function collectSelectionResult($input,$output)
 -	{
 -		$indices=$input->SelectedIndices;
 -		$result='';
 -		foreach($indices as $index)
 -		{
 -			$item=$input->Items[$index];
 -			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
 -		}
 -		if($result==='')
 -			$output->Text='Your selection is empty.';
 -		else
 -			$output->Text='Your selection is: '.$result;
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->SelectionResult);
 -	}
 -
 -	public function buttonClicked($sender, $param)
 -	{
 -		$data=array();
 -		for($i = 0; $i <= $this->ddl1->Items->Count; $i++)
 -			$data[$i]="Item number #".$i;
 -		$this->ddl1->DataSource=$data;
 -		$this->ddl1->dataBind();
 -		$this->label1->Text="Total ".count($data)." items";
 -	}
 -
 -	public function resetClicked($sender, $param)
 -	{
 -		$data=array('item 1','item 2','item 3','item 4');
 -		$this->ddl2->DataSource=$data;
 -		$this->ddl2->dataBind();
 -		$this->label2->Text="DropDownList has been reset";
 -	}
 -
 -	public function clearClicked($sender, $param)
 -	{
 -		$this->ddl2->DataSource=array();
 -		$this->ddl2->dataBind();
 -		$this->label2->Text="DropDownList cleared";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack && !$this->IsCallback) +		{ +			$this->resetClicked(null,null); +		} +	} + +	protected function collectSelectionResult($input,$output) +	{ +		$indices=$input->SelectedIndices; +		$result=''; +		foreach($indices as $index) +		{ +			$item=$input->Items[$index]; +			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)"; +		} +		if($result==='') +			$output->Text='Your selection is empty.'; +		else +			$output->Text='Your selection is: '.$result; +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->SelectionResult); +	} + +	public function buttonClicked($sender, $param) +	{ +		$data=array(); +		for($i = 0; $i <= $this->ddl1->Items->Count; $i++) +			$data[$i]="Item number #".$i; +		$this->ddl1->DataSource=$data; +		$this->ddl1->dataBind(); +		$this->label1->Text="Total ".count($data)." items"; +	} + +	public function resetClicked($sender, $param) +	{ +		$data=array('item 1','item 2','item 3','item 4'); +		$this->ddl2->DataSource=$data; +		$this->ddl2->dataBind(); +		$this->label2->Text="DropDownList has been reset"; +	} + +	public function clearClicked($sender, $param) +	{ +		$this->ddl2->DataSource=array(); +		$this->ddl2->dataBind(); +		$this->label2->Text="DropDownList cleared"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php index d5cf990a..29d05a1c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php @@ -1,21 +1,21 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function fileUploaded($sender,$param)
 -	{
 -		if($sender->HasFile)
 -		{
 -			$this->Result->Text="
 -				You just uploaded a file:
 -				<br/>
 -				Name: {$sender->FileName}
 -				<br/>
 -				Size: {$sender->FileSize}
 -				<br/>
 -				Type: {$sender->FileType}";
 -		}
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function fileUploaded($sender,$param) +	{ +		if($sender->HasFile) +		{ +			$this->Result->Text=" +				You just uploaded a file: +				<br/> +				Name: {$sender->FileName} +				<br/> +				Size: {$sender->FileSize} +				<br/> +				Type: {$sender->FileType}"; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php index c125d902..45ea1584 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php @@ -1,26 +1,26 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	function button1_clicked($sender, $param)
 -	{
 -		$this->link1->NavigateUrl = 'http://www.google.com';
 -	}
 -
 -	function button2_clicked($sender, $param)
 -	{
 -		$this->link2->Target = '_self';
 -	}
 -
 -	function button3_clicked($sender, $param)
 -	{
 -		$this->link3->Text = 'PradoSoft.com';
 -	}
 -
 -	function button4_clicked($sender, $param)
 -	{
 -		$img = $this->publishFilePath(dirname(__FILE__).'/hello_world.gif');
 -		$this->link4->ImageUrl = $img;
 -	}
 -}
 +<?php + +class Home extends TPage +{ +	function button1_clicked($sender, $param) +	{ +		$this->link1->NavigateUrl = 'http://www.google.com'; +	} + +	function button2_clicked($sender, $param) +	{ +		$this->link2->Target = '_self'; +	} + +	function button3_clicked($sender, $param) +	{ +		$this->link3->Text = 'PradoSoft.com'; +	} + +	function button4_clicked($sender, $param) +	{ +		$img = $this->publishFilePath(dirname(__FILE__).'/hello_world.gif'); +		$this->link4->ImageUrl = $img; +	} +}  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php index 3628ad0a..6850fb40 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php @@ -1,17 +1,17 @@ -<?php
 -
 -// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender, $param)
 -	{
 -		$this->imageTest->ImageUrl=$this->publishAsset("hello_world.gif");
 -	}
 -
 -	public function buttonClicked2($sender, $param)
 -	{
 -		$this->imageTest->ImageUrl=$this->publishAsset("hello_world2.gif");
 -	}
 -}
 -
 +<?php + +// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $ +class Home extends TPage +{ +	public function buttonClicked($sender, $param) +	{ +		$this->imageTest->ImageUrl=$this->publishAsset("hello_world.gif"); +	} + +	public function buttonClicked2($sender, $param) +	{ +		$this->imageTest->ImageUrl=$this->publishAsset("hello_world2.gif"); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php index b1f2c53b..28be10f9 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php @@ -1,18 +1,18 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		if($param instanceof TCallbackEventParameter)
 -		{
 -			$this->Result2->Text="Callback parameter: $param->CallbackParameter";
 -		}
 -		else
 -		{
 -			$this->Result->Text="You clicked at ($param->X,$param->Y)";
 -		}
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		if($param instanceof TCallbackEventParameter) +		{ +			$this->Result2->Text="Callback parameter: $param->CallbackParameter"; +		} +		else +		{ +			$this->Result->Text="You clicked at ($param->X,$param->Y)"; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php index 64e2dede..e929c07b 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php @@ -1,14 +1,14 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		if($param instanceof TCallbackEventParameter)
 -			$sender->Text="Callback Parameter: {$param->CallbackParameter}";
 -		else
 -			$sender->Text="I'm clicked";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		if($param instanceof TCallbackEventParameter) +			$sender->Text="Callback Parameter: {$param->CallbackParameter}"; +		else +			$sender->Text="I'm clicked"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php index 795e3eca..509e32ab 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php @@ -1,65 +1,65 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack && !$this->IsCallback)
 -		{
 -			$this->resetClicked(null,null);
 -		}
 -	}
 -
 -	protected function collectSelectionResult($input,$output)
 -	{
 -		$indices=$input->SelectedIndices;
 -		$result='';
 -		foreach($indices as $index)
 -		{
 -			$item=$input->Items[$index];
 -			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
 -		}
 -		if($result==='')
 -			$output->Text='Your selection is empty.';
 -		else
 -			$output->Text='Your selection is: '.$result;
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->SelectionResult);
 -	}
 -
 -	public function multiSelectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->MSelectionResult);
 -	}
 -
 -	public function buttonClicked($sender, $param)
 -	{
 -		$data=array();
 -		for($i = 0; $i <= $this->box1->Items->Count; $i++)
 -			$data[$i]="Item number #".$i;
 -		$this->box1->DataSource=$data;
 -		$this->box1->dataBind();
 -		$this->label1->Text="Total ".count($data)." items";
 -	}
 -
 -	public function resetClicked($sender, $param)
 -	{
 -		$data=array('item 1','item 2','item 3','item 4');
 -		$this->box2->DataSource=$data;
 -		$this->box2->dataBind();
 -		$this->label2->Text="ListBox has been reset";
 -	}
 -
 -	public function clearClicked($sender, $param)
 -	{
 -		$this->box2->DataSource=array();
 -		$this->box2->dataBind();
 -		$this->label2->Text="ListBox cleared";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack && !$this->IsCallback) +		{ +			$this->resetClicked(null,null); +		} +	} + +	protected function collectSelectionResult($input,$output) +	{ +		$indices=$input->SelectedIndices; +		$result=''; +		foreach($indices as $index) +		{ +			$item=$input->Items[$index]; +			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)"; +		} +		if($result==='') +			$output->Text='Your selection is empty.'; +		else +			$output->Text='Your selection is: '.$result; +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->SelectionResult); +	} + +	public function multiSelectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->MSelectionResult); +	} + +	public function buttonClicked($sender, $param) +	{ +		$data=array(); +		for($i = 0; $i <= $this->box1->Items->Count; $i++) +			$data[$i]="Item number #".$i; +		$this->box1->DataSource=$data; +		$this->box1->dataBind(); +		$this->label1->Text="Total ".count($data)." items"; +	} + +	public function resetClicked($sender, $param) +	{ +		$data=array('item 1','item 2','item 3','item 4'); +		$this->box2->DataSource=$data; +		$this->box2->dataBind(); +		$this->label2->Text="ListBox has been reset"; +	} + +	public function clearClicked($sender, $param) +	{ +		$this->box2->DataSource=array(); +		$this->box2->dataBind(); +		$this->label2->Text="ListBox cleared"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php index 1a5dbed3..24a240ca 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php @@ -1,15 +1,15 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function viewChanged($sender,$param)
 -	{
 -		if($this->MultiView->ActiveViewIndex===2)
 -		{
 -			$this->Result1->Text="Your text input is: ".$this->Memo->Text;
 -			$this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue;
 -		}
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function viewChanged($sender,$param) +	{ +		if($this->MultiView->ActiveViewIndex===2) +		{ +			$this->Result1->Text="Your text input is: ".$this->Memo->Text; +			$this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php index ae174f59..362fdebe 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php @@ -1,21 +1,21 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$this->check1->Checked = !$this->check1->Checked;
 -		if($this->txt1->Text=="")
 -			$this->txt1->Text="changes happens";
 -		else
 -			$this->txt1->Text="";
 -		if($this->label1->Text=="")
 -			$this->label1->Text="label has changed, too";
 -		else
 -			$this->label1->Text="";
 -
 -		$this->panel1->render($param->NewWriter);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$this->check1->Checked = !$this->check1->Checked; +		if($this->txt1->Text=="") +			$this->txt1->Text="changes happens"; +		else +			$this->txt1->Text=""; +		if($this->label1->Text=="") +			$this->label1->Text="label has changed, too"; +		else +			$this->label1->Text=""; + +		$this->panel1->render($param->NewWriter); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php index 034d2fcc..a0c2af32 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php @@ -1,27 +1,27 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function radiobuttonClicked($sender,$param)
 -	{
 -		$sender->Text="I'm clicked";
 -	}
 -
 -	public function selectRadioButton($sender,$param)
 -	{
 -		$selection='';
 -		if($this->Radio1->Checked)
 -			$selection.='1';
 -		if($this->Radio2->Checked)
 -			$selection.='2';
 -		if($this->Radio3->Checked)
 -			$selection.='3';
 -		if($this->Radio4->Checked)
 -			$selection.='4';
 -		if($selection==='')
 -			$selection='empty';
 -		$this->Result->Text='Your selection is '.$selection;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function radiobuttonClicked($sender,$param) +	{ +		$sender->Text="I'm clicked"; +	} + +	public function selectRadioButton($sender,$param) +	{ +		$selection=''; +		if($this->Radio1->Checked) +			$selection.='1'; +		if($this->Radio2->Checked) +			$selection.='2'; +		if($this->Radio3->Checked) +			$selection.='3'; +		if($this->Radio4->Checked) +			$selection.='4'; +		if($selection==='') +			$selection='empty'; +		$this->Result->Text='Your selection is '.$selection; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php index dfa52ce4..1033837c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php @@ -1,26 +1,26 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	protected function collectSelectionResult($input,$output)
 -	{
 -		$indices=$input->SelectedIndices;
 -		$result='';
 -		foreach($indices as $index)
 -		{
 -			$item=$input->Items[$index];
 -			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
 -		}
 -		if($result==='')
 -			$output->Text='Your selection is empty.';
 -		else
 -			$output->Text='Your selection is: '.$result;
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	protected function collectSelectionResult($input,$output) +	{ +		$indices=$input->SelectedIndices; +		$result=''; +		foreach($indices as $index) +		{ +			$item=$input->Items[$index]; +			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)"; +		} +		if($result==='') +			$output->Text='Your selection is empty.'; +		else +			$output->Text='Your selection is: '.$result; +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult); +	} +} +  ?>
\ No newline at end of file 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 diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php index b056eba8..d74160bb 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php @@ -1,22 +1,22 @@ -<?php
 -
 -// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
 -class Home extends TPage
 -{
 -
 -	public function clickCell ($sender, $param)
 -	{
 -		$sender->Text .= "<br/>Clicked";
 -		$this->lblResult->Text='You clicked on cell #'.$param->SelectedCellIndex.' with id='.$sender->id;
 -		$sender->render($param->NewWriter);
 -	}
 -
 -	public function clickRow ($sender, $param)
 -	{
 -		$sender->BackColor="yellow";
 -		$this->lblResult->Text='You clicked on row #'.$param->SelectedRowIndex.' with id='.$sender->id;
 -		$sender->render($param->NewWriter);
 -	}
 -}
 -
 +<?php + +// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $ +class Home extends TPage +{ + +	public function clickCell ($sender, $param) +	{ +		$sender->Text .= "<br/>Clicked"; +		$this->lblResult->Text='You clicked on cell #'.$param->SelectedCellIndex.' with id='.$sender->id; +		$sender->render($param->NewWriter); +	} + +	public function clickRow ($sender, $param) +	{ +		$sender->BackColor="yellow"; +		$this->lblResult->Text='You clicked on row #'.$param->SelectedRowIndex.' with id='.$sender->id; +		$sender->render($param->NewWriter); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php index ca8a9e59..290995c7 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php @@ -1,34 +1,34 @@ -<?php
 -// $Id$
 -class Home extends TPage
 -{
 -    public function suggestNames($sender,$param) {
 -        // Get the token
 -        $token=$param->getToken();
 -        // Sender is the Suggestions repeater
 -        $sender->DataSource=$this->getDummyData($token);
 -        $sender->dataBind();                                                                                                     
 -    }
 -
 -    public function suggestionSelected1($sender,$param) {
 -        $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
 -        $this->Selection1->Text='Selected ID: '.$id;
 -    }
 -
 -    public function suggestionSelected2($sender,$param) {
 -        $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
 -        $this->Selection2->Text='Selected ID: '.$id;
 -    }
 -
 -    public function getDummyData($token) {
 -        // You would look for matches to the given token here
 -        return array(
 -            array('id'=>1, 'name'=>'John'),
 -            array('id'=>2, 'name'=>'Paul'),
 -            array('id'=>3, 'name'=>'George'),
 -            array('id'=>4, 'name'=>'Ringo')
 -        );
 -    }
 -}
 -
 -?>
 +<?php +// $Id$ +class Home extends TPage +{ +    public function suggestNames($sender,$param) { +        // Get the token +        $token=$param->getToken(); +        // Sender is the Suggestions repeater +        $sender->DataSource=$this->getDummyData($token); +        $sender->dataBind();                                                                                                      +    } + +    public function suggestionSelected1($sender,$param) { +        $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ]; +        $this->Selection1->Text='Selected ID: '.$id; +    } + +    public function suggestionSelected2($sender,$param) { +        $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ]; +        $this->Selection2->Text='Selected ID: '.$id; +    } + +    public function getDummyData($token) { +        // You would look for matches to the given token here +        return array( +            array('id'=>1, 'name'=>'John'), +            array('id'=>2, 'name'=>'Paul'), +            array('id'=>3, 'name'=>'George'), +            array('id'=>4, 'name'=>'Ringo') +        ); +    } +} + +?> diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php index 500d7987..a8cef26c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php @@ -1,29 +1,29 @@ -<?php
 -
 -// $Id: Home.php -1   $
 -class Home extends TPage
 -{
 -	public function buttonCallback ($sender, $param)
 -	{
 -		switch($this->radio1->SelectedValue)
 -		{
 -			case 1:
 -				$this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>");
 -				break;
 -			case 2:
 -				$this->getCallbackClient()->check($this->check1, !$this->check1->Checked);
 -				break;
 -			case 3:
 -				$this->getCallbackClient()->hide($this->label1);
 -				break;
 -			case 4:
 -				$this->getCallbackClient()->show($this->label1);
 -				break;
 -			case 5:
 -				$this->getCallbackClient()->focus($this->txt1);
 -				break;
 -		}
 -	}
 -}
 -
 +<?php + +// $Id: Home.php -1   $ +class Home extends TPage +{ +	public function buttonCallback ($sender, $param) +	{ +		switch($this->radio1->SelectedValue) +		{ +			case 1: +				$this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>"); +				break; +			case 2: +				$this->getCallbackClient()->check($this->check1, !$this->check1->Checked); +				break; +			case 3: +				$this->getCallbackClient()->hide($this->label1); +				break; +			case 4: +				$this->getCallbackClient()->show($this->label1); +				break; +			case 5: +				$this->getCallbackClient()->focus($this->txt1); +				break; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php index 8dd794fe..f642ccbb 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php @@ -1,12 +1,12 @@ -<?php
 -
 -// $Id: Home.php -1   $
 -class Home extends TPage
 -{
 -	public function buttonCallback ($sender, $param)
 -	{
 -		sleep(5);
 -	}
 -}
 -
 +<?php + +// $Id: Home.php -1   $ +class Home extends TPage +{ +	public function buttonCallback ($sender, $param) +	{ +		sleep(5); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php index 6f101107..caff7360 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php @@ -1,12 +1,12 @@ -<?php
 -
 -// $Id$
 -class Home extends TPage
 -{
 -	public function buttonCallback ($sender, $param)
 -	{
 -		sleep(5);
 -	}
 -}
 -
 +<?php + +// $Id$ +class Home extends TPage +{ +	public function buttonCallback ($sender, $param) +	{ +		sleep(5); +	} +} +  ?>
\ No newline at end of file | 
