[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/Services/ -> TPageService.php (sommaire)

TPageService class file.

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TPageService.php 1508 2006-11-25 20:42:54Z xue $
Poids: 753 lignes (24 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 2 classes

TPageService:: (19 méthodes):
  __construct()
  init()
  initPageContext()
  determineRequestedPagePath()
  loadPageConfig()
  getTemplateManager()
  setTemplateManager()
  getThemeManager()
  setThemeManager()
  getRequestedPagePath()
  getRequestedPage()
  getDefaultPage()
  setDefaultPage()
  getBasePath()
  setBasePath()
  setBasePageClass()
  getBasePageClass()
  run()
  constructUrl()

TPageConfiguration:: (9 méthodes):
  getProperties()
  getAliases()
  getUsings()
  getModules()
  getParameters()
  getRules()
  loadConfigurationFiles()
  loadFromFile()
  loadXmlElement()


Classe: TPageService  - X-Ref

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
{@link 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 <b>config.xml</b> 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 {@link setBasePath BasePath} of the page service is the "pages"
directory under the application base path. You may change this default
by setting {@link 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 {@link 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:
- {@link TTemplateManager} : manages page and control templates
- {@link 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 {@link 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.

__construct()   X-Ref
Constructor.
Sets default service ID to 'page'.


init($config)   X-Ref
Initializes the service.
This method is required by IService interface and is invoked by application.

param: TXmlElement service configuration

initPageContext($pageConfig)   X-Ref
Initializes page context.
Page context includes path alias settings, namespace usages,
parameter initialization, module loadings, page initial properties
and authorization rules.

param: TPageConfiguration

determineRequestedPagePath()   X-Ref
Determines the requested page path.

return: string page path requested

loadPageConfig($pagePath,$config=null)   X-Ref
Collects configuration for a page.

param: string page path in the format of Path.To.Page
param: TXmlElement additional configuration
return: TPageConfiguration

getTemplateManager()   X-Ref

return: TTemplateManager template manager

setTemplateManager(TTemplateManager $value)   X-Ref

param: TTemplateManager template manager

getThemeManager()   X-Ref

return: TThemeManager theme manager

setThemeManager(TThemeManager $value)   X-Ref

param: TThemeManager theme manager

getRequestedPagePath()   X-Ref

return: string the requested page path

getRequestedPage()   X-Ref

return: TPage the requested page

getDefaultPage()   X-Ref

return: string default page path to be served if no explicit page is request. Defaults to 'Home'.

setDefaultPage($value)   X-Ref

param: string default page path to be served if no explicit page is request

getBasePath()   X-Ref

return: string the root directory for storing pages. Defaults to the 'pages' directory under the application base path.

setBasePath($value)   X-Ref

param: string root directory (in namespace form) storing pages

setBasePageClass($value)   X-Ref
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.

param: string class name

getBasePageClass()   X-Ref

return: string base page class name in namespace format. Defaults to 'TPage'.

run()   X-Ref
Runs the service.
This will create the requested page, initializes it with the property values
specified in the configuration, and executes the page.


constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)   X-Ref
Constructs a URL with specified page path and GET parameters.

param: string page path
param: array list of GET parameters, null if no GET parameters required
param: boolean whether to encode the ampersand in URL, defaults to true.
param: boolean whether to encode the GET parameters (their names and values), defaults to true.
return: string URL for the page and GET parameters

Classe: TPageConfiguration  - X-Ref

TPageConfiguration class

TPageConfiguration represents the configuration for a page.
The page is specified by a dot-connected path.
Configurations along this path are merged together to be provided for the page.

getProperties()   X-Ref
Returns list of page initial property values.
Each array element represents a single property with the key
being the property name and the value the initial property value.

return: array list of page initial property values

getAliases()   X-Ref
Returns list of path alias definitions.
The definitions are aggregated (top-down) from configuration files along the path
to the specified page. Each array element represents a single alias definition,
with the key being the alias name and the value the absolute path.

return: array list of path alias definitions

getUsings()   X-Ref
Returns list of namespaces to be used.
The namespaces are aggregated (top-down) from configuration files along the path
to the specified page. Each array element represents a single namespace usage,
with the value being the namespace to be used.

return: array list of namespaces to be used

getModules()   X-Ref
Returns list of module configurations.
The module configurations are aggregated (top-down) from configuration files
along the path to the specified page. Each array element represents
a single module configuration, with the key being the module ID and
the value the module configuration. Each module configuration is
stored in terms of an array with the following content
([0]=>module type, [1]=>module properties, [2]=>complete module configuration)
The module properties are an array of property values indexed by property names.
The complete module configuration is a TXmlElement object representing
the raw module configuration which may contain contents enclosed within
module tags.

return: array list of module configurations to be used

getParameters()   X-Ref
Returns list of parameter definitions.
The parameter definitions are aggregated (top-down) from configuration files
along the path to the specified page. Each array element represents
a single parameter definition, with the key being the parameter ID and
the value the parameter definition. A parameter definition can be either
a string representing a string-typed parameter, or an array.
The latter defines a component-typed parameter whose format is as follows,
([0]=>component type, [1]=>component properties)
The component properties are an array of property values indexed by property names.

return: array list of parameter definitions to be used

getRules()   X-Ref
Returns list of authorization rules.
The authorization rules are aggregated (bottom-up) from configuration files
along the path to the specified page.

return: TAuthorizationRuleCollection collection of authorization rules

loadConfigurationFiles($pagePath,$basePath)   X-Ref
Loads configuration for a page specified in a path format.

param: string path to the page (dot-connected format)
param: string root path for pages

loadFromFile($fname,$page)   X-Ref
Loads a specific config file.

param: string config file name
param: string page name, null if page is not required

loadXmlElement($dom,$configPath,$page)   X-Ref
Loads a specific configuration xml element.

param: TXmlElement config xml element
param: string base path corresponding to this xml element
param: string page name, null if page is not required



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7