System.Web.UI
[ class tree: System.Web.UI ] [ index: System.Web.UI ] [ all elements ]

Class: TPage

Source Location: /Web/UI/TPage.php

Class Overview

TComponent
   |
   --TControl
      |
      --TPage

TPage class

Class Details

[line 49]
TPage class

TPage implements the postback mechanism as well as many functions related to client scripting.

A page, an instance of TPage or its descendent class is a top-level control in a PRADO application. It has neither parent nor container. In order for an application to load a page, the page name and the location of the page class must be defined in the application specification.

Namespace: System.Web.UI

Properties

  • IsValid, boolean, read-only
    Gets the value that indicates whether the page has passed validation.
  • IsPostBack, boolean, read-only
    Gets the value that indicates whether the current request is a postback.
  • Form, TForm, read-only
    Gets the form control associated with the page.
  • Validators, array, read-only
    Gets the list of registered validators.
  • MasterPage, TPage, read-only
    Gets the master page, null if none.
  • MasterPageName, string
    Gets or sets the name of the master page.




version:  v1.0, last update on 2004/08/13 21:44:52
author:  Qiang Xue <qiang.xue@gmail.com>


[ Top ]

Constants

Methods


Child classes:

TCallbackPage
TCallbackPage page class handles component callback requests (AJAX).

Inherited Variables

Inherited Methods

Class: TControl

TControl::__construct()
Constructor.
TControl::addBody()
Appends an object into the body collection of this control.
TControl::addParsedObject()
Adds the object parsed in template as a body of the component.
TControl::allowBody()
Determines whether the control can add the object as a body.
TControl::clearViewState()
Clears viewstate
TControl::findBodyControl()
TControl::getAttribute()
TControl::getAttributes()
Returns the attribute list object.
TControl::getAttributesToRender()
Returns attributes to be rendered.
TControl::getBodies()
TControl::getClientID()
Returns the client ID of the component.
TControl::getContainer()
Returns the container of this component.
TControl::getSkinName()
TControl::getTagName()
TControl::getViewState()
Returns a viewstate value.
TControl::initSkin()
Initializes a skin for the control. If a skin name is provided then that skin will be loaded.
TControl::isViewStateEnabled()
TControl::isVisible()
This method checks whether a control is visible.
TControl::loadViewState()
Loads viewstate into this component and its children.
TControl::onBubbleEvent()
This method responds to a bubbled event.
TControl::onInit()
This method is invoked when the control enters 'Init' stage.
TControl::onInitRecursive()
Calls onInit of this control and its children recursively.
TControl::onLoad()
This method is invoked when the control enters 'Load' stage.
TControl::onLoadRecursive()
Calls onLoad of this control and its children recursively.
TControl::onPreRender()
This method is invoked when the control enters 'PreRender' stage.
TControl::onPreRenderRecursive()
Calls onPreRender of this control and its children recursively.
TControl::onUnload()
This method is invoked when the control enters 'Unload' stage.
TControl::onUnloadRecursive()
Calls onUnload of this control and its children recursively.
TControl::raiseBubbleEvent()
Invokes the parent's onBubbleEvent method.
TControl::removeBodies()
Removes all body content.
TControl::render()
Renders this control.
TControl::renderAttributes()
Renders the attributes.
TControl::renderBody()
Renders the body content.
TControl::saveViewState()
Returns the viewstate of this component and its children.
TControl::setAttribute()
Sets an attribute.
TControl::setContainer()
Sets the container of this component
TControl::setEnableViewState()
TControl::setSkinName()
Sets the skin to use for this control
TControl::setTagName()
Sets the tag name.
TControl::setViewState()
Sets a viewstate value.
TControl::setVisible()
TControl::synchronizeControl()
This method should only be used by framework developer.

Class: TComponent

