summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2005-11-11 04:11:42 +0000
committerxue <>2005-11-11 04:11:42 +0000
commit5147906809d0fb77b75080da7fd0112a6f6f51f7 (patch)
tree9f5370e3bea19235032e6a770ffc75f5363cad12
parent914776d70153e2db570704def66e03446499c7a3 (diff)
Added Request, Response, Session, User properties to TControl.
-rw-r--r--demos/controls/protected/pages/HomePage.tpl2
-rw-r--r--demos/controls/protected/pages/private/MemberPage.tpl2
-rw-r--r--framework/Web/UI/TControl.php32
3 files changed, 34 insertions, 2 deletions
diff --git a/demos/controls/protected/pages/HomePage.tpl b/demos/controls/protected/pages/HomePage.tpl
index 3e31801f..c7b35f02 100644
--- a/demos/controls/protected/pages/HomePage.tpl
+++ b/demos/controls/protected/pages/HomePage.tpl
@@ -1,5 +1,5 @@
<com:TForm>
-<h1>Welcome! <%=$this->Application->User->Name %></h1>
+<h1>Welcome! <%=$this->User->Name %></h1>
<com:TLiteral Text="literal" />
<com:TTextBox Text="textbox" />
<com:TLabel Text="label" /><br/>
diff --git a/demos/controls/protected/pages/private/MemberPage.tpl b/demos/controls/protected/pages/private/MemberPage.tpl
index cf92f22c..a19c934c 100644
--- a/demos/controls/protected/pages/private/MemberPage.tpl
+++ b/demos/controls/protected/pages/private/MemberPage.tpl
@@ -1,5 +1,5 @@
<com:TForm>
-Congratulations, <com:TLabel Text=<%=$this->Application->User->Name%> />!<br/>
+Congratulations, <com:TLabel Text=<%=$this->User->Name%> />!<br/>
<%=
$this->Application->User->Name;
%>
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 0d7fb333..ed6e7dd0 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -239,6 +239,38 @@ class TControl extends TComponent
}
/**
+ * @return THttpRequest the current user request
+ */
+ public function getRequest()
+ {
+ return Prado::getApplication()->getRequest();
+ }
+
+ /**
+ * @return THttpResponse the response
+ */
+ public function getResponse()
+ {
+ return Prado::getApplication()->getResponse();
+ }
+
+ /**
+ * @return THttpSession user session
+ */
+ public function getSession()
+ {
+ return Prado::getApplication()->getSession();
+ }
+
+ /**
+ * @return IUser user
+ */
+ public function getUser()
+ {
+ return Prado::getApplication()->getUser();
+ }
+
+ /**
* Returns the id of the control.
* Control ID can be either manually set or automatically generated.
* If $hideAutoID is true, automatically generated ID will be returned as an empty string.