Class ThemeInterface

Description

A

  1. Theme
is a combination of two things: first, it stores a variety of reusable
  1. StyleCollections
and second, it offers a mechanism for printing an HTML web page.



Each

  1. Theme
has a set of style collections that correspond to each component type.

Each
  1. Theme
has a single component (could be container) that will be printed when
  1. printPage()
is called.

  • version: $Id: Theme.interface.php,v 1.14 2007/09/04 20:25:21 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/GUIManager/Theme.interface.php (line 25)


	
			
Direct descendents
Class Description
Theme A generic
  1. Theme
implementation. It should be sufficient just to extend it to create new fully fledged Themes.
Method Summary
void addGlobalStyle (ref $styleCollection)
void addStyleForComponentType (ref $styleCollection, integer $type, integer $index)
mixed exportRegisteredSP (integer $id)
ref getComponent ()
string getCSS ([string $tabs = ""])
string getDescription ()
string getDisplayName ()
void getGlobalStyle (ref 0)
string getPostHTMLForComponentType (integer $type, integer $index)
string getPreHTMLForComponentType (integer $type, integer $index)
ref getRegisteredSP (integer $id)
ref getStylesForComponentType (integer $type, integer $index)
ref importRegisteredSP (integer $id, mixed $importData)
void printPage ()
integer registerSP (ref $sp, string $postImportMethod)
void setComponent (ref $component)
void setDescription (string $description)
void setDisplayName (string $displayName)
void setPostHTMLForComponentType (string $html, integer $type, integer $index)
void setPreHTMLForComponentType (string $html, integer $type, integer $index)
Methods
addGlobalStyle (line 70)

Attaches to the Theme a style collection that will have a global effect on the page look and feel. For example, this could be a style collection affecting the

  1. body
HTML element.

  • access: public
void addGlobalStyle (ref $styleCollection)
  • ref $styleCollection: object styleCollection The style collection to attach.

Redefined in descendants as:
  • Theme::addGlobalStyle() : Attaches to the Theme a style collection that will have a global effect on the page look and feel. For example, this could be a style collection affecting the
    1. body
    HTML element.
addStyleForComponentType (line 126)

Registers the specified style collection with the given component type.

  • access: public
void addStyleForComponentType (ref $styleCollection, integer $type, integer $index)
  • ref $styleCollection: object styleCollection The style collection to add.
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index with which to register the style collection. For a description of the role of indices, see the documentation of
    1. getStylesForComponentType()
    .

Redefined in descendants as:
exportAllRegisteredSPs (line 292)

This method is like

  1. exportRegisteredSP
but exports all registered stlye properties at the same time. The output is an array whose elements are the inividual export data as returned by
  1. exportRegisteredSP
.

  • return: An array containing the export data for each registered
    1. StylePorperty
    . The indexes of the array are the ids of the style properties.
  • access: public
array exportAllRegisteredSPs ()

Redefined in descendants as:
  • Theme::exportAllRegisteredSPs() : This method is like
    1. exportRegisteredSP
    but exports all registered stlye properties at the same time. The output is an array whose elements are the inividual export data as returned by
    1. exportRegisteredSP
    .
exportRegisteredSP (line 278)

This methods exports the content of a registered style property object. The output is implementation specific. The only requirement is that if the output of this method is passed as an input to

  1. importRegisteredSP()
, then the contents of the
  1. StyleProperty
should not change.

  • return: The contens of the
    1. StyleProperty
    . The output representation is implementation specific.
  • access: public
mixed exportRegisteredSP (integer $id)

Redefined in descendants as:
  • Theme::exportRegisteredSP() : This methods exports the content of a registered style property object. The output is implementation specific. The only requirement is that if the output of this method is passed as an input to
    1. importRegisteredSP()
    , then the contents of the
    1. StyleProperty
    should not change.
getAllRegisteredSPs (line 331)

Returns all registered mutable style properties in an array whose indexes are the ids of the style properties (as returned by

  1. registerSP()
).

  • return: array An array containing all registered mutable
    1. StyleProperty
    objects.
  • access: public
ref getAllRegisteredSPs ()

Redefined in descendants as:
  • Theme::getAllRegisteredSPs() : Returns all registered mutable style properties in an array whose indexes are the ids of the style properties (as returned by
    1. registerSP()
    ).
getComponent (line 203)

Returns the component of this

  1. Theme
.

  • return: object The component of this
    1. Theme
    .
  • access: public
ref getComponent ()

Redefined in descendants as:
getCSS (line 227)

Returns all CSS code: The CSS code for the Theme, the various component types, the theme component and all sub-components (if any). Theme styles should come first, followed by individual component's styles to allow the latter to take precedence.

  • return: CSS code.
  • access: public
string getCSS ([string $tabs = ""])
  • string $tabs: tabs This is a string (normally a bunch of tabs) that will be prepended to each text line. This argument is optional but its usage is highly recommended in order to produce a nicely formatted HTML output.

Redefined in descendants as:
  • Theme::getCSS() : Returns all CSS code: The CSS code for the Theme, the various component types, the theme component and all sub-components (if any). Theme styles should come first, followed by individual component's styles to allow the latter to take precedence.
getDescription (line 50)

Returns the description of this Theme.

  • return: The description of this Theme.
  • access: public
string getDescription ()

Redefined in descendants as:
getDisplayName (line 32)

Returns the display name of this Theme.

  • return: The display name of this Theme.
  • access: public
string getDisplayName ()

Redefined in descendants as:
getGlobalStyle (line 79)

Answers the Style Collection that has global effects.

  • access: public
void getGlobalStyle (ref 0)
  • ref 0: object styleCollection The style collection to attach.
getPostHTMLForComponentType (line 194)

Returns the HTML string that needs to be printed after successful rendering of components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see

  1. addStyleForComponentType()
and
  1. getStylesForComponentType()
.

  • return: The HTML string.
  • access: public
string getPostHTMLForComponentType (integer $type, integer $index)
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index that will determine which HTML string to return If the given index is greater than the maximal registered index for the given component type, then the highest index availible will be used.

Redefined in descendants as:
  • Theme::getPostHTMLForComponentType() : Returns the HTML string that needs to be printed after successful rendering of components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see
    1. addStyleForComponentType()
    and
    1. getStylesForComponentType()
    .
getPreHTMLForComponentType (line 160)

Returns the HTML string that needs to be printed before an attempt is made to render components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see

  1. addStyleForComponentType()
and
  1. getStylesForComponentType()
.

  • return: The HTML string.
  • access: public
string getPreHTMLForComponentType (integer $type, integer $index)
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index that will determine which HTML string to return If the given index is greater than the maximal registered index for the given component type, then the highest index availible will be used.

Redefined in descendants as:
  • Theme::getPreHTMLForComponentType() : Returns the HTML string that needs to be printed before an attempt is made to render components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see
    1. addStyleForComponentType()
    and
    1. getStylesForComponentType()
    .
getRegisteredSP (line 320)

Returns a

previously registered by
  1. registerSP()
for the given id.

  • return: object A
    1. StylePorperty
    object.
  • access: public
ref getRegisteredSP (integer $id)
  • integer $id: id The id identifying which StyleProperty to return; as returned by
    1. registerSP()
    .

Redefined in descendants as:
getStylesForComponentType (line 112)

This method returns all style collections for the given component type and the given numeric index.



Each

  1. Theme
has a set of style collections that correspond to a combination of a component type and a numeric index. For example, the user can define two style collections for components of type BLOCK and index 1 and a totally different set of three style collections for componets of type MENU and index 2.

The index has no semantic meaning: you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. For example, a BLOCK component with index 2 will normally have a different set of style collections than a BLOCK component with index 1.

Another way of interpreting the index is drawing a parallel to the HTML headings <h1>, <h2>, <h3>, ..., where the lower the index, the more "prominent" the look of the component.

The style collections would be normally set by the
  1. setStyleForComponentType()
method in the Theme constructor.

  • return: array An array of Style Collections.
  • access: public