TComponent::__construct()
Constructor.
TComponent::addChild()
Adds a child component.
TComponent::addParsedObject()
Handles a component or string met in template.
TComponent::attachEventHandler()
Attaches a handler function to an event.
TComponent::bindProperty()
Sets up the binding between a property and an expression.
TComponent::canGetProperty()
Determines whether a property can be read.
TComponent::canSetProperty()
Determines whether a property can be written.
TComponent::createComponent()
Creates a child component.
TComponent::dataBind()
Performs the databinding for this component.
TComponent::evaluateExpression()
Evaluates a PHP expression.
TComponent::evaluateStatements()
Evaluates a list of PHP statements.
TComponent::findObject()
Finds an object by its ID path.
TComponent::getApplication()
TComponent::getChild()
TComponent::getChildren()
TComponent::getDefinition()
Returns or builds a component definition.
TComponent::getGlobalization()
Returns the Globalization instance for the application.
TComponent::getID()
TComponent::getModule()
Returns the module object that contains the component or the page containing the component.
TComponent::getPage()
TComponent::getParent()
TComponent::getPropertyInitValue()
Gets the initial value of a property.
TComponent::getPropertyType()
Returns the type of a property
TComponent::getRequest()
Returns the request object associated with application.
TComponent::getServiceManager()
Returns the service manager for this application.
TComponent::getSession()
Returns the session object associated with the application.
TComponent::getSessionState()
Returns a session variable.
TComponent::getUniqueID()
Returns the unique ID of the component.
TComponent::getUser()
Returns the user object associated with the application.
TComponent::hasChildren()
TComponent::hasEvent()
Determines whether an event is defined.
TComponent::hasProperty()
Determines whether a property is defined.
TComponent::initProperties()
Initializes the property values.
TComponent::instantiateTemplate()
Parses a template string and instantiates the content.
TComponent::onDataBinding()
This method is invoked when dataBind is invoked for the component.
TComponent::raiseEvent()
Invokes all attached event handler functions for a particular event.
TComponent::removeChild()
Removes a child component.
TComponent::removeChildren()
Removes all child components.
TComponent::setAttribute()
Sets an attribute.
TComponent::setDefinition()
Sets a component definition.
TComponent::setID()
Sets a component ID.
TComponent::setParent()
Sets the parent of this component.
TComponent::setPropertyInitValue()
Sets the initial value of a property.
TComponent::setRoot()
Sets the root component in the component hierarchy.
TComponent::setSessionState()
Sets a session variable.
TComponent::unbindProperty()
Breaks the binding between a property and an expression.
TComponent::__get()
Returns a property value by name or a child component by ID.
TComponent::__set()
Sets value of a component property.

Class Methods


constructor __construct [line 167]

TPage __construct( )

Constructor, initiates the root to itself.

Use pradoGetApplication()->loadPage() to create a page instead of using the new operator.




Overridden in child classes as:

TCallbackPage::__construct()
Initialize the callback service.

Overrides TControl::__construct() (Constructor.)

[ Top ]

method attachContent [line 412]

void attachContent( TContent $content)

Attaches a content control to a content placeholder.

The attachment is based on ID matching.




access:  public


Parameters:

TContent   $content  

[ Top ]

method determinePostBackMode [line 178]

void determinePostBackMode( )

Determines whether the current request is a postback.

This method should only be used by framework developers.




access:  public


[ Top ]

method execute [line 935]

void execute( )

Executes page lifecycles.

Starting with TModule.onLoad

If the page is requested for the first time, it consists of the following lifecycles,

  • OnInit event
  • OnLoad event
  • OnPreRender event
  • save viewstate
  • render page
  • OnUnload event
If the page is requested in response to a form submission (called postback), the life cycles include
  • OnInit event
  • load viewstate
  • load post data
  • OnLoad event
  • load post data (for newly created components during Load event)
  • OnPostDataChanged event
  • Input validation if the postback event handler is enabled with CausesValidation property
  • PostBack event
  • OnPreRender event
  • save viewstate
  • render page
  • OnUnload event
The execution is ended with TMOdule.onUnload




access:  public


Overridden in child classes as:

TCallbackPage::execute()
Executes page lifecycles for a callback request

[ Top ]

method getForm [line 250]

TForm getForm( [string $id = ''])

Returns the currently attached form object.



return:  the reference to the currently attached form object
access:  public


Parameters:

string   $id   The unique id of the form to detach

[ Top ]

method getHead [line 270]

THead getHead( )

Returns the current page's Head object.



return:  The reference to the THead object
access:  public


[ Top ]

method getMasterPage [line 855]

null|TPage getMasterPage( )



return:  the master page
access:  public


[ Top ]

method getMasterPageName [line 863]

string getMasterPageName( )



return:  the master page name
access:  public


[ Top ]

method getModule [line 837]

TModule getModule( )

Returns the module object.

This method overrides the TComponent implementation.




access:  public


Overrides TComponent::getModule() (Returns the module object that contains the component or the page containing the component.)

[ Top ]

method getPageName [line 891]

string getPageName( )



return:  full qualified page name including module name if any.
access:  public


[ Top ]

method getPostBackClientEvent [line 553]

void getPostBackClientEvent( TComponent $target, string $param)

Returns a javascript that can be used to trigger client-side postback event.

You have to add your own javascript surrounding elements if necessary.




access:  public


Parameters:

TComponent   $target   the control that needs to trigger the postback event
string   $param   a parameter to be included with the postback event

[ Top ]

method getPostBackParameter [line 528]

string getPostBackParameter( )



return:  the parameter of the postback event
access:  public


[ Top ]

method getPostBackTarget [line 498]

Tcontrol getPostBackTarget( )



return:  the control responsible for the postback event, null if no postback target available
access:  public


[ Top ]

method getStage [line 901]

string getStage( )

Returns the current life cycle the page is in.

This method should only be used by framework developers.




return:  the current life cycle the page is in
access:  public


[ Top ]

method getTheme [line 290]

string getTheme( )



return:  the name of the theme to be applied to the page
access:  public


[ Top ]

method getUrl [line 882]

string getUrl( [array|null $getParameters = null])



return:  a URL for this page
access:  public


Parameters:

array|null   $getParameters   GET parameters (name=>value pairs), null if no GET parameters

[ Top ]

method getValidators [line 432]

void getValidators( )



access:  public


[ Top ]

method handlePostBackEvent [line 992]

void handlePostBackEvent( )



access:  protected


[ Top ]

method isArrayDeclarationRegistered [line 675]

boolean isArrayDeclarationRegistered( string $name)

Indicates whether the named array has been registered before.



access:  public
see:  TPage::registerArrayDeclaration()


Parameters:

string   $name   the array name

[ Top ]

method isBeginScriptRegistered [line 689]

boolean isBeginScriptRegistered( string $key)

Indicates whether the named beginscript has been registered before.



access:  public
see:  TPage::registerBeginScript()


Parameters:

string   $key   the key that identifies a beginscript

[ Top ]

method isEndScriptRegistered [line 717]

boolean isEndScriptRegistered( string $key)

Indicate whether the named endscript has been registered before.



access:  public
see:  TPage::registerEndScript()


Parameters:

string   $key   the key that identifies a beginscript

[ Top ]

method isHiddenFieldRegistered [line 620]

boolean isHiddenFieldRegistered( string $name)

Indicates whether the named hidden field has been registered before.



access:  public
see:  TPage::registerHiddenField()


Parameters:

string   $name   the name of the hidden field

[ Top ]

method isOnSubmitStatementRegistered [line 647]

boolean isOnSubmitStatementRegistered( string $name)

Indicates whether the named onsubmit statement has been registered before.



access:  public
see:  TPage::registerOnSubmitStatement()


Parameters:

string   $name   the key that identifies the onsubmit statement

[ Top ]

method isPostBack [line 197]

boolean|false isPostBack( )

Indicates whether the current request is a postback.

