/**
* 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.'/Link.php');
require_once(HTML_BASE_UTIL_PATH.'/Image.php');
if (defined('HTML_LANGUAGE_UTIL_PATH')) {
require_once(HTML_LANGUAGE_UTIL_PATH.'/Translate.php');
}
if (defined('HTML_LOG_UTIL_PATH')) {
require_once(HTML_LOG_UTIL_PATH.'/Log.php');
}
/**
* Used to get/display the Company Information
* <code>
* +-----------------------------------------+
* | Company Information and picture |
* +-----------------------------------------+
* Usage:
* $html = new Company($text,$width,$class,$border,$cellPadding,$cellSpacing);
* print $html->getHtml();
* Or
* Company::display($text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @package layout
*/
class Company extends Table {
var $text = ''; // Header text
var $company_name = '';
var $contact_person = '';
var $address = '';
var $zip = '';
var $city = '';
var $country = '';
var $private_phone = '';
var $mobile_phone = '';
var $phone = '';
var $fax = '';
var $email = '';
var $www = '';
var $se_nr = '';
var $cvr_nr = '';
var $bank_name = '';
var $bank_account = '';
var $picture = '';
/**
* Constructor
* @param String $text The text of 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
* @global String IMG_PATH, The path to the images dir
*/
function Company($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$theClass = $class!=''?$class:CSS_BORDER;
$this->Table($text,$width,$theClass,$border,$cellpadding,$cellspacing,$summary,$caption);
$this->text = $text!=''?$text:'Company - '.TEXT_COMPANY_PROFILE.' -';
$this->company_name = LINK_TEXT;
$this->contact_person = MY_SELF;
$this->address = 'Kongens Vænge 79';
$this->zip = '3400';
$this->city = 'Hillerød';
$this->country = 'Denmark';
$this->private_phone = '';
$this->mobile_phone = MOBILE_PHONE;
$this->business_phone = '(+45) 48 24 60 30';
//$this->fax = '(+45) 48 24 60 37';
$this->email = LINK_HREF_EMAIL;
$this->www = LINK_HREF_URL;
$this->se_nr = '10142865';
$this->cvr_nr = '10142865';
$this->bank_name = 'Den Danske Bank, Hilleød';
$this->bank_account = 'Du skal ringe for at få konto no oplyst';
}
/**
* Get the CSS class Name for this component
* @return String The CSS class name
*/
function getCssClass() {
return CSS_COMPANY;
}
/**
* 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_COMPANY);
}
/**
* Builds the html, and return it for a Customer Information
* @return String The html
*/
function getHtml() {
$html = $this->html;
if (LAYOUT_SHOW & LAYOUT_SHOW_COMPANY && 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 {
if ($this->contact_person==MY_SELF) {
$this->picture = '/finn.jpg'; // 100x136
}
// Render it
$html .= $this->getTableHeader();
$html .= $this->getStart();
$html .= $this->getInfo('picture'); // Must be the very first, due to rowspan
$html .= $this->getInfo('company_name');
$html .= $this->getInfo('contact_person');
$html .= $this->getInfo('address');
$html .= $this->getInfo('zip');
$html .= $this->getInfo('city');
$html .= $this->getInfo('country');
$html .= $this->getInfo('private_phone');
$html .= $this->getInfo('mobile_phone');
$html .= $this->getInfo('business_phone');
$html .= $this->getInfo('fax');
$html .= $this->getInfo('email');
$html .= $this->getInfo('www');
//$html .= $this->getInfo('se_nr');
$html .= $this->getInfo('cvr_nr');
$html .= $this->getInfo('bank_name');
$html .= $this->getInfo('bank_account');
$html .= $this->getEnd();
if (CACHE_LAYOUT) {
$this->save($html, CACHE_LAYOUT_PATH);
}
}
} else {
$html .= $this->getMaximize();
}
return $html;
}
/**
* Get the html for each row, and return it
* @return String The html
*/
function getInfo($info) {
$html = '';
$class = $this->getCssClass();
if ($this->$info!='') {
$keyInfo = $info;
if (defined('HTML_LANGUAGE_UTIL_PATH')) {
$keyInfo = Translate::sql($info);
if (defined($keyInfo)) {
$keyInfo = constant($keyInfo);
} else {
// $msg = LANGUAGE."=languge, Unknown translation for: $info";
// if (defined('HTML_LOG_UTIL_PATH')) {
// //Log::error(__FILE__,__LINE__,$msg);
// } else {
// }
// Message::add($msg, __FILE__, __LINE__);
}
}
$key = ucfirst(str_replace('_',' ', $keyInfo));
$value = $this->$info;
switch ($info) {
case 'email':
$link = new Link(LINK_TEXT_CONTACT_US,$value,$class,LINK_TITLE_CONTACT_US);
$value = $link->getHtml();
break;
case 'www':
$link = new Link($value,$value,$class,LINK_TITLE_VISIT_US.$value);
$value = $link->getHtml();
break;
case 'picture':
$image = new Image($value,'100','136','Hvepse Eksperten Finn Rasmussen',CSS_COMPANY.' '.CSS_FLOAT_RIGHT);
$value = $image->getHtml(); // TODO, how to float right ??? in a table??
break;
default:
break;
}
$nbsp = ' ';
switch ($info) {
case 'picture': // Rowspan
$image = $this->newTriangle(IMAGE_TRIANGLE, $class);
$html .= " <tr>\r\n";
$html .= ' <td class="'.$class.'">'.$nbsp."</td>\r\n";
$html .= ' <td class="'.$class.'">'.$nbsp."</td>\r\n";
$html .= ' <td class="'.$class.'" rowspan="15" valign="top">'.$nbsp.$value."</td>\r\n";
$html .= ' <td class="'.$class.'">'.$nbsp.$image->getHtml()."</td>\r\n";
$html .= " </tr>\r\n";
break;
default:
$html .= " <tr>\r\n";
$html .= ' <td class="'.$class.'" valign="top">'.$nbsp.$nbsp.$nbsp.$key.$nbsp."</td>\r\n";
$html .= ' <td class="'.$class.'" valign="top">'.$value.$nbsp."</td>\r\n";
$html .= ' <td class="'.$class.'" valign="top">'.$nbsp."</td>\r\n";
//$html .= ' <td class="'.$class.'">'.$nbsp."</td>\r\n";
//$html .= ' <td class="'.$class.'">'.$nbsp."</td>\r\n";
$html .= " </tr>\r\n";
break;
}
}
return $html;
}
/**
* Display html
* <code>
* Usage:
* Company::display($text,$width,$class,$border,$cellpadding,$cellspacing);
* </code>
* @static
* @param String $text The text of 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($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$html = new Company($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for Company klassen
<?
<table width="100%" class="baseBorder" border="0" cellpadding="2" cellspacing="0">
<tr>
<td class="baseArrowHeader" valign="middle"><img src="/images/arrow-headline.gif" width="4" height="7" alt="Company" />
</td>
<th class="baseColorHeader" valign="top" align="left">Company - Webmaster, Udvikling og Design af disse hjemmesider -</th>