ref getStylesForComponentType (integer $type, integer $index)
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index that will determine which style collections to return. If the given index is greater than the maximal registered index for the given component type, then the highest index availible will be used.

Redefined in descendants as:
importRegisteredSP (line 308)

Imports the contents of a registered mutable

  1. StyleProperty
.

The input to this method should be an output obtained from calling

  1. exportRegisteredSP
on the same
  1. StyleProperty
.

  • return: object The updated
    1. StyleProperty
    object.
  • access: public
ref importRegisteredSP (integer $id, mixed $importData)

Redefined in descendants as:
printPage (line 235)

Prints the HTML page.

  • access: public
void printPage ()

Redefined in descendants as:
registerSP (line 263)

Adds the given StyleProperty to the internally maintained list of mutable

(updateable) style properties and assigns it an id. This method and the

  1. getRegisteredSP
method enable the user to quickly change the values of key Theme settings. For example, let us assume that Bob has created his own theme and he has added a global style collection for the main content block. Bob would like to allow the user to change the width property of that collection. In order to do so, Bob needs to call
  1. registerSP()
and pass the WidthSP object accordingly. This WidthSP object must be the same object that had been added to the aforementioned global style collection. The user now can call
  1. getRegisteredSP
with the id that was returned by
  1. registerSP
and access/modify the
  1. WidthSP
object.

  • return: An integer id assigned to the given style property. The id only meaningful within the context of this Theme (i.e. this is not a system wide unique id).
  • access: public
integer registerSP (ref $sp, string $postImportMethod)
  • ref $sp: object sp The StyleProperty object that will be registered as mutable within this Theme.
  • string $postImportMethod: postImportMethod This is the name of the method that will be called after this SP is imported. This can be useful in case other properties depend on the content of this property, but the user does not to export all of them.

Redefined in descendants as:
  • Theme::registerSP() : Adds the given StyleProperty to the internally maintained list of mutable
setComponent (line 212)

Sets the component of this

  1. Theme
.

  • access: public
void setComponent (ref $component)
  • ref $component: object A component.

Redefined in descendants as:
setDescription (line 59)

Sets the description of this Theme.

  • access: public
void setDescription (string $description)
  • string $description: description The new description of this Theme.

Redefined in descendants as:
setDisplayName (line 41)

Sets the display name of this Theme.

  • access: public
void setDisplayName (string $displayName)
  • string $displayName: displayName The new display name of this Theme.

Redefined in descendants as:
setPostHTMLForComponentType (line 177)

Sets the HTML string that needs to be printed after successful rendering of components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see

  1. addStyleForComponentType()
and
  1. getStylesForComponentType()
.

  • access: public
void setPostHTMLForComponentType (string $html, integer $type, integer $index)
  • string $html: html The HTML code to use.
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index with which to register the HTML string. For a description of the role of indices, see the documentation of
    1. getStylesForComponentType()
    .

Redefined in descendants as:
  • Theme::setPostHTMLForComponentType() : Sets the HTML string that needs to be printed after successful rendering of components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see
    1. addStyleForComponentType()
    and
    1. getStylesForComponentType()
    .
setPreHTMLForComponentType (line 143)

Sets the HTML string that needs to be printed before an attempt is made to render components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see

  1. addStyleForComponentType()
and
  1. getStylesForComponentType()
.

  • access: public
void setPreHTMLForComponentType (string $html, integer $type, integer $index)
  • string $html: html The HTML code to use.
  • integer $type: type The type of the component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index with which to register the HTML string. For a description of the role of indices, see the documentation of
    1. getStylesForComponentType()
    .

Redefined in descendants as:
  • Theme::setPreHTMLForComponentType() : Sets the HTML string that needs to be printed before an attempt is made to render components of the given type and index. Note: use of the PreHTML and PostHTML get/set methods is discouraged - use styles instead: see
    1. addStyleForComponentType()
    and
    1. getStylesForComponentType()
    .

Documentation generated on Wed, 19 Sep 2007 10:27:19 -0400 by phpDocumentor 1.3.0RC3