Source for file NiksTheme.class.php

Documentation is available at NiksTheme.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/Theme.class.php");
  4.  
  5. require_once(HARMONI."GUIManager/StyleCollection.class.php");
  6.  
  7. require_once(HARMONI."GUIManager/StyleProperties/BackgroundColorSP.class.php");
  8. require_once(HARMONI."GUIManager/StyleProperties/ColorSP.class.php");
  9. require_once(HARMONI."GUIManager/StyleProperties/BorderSP.class.php");
  10. require_once(HARMONI."GUIManager/StyleProperties/BorderTopSP.class.php");
  11. require_once(HARMONI."GUIManager/StyleProperties/BorderRightSP.class.php");
  12. require_once(HARMONI."GUIManager/StyleProperties/BorderBottomSP.class.php");
  13. require_once(HARMONI."GUIManager/StyleProperties/BorderLeftSP.class.php");
  14. require_once(HARMONI."GUIManager/StyleProperties/MarginSP.class.php");
  15. require_once(HARMONI."GUIManager/StyleProperties/PaddingSP.class.php");
  16. require_once(HARMONI."GUIManager/StyleProperties/FontSP.class.php");
  17. require_once(HARMONI."GUIManager/StyleProperties/FontFamilySP.class.php");
  18. require_once(HARMONI."GUIManager/StyleProperties/FontSizeSP.class.php");
  19. require_once(HARMONI."GUIManager/StyleProperties/FontWeightSP.class.php");
  20. require_once(HARMONI."GUIManager/StyleProperties/TextAlignSP.class.php");
  21. require_once(HARMONI."GUIManager/StyleProperties/TextDecorationSP.class.php");
  22. require_once(HARMONI."GUIManager/StyleProperties/DisplaySP.class.php");
  23.  
  24. /**
  25. * A very basic theme based on simple borders and colored blocks.
  26. * <br /><br />
  27. * A <code>Theme</code> is a combination of two things: first, it stores a variety
  28. * of reusable <code>StyleCollections</code> and second, it offers a mechanism for
  29. * printing an HTML web page.
  30. * <br /><br />
  31. * Each <code>Theme</code> has a set of style collections that correspond to
  32. * each component type.
  33. * <br /><br />
  34. * Each <code>Theme</code> has a single component (could be container) that will
  35. * be printed when <code>printPage()</code> is called.
  36. *
  37. * @package harmoni.gui.themes
  38. *
  39. * @copyright Copyright &copy; 2005, Middlebury College
  40. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  41. *
  42. * @version $Id: NiksTheme.class.php,v 1.3 2007/09/04 20:25:23 adamfranco Exp $
  43. */
  44. class NiksTheme extends Theme {
  45.  
  46. /**
  47. * The constructor. All initialization and Theme customization is performed
  48. * here.
  49. * @access public
  50. ***/
  51. function NiksTheme() {
  52. $this->Theme("Nik's Theme", "A basic theme based on simple borders and colored blocks.");
  53. // =====================================================================
  54. // global Theme style
  55. $body = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
  56. $sp1 = new BackgroundColorSP("#AAA");
  57. $body->addSP($sp1);
  58. $this->registerSP($sp1);
  59. $body->addSP(new ColorSP("#000"));
  60. $sp2 = new FontSP("Times New Roman","12px");
  61. $this->registerSP($sp2);
  62. $body->addSP($sp2);
  63. $body->addSP(new PaddingSP("0px"));
  64. $body->addSP(new MarginSP("0px"));
  65. $this->addGlobalStyle($body);
  66.  
  67. $links = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
  68. $links->addSP(new TextDecorationSP("underline"));
  69. $this->addGlobalStyle($links);
  70.  
  71. $links_hover = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of hover links.");
  72. $links_hover->addSP(new TextDecorationSP("underline"));
  73. $this->addGlobalStyle($links_hover);
  74.  
  75. // =====================================================================
  76. // Block 1 style
  77. $block1 = new StyleCollection("*.block1", "block1", "Block 1", "The main block where normally all of the page content goes in.");
  78. $block1->addSP(new BackgroundColorSP("#FFFFFF"));
  79. $block1->addSP(new ColorSP("#000"));
  80. $block1->addSP(new BorderTopSP("1px", "solid", "#000"));
  81. $block1->addSP(new BorderRightSP("3px", "solid", "#000"));
  82. $block1->addSP(new BorderBottomSP("3px", "solid", "#000"));
  83. $block1->addSP(new BorderLeftSP("1px", "solid", "#000"));
  84. $block1->addSP(new PaddingSP("10px"));
  85. $block1->addSP(new MarginSP("10px"));
  86. $this->addStyleForComponentType($block1, BLOCK, 1);
  87. // =====================================================================
  88. // Block 2 style
  89. $block2 = new StyleCollection("*.block2", "block2", "Block 2", "A 2nd level block.");
  90. //$block2->addSP(new PaddingSP("10px"));
  91. $block2->addSP(new TextAlignSP("justify"));
  92. $this->addStyleForComponentType($block2, BLOCK, 2);
  93. // =====================================================================
  94. // Block 3 style
  95. $block3 = new StyleCollection("*.block3", "block3", "Block 3", "A 3rd level block.");
  96. //$block3->addSP(new BackgroundColorSP("#FFFFFF"));
  97. //$block3->addSP(new ColorSP("#000"));
  98. //$block3->addSP(new BorderSP("1px", "solid", "#000"));
  99. $block3->addSP(new PaddingSP("10px"));
  100. $block3->addSP(new TextAlignSP("justify"));
  101. $this->addStyleForComponentType($block3, BLOCK, 3);
  102. // =====================================================================
  103. // Block 4 style
  104. $block4 = new StyleCollection("*.block4", "block4", "Block 4", "A 4th level block.");
  105. $block4->addSP(new BackgroundColorSP("#D4D4D4"));
  106. $block4->addSP(new ColorSP("#000"));
  107. $block4->addSP(new BorderTopSP("1px", "solid", "#000"));
  108. $block4->addSP(new BorderRightSP("1px", "solid", "#000"));
  109. $block4->addSP(new BorderBottomSP("1px", "solid", "#000"));
  110. $block4->addSP(new BorderLeftSP("1px", "solid", "#000"));
  111. $block4->addSP(new PaddingSP("10px"));
  112. $block4->addSP(new MarginSP("10px"));
  113. $this->addStyleForComponentType($block4, BLOCK, 4);
  114. // =====================================================================
  115. // Heading 1 style
  116. $heading1 = new StyleCollection("*.heading1", "heading1", "Heading 1", "A 1st level heading.");
  117. $heading1->addSP(new ColorSP("#F00"));
  118. $heading1->addSP(new FontSizeSP("200%"));
  119. $this->addStyleForComponentType($heading1, HEADING, 1);
  120. // =====================================================================
  121. // Heading 2 style
  122. $heading2 = new StyleCollection("*.heading2", "heading2", "Heading 2", "A 2nd level heading.");
  123. $heading2->addSP(new BackgroundColorSP("#D4D4D4"));
  124. $heading2->addSP(new ColorSP("#007"));
  125. $heading2->addSP(new FontSizeSP("125%"));
  126. $heading2->addSP(new PaddingSP("10px"));
  127. $heading2->addSP(new MarginSP("10px"));
  128. $heading2->addSP(new BorderTopSP("1px", "solid", "#000"));
  129. $this->addStyleForComponentType($heading2, HEADING, 2);
  130.  
  131. // =====================================================================
  132. // Footer 1 style
  133. $footer1 = new StyleCollection("*.footer1", "footer1", "Footer 1", "A 1st level footer.");
  134. $footer1->addSP(new ColorSP("#959595"));
  135. $footer1->addSP(new MarginSP("10px"));
  136. $footer1->addSP(new FontSizeSP("125%"));
  137. $this->addStyleForComponentType($footer1, FOOTER, 1);
  138. // =====================================================================
  139. // Menu 1 style
  140. $menu1 = new StyleCollection("*.menu1", "menu1", "Menu 1", "A 1st level menu.");
  141. $menu1->addSP(new BackgroundColorSP("#D4D4D4"));
  142. $menu1->addSP(new ColorSP("#000"));
  143. $menu1->addSP(new BorderSP("1px", "solid", "#000"));
  144. $this->addStyleForComponentType($menu1, MENU, 1);
  145. // =====================================================================
  146. // Menu Heading 1 style
  147. $menuHeading1 = new StyleCollection("*.menuHeading1", "menuHeading1", "Menu Heading 1", "A 1st level menu heading.");
  148. $menuHeading1->addSP(new DisplaySP("block"));
  149. $menuHeading1->addSP(new BackgroundColorSP("#AAA"));
  150. $menuHeading1->addSP(new PaddingSP("10px"));
  151. //$menuHeading1->addSP(new FontWeightSP("bold"));
  152. $this->addStyleForComponentType($menuHeading1, MENU_ITEM_HEADING, 1);
  153. // =====================================================================
  154. // Menu Unselected Link 1 style
  155. $menuLink1_unselected = new StyleCollection("*.menuLink1_unselected a", "menuLink1_unselected", "Unselected Menu Link 1", "A 1st level unselected menu link.");
  156. $menuLink1_unselected->addSP(new DisplaySP("block"));
  157. $menuLink1_unselected->addSP(new BackgroundColorSP("#D4D4D4"));
  158. $menuLink1_unselected->addSP(new PaddingSP("10px"));
  159. $this->addStyleForComponentType($menuLink1_unselected, MENU_ITEM_LINK_UNSELECTED, 1);
  160. $menuLink1_hover = new StyleCollection("*.menuLink1_hover a:hover", "menuLink1_hover", "Menu Link 1 Hover", "A 1st level menu link hover behavior.");
  161. $menuLink1_hover->addSP(new BackgroundColorSP("#AAA"));
  162. $this->addStyleForComponentType($menuLink1_hover, MENU_ITEM_LINK_UNSELECTED, 1);
  163. // =====================================================================
  164. // Menu Selected Link 1 style
  165. $menuLink1_selected = new StyleCollection("*.menuLink1_selected a", "menuLink1_selected", "Selected Menu Link 1", "A 1st level selected menu link.");
  166. $menuLink1_selected->addSP(new DisplaySP("block"));
  167. $menuLink1_selected->addSP(new BackgroundColorSP("#AAA"));
  168. $menuLink1_selected->addSP(new PaddingSP("10px"));
  169. $this->addStyleForComponentType($menuLink1_selected, MENU_ITEM_LINK_SELECTED, 1);
  170. }
  171.  
  172.  
  173. }
  174.  
  175. ?>

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