Source for file SimpleTheme1.class.php

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

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