The value is available since Init stage.




access:  public


[ Top ]

method isScriptFileRegistered [line 745]

boolean isScriptFileRegistered( string $key)

Indicates whether the named scriptfile has been registered before.



access:  public
see:  TPage::registerScriptFile()


Parameters:

string   $key   the name of the scriptfile

[ Top ]

method isStyleFileRegistered [line 785]

boolean isStyleFileRegistered( string $key)

Indicates whether the named CSS style file has been registered before.



access:  public
see:  TPage::registerStyleFile()


Parameters:

string   $key   the name of the style file

[ Top ]

method isValid [line 207]

boolean isValid( )

Indicates whether all validators have successfully validated the post data.

The value is available since PostBack stage.




access:  public


[ Top ]

method loadPageStateFromPersistenceMedium [line 344]

array loadPageStateFromPersistenceMedium( )

Loads viewstate of the page and all its children from a persistence medium.

By default, a hidden field is used as persistence medium. You can override this function to provide your own viewstate maintenance method. For example, you can keep the viewstate in session data or in database. If you override, you have to override savePageStateToPersistenceMedium as well to match the load and save processes.

This method should only be used by framework developers.




return:  reference to the loaded viewstate array.
access:  public
see:  TPage::savePageStateToPersistenceMedium()


[ Top ]

method loadPostData [line 307]

void loadPostData( )

Runs through every postdata loader to load postdata.

This method should only be used by framework developers.




access:  public


[ Top ]

method loadViewState [line 1100]

void loadViewState( mixed $viewState)



access:  public


Overrides TControl::loadViewState() (Loads viewstate into this component and its children.)

[ Top ]

method onAuthorize [line 826]

boolean onAuthorize( IUser $user)

Checks if the user is authorized to access this page.

Default implement always returns true. Derived classes may override this method to do real authorization work.




return:  whether the user is authorized
access:  public


Parameters:

IUser   $user   the user object

[ Top ]

method onInitRecursive [line 1065]

void onInitRecursive( mixed $param)



access:  protected


Overrides TControl::onInitRecursive() (Calls onInit of this control and its children recursively.)

[ Top ]

method onLoadRecursive [line 1074]

void onLoadRecursive( mixed $param)



access:  protected


Overrides TControl::onLoadRecursive() (Calls onLoad of this control and its children recursively.)

[ Top ]

method onPreInit [line 981]

void onPreInit( mixed $param)



access:  protected


[ Top ]

method onPreRenderRecursive [line 1083]

void onPreRenderRecursive( mixed $param)



access:  protected


Overrides TControl::onPreRenderRecursive() (Calls onPreRender of this control and its children recursively.)

[ Top ]

method onUnloadRecursive [line 1092]

void onUnloadRecursive( mixed $param)



access:  protected


Overrides TControl::onUnloadRecursive() (Calls onUnload of this control and its children recursively.)

[ Top ]

method raisePostDataChangedEvents [line 323]

void raisePostDataChangedEvents( )

Raises PostDataChanged event for each postdata loader whose data is changed.

This method should only be used by framework developers.




access:  public


[ Top ]

method registerArrayDeclaration [line 661]

void registerArrayDeclaration( string $name, string $value)

Register an element of a javascript array to be created on client side.

The elements of multiple registration of the same array name will be merged together.




access:  public


Parameters:

string   $name   the name of the array
string   $value   the value of the array element

[ Top ]

method registerBeginScript [line 703]

void registerBeginScript( string $key, string $script)

Registers a javascript block to be rendered right after the openning form element.



access:  public
see:  TPage::isBeginScriptRegistered()


Parameters:

string   $key   a key that identifies the script block to avoid repetitive registration
string   $script   the javascript block

[ Top ]

method registerClientScript [line 1124]

void registerClientScript( mixed $scripts)



access:  public


[ Top ]

method registerContentPlaceHolder [line 402]

void registerContentPlaceHolder( TContentPlaceHolder $placeHolder)

