PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TPageService

TPageService class.

TPageService implements the service for serving user page requests.

Pages that are available to client users are stored under a directory specified by setBasePath BasePath. The directory may contain subdirectories. Pages serving for a similar goal are usually placed under the same directory. A directory may contain a configuration file config.xml whose content is similar to that of application configuration file.

A page is requested via page path, which is a dot-connected directory names appended by the page name. Assume '<BasePath>/Users/Admin' is the directory containing the page 'Update'. Then the page can be requested via 'Users.Admin.Update'. By default, the setBasePath BasePath of the page service is the "pages" directory under the application base path. You may change this default by setting setBasePath BasePath with a different path you prefer.

Page name refers to the file name (without extension) of the page template. In order to differentiate from the common control template files, the extension name of the page template files must be '.page'. If there is a PHP file with the same page name under the same directory as the template file, that file will be considered as the page class file and the file name is the page class name. If such a file is not found, the page class is assumed as TPage.

Modules can be configured and loaded in page directory configurations. Configuration of a module in a subdirectory will overwrite its parent directory's configuration, if both configurations refer to the same module.

By default, TPageService will automatically load two modules:

  • TTemplateManager : manages page and control templates
  • TThemeManager : manages themes used in a Prado application

In page directory configurations, static authorization rules can also be specified, which governs who and which roles can access particular pages. Refer to TAuthorizationRule for more details about authorization rules. Page authorization rules can be configured within an <authorization> tag in each page directory configuration as follows, <authorization> <deny pages="Update" users="?" /> <allow pages="Admin" roles="administrator" /> <deny pages="Admin" users="*" /> </authorization> where the 'pages' attribute may be filled with a sequence of comma-separated page IDs. If 'pages' attribute does not appear in a rule, the rule will be applied to all pages in this directory and all subdirectories (recursively). Application of authorization rules are in a bottom-up fashion, starting from the directory containing the requested page up to all parent directories. The first matching rule will be used. The last rule always allows all users accessing to any resources.

TComponent
Extended by TApplicationComponent
Extended by TService implements IService
Extended by TPageService

Direct known subclasses

TWsatService
Package: System\Web\Services
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Since: 3.0
Located at Web/Services/TPageService.php
Methods summary
public
# init( TXmlElement $config )

Initializes the service. This method is required by IService interface and is invoked by application.

Initializes the service. This method is required by IService interface and is invoked by application.

Parameters

$config
TXmlElement
service configuration

Overrides

TService::init()
protected
# initPageContext( TPageConfiguration $pageConfig )

Initializes page context. Page context includes path alias settings, namespace usages, parameter initialization, module loadings, page initial properties and authorization rules.

Initializes page context. Page context includes path alias settings, namespace usages, parameter initialization, module loadings, page initial properties and authorization rules.

Parameters

$pageConfig
TPageConfiguration
protected
# applyConfiguration( TPageConfiguration $config )

Applies a page configuration.

Applies a page configuration.

Parameters

$config
TPageConfiguration
the configuration
protected string
# determineRequestedPagePath( )

Determines the requested page path.

Determines the requested page path.

Returns

string
page path requested
protected TPageConfiguration
# loadPageConfig( TXmlElement $config )

Collects configuration for a page.

Collects configuration for a page.

Parameters

$config
TXmlElement
additional configuration specified in the application configuration

Returns

TPageConfiguration
public TTemplateManager
# getTemplateManager( )

Returns

TTemplateManager
template manager
public
# setTemplateManager( TTemplateManager $value )

Parameters

$value
TTemplateManager
template manager
public TThemeManager
# getThemeManager( )

Returns

TThemeManager
theme manager
public
# setThemeManager( TThemeManager $value )

Parameters

$value
TThemeManager
theme manager
public string
# getRequestedPagePath( )

Returns

string
the requested page path
public TPage
# getRequestedPage( )

Returns

TPage
the requested page
public string
# getDefaultPage( )

Returns

string
default page path to be served if no explicit page is request. Defaults to 'Home'.
public
# setDefaultPage( string $value )

Parameters

$value
string
default page path to be served if no explicit page is request

Throws

TInvalidOperationException
if the page service is initialized
public string
# getDefaultPageUrl( )

Returns

string
the URL for the default page
public string
# getBasePath( )

Returns

string
the root directory for storing pages. Defaults to the 'pages' directory under the application base path.
public
# setBasePath( string $value )

Parameters

$value
string
root directory (in namespace form) storing pages

Throws

TInvalidOperationException
if the service is initialized already or basepath is invalid
public
# setBasePageClass( string $value )

Sets the base page class name (in namespace format). If a page only has a template file without page class file, this base page class will be instantiated.

Sets the base page class name (in namespace format). If a page only has a template file without page class file, this base page class will be instantiated.

Parameters

$value
string
class name
public string
# getBasePageClass( )

Returns

string
base page class name in namespace format. Defaults to 'TPage'.
public
# setClientScriptManagerClass( string $value )

Sets the clientscript manager class (in namespace format).

Sets the clientscript manager class (in namespace format).

Parameters

$value
string
class name

Since

3.1.7
public string
# getClientScriptManagerClass( )

Returns

string
clientscript manager class in namespace format. Defaults to 'System.Web.UI.TClientScriptManager'.

Since

3.1.7
public
# run( )

Runs the service. This will create the requested page, initializes it with the property values specified in the configuration, and executes the page.

Runs the service. This will create the requested page, initializes it with the property values specified in the configuration, and executes the page.

Overrides

TService::run()
protected TPage
# createPage( string $pagePath )

Creates a page instance based on requested page path.

Creates a page instance based on requested page path.

Parameters

$pagePath
string
requested page path

Returns

TPage
the requested page instance

Throws

THttpException
if requested page path is invalid
TConfigurationException
if the page class cannot be found
protected
# runPage( TPage $page, array $properties )

Executes a page.

Executes a page.

Parameters

$page
TPage
the page instance to be run
$properties
array
list of initial page properties
public string
# constructUrl( string $pagePath, array $getParams = null, boolean $encodeAmpersand = true, boolean $encodeGetItems = true )

Constructs a URL with specified page path and GET parameters.

Constructs a URL with specified page path and GET parameters.

Parameters

$pagePath
string
page path
$getParams
array
list of GET parameters, null if no GET parameters required
$encodeAmpersand
boolean
whether to encode the ampersand in URL, defaults to true.
$encodeGetItems
boolean
whether to encode the GET parameters (their names and values), defaults to true.

Returns

string
URL for the page and GET parameters
Methods inherited from TService
getEnabled(), getID(), setEnabled(), setID()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __construct(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string CONFIG_FILE_XML 'config.xml'
#

Configuration file name

Configuration file name

string CONFIG_FILE_PHP 'config.php'
#

Configuration file name

Configuration file name

string DEFAULT_BASEPATH 'Pages'
#

Default base path

Default base path

string FALLBACK_BASEPATH 'pages'
#

Fallback base path - used to be the default up to Prado < 3.2

Fallback base path - used to be the default up to Prado < 3.2

string CONFIG_CACHE_PREFIX 'prado:pageservice:'
#

Prefix of ID used for storing parsed configuration in cache

Prefix of ID used for storing parsed configuration in cache

string PAGE_FILE_EXT '.page'
#

Page template file extension

Page template file extension

Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO