diff options
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
58 files changed, 1828 insertions, 1828 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php index 2309bd88..cfc01a31 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php @@ -1,13 +1,13 @@ -<?php
 -
 -Prado::using('Application.pages.Controls.Samples.LabeledTextBox1.LabeledTextBox');
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$sender->Text=$this->Input->TextBox->Text;
 -	}
 -}
 -
 +<?php + +Prado::using('Application.pages.Controls.Samples.LabeledTextBox1.LabeledTextBox'); + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$sender->Text=$this->Input->TextBox->Text; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php index 999639d7..0c374b72 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php +++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php @@ -1,18 +1,18 @@ -<?php
 -
 -class LabeledTextBox extends TTemplateControl
 -{
 -	public function getLabel()
 -	{
 -		$this->ensureChildControls();
 -		return $this->getRegisteredObject('Label');
 -	}
 -
 -	public function getTextBox()
 -	{
 -		$this->ensureChildControls();
 -		return $this->getRegisteredObject('TextBox');
 -	}
 -}
 -
 +<?php + +class LabeledTextBox extends TTemplateControl +{ +	public function getLabel() +	{ +		$this->ensureChildControls(); +		return $this->getRegisteredObject('Label'); +	} + +	public function getTextBox() +	{ +		$this->ensureChildControls(); +		return $this->getRegisteredObject('TextBox'); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php index 2b18972d..ae3f9e8b 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php @@ -1,13 +1,13 @@ -<?php
 -
 -Prado::using('Application.pages.Controls.Samples.LabeledTextBox2.LabeledTextBox');
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$sender->Text=$this->Input->TextBox->Text;
 -	}
 -}
 -
 +<?php + +Prado::using('Application.pages.Controls.Samples.LabeledTextBox2.LabeledTextBox'); + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$sender->Text=$this->Input->TextBox->Text; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php index fc912003..601cebc6 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php +++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php @@ -1,33 +1,33 @@ -<?php
 -
 -class LabeledTextBox extends TCompositeControl
 -{
 -	private $_label;
 -	private $_textbox;
 -
 -	public function createChildControls()
 -	{
 -		$this->_label=new TLabel;
 -		$this->_label->setID('Label');
 -		$this->getControls()->add($this->_label);
 -		$this->getControls()->add(' ');
 -		$this->_textbox=new TTextBox;
 -		$this->_textbox->setID('TextBox');
 -		$this->_label->setForControl('TextBox');
 -		$this->getControls()->add($this->_textbox);
 -	}
 -
 -	public function getLabel()
 -	{
 -		$this->ensureChildControls();
 -		return $this->_label;
 -	}
 -
 -	public function getTextBox()
 -	{
 -		$this->ensureChildControls();
 -		return $this->_textbox;
 -	}
 -}
 -
 +<?php + +class LabeledTextBox extends TCompositeControl +{ +	private $_label; +	private $_textbox; + +	public function createChildControls() +	{ +		$this->_label=new TLabel; +		$this->_label->setID('Label'); +		$this->getControls()->add($this->_label); +		$this->getControls()->add(' '); +		$this->_textbox=new TTextBox; +		$this->_textbox->setID('TextBox'); +		$this->_label->setForControl('TextBox'); +		$this->getControls()->add($this->_textbox); +	} + +	public function getLabel() +	{ +		$this->ensureChildControls(); +		return $this->_label; +	} + +	public function getTextBox() +	{ +		$this->ensureChildControls(); +		return $this->_textbox; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php index 3da69927..4faaef1c 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php @@ -1,17 +1,17 @@ -<?php
 -
 -class Home extends TPage
 -{
 -        public function onLoad($param)
 -        {
 -                parent::onLoad($param);
 -                $this->lab1->Text="";
 -        }
 -
 -        public function executeTransaction($sender, $param)
 -        {
 -                $this->lab1->Text="executeTransaction ok";
 -        }
 -}
 -
 +<?php + +class Home extends TPage +{ +        public function onLoad($param) +        { +                parent::onLoad($param); +                $this->lab1->Text=""; +        } + +        public function executeTransaction($sender, $param) +        { +                $this->lab1->Text="executeTransaction ok"; +        } +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php index d3e04787..93c947fe 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php @@ -1,12 +1,12 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$item=$sender->Items[$param->Index];
 -		$this->Result->Text="You clicked $item->Text : $item->Value.";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$item=$sender->Items[$param->Index]; +		$this->Result->Text="You clicked $item->Text : $item->Value."; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php index f18072f2..3711ca46 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php @@ -1,14 +1,14 @@ -<?php
 -
 -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";
 -	}
 -}
 -
 +<?php + +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"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php index 6965bbbd..c88b9378 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php @@ -1,27 +1,27 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onInit($param)
 -	{
 -		if(!$this->IsPostBack)
 -		{
 -			$this->CaptchaList->DataSource=range(0,63);
 -			$this->CaptchaList->dataBind();
 -		}
 -	}
 -
 -	public function regenerateToken($sender,$param)
 -	{
 -		$this->Captcha->regenerateToken();
 -		$this->SubmitButton->Text="Submit";
 -	}
 -
 -	public function buttonClicked($sender,$param)
 -	{
 -		if($this->IsValid)
 -			$sender->Text="You passed!";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onInit($param) +	{ +		if(!$this->IsPostBack) +		{ +			$this->CaptchaList->DataSource=range(0,63); +			$this->CaptchaList->dataBind(); +		} +	} + +	public function regenerateToken($sender,$param) +	{ +		$this->Captcha->regenerateToken(); +		$this->SubmitButton->Text="Submit"; +	} + +	public function buttonClicked($sender,$param) +	{ +		if($this->IsValid) +			$sender->Text="You passed!"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php index 37eae19b..89fb6852 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function checkboxClicked($sender,$param)
 -	{
 -		$sender->Text="I'm clicked";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function checkboxClicked($sender,$param) +	{ +		$sender->Text="I'm clicked"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php index 08c6f3ca..ac7ca8bc 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php @@ -1,70 +1,70 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$data=array('item 1','item 2','item 3','item 4');
 -			$this->DBCheckBoxList1->DataSource=$data;
 -			$this->DBCheckBoxList1->dataBind();
 -
 -			$data=array('key 1'=>'item 1','key 2'=>'item 2',
 -						'key 3'=>'item 3','key 4'=>'item 4');
 -			$this->DBCheckBoxList2->DataSource=$data;
 -			$this->DBCheckBoxList2->dataBind();
 -
 -			$data=array(
 -				array('id'=>'001','name'=>'John','age'=>31),
 -				array('id'=>'002','name'=>'Mary','age'=>30),
 -				array('id'=>'003','name'=>'Cary','age'=>20));
 -			$this->DBCheckBoxList3->DataSource=$data;
 -			$this->DBCheckBoxList3->dataBind();
 -		}
 -	}
 -
 -	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 buttonClicked($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->SelectionResult2);
 -	}
 -
 -	public function DBCheckBoxList1Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBCheckBoxList1Result);
 -	}
 -
 -	public function DBCheckBoxList2Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBCheckBoxList2Result);
 -	}
 -
 -	public function DBCheckBoxList3Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBCheckBoxList3Result);
 -	}
 -
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$data=array('item 1','item 2','item 3','item 4'); +			$this->DBCheckBoxList1->DataSource=$data; +			$this->DBCheckBoxList1->dataBind(); + +			$data=array('key 1'=>'item 1','key 2'=>'item 2', +						'key 3'=>'item 3','key 4'=>'item 4'); +			$this->DBCheckBoxList2->DataSource=$data; +			$this->DBCheckBoxList2->dataBind(); + +			$data=array( +				array('id'=>'001','name'=>'John','age'=>31), +				array('id'=>'002','name'=>'Mary','age'=>30), +				array('id'=>'003','name'=>'Cary','age'=>20)); +			$this->DBCheckBoxList3->DataSource=$data; +			$this->DBCheckBoxList3->dataBind(); +		} +	} + +	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 buttonClicked($sender,$param) +	{ +		$this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult); +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->SelectionResult2); +	} + +	public function DBCheckBoxList1Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBCheckBoxList1Result); +	} + +	public function DBCheckBoxList2Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBCheckBoxList2Result); +	} + +	public function DBCheckBoxList3Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBCheckBoxList3Result); +	} + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php index d6dded08..cccbf845 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php @@ -1,17 +1,17 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	function check_validate($sender, $params)
 -	{
 -		$sender->enabled = $this->check1->checked;
 -	}
 -
 -	function onPreRender($param)
 -	{
 -		//always re-enable the validator2 so as to display the client-side validator
 -		$this->validator2->enabled=true;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	function check_validate($sender, $params) +	{ +		$sender->enabled = $this->check1->checked; +	} + +	function onPreRender($param) +	{ +		//always re-enable the validator2 so as to display the client-side validator +		$this->validator2->enabled=true; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php index badbca73..b03361b8 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php @@ -1,7 +1,7 @@ -<?php
 -
 -class Home extends TPage
 -{
 -}
 -
 +<?php + +class Home extends TPage +{ +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php index da0d15b2..a3b83ff5 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php @@ -1,18 +1,18 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function serverValidate($sender,$param)
 -	{
 -		if($param->Value!=='test')
 -			$param->IsValid=false;
 -	}
 -
 -	public function serverValidateNoControl($sender,$param)
 -	{
 -		if($this->TextBox4->Text!=='test')
 -			$param->IsValid=false;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function serverValidate($sender,$param) +	{ +		if($param->Value!=='test') +			$param->IsValid=false; +	} + +	public function serverValidateNoControl($sender,$param) +	{ +		if($this->TextBox4->Text!=='test') +			$param->IsValid=false; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php index ec78006b..628d0740 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php @@ -1,41 +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),
 -		);
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$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 onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$this->DataGrid->DataSource=$this->Data; +			$this->DataGrid->dataBind(); +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php index a49077b5..026d1a5a 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/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->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->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/Controls/Samples/TDataGrid/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php index bb18f36b..74085a0f 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/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->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->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/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php index f9c0804d..ba7cba11 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php @@ -1,21 +1,21 @@ -<?php
 -
 -Prado::using('Application.pages.Controls.Samples.TDataGrid.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.Controls.Samples.TDataGrid.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/Controls/Samples/TDataGrid/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php index bdca2ca8..fcf075ea 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php @@ -1,68 +1,68 @@ -<?php
 -
 -Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
 -
 -class Sample5 extends Sample1
 -{
 -	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.Controls.Samples.TDataGrid.Sample1'); + +class Sample5 extends Sample1 +{ +	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/Controls/Samples/TDataGrid/Sample6.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php index 90e3f7fe..3f24c9ac 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php @@ -1,56 +1,56 @@ -<?php
 -
 -Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
 -
 -class Sample6 extends Sample1
 -{
 -	/**
 -	 * Returns a subset of data.
 -	 * In MySQL database, this can be replaced by LIMIT clause
 -	 * in an SQL select statement.
 -	 * @param integer the starting index of the row
 -	 * @param integer number of rows to be returned
 -	 * @return array subset of data
 -	 */
 -	protected function getDataRows($offset,$rows)
 -	{
 -		$data=$this->getData();
 -		$page=array();
 -		for($i=0;$i<$rows;++$i)
 -		{
 -			if($offset+$i<$this->getRowCount())
 -				$page[$i]=$data[$offset+$i];
 -		}
 -		return $page;
 -	}
 -
 -	/**
 -	 * Returns total number of data rows.
 -	 * In real DB applications, this may be replaced by an SQL select
 -	 * query with count().
 -	 * @return integer total number of data rows
 -	 */
 -	protected function getRowCount()
 -	{
 -		return 19;
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		if(!$this->IsPostBack)
 -		{
 -			$this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
 -			$this->DataGrid->dataBind();
 -		}
 -	}
 -
 -	public function changePage($sender,$param)
 -	{
 -		$this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
 -		$offset=$param->NewPageIndex*$this->DataGrid->PageSize;
 -		$this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
 -		$this->DataGrid->dataBind();
 -	}
 -}
 -
 +<?php + +Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1'); + +class Sample6 extends Sample1 +{ +	/** +	 * Returns a subset of data. +	 * In MySQL database, this can be replaced by LIMIT clause +	 * in an SQL select statement. +	 * @param integer the starting index of the row +	 * @param integer number of rows to be returned +	 * @return array subset of data +	 */ +	protected function getDataRows($offset,$rows) +	{ +		$data=$this->getData(); +		$page=array(); +		for($i=0;$i<$rows;++$i) +		{ +			if($offset+$i<$this->getRowCount()) +				$page[$i]=$data[$offset+$i]; +		} +		return $page; +	} + +	/** +	 * Returns total number of data rows. +	 * In real DB applications, this may be replaced by an SQL select +	 * query with count(). +	 * @return integer total number of data rows +	 */ +	protected function getRowCount() +	{ +		return 19; +	} + +	public function onLoad($param) +	{ +		if(!$this->IsPostBack) +		{ +			$this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize); +			$this->DataGrid->dataBind(); +		} +	} + +	public function changePage($sender,$param) +	{ +		$this->DataGrid->CurrentPageIndex=$param->NewPageIndex; +		$offset=$param->NewPageIndex*$this->DataGrid->PageSize; +		$this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize); +		$this->DataGrid->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php index 7b8a2ae4..037036f5 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php @@ -1,41 +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),
 -		);
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$this->DataList->DataSource=$this->Data;
 -			$this->DataList->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 onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$this->DataList->DataSource=$this->Data; +			$this->DataList->dataBind(); +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php index 9715f5ba..7273dd39 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php @@ -1,132 +1,132 @@ -<?php
 -
 -class Sample2 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 Sample2 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/Controls/Samples/TDataTypeValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php index 133a797a..74e47b6c 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php @@ -1,69 +1,69 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$data=array('item 1','item 2','item 3','item 4');
 -			$this->DBDropDownList1->DataSource=$data;
 -			$this->DBDropDownList1->dataBind();
 -
 -			$data=array('key 1'=>'item 1','key 2'=>'item 2',
 -						'key 3'=>'item 3','key 4'=>'item 4');
 -			$this->DBDropDownList2->DataSource=$data;
 -			$this->DBDropDownList2->dataBind();
 -
 -			$data=array(
 -				array('id'=>'001','name'=>'John','age'=>31),
 -				array('id'=>'002','name'=>'Mary','age'=>30),
 -				array('id'=>'003','name'=>'Cary','age'=>20));
 -			$this->DBDropDownList3->DataSource=$data;
 -			$this->DBDropDownList3->dataBind();
 -		}
 -	}
 -
 -	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 DBDropDownList1Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBDropDownList1Result);
 -	}
 -
 -	public function DBDropDownList2Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBDropDownList2Result);
 -	}
 -
 -	public function DBDropDownList3Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBDropDownList3Result);
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->SelectionResult);
 -	}
 -
 -	public function buttonClicked($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->DropDownList1,$this->SelectionResult2);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$data=array('item 1','item 2','item 3','item 4'); +			$this->DBDropDownList1->DataSource=$data; +			$this->DBDropDownList1->dataBind(); + +			$data=array('key 1'=>'item 1','key 2'=>'item 2', +						'key 3'=>'item 3','key 4'=>'item 4'); +			$this->DBDropDownList2->DataSource=$data; +			$this->DBDropDownList2->dataBind(); + +			$data=array( +				array('id'=>'001','name'=>'John','age'=>31), +				array('id'=>'002','name'=>'Mary','age'=>30), +				array('id'=>'003','name'=>'Cary','age'=>20)); +			$this->DBDropDownList3->DataSource=$data; +			$this->DBDropDownList3->dataBind(); +		} +	} + +	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 DBDropDownList1Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBDropDownList1Result); +	} + +	public function DBDropDownList2Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBDropDownList2Result); +	} + +	public function DBDropDownList3Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBDropDownList3Result); +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->SelectionResult); +	} + +	public function buttonClicked($sender,$param) +	{ +		$this->collectSelectionResult($this->DropDownList1,$this->SelectionResult2); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php index d5cf990a..29d05a1c 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/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/Controls/Samples/THtmlArea/Home.php b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php index c56b5229..255a2bf3 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php @@ -1,21 +1,21 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function button1Clicked($sender,$param)
 -	{
 -		$this->Result1->Text="You have entered: ".$this->HtmlArea1->Text;
 -	}
 -
 -	public function button2Clicked($sender,$param)
 -	{
 -		$this->Result2->Text="You have entered: ".$this->HtmlArea2->Text;
 -	}
 -
 -	public function button3Clicked($sender,$param)
 -	{
 -		$this->Result3->Text="You have entered: ".$this->HtmlArea3->Text;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function button1Clicked($sender,$param) +	{ +		$this->Result1->Text="You have entered: ".$this->HtmlArea1->Text; +	} + +	public function button2Clicked($sender,$param) +	{ +		$this->Result2->Text="You have entered: ".$this->HtmlArea2->Text; +	} + +	public function button3Clicked($sender,$param) +	{ +		$this->Result3->Text="You have entered: ".$this->HtmlArea3->Text; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php index df61ed82..e30aab2b 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php @@ -1,18 +1,18 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		if($param instanceof TCommandEventParameter)
 -		{
 -			$this->Result2->Text="Command name: $param->CommandName, Command parameter: $param->CommandParameter";
 -		}
 -		else
 -		{
 -			$this->Result->Text="You clicked at ($param->X,$param->Y)";
 -		}
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		if($param instanceof TCommandEventParameter) +		{ +			$this->Result2->Text="Command name: $param->CommandName, Command parameter: $param->CommandParameter"; +		} +		else +		{ +			$this->Result->Text="You clicked at ($param->X,$param->Y)"; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php index b8e17941..01294c60 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$this->Result->Text="Your post value is : ".$param->PostBackValue;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$this->Result->Text="Your post value is : ".$param->PostBackValue; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php index 689f45c8..d725dc06 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$this->Result->Text='You have entered "'.$this->PasswordInput->Text.'".';
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$this->Result->Text='You have entered "'.$this->PasswordInput->Text.'".'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php index f18072f2..3711ca46 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php @@ -1,14 +1,14 @@ -<?php
 -
 -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";
 -	}
 -}
 -
 +<?php + +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"; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php index a570d38b..9e5add52 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php @@ -1,79 +1,79 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$data=array('item 1','item 2','item 3','item 4');
 -			$this->DBListBox1->DataSource=$data;
 -			$this->DBListBox1->dataBind();
 -
 -			$data=array('key 1'=>'item 1','key 2'=>'item 2',
 -						'key 3'=>'item 3','key 4'=>'item 4');
 -			$this->DBListBox2->DataSource=$data;
 -			$this->DBListBox2->dataBind();
 -
 -			$data=array(
 -				array('id'=>'001','name'=>'John','age'=>31),
 -				array('id'=>'002','name'=>'Mary','age'=>30),
 -				array('id'=>'003','name'=>'Cary','age'=>20));
 -			$this->DBListBox3->DataSource=$data;
 -			$this->DBListBox3->dataBind();
 -		}
 -	}
 -
 -	public function DBListBox1Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBListBox1Result);
 -	}
 -
 -	public function DBListBox2Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBListBox2Result);
 -	}
 -
 -	public function DBListBox3Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBListBox3Result);
 -	}
 -
 -	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)
 -	{
 -		$this->collectSelectionResult($this->ListBox1,$this->SelectionResult2);
 -	}
 -
 -	public function multiSelectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->MultiSelectionResult);
 -	}
 -
 -	public function buttonClicked2($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->ListBox2,$this->MultiSelectionResult2);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$data=array('item 1','item 2','item 3','item 4'); +			$this->DBListBox1->DataSource=$data; +			$this->DBListBox1->dataBind(); + +			$data=array('key 1'=>'item 1','key 2'=>'item 2', +						'key 3'=>'item 3','key 4'=>'item 4'); +			$this->DBListBox2->DataSource=$data; +			$this->DBListBox2->dataBind(); + +			$data=array( +				array('id'=>'001','name'=>'John','age'=>31), +				array('id'=>'002','name'=>'Mary','age'=>30), +				array('id'=>'003','name'=>'Cary','age'=>20)); +			$this->DBListBox3->DataSource=$data; +			$this->DBListBox3->dataBind(); +		} +	} + +	public function DBListBox1Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBListBox1Result); +	} + +	public function DBListBox2Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBListBox2Result); +	} + +	public function DBListBox3Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBListBox3Result); +	} + +	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) +	{ +		$this->collectSelectionResult($this->ListBox1,$this->SelectionResult2); +	} + +	public function multiSelectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->MultiSelectionResult); +	} + +	public function buttonClicked2($sender,$param) +	{ +		$this->collectSelectionResult($this->ListBox2,$this->MultiSelectionResult2); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php index 1a5dbed3..24a240ca 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TMultiView/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/Controls/Samples/TPager/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php index e5446f60..86563cc1 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php @@ -1,82 +1,82 @@ -<?php
 -
 -class Sample1 extends TPage
 -{
 -	/**
 -	 * Returns total number of data items.
 -	 * In DB-driven applications, this typically requires
 -	 * execution of an SQL statement with COUNT function.
 -	 * Here we simply return a constant number.
 -	 */
 -	protected function getDataItemCount()
 -	{
 -		return 19;
 -	}
 -
 -	/**
 -	 * Fetches a page of data.
 -	 * In DB-driven applications, this can be achieved by executing
 -	 * an SQL query with LIMIT clause.
 -	 */
 -	protected function getData($offset,$limit)
 -	{
 -		$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'=>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),
 -		);
 -		return array_slice($data,$offset,$limit);
 -	}
 -
 -	/**
 -	 * Determines which page of data to be displayed and
 -	 * populates the datalist with the fetched data.
 -	 */
 -	protected function populateData()
 -	{
 -		$offset=$this->DataList->CurrentPageIndex*$this->DataList->PageSize;
 -		$limit=$this->DataList->PageSize;
 -		if($offset+$limit>$this->DataList->VirtualItemCount)
 -			$limit=$this->DataList->VirtualItemCount-$offset;
 -		$data=$this->getData($offset,$limit);
 -		$this->DataList->DataSource=$data;
 -		$this->DataList->dataBind();
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$this->DataList->VirtualItemCount=$this->DataItemCount;
 -			$this->populateData();
 -		}
 -	}
 -
 -	/**
 -	 * Event handler to the OnPageIndexChanged event of pagers.
 -	 */
 -	public function pageChanged($sender,$param)
 -	{
 -		$this->DataList->CurrentPageIndex=$param->NewPageIndex;
 -		$this->populateData();
 -	}
 -}
 -
 +<?php + +class Sample1 extends TPage +{ +	/** +	 * Returns total number of data items. +	 * In DB-driven applications, this typically requires +	 * execution of an SQL statement with COUNT function. +	 * Here we simply return a constant number. +	 */ +	protected function getDataItemCount() +	{ +		return 19; +	} + +	/** +	 * Fetches a page of data. +	 * In DB-driven applications, this can be achieved by executing +	 * an SQL query with LIMIT clause. +	 */ +	protected function getData($offset,$limit) +	{ +		$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'=>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), +		); +		return array_slice($data,$offset,$limit); +	} + +	/** +	 * Determines which page of data to be displayed and +	 * populates the datalist with the fetched data. +	 */ +	protected function populateData() +	{ +		$offset=$this->DataList->CurrentPageIndex*$this->DataList->PageSize; +		$limit=$this->DataList->PageSize; +		if($offset+$limit>$this->DataList->VirtualItemCount) +			$limit=$this->DataList->VirtualItemCount-$offset; +		$data=$this->getData($offset,$limit); +		$this->DataList->DataSource=$data; +		$this->DataList->dataBind(); +	} + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$this->DataList->VirtualItemCount=$this->DataItemCount; +			$this->populateData(); +		} +	} + +	/** +	 * Event handler to the OnPageIndexChanged event of pagers. +	 */ +	public function pageChanged($sender,$param) +	{ +		$this->DataList->CurrentPageIndex=$param->NewPageIndex; +		$this->populateData(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php index d6cf1bd5..1864f380 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		$this->Result->Text="You have clicked on '$sender->Text'.";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function buttonClicked($sender,$param) +	{ +		$this->Result->Text="You have clicked on '$sender->Text'."; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php index ecae7876..8987c230 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php @@ -1,16 +1,16 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onInit($param)
 -	{
 -		parent::onInit($param);
 -		$label=new TLabel;
 -		$label->Text='dynamic';
 -		$label->BackColor='silver';
 -		$this->PlaceHolder1->Controls[]=$label;
 -		$this->PlaceHolder1->Controls[]=' content';
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onInit($param) +	{ +		parent::onInit($param); +		$label=new TLabel; +		$label->Text='dynamic'; +		$label->BackColor='silver'; +		$this->PlaceHolder1->Controls[]=$label; +		$this->PlaceHolder1->Controls[]=' content'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php index 034d2fcc..a0c2af32 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/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/Controls/Samples/TRadioButtonList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php index b45441f9..62b4d7e7 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php @@ -1,69 +1,69 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$data=array('item 1','item 2','item 3','item 4');
 -			$this->DBRadioButtonList1->DataSource=$data;
 -			$this->DBRadioButtonList1->dataBind();
 -
 -			$data=array('key 1'=>'item 1','key 2'=>'item 2',
 -						'key 3'=>'item 3','key 4'=>'item 4');
 -			$this->DBRadioButtonList2->DataSource=$data;
 -			$this->DBRadioButtonList2->dataBind();
 -
 -			$data=array(
 -				array('id'=>'001','name'=>'John','age'=>31),
 -				array('id'=>'002','name'=>'Mary','age'=>30),
 -				array('id'=>'003','name'=>'Cary','age'=>20));
 -			$this->DBRadioButtonList3->DataSource=$data;
 -			$this->DBRadioButtonList3->dataBind();
 -		}
 -	}
 -
 -	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 buttonClicked($sender,$param)
 -	{
 -		$this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
 -	}
 -
 -	public function selectionChanged($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->SelectionResult2);
 -	}
 -
 -	public function DBRadioButtonList1Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBRadioButtonList1Result);
 -	}
 -
 -	public function DBRadioButtonList2Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBRadioButtonList2Result);
 -	}
 -
 -	public function DBRadioButtonList3Changed($sender,$param)
 -	{
 -		$this->collectSelectionResult($sender,$this->DBRadioButtonList3Result);
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			$data=array('item 1','item 2','item 3','item 4'); +			$this->DBRadioButtonList1->DataSource=$data; +			$this->DBRadioButtonList1->dataBind(); + +			$data=array('key 1'=>'item 1','key 2'=>'item 2', +						'key 3'=>'item 3','key 4'=>'item 4'); +			$this->DBRadioButtonList2->DataSource=$data; +			$this->DBRadioButtonList2->dataBind(); + +			$data=array( +				array('id'=>'001','name'=>'John','age'=>31), +				array('id'=>'002','name'=>'Mary','age'=>30), +				array('id'=>'003','name'=>'Cary','age'=>20)); +			$this->DBRadioButtonList3->DataSource=$data; +			$this->DBRadioButtonList3->dataBind(); +		} +	} + +	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 buttonClicked($sender,$param) +	{ +		$this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult); +	} + +	public function selectionChanged($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->SelectionResult2); +	} + +	public function DBRadioButtonList1Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBRadioButtonList1Result); +	} + +	public function DBRadioButtonList2Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBRadioButtonList2Result); +	} + +	public function DBRadioButtonList3Changed($sender,$param) +	{ +		$this->collectSelectionResult($sender,$this->DBRadioButtonList3Result); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php index 40d1841e..4f7ab6c2 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php @@ -1,28 +1,28 @@ -<?php
 -
 -class RegionDisplay extends TRepeaterItemRenderer
 -{
 -	/**
 -	 * This method is invoked when the data is being bound
 -	 * to the parent repeater.
 -	 * At this time, the <b>Data</b> is available which
 -	 * refers to the data row associated with the parent repeater item.
 -	 */
 -	public function onDataBinding($param)
 -	{
 -		parent::onDataBinding($param);
 -		$this->Repeater->DataSource=$this->Data['detail'];
 -		$this->Repeater->dataBind();
 -	}
 -
 -	public function itemCreated($sender,$param)
 -	{
 -		static $itemIndex=0;
 -		$item=$param->Item;
 -		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
 -			$item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
 -		$itemIndex++;
 -	}
 -}
 -
 +<?php + +class RegionDisplay extends TRepeaterItemRenderer +{ +	/** +	 * This method is invoked when the data is being bound +	 * to the parent repeater. +	 * At this time, the <b>Data</b> is available which +	 * refers to the data row associated with the parent repeater item. +	 */ +	public function onDataBinding($param) +	{ +		parent::onDataBinding($param); +		$this->Repeater->DataSource=$this->Data['detail']; +		$this->Repeater->dataBind(); +	} + +	public function itemCreated($sender,$param) +	{ +		static $itemIndex=0; +		$item=$param->Item; +		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem') +			$item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF"; +		$itemIndex++; +	} +} +  ?>
\ 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 index 905a3b8d..c3cff79b 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php @@ -1,41 +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),
 -		);
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$this->Repeater->DataSource=$this->getData();
 -			$this->Repeater->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 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.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php index e84580a2..803201e9 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php @@ -1,79 +1,79 @@ -<?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];
 -	}
 -
 -	public 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();
 -		}
 -	}
 -
 -	public function repeaterItemCreated($sender,$param)
 -	{
 -		static $itemIndex=0;
 -		$item=$param->Item;
 -		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
 -		{
 -			$item->Cell->BackColor=$itemIndex%2 ? "#6078BF" : "#809FFF";
 -			$item->Cell->ForeColor='white';
 -			$itemIndex++;
 -		}
 -	}
 -
 -	public function repeater2ItemCreated($sender,$param)
 -	{
 -		static $itemIndex=0;
 -		$item=$param->Item;
 -		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
 -		{
 -			$item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
 -			$itemIndex++;
 -		}
 -	}
 -}
 -
 +<?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]; +	} + +	public 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(); +		} +	} + +	public function repeaterItemCreated($sender,$param) +	{ +		static $itemIndex=0; +		$item=$param->Item; +		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem') +		{ +			$item->Cell->BackColor=$itemIndex%2 ? "#6078BF" : "#809FFF"; +			$item->Cell->ForeColor='white'; +			$itemIndex++; +		} +	} + +	public function repeater2ItemCreated($sender,$param) +	{ +		static $itemIndex=0; +		$item=$param->Item; +		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem') +		{ +			$item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF"; +			$itemIndex++; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php index d4f4c8e9..dbaf598f 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php @@ -1,79 +1,79 @@ -<?php
 -
 -class Sample3 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 Sample3 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/Controls/Samples/TRepeater/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php index aabab157..fb0e4922 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php @@ -1,37 +1,37 @@ -<?php
 -
 -Prado::using('System.Collections.TDummyDataSource');
 -
 -class Sample4 extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			// use a dummy data source to create 3 repeater items
 -			$this->Repeater->DataSource=new TDummyDataSource(3);
 -			$this->Repeater->dataBind();
 -		}
 -	}
 -
 -	public function itemCreated($sender,$param)
 -	{
 -		// $param->Item refers to the newly created repeater item
 -		$param->Item->Style="width:300px; margin:10px; margin-left:0px";
 -	}
 -
 -	public function buttonClicked($sender,$param)
 -	{
 -		$links=array();
 -		foreach($this->Repeater->Items as $textBox)
 -		{
 -			if($textBox->Text!=='')
 -				$links[]=$textBox->Text;
 -		}
 -		$this->Repeater2->DataSource=$links;
 -		$this->Repeater2->dataBind();
 -	}
 -}
 -
 +<?php + +Prado::using('System.Collections.TDummyDataSource'); + +class Sample4 extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		if(!$this->IsPostBack) +		{ +			// use a dummy data source to create 3 repeater items +			$this->Repeater->DataSource=new TDummyDataSource(3); +			$this->Repeater->dataBind(); +		} +	} + +	public function itemCreated($sender,$param) +	{ +		// $param->Item refers to the newly created repeater item +		$param->Item->Style="width:300px; margin:10px; margin-left:0px"; +	} + +	public function buttonClicked($sender,$param) +	{ +		$links=array(); +		foreach($this->Repeater->Items as $textBox) +		{ +			if($textBox->Text!=='') +				$links[]=$textBox->Text; +		} +		$this->Repeater2->DataSource=$links; +		$this->Repeater2->dataBind(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php index 60beb30e..de6e5bd9 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php @@ -1,52 +1,52 @@ -<?php
 -
 -class Sample5 extends TPage
 -{
 -	protected function getData()
 -	{
 -		return array(
 -			array(
 -				'name'=>'North',
 -				'detail'=>array(
 -					array('name'=>'John','age'=>30,'position'=>'Program Manager'),
 -					array('name'=>'Edward','age'=>35,'position'=>'Developer'),
 -					array('name'=>'Walter','age'=>28,'position'=>'Developer'),
 -				),
 -			),
 -			array(
 -				'name'=>'West',
 -				'detail'=>array(
 -					array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
 -					array('name'=>'Ted','age'=>25,'position'=>'Developer'),
 -					array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
 -				),
 -			),
 -			array(
 -				'name'=>'East',
 -				'detail'=>array(
 -					array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
 -					array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
 -				),
 -			),
 -			array(
 -				'name'=>'South',
 -				'detail'=>array(
 -					array('name'=>'King','age'=>30,'position'=>'Program Manager'),
 -					array('name'=>'Carter','age'=>22,'position'=>'Developer'),
 -				),
 -			),
 -		);
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		if(!$this->IsPostBack)
 -		{
 -			$this->Repeater->DataSource=$this->getData();
 -			$this->Repeater->dataBind();
 -		}
 -	}
 -}
 -
 +<?php + +class Sample5 extends TPage +{ +	protected function getData() +	{ +		return array( +			array( +				'name'=>'North', +				'detail'=>array( +					array('name'=>'John','age'=>30,'position'=>'Program Manager'), +					array('name'=>'Edward','age'=>35,'position'=>'Developer'), +					array('name'=>'Walter','age'=>28,'position'=>'Developer'), +				), +			), +			array( +				'name'=>'West', +				'detail'=>array( +					array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'), +					array('name'=>'Ted','age'=>25,'position'=>'Developer'), +					array('name'=>'Kevin','age'=>28,'position'=>'Developer'), +				), +			), +			array( +				'name'=>'East', +				'detail'=>array( +					array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'), +					array('name'=>'Larry','age'=>28,'position'=>'Document Writer'), +				), +			), +			array( +				'name'=>'South', +				'detail'=>array( +					array('name'=>'King','age'=>30,'position'=>'Program Manager'), +					array('name'=>'Carter','age'=>22,'position'=>'Developer'), +				), +			), +		); +	} + +	public 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/TRequiredFieldValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php index c1c8a711..228fd727 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php @@ -1,9 +1,9 @@  <?php  class Home extends TPage  -{
 -	public function onInit ($param)
 -	{
 -		parent::onInit($param);
 +{ +	public function onInit ($param) +	{ +		parent::onInit($param);  	}  	public function submit1 ($sender, $param)  	{ diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php index badbca73..b03361b8 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php @@ -1,7 +1,7 @@ -<?php
 -
 -class Home extends TPage
 -{
 -}
 -
 +<?php + +class Home extends TPage +{ +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php index fa5efe38..505a6ded 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php @@ -1,33 +1,33 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		$this->Table->GridLines='Both';
 -
 -		$row=new TTableRow;
 -		$this->Table->Rows[]=$row;
 -
 -		$cell=new TTableHeaderCell;
 -		$cell->Text='Header 1';
 -		$row->Cells[]=$cell;
 -
 -		$cell=new TTableHeaderCell;
 -		$cell->Text='Header 2';
 -		$row->Cells[]=$cell;
 -
 -		$row=new TTableRow;
 -		$this->Table->Rows[]=$row;
 -
 -		$cell=new TTableCell;
 -		$cell->Text='Cell 1';
 -		$row->Cells[]=$cell;
 -
 -		$cell=new TTableCell;
 -		$cell->Text='Cell 2';
 -		$row->Cells[]=$cell;
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		$this->Table->GridLines='Both'; + +		$row=new TTableRow; +		$this->Table->Rows[]=$row; + +		$cell=new TTableHeaderCell; +		$cell->Text='Header 1'; +		$row->Cells[]=$cell; + +		$cell=new TTableHeaderCell; +		$cell->Text='Header 2'; +		$row->Cells[]=$cell; + +		$row=new TTableRow; +		$this->Table->Rows[]=$row; + +		$cell=new TTableCell; +		$cell->Text='Cell 1'; +		$row->Cells[]=$cell; + +		$cell=new TTableCell; +		$cell->Text='Cell 2'; +		$row->Cells[]=$cell; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php index f8aa0825..2ac0cb3f 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php @@ -1,22 +1,22 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		$this->Output->dataBind();
 -	}
 -
 -	public function textChanged($sender,$param)
 -	{
 -		$sender->Text="text changed";
 -	}
 -
 -	public function submitText($sender,$param)
 -	{
 -		$this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'.";
 -	}
 -}
 -
 +<?php + +class Home extends TPage +{ +	public function onLoad($param) +	{ +		parent::onLoad($param); +		$this->Output->dataBind(); +	} + +	public function textChanged($sender,$param) +	{ +		$sender->Text="text changed"; +	} + +	public function submitText($sender,$param) +	{ +		$this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'."; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php index 88d2dbf2..1c5efbcf 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php @@ -1,8 +1,8 @@ -<?php
 -
 -class Home extends TPage
 -{
 -
 -}
 -
 +<?php + +class Home extends TPage +{ + +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php index 20440e62..5d9bcb1d 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Sample1 extends TPage
 -{
 -	public function wizardCompleted($sender,$param)
 -	{
 -		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
 -	}
 -}
 -
 +<?php + +class Sample1 extends TPage +{ +	public function wizardCompleted($sender,$param) +	{ +		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php index a508fbf3..61572075 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Sample2 extends TPage
 -{
 -	public function wizardCompleted($sender,$param)
 -	{
 -		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
 -	}
 -}
 -
 +<?php + +class Sample2 extends TPage +{ +	public function wizardCompleted($sender,$param) +	{ +		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php index d85d041a..6e767cd4 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php @@ -1,25 +1,25 @@ -<?php
 -
 -class Sample3 extends TPage
 -{
 -	public function wizard3Completed($sender,$param)
 -	{
 -		if($this->StudentCheckBox->Checked)
 -		{
 -			$str="You are a college student.<br/>";
 -			$str.="You are in major: ".$this->DropDownList11->SelectedValue."<br/>";
 -			$str.="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
 -		}
 -		else
 -			$str="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
 -		$this->Wizard3Result->Text=$str;
 -	}
 -
 -	public function wizard3NextStep($sender,$param)
 -	{
 -		if($param->CurrentStepIndex===0 && !$this->StudentCheckBox->Checked)
 -			$this->Wizard3->ActiveStepIndex=2;
 -	}
 -}
 -
 +<?php + +class Sample3 extends TPage +{ +	public function wizard3Completed($sender,$param) +	{ +		if($this->StudentCheckBox->Checked) +		{ +			$str="You are a college student.<br/>"; +			$str.="You are in major: ".$this->DropDownList11->SelectedValue."<br/>"; +			$str.="Your favorite sport is: ".$this->DropDownList22->SelectedValue; +		} +		else +			$str="Your favorite sport is: ".$this->DropDownList22->SelectedValue; +		$this->Wizard3Result->Text=$str; +	} + +	public function wizard3NextStep($sender,$param) +	{ +		if($param->CurrentStepIndex===0 && !$this->StudentCheckBox->Checked) +			$this->Wizard3->ActiveStepIndex=2; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php index 6b79698d..c7317654 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php @@ -1,11 +1,11 @@ -<?php
 -
 -class Sample4 extends TPage
 -{
 -	public function wizardCompleted($sender,$param)
 -	{
 -		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
 -	}
 -}
 -
 +<?php + +class Sample4 extends TPage +{ +	public function wizardCompleted($sender,$param) +	{ +		$this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php index 4ab6d08b..4fb64395 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php @@ -1,12 +1,12 @@ -<?php
 -
 -class Sample5 extends TPage
 -{
 -	public function wizardCompleted($sender,$param)
 -	{
 -		$this->Result1->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
 -		$this->Result2->Text="Your favorite sport is: " . $this->Step2->DropDownList2->SelectedValue;
 -	}
 -}
 -
 +<?php + +class Sample5 extends TPage +{ +	public function wizardCompleted($sender,$param) +	{ +		$this->Result1->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; +		$this->Result2->Text="Your favorite sport is: " . $this->Step2->DropDownList2->SelectedValue; +	} +} +  ?>
\ No newline at end of file  | 
