From 5147906809d0fb77b75080da7fd0112a6f6f51f7 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 11 Nov 2005 04:11:42 +0000 Subject: Added Request, Response, Session, User properties to TControl. --- demos/controls/protected/pages/HomePage.tpl | 2 +- .../protected/pages/private/MemberPage.tpl | 2 +- framework/Web/UI/TControl.php | 32 ++++++++++++++++++++++ 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 @@ -

Welcome! <%=$this->Application->User->Name %>

+

Welcome! <%=$this->User->Name %>


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 @@ -Congratulations, Application->User->Name%> />!
+Congratulations, User->Name%> />!
<%= $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 @@ -238,6 +238,38 @@ class TControl extends TComponent return Prado::getApplication(); } + /** + * @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. -- cgit v1.2.3