Class TTheme

Description

Implements interfaces:

TTheme class

TTheme represents a particular theme. It is merely a collection of skins that are applicable to the corresponding controls.

Each theme is stored as a directory and files under that directory. The theme name is the directory name. When TTheme is created, the files whose name has the extension ".skin" are parsed and saved as controls skins.

A skin is essentially a list of initial property values that are to be applied to a control when the skin is applied. Each type of control can have multiple skins identified by the SkinID. If a skin does not have SkinID, it is the default skin that will be applied to controls that do not specify particular SkinID.

Whenever possible, TTheme will try to make use of available cache to save the parsing time.

To apply a theme to a particular control, call applySkin.

  • author: Qiang Xue <qiang.xue@gmail.com>
  • version: $Id: TThemeManager.php 3035 2011-08-30 13:58:52Z GODZilla0480@gmail.com $
  • since: 3.0

Located in /Web/UI/TThemeManager.php (line 213)

TComponent
   |
   --TApplicationComponent
      |
      --TTheme
Class Constant Summary
 SKIN_FILE_EXT = '.skin'
 THEME_CACHE_PREFIX = 'prado:theme:'
Method Summary
TTheme __construct (string $themePath, string $themeUrl)
boolean applySkin (TControl $control)
string getBasePath ()
string getBaseUrl ()
string getName ()
array getSkins ()
void setBasePath (string $value)
void setBaseUrl (string $value)
void setJavaScriptFiles (array $value)
void setName (string $value)
void setSkins (array $value)
void setStyleSheetFiles (array $value)
Methods
Constructor __construct (line 254)

Constructor.

  • throws: TConfigurationException if theme path does not exist or any parsing error of the skin files
  • access: public
TTheme __construct (string $themePath, string $themeUrl)
  • string $themePath: theme path
  • string $themeUrl: theme URL
applySkin (line 420)

Applies the theme to a particular control.

The control's class name and SkinID value will be used to identify which skin to be applied. If the control's SkinID is empty, the default skin will be applied.

  • return: if a skin is successfully applied
  • throws: TConfigurationException if any error happened during the skin application
  • access: public
boolean applySkin (TControl $control)
  • TControl $control: the control to be applied with a skin

Implementation of:
ITheme::applySkin()
Applies this theme to the specified control.
getBasePath (line 382)
  • return: the file path to the theme folder
  • access: public
string getBasePath ()
getBaseUrl (line 366)
  • return: the URL to the theme folder (without ending slash)
  • access: public
string getBaseUrl ()
getJavaScriptFiles (line 503)
  • return: list of Javascript files (URL) in the theme
  • access: public
array getJavaScriptFiles ()
getName (line 350)
  • return: theme name
  • access: public
string getName ()
getSkins (line 398)
  • return: list of skins for the theme
  • access: public
array getSkins ()
getStyleSheetFiles (line 487)
  • return: list of CSS files (URL) in the theme
  • access: public
array getStyleSheetFiles ()
setBasePath (line 390)
  • access: protected
void setBasePath (string $value)
  • string $value: tthe file path to the theme folder
setBaseUrl (line 374)
  • access: protected
void setBaseUrl (string $value)
  • string $value: the URL to the theme folder
setJavaScriptFiles (line 511)
  • access: protected
void setJavaScriptFiles (array $value)
  • array $value: list of Javascript files (URL) in the theme
setName (line 358)
  • access: protected
void setName (string $value)
  • string $value: theme name
setSkins (line 406)
  • access: protected
void setSkins (array $value)
  • array $value: list of skins for the theme
setStyleSheetFiles (line 495)
  • access: protected
void setStyleSheetFiles (array $value)
  • array $value: list of CSS files (URL) in the theme

Inherited Methods

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants
SKIN_FILE_EXT = '.skin' (line 222)

Extension name of skin files

THEME_CACHE_PREFIX = 'prado:theme:' (line 218)

prefix for cache variable name used to store parsed themes

Documentation generated on Mon, 25 Jun 2012 14:39:30 +0200 by phpDocumentor 1.4.3