summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples
diff options
context:
space:
mode:
authorxue <>2006-02-05 23:38:21 +0000
committerxue <>2006-02-05 23:38:21 +0000
commit84a6c667801d46c4cb6f831c9e40043b308f96d8 (patch)
tree0219a6ac8191f690645f35ba8ac4bab65e63bbe2 /demos/quickstart/protected/pages/Controls/Samples
parent56b4436587f7e85c7ec1a8edb44b1d37506fbf38 (diff)
Added two examples showing creating new controls by composition.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.page11
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php13
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php18
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.tpl2
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.page11
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php13
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php32
7 files changed, 100 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.page b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.page
new file mode 100644
index 00000000..ed05bfdf
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.page
@@ -0,0 +1,11 @@
+<com:TContent ID="body" >
+<com:LabeledTextBox
+ ID="Input"
+ Label.Text="Username" />
+<com:TButton
+ Text="Submit"
+ OnClick="buttonClicked" />
+<com:TRequiredFieldValidator
+ ControlToValidate="Input.TextBox"
+ ErrorMessage="You must enter a value"/>
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php
new file mode 100644
index 00000000..2b18972d
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php
@@ -0,0 +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;
+ }
+}
+
+?> \ 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
new file mode 100644
index 00000000..999639d7
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php
@@ -0,0 +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');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.tpl b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.tpl
new file mode 100644
index 00000000..8b3c1406
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.tpl
@@ -0,0 +1,2 @@
+<com:TLabel ID="Label" ForControl="TextBox" />
+<com:TTextBox ID="TextBox" /> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.page b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.page
new file mode 100644
index 00000000..ed05bfdf
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.page
@@ -0,0 +1,11 @@
+<com:TContent ID="body" >
+<com:LabeledTextBox
+ ID="Input"
+ Label.Text="Username" />
+<com:TButton
+ Text="Submit"
+ OnClick="buttonClicked" />
+<com:TRequiredFieldValidator
+ ControlToValidate="Input.TextBox"
+ ErrorMessage="You must enter a value"/>
+</com:TContent> \ 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
new file mode 100644
index 00000000..2309bd88
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php
@@ -0,0 +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;
+ }
+}
+
+?> \ 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
new file mode 100644
index 00000000..f4148148
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php
@@ -0,0 +1,32 @@
+<?php
+
+class LabeledTextBox extends TControl
+{
+ private $_label;
+ private $_textbox;
+
+ protected function createChildControls()
+ {
+ $this->_label=new TLabel;
+ $this->_label->setID('Label');
+ $this->getControls()->add($this->_label);
+ $this->getControls()->add('&nbsp;');
+ $this->_textbox=new TTextBox;
+ $this->_textbox->setID('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