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

Source for file Td.php

Documentation is available at Td.php

  1. <?
  2. /**
  3. * @package table
  4. * @filesource
  5. * @see HTML_TABLE_COMPONENT_PATH.'/Td.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. * Generates a table Data column
  20. * <code>
  21. * +--------------------------------
  22. * | dat_1 |
  23. * +--------------------------------
  24. * Usage:
  25. * $td = new Td($class,$valign,$colspan);
  26. * print $td->getHtml();
  27. * Or
  28. * Td::display($class,$valign,$colspan);
  29. * Or
  30. * Td::start($class,$valign,$colspan);
  31. * :
  32. * Td::end();
  33. * </code>
  34. * @package table
  35. */
  36.  
  37. class Td extends Html {
  38. var $class = '';
  39. var $valign = '';
  40. var $colspan = '';
  41.  
  42. /**
  43. * Constructor
  44. * @param String $class The class name
  45. * @param String $valign The alignment of data
  46. * @param String $colspan The Column Span
  47. */
  48. function Td($class='',$valign='',$colspan='') {
  49. $this->Html();
  50. $this->class = $class!=''?$class:'';
  51. $this->valign = $valign!=''?$valign:'top';
  52. $this->colspan = $colspan!=''?$colspan:'';
  53. }
  54.  
  55. /**
  56. * Get the start html for a TD
  57. * @return String the html
  58. */
  59. function getStart() {
  60. $html = ' <td';
  61. $html .= $this->getAttribute('class');
  62. $html .= $this->getAttribute('valign');
  63. $html .= $this->getAttribute('colspan');
  64. $html .= ">";
  65. return $html;
  66. }
  67.  
  68. /**
  69. * Get the end html for a TD
  70. * @return String the html
  71. */
  72. function getEnd() {
  73. return "</td>\r\n";
  74. }
  75.  
  76. /**
  77. * Get the complete html for a TD
  78. * @return String the html
  79. */
  80. function getHtml() {
  81. $html = '';
  82. $html .= $this->getStart();
  83. $html .= $this->getElements();
  84. $html .= $this->getEnd();
  85. return $html;
  86. }
  87.  
  88.  
  89. /**
  90. * Get the start of the tag
  91. * <code>
  92. * Usage:
  93. * Td::start($class,$valign,$colspan);
  94. * </code>
  95. * @static
  96. * @param String $class The class name
  97. * @param String $valign The alignment of data
  98. * @param String $colspan The Column Span
  99. */
  100. function start($class='',$valign='',$colspan='') {
  101. $html = new Td($class,$valign,$colspan);
  102. $html->addHtml($html->getStart());
  103. }
  104.  
  105. /**
  106. * Get the end of the tag
  107. * <code>
  108. * Usage:
  109. * Td::end();
  110. * </code>
  111. * @static
  112. */
  113. function end() {
  114. $html = new Html();
  115. $html->addHtml(Td::getEnd());
  116. }
  117.  
  118. /**
  119. * Display html
  120. * <code>
  121. * Usage:
  122. * Td::display($class,$valign,$colspan);
  123. * </code>
  124. * @static
  125. * @param String $class The class name
  126. * @param String $valign The alignment of data
  127. * @param String $colspan The Column Span
  128. */
  129. function display($class='',$valign='',$colspan='') {
  130. $html = new Td($class,$valign,$colspan);
  131. $html->addHtml();
  132. }
  133. }
  134. ?>

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