summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php
diff options
context:
space:
mode:
authorChristophe.Boulain <>2009-09-29 08:33:46 +0000
committerChristophe.Boulain <>2009-09-29 08:33:46 +0000
commitd76123127139a7cb013a0e4c17a63eb8aab57e3e (patch)
tree4a6093cec85636f5e595b66f4fb33f77f1d424e1 /demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php
parentb49bc6e7db63f0ae9788970108c4d2f20d841bed (diff)
Added TActiveDataGrid and TActiveRepeater from LCS
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php79
1 files changed, 79 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php
new file mode 100644
index 00000000..e84580a2
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php
@@ -0,0 +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++;
+ }
+ }
+}
+
+?> \ No newline at end of file