- <?
- /**
- * @package table
- * @filesource
- * @see HTML_TABLE_COMPONENT_PATH.'/Td.php'
- * @copyright (c) http://Finn-Rasmussen.com
- * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
- * @author http://Finn-Rasmussen.com
- * @version 1.9
- * @since 21-oct-2005
- */
-
- /**
- * The required files
- */
- require_once(HTML_PATH.'/Html.php');
-
- /**
- * Generates a table Data column
- * <code>
- * +--------------------------------
- * | dat_1 |
- * +--------------------------------
- * Usage:
- * $td = new Td($class,$valign,$colspan);
- * print $td->getHtml();
- * Or
- * Td::display($class,$valign,$colspan);
- * Or
- * Td::start($class,$valign,$colspan);
- * :
- * Td::end();
- * </code>
- * @package table
- */
-
- class Td extends Html {
- var $class = '';
- var $valign = '';
- var $colspan = '';
-
- /**
- * Constructor
- * @param String $class The class name
- * @param String $valign The alignment of data
- * @param String $colspan The Column Span
- */
- function Td($class='',$valign='',$colspan='') {
- $this->Html();
- $this->class = $class!=''?$class:'';
- $this->valign = $valign!=''?$valign:'top';
- $this->colspan = $colspan!=''?$colspan:'';
- }
-
- /**
- * Get the start html for a TD
- * @return String the html
- */
- function getStart() {
- $html = ' <td';
- $html .= $this->getAttribute('class');
- $html .= $this->getAttribute('valign');
- $html .= $this->getAttribute('colspan');
- $html .= ">";
- return $html;
- }
-
- /**
- * Get the end html for a TD
- * @return String the html
- */
- function getEnd() {
- return "</td>\r\n";
- }
-
- /**
- * Get the complete html for a TD
- * @return String the html
- */
- function getHtml() {
- $html = '';
- $html .= $this->getStart();
- $html .= $this->getElements();
- $html .= $this->getEnd();
- return $html;
- }
-
-
- /**
- * Get the start of the tag
- * <code>
- * Usage:
- * Td::start($class,$valign,$colspan);
- * </code>
- * @static
- * @param String $class The class name
- * @param String $valign The alignment of data
- * @param String $colspan The Column Span
- */
- function start($class='',$valign='',$colspan='') {
- $html = new Td($class,$valign,$colspan);
- $html->addHtml($html->getStart());
- }
-
- /**
- * Get the end of the tag
- * <code>
- * Usage:
- * Td::end();
- * </code>
- * @static
- */
- function end() {
- $html = new Html();
- $html->addHtml(Td::getEnd());
- }
-
- /**
- * Display html
- * <code>
- * Usage:
- * Td::display($class,$valign,$colspan);
- * </code>
- * @static
- * @param String $class The class name
- * @param String $valign The alignment of data
- * @param String $colspan The Column Span
- */
- function display($class='',$valign='',$colspan='') {
- $html = new Td($class,$valign,$colspan);
- $html->addHtml();
- }
- }
- ?>