Registers a content placeholder with the page.



access:  public


Parameters:

TContentPlaceHolder   $placeHolder  

[ Top ]

method registerEndScript [line 731]

void registerEndScript( string $key, string $script)

Register a javascript block to be rendered right before the closing form element.



access:  public
see:  TPage::isEndScriptRegistered()


Parameters:

string   $key   a key that identifies the script block to avoid repetitive registration
string   $script   the javascript block

[ Top ]

method registerHiddenField [line 606]

void registerHiddenField( string $name, string $value)

Registers a hidden field to be submitted upon client postback event.



access:  public


Parameters:

string   $name   name of the hidden field
string   $value   value of the hidden field

[ Top ]

method registerOnSubmitStatement [line 633]

void registerOnSubmitStatement( string $key, string $script)

Registers a javascript statement to be executed upon client postback event.



access:  public


Parameters:

string   $key   a key that identifies the statement to avoid repetitive registration
string   $script   the javascript statement to be registered

[ Top ]

method registerPostBackCandidate [line 471]

void registerPostBackCandidate( IPostBackEventHandler $control)

Registers a postback event handler.



access:  public


Parameters:

IPostBackEventHandler   $control   the control that wants to respond to postback event

[ Top ]

method registerPostDataLoader [line 452]

void registerPostDataLoader( IPostBackDataHandler $control)

Registers a postdata loader.

The control must implement IPostBackDataHandler interface.




access:  public


Overridden in child classes as:

TCallbackPage::registerPostDataLoader()
Registers a postdata loader. This allows the callback request to collect the form inputs.

Parameters:

IPostBackDataHandler   $control   the control that wants to load postback data

[ Top ]

method registerScriptFile [line 764]

void registerScriptFile( string $key, string $scriptFile)

Registers a javascript file to be loaded in client side



access:  public
see:  TPage::isScriptFileRegistered()


Parameters:

string   $key   a key that identifies the script file to avoid repetitive registration
string   $scriptFile   the javascript file which can be relative or absolute URL

[ Top ]

method registerStyleFile [line 804]

void registerStyleFile( string $key, string $styleFile)

Registers a CSS style file to be imported with the page body



access:  public
see:  TPage::isStyleFileRegistered()


Parameters:

string   $key   a key that identifies the style file to avoid repetitive registration
string   $styleFile   the javascript file which can be relative or absolute URL

[ Top ]

method registerValidator [line 393]

void registerValidator( IValidator $validator)

Registers a validator with the page.

The validator must implement IValidator interface




access:  public


Parameters:

IValidator   $validator   the validator to be registered

[ Top ]

method registerViewState [line 591]

void registerViewState( string $value)

Registers the viewstate into each form so that regardless of which

form triggers the postback, viewstate is found for the whole page




access:  public


Parameters:

string   $value   The value to register for the viewstate

[ Top ]

method renderBody [line 1037]

string renderBody( )

Renders the body content.

This is overridden so that the THead control can be caught and have its rendering deferred. This is so that if any other controls on the page want to register scripts or styles, the rendering of the head will be delayed until later. Thanks to stever on the prado forums for the very elegant memory location reassignment method for building the content string whether or not there's a THead present or not.




return:  the rendering result
access:  protected
author:  Marcus Nyeholt <tanus@users.sourceforge.net>


Overrides TControl::renderBody() (Renders the body content.)

[ Top ]

method renderContent [line 1009]

void renderContent( )



access:  protected


[ Top ]

method savePageStateToPersistenceMedium [line 371]

void savePageStateToPersistenceMedium( array $viewState)

Saves viewstate of the page and all its children to a persistence medium.

This method should only be used by framework developers.






Parameters:

array   $viewState   the viewstate structure of the page and all its children

[ Top ]

method saveViewState [line 1112]

void saveViewState( )



access:  public


Overrides TControl::saveViewState() (Returns the viewstate of this component and its children.)

[ Top ]

