/**
* The required files
*/
require_once(HTML_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Table.php');
require_once(HTML_BASE_UTIL_PATH.'/Images.php');
/**
* Used to draw a line, in order to show some visual effects
* <code>
* Usage:
* $line = new Line($height,$text,$width,$height,$class,$border,$cellPadding,$cellSpacing);
* print $line->getHtml();
* Or
* Line::display($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @package layout
*/
class Line extends Table {
var $height = '';
var $lineclass = '';
/**
* Constructor
* @param String $height The height of the line
* @param String $text The text header for the table
* @param String $width The width of the table, default 100%
* @param String $class The css class to use
* @param String $border The table border
* @param String $cellPadding
* @param String $cellSpacing
*/
function Line($height='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
$theText = $text!=''?$text:'';
$theWidth = $width!=''?$width:LINE_VIEW_WIDTH;
$theBorder = $border!=''?$border:LINE_VIEW_BORDER;
$theCellPadding = $cellPadding!=''?$cellPadding:LINE_VIEW_CELLPADDING;
$theCellSpacing = $cellSpacing!=''?$cellSpacing:LINE_VIEW_CELLSPACING;
$this->Table($theText,$theWidth,CSS_PRINTER,$theBorder,$theCellPadding,$theCellSpacing);
$this->height = $height!=''?$height:LINE_VIEW_HEIGHT;
$this->lineclass = $class!=''?LINE_VIEW_CLASS.' '.$class:LINE_VIEW_CLASS;
}
/**
* Get the CSS class Name for this component
* @return String The CSS class name
*/
function getCssClass() {
return $this->lineclass;
}
/**
* Return the content as an object
* @return Object The content as an object
*/
function newContent() {
$tr = new Tr();
$img = new Images(IMAGE_BLANK,$this->width,$this->height);
$td = new Raw('<td class="'.$this->getCssClass().'">'.$img->getHtml().'</td>');
$tr->add($td);
return $tr;
}
/**
* Builds the html, and return it for a Line object
* @return String The html
*/
function getHtml() {
$html = $this->html;
if (defined('LAYOUT_SHOW') && LAYOUT_SHOW & LAYOUT_SHOW_LINE && HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
$this->add($this->newContent());
// Render it
if ($this->text != '') {
$html .= $this->getTableHeader();
}
$html .= $this->getStart();
$html .= $this->getEnd();
}
return $html;
}
/**
* Display html
* <code>
* Usage:
* Line::display($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @static
* @param String $height The height of the line
* @param String $text The text header for the table
* @param String $width The width of the table, default 100%
* @param String $class The css class to use
* @param String $border The table border
* @param String $cellPadding
* @param String $cellSpacing
*/
function display($height='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
$html = new Line($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
$html->addHtml();
}
}
?>