class Banner extends TableDataReader {
/**
* Constructor
* @param DataReader $datareader The Data Reader object
* @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 Banner($datareader='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
$theText = $text!=''?$text:'';
$theWidth = $width!=''?$width:BANNER_VIEW_WIDTH;
$theClass = $class!=''?$class:BANNER_VIEW_CLASS;
$theBorder = $border!=''?$border:BANNER_VIEW_BORDER;
$theCellPadding = $cellPadding!=''?$cellPadding:BANNER_VIEW_CELLPADDING;
$theCellSpacing = $cellSpacing!=''?$cellSpacing:BANNER_VIEW_CELLSPACING;
$theDatareader = $this->getDatareader($datareader);
$this->layout = LINK_LAYOUT_TRIANGLE | LINK_LAYOUT_BR;
$this->TableDataReader($theDatareader,$theText,$theWidth,$theClass,$theBorder,$theCellPadding,$theCellSpacing);
}
/**
* Get the DataReader to use for this class
* @param DataReader $datareader The DataReader object, if defined
* @return DataReader or array The DataReader object or an array of default data
*/
function getDatareader($datareader) {
$theDatareader = $datareader;
if ($theDatareader == '') {
$columns = array(
array('valign'=>'middle','text'=>LINK_TEXT_HOME,'title'=>LINK_TITLE_HOME,'href'=>LINK_HREF_HOME,'class'=>CSS_BANNER,),
array('valign'=>'middle','text'=>'','href'=>LINK_HREF_URL,'class'=>CSS_BANNER.' '.CSS_ALIGN_RIGHT,'title'=>LINK_HREF_URL,
'src'=>'/'.IMAGE_LOGO.'.gif','width'=>469,'height'=>60,'alt'=>LINK_HREF_URL,),
);
$theDatareader = $columns;
}
return $theDatareader;
}
/**
* Get the CSS class Name for this component
* @return String The CSS class name
*/
function getCssClass() {
return CSS_BANNER;
}
/**
* Toogle the request parameters which will minimize or maximize this component
* @return array The array of key=>value pair
*/
function getMinimize() {
return $this->getToogle(REQUEST_LAYOUT_SHOW, LAYOUT_SHOW, LAYOUT_SHOW_BANNER);
}
/**
* Builds the html for a Banner, and return it
* @return String The table header as html
*/
function getHtml() {
$html = $this->html;
if (LAYOUT_SHOW & LAYOUT_SHOW_BANNER && HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
if (CACHE_LAYOUT && $this->getCacheFileName(CACHE_LAYOUT_PATH)!='' && file_exists($this->getCacheFileName(CACHE_LAYOUT_PATH))) {
$html .= $this->content($this->getCacheFileName(CACHE_LAYOUT_PATH));
} else {
$html .= $this->getColumns();
if (CACHE_LAYOUT) {
$this->save($html, CACHE_LAYOUT_PATH);
}
}
} else {
$html .= $this->getMaximize();
}
return $html;
}
/**
* Display html
* <code>
* Usage:
* Banner::display($datareader,$text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @static
* @param DataReader $datareader The Data Reader object
* @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 The Cell Padding
* @param String $cellSpacing The Cell Spacing
*/
function display($datareader='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
$html = new Banner($datareader,$text,$width,$class,$border,$cellPadding,$cellSpacing);
$html->addHtml();
}
}
?>