summaryrefslogtreecommitdiff
path: root/demos/composer/protected/pages/Home.php
blob: a2281828f3f032cf9deeef6e0ee36a9ad48260fa (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php

class Home extends TPage
{
	public function onLoad($param)
	{
		parent::onLoad($param);
		if(!$this->IsPostBack)
		{
			$this->Repeater->setDataSource($this->getInitialProperties());
			$this->Repeater->dataBind();
		}
		else
			$this->Repeater->ensureChildControls();
	}

	protected function getInitialProperties()
	{
		return array(
			new PropertyDefinition,
			new PropertyDefinition,
			new PropertyDefinition,
			new PropertyDefinition,
		);
	}

	public function generateCode($sender,$param)
	{
		$code="<?php\n\n";
		$code.="class ".$this->ClassName->Text." extends ".$this->ParentClass->Text."implements ".$this->Interfaces->Text;
		$code.="\n";
		$code.="{\n";
		$code.="}\n";
		$code.="?>";
		$this->SourceCode->Text=htmlentities($code);
	}
}

class PropertyDefinition extends TComponent
{
	private $_name='';
	private $_type='string';
	private $_default='';
	private $_readOnly=false;
	private $_protected=false;
	private $_storage='ViewState';
	private $_comments='';

	public function getName()
	{
		return $this->_name;
	}

	public function setName($value)
	{
		$this->_name=$value;
	}

	public function getType()
	{
		return $this->_type;
	}

	public function setType($value)
	{
		$this->_type=$value;
	}

	public function getDefaultValue()
	{
		return $this->_default;
	}

	public function setDefaultValue($value)
	{
		$this->_default=$value;
	}

	public function getReadOnly()
	{
		return $this->_readOnly;
	}

	public function setReadOnly($value)
	{
		$this->_readOnly=TPropertyValue::ensureBoolean($value);
	}

	public function getIsProtected()
	{
		return $this->_protected;
	}

	public function setIsProtected($value)
	{
		$this->_protected=TPropertyValue::ensureBoolean($value);
	}

	public function getStorage()
	{
		return $this->_storage;
	}

	public function setStorage($value)
	{
		$this->_storage=$value;
	}

	public function getComments()
	{
		return $this->_comments;
	}

	public function setComments($value)
	{
		$this->_comments=$value;
	}
}

?>