Source for file Theme.interface.php

Documentation is available at Theme.interface.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/Component.interface.php");
  4. require_once(HARMONI."GUIManager/Container.interface.php");
  5. require_once(HARMONI."GUIManager/StyleCollection.interface.php");
  6.  
  7. /**
  8. * A <code>Theme</code> is a combination of two things: first, it stores a variety
  9. * of reusable <code>StyleCollections</code> and second, it offers a mechanism for
  10. * printing an HTML web page.
  11. * <br /><br />
  12. * Each <code>Theme</code> has a set of style collections that correspond to
  13. * each component type.
  14. * <br /><br />
  15. * Each <code>Theme</code> has a single component (could be container) that will
  16. * be printed when <code>printPage()</code> is called.
  17. *
  18. * @package harmoni.gui
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: Theme.interface.php,v 1.14 2007/09/04 20:25:21 adamfranco Exp $
  24. ***/
  25. class ThemeInterface {
  26.  
  27. /**
  28. * Returns the display name of this Theme.
  29. * @access public
  30. * @return string The display name of this Theme.
  31. ***/
  32. function getDisplayName() {
  33. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  34. }
  35.  
  36. /**
  37. * Sets the display name of this Theme.
  38. * @access public
  39. * @param string displayName The new display name of this Theme.
  40. ***/
  41. function setDisplayName($displayName) {
  42. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  43. }
  44.  
  45. /**
  46. * Returns the description of this Theme.
  47. * @access public
  48. * @return string The description of this Theme.
  49. ***/
  50. function getDescription() {
  51. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  52. }
  53.  
  54. /**
  55. * Sets the description of this Theme.
  56. * @access public
  57. * @param string description The new description of this Theme.
  58. ***/
  59. function setDescription($description) {
  60. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  61. }
  62. /**
  63. * Attaches to the Theme a style collection that will have a global effect
  64. * on the page look and feel. For example, this could be a style collection
  65. * affecting the <code>body</code> HTML element.
  66. * @access public
  67. * @param ref object styleCollection The style collection to attach.
  68. ***/
  69. function addGlobalStyle($styleCollection) {
  70. }
  71.  
  72. /**
  73. * Answers the Style Collection that has global effects.
  74. *
  75. * @access public
  76. * @param ref object styleCollection The style collection to attach.
  77. ***/
  78. function getGlobalStyle() {
  79. }
  80. /**
  81. * This method returns all style collections for the given component type and
  82. * the given numeric index.
  83. * <br /><br />
  84. * Each <code>Theme</code> has a set of style collections that correspond to
  85. * a combination of a component type and a numeric index. For example, the user
  86. * can define two style collections for components of type BLOCK and index 1 and
  87. * a totally different set of three style collections for componets of type
  88. * MENU and index 2.
  89. * <br /><br />
  90. * The index has no semantic meaning: you can think of the index as 'level' of the
  91. * component. Alternatively, the index could serve as means of distinguishing
  92. * between components with the same type.
  93. * For example, a BLOCK component with index 2 will normally have a
  94. * different set of style collections than a BLOCK component with index 1.
  95. * <br /><br />
  96. * Another way of interpreting the index is drawing a parallel to the HTML headings
  97. * &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, ..., where the lower the index,
  98. * the more "prominent" the look of the component.
  99. * <br /><br />
  100. * The style collections would be normally set by the
  101. * <code>setStyleForComponentType()</code> method in the Theme constructor.
  102. * @access public
  103. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  104. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  105. * @param integer index The index that will determine which style collections
  106. * to return. If the given index is greater than the maximal registered index
  107. * for the given component type, then the highest index availible will be used.
  108. * @return ref array An array of Style Collections.
  109. ***/
  110. function getStylesForComponentType($type, $index) {
  111. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  112. }
  113. /**
  114. * Registers the specified style collection with the given component type.
  115. * @access public
  116. * @param ref object styleCollection The style collection to add.
  117. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  118. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  119. * @param integer index The index with which to register the style collection.
  120. * For a description of the role of indices, see the documentation of
  121. * <code>getStylesForComponentType()</code>.
  122. ***/
  123. function addStyleForComponentType($styleCollection, $type, $index) {
  124. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  125. }
  126. /**
  127. * Sets the HTML string that needs to be printed before an attempt is made
  128. * to render components of the given type and index. Note: use of the PreHTML
  129. * and PostHTML get/set methods is discouraged - use styles instead: see
  130. * <code>addStyleForComponentType()</code> and <code>getStylesForComponentType()</code>.
  131. * @access public
  132. * @param string html The HTML code to use.
  133. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  134. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  135. * @param integer index The index with which to register the HTML string.
  136. * For a description of the role of indices, see the documentation of
  137. * <code>getStylesForComponentType()</code>.
  138. ***/
  139. function setPreHTMLForComponentType($html, $type, $index) {
  140. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  141. }
  142.  
  143. /**
  144. * Returns the HTML string that needs to be printed before an attempt is made
  145. * to render components of the given type and index. Note: use of the PreHTML
  146. * and PostHTML get/set methods is discouraged - use styles instead: see
  147. * <code>addStyleForComponentType()</code> and <code>getStylesForComponentType()</code>.
  148. * @access public
  149. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  150. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  151. * @param integer index The index that will determine which HTML string to return
  152. * If the given index is greater than the maximal registered index
  153. * for the given component type, then the highest index availible will be used.
  154. * @return string The HTML string.
  155. ***/
  156. function getPreHTMLForComponentType($type, $index) {
  157. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  158. }
  159. /**
  160. * Sets the HTML string that needs to be printed after successful rendering
  161. * of components of the given type and index. Note: use of the PreHTML
  162. * and PostHTML get/set methods is discouraged - use styles instead: see
  163. * <code>addStyleForComponentType()</code> and <code>getStylesForComponentType()</code>.
  164. * @access public
  165. * @param string html The HTML code to use.
  166. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  167. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  168. * @param integer index The index with which to register the HTML string.
  169. * For a description of the role of indices, see the documentation of
  170. * <code>getStylesForComponentType()</code>.
  171. ***/
  172. function setPostHTMLForComponentType($html, $type, $index) {
  173. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  174. }
  175. /**
  176. * Returns the HTML string that needs to be printed after successful rendering
  177. * of components of the given type and index. Note: use of the PreHTML
  178. * and PostHTML get/set methods is discouraged - use styles instead: see
  179. * <code>addStyleForComponentType()</code> and <code>getStylesForComponentType()</code>.
  180. * @access public
  181. * @param integer type The type of the component. One of BLANK, HEADING, FOOTER,
  182. * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  183. * @param integer index The index that will determine which HTML string to return
  184. * If the given index is greater than the maximal registered index
  185. * for the given component type, then the highest index availible will be used.
  186. * @return string The HTML string.
  187. ***/
  188. function getPostHTMLForComponentType($type, $index) {
  189. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  190. }
  191.  
  192. /**
  193. * Returns the component of this <code>Theme</code>.
  194. * @access public
  195. * @return ref object The component of this <code>Theme</code>.
  196. ***/
  197. function getComponent() {
  198. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  199. }
  200. /**
  201. * Sets the component of this <code>Theme</code>.
  202. * @access public
  203. * @param ref object A component.
  204. ***/
  205. function setComponent($component) {
  206. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  207. }
  208.  
  209. /**
  210. * Returns all CSS code: The CSS code for the Theme, the various component types,
  211. * the theme component and all sub-components (if any). Theme styles should come
  212. * first, followed by individual component's styles to allow the latter to take
  213. * precedence.
  214. * @access public
  215. * @param string tabs This is a string (normally a bunch of tabs) that will be
  216. * prepended to each text line. This argument is optional but its usage is highly
  217. * recommended in order to produce a nicely formatted HTML output.
  218. * @return string CSS code.
  219. ***/
  220. function getCSS($tabs = "") {
  221. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  222. }
  223. /**
  224. * Prints the HTML page.
  225. * @access public
  226. ***/
  227. function printPage() {
  228. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  229. }
  230.  
  231. /**
  232. * Adds the given StyleProperty to the internally maintained list of mutable
  233. * (updateable) style properties and assigns it an id. This method and
  234. * the <code>getRegisteredSP</code> method enable the user to quickly change
  235. * the values of key Theme settings. For example,
  236. * let us assume that Bob has created his own theme and he has added a global
  237. * style collection for the main content block. Bob would like to allow the
  238. * user to change the width property of that collection. In order to do so,
  239. * Bob needs to call <code>registerSP()</code> and pass the WidthSP
  240. * object accordingly. This WidthSP object must be the same object that had
  241. * been added to the aforementioned global style collection. The user now can
  242. * call <code>getRegisteredSP</code> with the id that was returned by
  243. * <code>registerSP</code> and access/modify the <code>WidthSP</code> object.
  244. * @access public
  245. * @param ref object sp The StyleProperty object that will be registered as
  246. * mutable within this Theme.
  247. * @param string postImportMethod This is the name of the method that will
  248. * be called after this SP is imported. This can be useful in case other
  249. * properties depend on the content of this property, but the user does not
  250. * to export all of them.
  251. * @return integer An integer id assigned to the given style property. The id
  252. * only meaningful within the context of this Theme (i.e. this is not a system wide unique id).
  253. ***/
  254. function registerSP($sp, $postImportMethod) {
  255. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  256. }
  257. /**
  258. * This methods exports the content of a registered style property object. The
  259. * output is implementation specific. The only requirement is that if the output
  260. * of this method is passed as an input to <code>importRegisteredSP()</code>,
  261. * then the contents of the <code>StyleProperty</code> should not change.
  262. * @access public
  263. * @param integer id The id of the <code>StyleProperty</code> as returned
  264. * by <code>registerSP()</code>.
  265. * @return mixed The contens of the <code>StyleProperty</code>. The output
  266. * representation is implementation specific.
  267. ***/
  268. function exportRegisteredSP($id) {
  269. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  270. }
  271. /**
  272. * This method is like <code>exportRegisteredSP</code> but exports all
  273. * registered stlye properties at the same time. The output is an array
  274. * whose elements are the inividual export data as returned by <code>exportRegisteredSP</code>.
  275. * @access public
  276. * @return array An array containing the export data for each registered
  277. * <code>StylePorperty</code>. The indexes of the array are the ids of the
  278. * style properties.
  279. ***/
  280. function exportAllRegisteredSPs() {
  281. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  282. }
  283. /**
  284. * Imports the contents of a registered mutable <code>StyleProperty</code>.
  285. * The input to this method should be an output obtained from calling
  286. * <code>exportRegisteredSP</code> on the same <code>StyleProperty</code>.
  287. * @access public
  288. * @param integer id The id of the <code>StyleProperty</code> as returned
  289. * by <code>registerSP()</code>.
  290. * @param mixed importData The contens of the <code>StyleProperty</code> as exported by
  291. * <code>exportRegisteredSP()</code>.
  292. * @return ref object The updated <code>StyleProperty</code> object.
  293. ***/
  294. function importRegisteredSP($id, $importData) {
  295. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  296. }
  297. /**
  298. * Returns a <code> </code>previously registered by <code>registerSP()</code>
  299. * for the given id.
  300. * @access public
  301. * @param integer id The id identifying which StyleProperty to return; as returned
  302. * by <code>registerSP()</code>.
  303. * @return ref object A <code>StylePorperty</code> object.
  304. ***/
  305. function getRegisteredSP($id) {
  306. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  307. }
  308. /**
  309. * Returns all registered mutable style properties in an array whose indexes are the
  310. * ids of the style properties (as returned by <code>registerSP()</code>).
  311. * @access public
  312. * @return ref array An array containing all registered mutable
  313. * <code>StyleProperty</code> objects.
  314. ***/
  315. function getAllRegisteredSPs() {
  316. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  317. }
  318. }
  319.  
  320. ?>

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