summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/protected/pages/RepeaterWithActiveControls.php
blob: c5235dc65e61b65482a66e72eb6b4a78bb4ce041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

class RepeaterWithActiveControls extends TPage
{
	private $_data=array('Hello', 'World', 'Prado');

	private $_status='';

	public function onLoad($param)
	{
		parent::onLoad($param);
		if(!$this->IsCallback)
		{
			$this->repeater1->DataSource = $this->_data;
			$this->repeater1->dataBind();
		}
	}

	public function label_changed($sender, $param)
	{
		$index = $sender->getParent()->ItemIndex + 1;
		$this->_status .= " Update textbox {$index}: ".$sender->Text;
	}

	public function onPreRender($param)
	{
		parent::onPreRender($param);
		if(trim($this->_status))
			$this->label1->Text = $this->_status;
	}

	public function enable_edit($sender, $param)
	{
		if($this->update_button->Enabled==false)
		{
			for($i = 0; $i<count($this->repeater1->Items); $i++)
			{
				$textbox = $this->repeater1->Items[$i]->edit_box;
				$textbox->DisplayTextBox = true;
			}
			$this->update_button->Enabled = true;
			$sender->Enabled=false;
		}
	}

	public function disable_edit($sender, $param)
	{
		if($this->update_button->Enabled==true)
		{
			for($i = 0; $i<count($this->repeater1->Items); $i++)
			{
				$textbox = $this->repeater1->Items[$i]->edit_box;
				$textbox->DisplayTextBox = false;
			}
			$this->edit_button->Enabled = true;
			$sender->Enabled=false;
		}
	}
}

?>