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 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 '/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 tag in each page directory configuration as follows, 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.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Author: Carl G. Mathisen (carlgmathisen@gmail.com)
Inheritance: extends Prado\TService
Exemplo n.º 1
0
 public function init($config)
 {
     if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) {
         throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes.");
     }
     if (empty($this->_pass)) {
         throw new TConfigurationException("You need to specify the Password attribute.");
     }
     $this->setDefaultPage("TWsatHome");
     $this->_startThemeManager();
     parent::init($config);
 }