summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php
blob: 322f4db7e877752ae78ba1f1d10e88a72cf365c4 (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
<?php
/*
 * Created on 2/05/2006
 */
 
class ActiveControl extends TPage
{
	static private $_colors = array('red', 'green', 'blue', 'purple','black','orange');
	
	public function slowResponse($sender, $param)
	{
		//sleep(1);
		$this->label1->setText("The time is ".time()." from ".$sender->ID);
		$this->label1->setForeColor($this->getColor());
		$this->label1->renderControl($param->getOutput());

		$this->button2->setEnabled(true);
		
		$this->panel2->setVisible(true);
		$this->panel1->setBackColor($this->getColor());
		$this->panel1->renderControl($param->getOutput());
		$this->getCallbackClient()->shake($this->panel1);
	}
	
	public function onButtonClicked($sender, $param)
	{
		$this->label2->setText("Muahaha !!! the time is ".time()." from ".$sender->ID);
	}
	
	public function fastResponse($sender, $param)
	{
		$this->button2->setEnabled(false);
		$style['color'] = $this->getColor();
		$this->getCallbackClient()->setStyle($this->label2, $style);
		$this->getCallbackClient()->shake($this->label2);
	}
	
	private function getColor()
	{
		return self::$_colors[rand(0,count(self::$_colors)-1)];
	}
}
?>