/**
* The required files
*/
require_once(HTML_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Table.php');
/**
* Generates a Tab navigation menu
* <code>
* ______________+-------+_________________
* | link1 |link2 | link3 | link4 | |
* +--------------+ +-----------------+
* | |
* | Tab Body |
* | |
* +-------- tab end -----------------------+
* Usage:
* $html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* print $html->getStart();
* print "The tab body";
* print $html->getEnd();
* Or
* TabBody::start($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* Raw::display"The tab body");
* TabBody::end();
* Or
* TabBody::display($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* </code>
* @package tab
*/
class TabBody extends Table {
/**
* Constructor
* @param String $text The text header for the table
* @param String $width The Width for the table
* @param String $class The Class
* @param String $border The Border
* @param String $cellpadding The CellSpacing
* @param String $cellspacing The CellPadding
* @param String $summary The Summary
* @param String $caption The Caption
*/
function TabBody($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$theText = $text!=''?$text:'';
$theWidth = $width!=''?$width:TAB_BODY_WIDTH;
$theClass = $class!=''?$class:TAB_BODY_CLASS;
$theBorder = $border!=''?$border:TAB_BODY_BORDER;
$thePadding = $cellpadding!=''?$cellpadding:TAB_BODY_CELL_PADDING;
$theSpacing = $cellspacing!=''?$cellspacing:TAB_BODY_CELL_SPACING;
$this->Table($theText,$theWidth,$theClass,$theBorder,$thePadding,$theSpacing,$summary,$caption);
}
/**
* Get the content as an object
* @return Object The content
*/
function newContent() {
$object = new Tr();
$object->add(new Td(CSS_TAB_BODY));
return $object;
}
/**
* Builds the html for a Tab menu, and return it
* @return String The tab menu as html
*/
function getHtml() {
$html = $this->html;
if (defined('TAB_SHOW') && TAB_SHOW & TAB_SHOW_MENU_TAB) {
if (CACHE_TAB && $this->getCacheFileName(CACHE_TAB_PATH)!='' && file_exists($this->getCacheFileName(CACHE_TAB_PATH))) {
$html .= $this->content($this->getCacheFileName(CACHE_TAB_PATH));
} else {
$this->add($this->newContent());
// Render it
if ($this->text != '') {
$html .= $this->getTableHeader();
}
$html .= $this->getStart();
$html .= $this->getEnd();
if (CACHE_TAB) {
$this->save($html, CACHE_TAB_PATH);
}
}
}
return $html;
}
/**
* Get the start of the table tag
* <code>
* Usage:
* TableBody::start($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* </code>
* @static
* @param String $text The text header for the table
* @param String $width The Width for the table
* @param String $class The Class
* @param String $border The Border
* @param String $cellpadding The CellSpacing
* @param String $cellspacing The CellPadding
* @param String $summary The Summary
* @param String $caption The Caption
*/
function start($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
if ($text != '') {
$html->addHtml($html->getTableHeader());
}
$html->addHtml($html->getStart());
// Note: you must write the start TR + TD your self
}
/**
* Get the end of the table tag
* <code>
* Usage:
* TableBody::end($type);
* </code>
* @static
*/
function end() {
$html = new TabBody();
// Note: you must write the end TD + TR your self
$html->addHtml($html->getEnd());
}
/**
* Display the html
* <code>
* Usage:
* TabBody::display($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* </code>
* @static
* @param String $text The text header for the table
* @param String $width The Width for the table
* @param String $class The Class
* @param String $border The Border
* @param String $cellpadding The CellSpacing
* @param String $cellspacing The CellPadding
* @param String $summary The Summary
* @param String $caption The Caption
*/
function display($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
$html->addHtml();
}
}
?>