phpDocumentor table
[ class tree: table ] [ index: table ] [ all elements ]

Source for file Th.php

Documentation is available at Th.php

  1. <?
  2. /**
  3. * @package table
  4. * @filesource
  5. * @see HTML_TABLE_COMPONENT_PATH.'/Th.php'
  6. * @copyright (c) http://Finn-Rasmussen.com
  7. * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
  8. * @author http://Finn-Rasmussen.com
  9. * @version 1.9
  10. * @since 21-oct-2005
  11. */
  12.  
  13. /**
  14. * The required files
  15. */
  16. require_once(HTML_PATH.'/Html.php');
  17.  
  18. /**
  19. * The Table Header Data.
  20. * Generates a table Header column
  21. * <code>
  22. * +--------------------------------
  23. * | header_1 |
  24. * +--------------------------------
  25. * Usage:
  26. * $th = new Th($class,$valign,$align);
  27. * print $th->getHtml();
  28. * Or
  29. * Th::display($class,$valign,$align);
  30. * Or
  31. * Th::start($class,$valign,$align);
  32. * :
  33. * Th::end();
  34. * </code>
  35. * @package table
  36. */
  37.  
  38. class Th extends Html {
  39. /**
  40. * @var String $class The CSS class name for the TH
  41. */
  42. var $class = '';
  43.  
  44. /**
  45. * @var String $valign The html THr valign attribute
  46. */
  47. var $valign = '';
  48.  
  49. /**
  50. * @var String $align The html TH align attribute
  51. */
  52. var $align = '';
  53.  
  54. /**
  55. * Constructor
  56. * @param String $class The class name
  57. * @param String $valign The valignment of data
  58. * @param String $align The alignment of data
  59. */
  60. function Th($class='',$valign='',$align='') {
  61. $this->Html();
  62. $this->class = $class!=''?$class:'';
  63. $this->valign = $valign!=''?$valign:'top';
  64. $this->align = $align!=''?$align:'';
  65. }
  66.  
  67. /**
  68. * Get the start html for a TH
  69. * @return String the html
  70. */
  71. function getStart() {
  72. $html = ' <th';
  73. $html .= $this->getAttribute('class');
  74. $html .= $this->getAttribute('valign');
  75. $html .= $this->getAttribute('align');
  76. $html .= ">";
  77. return $html;
  78. }
  79.  
  80. /**
  81. * Get the end html for a TH
  82. * @return String the html
  83. */
  84. function getEnd() {
  85. return "</th>\r\n";
  86. }
  87.  
  88. /**
  89. * Get the complete html for a TH
  90. * @return String the html
  91. */
  92. function getHtml() {
  93. $html = '';
  94. $html .= $this->getStart();
  95. $html .= $this->getElements();
  96. $html .= $this->getEnd();
  97. return $html;
  98. }
  99.  
  100.  
  101. /**
  102. * Get the start of the tag
  103. * <code>
  104. * Usage:
  105. * Th::start($class,$valign,$align);
  106. * </code>
  107. * @static
  108. * @param String $class The class name
  109. * @param String $valign The valignment of data
  110. * @param String $align The alignment of data
  111. */
  112. function start($class='',$valign='',$align='') {
  113. $html = new Th($class,$valign,$align);
  114. $html->addHtml($html->getStart());
  115. }
  116.  
  117. /**
  118. * Get the end of the tag
  119. * <code>
  120. * Usage:
  121. * Th::end();
  122. * </code>
  123. * @static
  124. */
  125. function end() {
  126. $html = new Html();
  127. $html->addHtml(Th::getEnd());
  128. }
  129.  
  130. /**
  131. * Display html
  132. * <code>
  133. * Usage:
  134. * Th::display($class,$valign,$align);
  135. * </code>
  136. * @static
  137. * @param String $class The class name
  138. * @param String $valign The valignment of data
  139. * @param String $align The alignment of data
  140. */
  141. function display($class='',$valign='',$align='') {
  142. $html = new Th($class,$valign,$align);
  143. $html->addHtml();
  144. }
  145. }
  146. ?>

Documentation generated on Thu, 22 Dec 2005 17:20:37 +0100 by phpDocumentor 1.3.0RC3