method setForm [line 217]

void setForm( TForm $form)

Attaches the form object to the page.

If the




access:  public


Parameters:

TForm   $form   an instance of TForm or its desendent class

[ Top ]

method setHead [line 280]

void setHead( THead $head)

sets the current page's Head object.



access:  public


Parameters:

THead   $head   The head object

[ Top ]

method setMasterPageName [line 873]

void setMasterPageName( string $pageName)

Sets the master page name.

This method should only be invoked at the beginning of onPreInit() method.




access:  public


Parameters:

string   $pageName  

[ Top ]

method setModule [line 847]

void setModule( TModule $module)

Sets the module object.

This method should only be used by framework developers.




access:  public


Parameters:

TModule   $module  

[ Top ]

method setPostBackParameter [line 520]

void setPostBackParameter( string $value)

Sets postback parameter



access:  public


Parameters:

string   $value   postback parameter to be passed to postback event handler

[ Top ]

method setPostBackTarget [line 490]

void setPostBackTarget( string $uniqueID)

Sets postback target by its unique ID



access:  public


Parameters:

string   $uniqueID   the unique ID of the postback target

[ Top ]

method setTheme [line 298]

void setTheme( string $theme)



access:  public


Parameters:

string   $theme   the name of the theme to be applied to the page

[ Top ]

method unregisterContentPlaceHolder [line 423]

void unregisterContentPlaceHolder( TContentPlaceHolder $placeHolder)

Unregisters a content placeholder with the page.



access:  public


Parameters:

TContentPlaceHolder   $placeHolder  

[ Top ]

method unregisterPostBackCandidate [line 480]

void unregisterPostBackCandidate( TControl $control)

Unregisters a postback handler from the page.



access:  public


Parameters:

TControl   $control   the postback candidate control

[ Top ]

method unregisterPostDataLoader [line 461]

void unregisterPostDataLoader( TControl $control)

Unregister a postdata loader from the page.



access:  public


Overridden in child classes as:

TCallbackPage::unregisterPostDataLoader()
Unregister a postdata loader from the page.

Parameters:

TControl   $control   the post data loader control

[ Top ]

method unregisterValidator [line 441]

void unregisterValidator( TControl $control)

Unregisters a validator from the page.



access:  public


Parameters:

TControl   $control   the validator control

[ Top ]

method unsetForm [line 236]

void unsetForm( TForm $form)

Detaches the form object from the page.



access:  public


Parameters:

TForm   $form   an instance of TForm or its desendent class

[ Top ]

method validate [line 538]

void validate( )

Invokes validate() method of every registered validator and update isValid accordingly.



access:  public
see:  TPage::isValid()


[ Top ]


Class Constants

INPUT_EVENTPARAMETER = '__EVENTPARAMETER'

[line 62]

hidden form field name for event parameter


[ Top ]

INPUT_EVENTTARGET = '__EVENTTARGET'

[line 58]

hidden form field name for event target


[ Top ]

INPUT_VIEWSTATE = '__VIEWSTATE'

[line 54]

hidden form field name for viewstate


[ Top ]

JS_POSTBACK = '__doPostBack'

[line 66]

name of javascript function that submits a form


[ Top ]

STAGE_CREATE = 0

[line 70]

the current life cycle that the page is in


[ Top ]

STAGE_INIT = 1

[line 71]


[ Top ]

STAGE_LOAD = 3

[line 73]


[ Top ]

STAGE_LOADVIEWSTATE = 2

[line 72]


[ Top ]

STAGE_PRERENDER = 5

[line 75]


[ Top ]

STAGE_RAISEEVENTS = 4

[line 74]


[ Top ]

STAGE_RENDER = 7

[line 77]


[ Top ]

STAGE_SAVEVIEWSTATE = 6

[line 76]


[ Top ]

STAGE_UNLOAD = 8

[line 78]


[ Top ]



© 2004-2005 PRADO Software Group. All Rights Reserved.