class TableHeader extends Table {
/**
* @var String $text The text heading
*/
var $text = '';
/**
* @var String $text The Image object
*/
var $image = NULL;
/**
* 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
*/
function TableHeader($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$this->Table($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
if (defined('DEBUG_LEVEL') && DEBUG_LEVEL & DEBUG_LEVEL_SHOW_INFO) {
//$this->text = $text!=''?$text:$this->getClassName().'(), you forgot to add text';
} else {
$this->text = trim($text!=''?$text:'');
}
$this->image = NULL;
}
/**
* Return a new content object for table header
* @return Object The table header as html
*/
function newContent() {
$tr = new Tr();
$image = $this->newTriangle(IMAGE_ARROW_HEADLINE);
if ($this->image!=NULL) {
$image = $this->image;
}
$td = new Td(CSS_ARROW_HEADLINE,'middle','',$image);
$tr->add($td);
$rawvalue = ucfirst(str_replace('_',' ',$this->text));
$text = Htmlspecialchars::encode($rawvalue);
$th = new Th(CSS_COLOR_HEADER,'','left',$text);
$tr->add($th);
return $tr;
}
/**
* Toogle the request parameters which will minimize or maximize this component
* You may override this function in order to create the minimize functionality
* @abstract
* @return array The array of key=>value pair
*/
function getMinimize() {
return array(); // Dymmy stub
}
/**
* Builds the html for a table header, and return it
* @return String The table header as html
*/
function getHtml() {
$html = $this->html;
if (HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
if ($this->text!='') {
$this->add($this->newContent());
// Render it
$html .= $this->getStart();
$html .= $this->getEnd();
} else {
$html .= '<!-- No text in TableHeader -->'."\r\n";
}
}
return $html;
}
/**
* Display html
* <code>
* Usage:
* TableHeader::display($text,$width,$class,$border,$cellPadding,$cellSpacing);
* </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
*/
function display($text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
$html = new TableHeader($text,$width,$class,$border,$cellPadding,$cellSpacing);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for TableHeader klassen
<?
<!-- No text in TableHeader -->
?>
Class methods
Her er 'klasse metoderne' for TableHeader klassen: