/**
* Used to popup the Travel form for Rejseplanen
* <code>
* Usage:
* $html = new Rejseplanen($from, $to);
* print $html->getHtml();
* Or
* Rejseplanen::display($from, $to);
* </code>
* @package component
*/
class Rejseplanen extends Html {
/**
* @var String $from The from destination
*/
var $from = '';
/**
* @var String $to The to destination
*/
var $to = '';
/**
* Constructor
* @param String $from The source destination
* @param String $to The target destination
*/
function Rejseplanen($from='', $to='') {
$this->Html();
$this->from = $from!=''?$from:CONTACT_ADDRESS;
$this->to = $to;
}
/**
* Builds the html, and return it for the Rejseplanen
* @return String The html
*/
function getHtml() {
$html = $this->html;
if (COMPONENT_SHOW & COMPONENT_SHOW_REJSEPLANEN) {
if (CACHE_COMPONENT && $this->getCacheFileName(CACHE_COMPONENT_PATH)!='' && file_exists($this->getCacheFileName(CACHE_COMPONENT_PATH))) {
$html .= $this->content($this->getCacheFileName(CACHE_COMPONENT_PATH));
}
else {
$html .= '<h1>'.REJSEPLANEN_TEXT."</h1>\r\n";
$form = new Form("http:/"."/www.rejseplanen.dk/bin/query.exe/mn", "post",'','target="blank"');
$form->add(new Label(REJSEPLANEN_FROM));
$form->add(new Text("S",$this->from));
$form->add(new Hidden("SADR","1"));
$form->add(new Label(REJSEPLANEN_TO));
$form->add(new Text("Z",$this->to));
$form->add(new Hidden("ZADR","1"));
$form->add(new SubmitButton(REJSEPLANEN_SUBMIT));
$fieldset = new Fieldset(new Legend(REJSEPLANEN_HELP));
$fieldset->add($form);
$html .= $fieldset->getHtml();
$html .= '<p>'.REJSEPLANEN_INFO."</p>\r\n";
$image = new Image('/rejseplanen.gif','96','40',"Rejseplanen",CSS_LINK_COLOR);
$link = new Link('',"http:/"."/www.rejseplanen.dk/",CSS_LINK_COLOR,'Planlæg din rejse via Rejseplanen');
$imagelink = new Imagelink($image,$link);
$html .= $imagelink->getHtml();
if (CACHE_COMPONENT) {
$this->save($html, CACHE_COMPONENT_PATH);
}
}
}
return $html;
}
/**
* Display html
* <code>
* Usage:
* Rejseplanen::display($from, $to);
* </code>
* @static
* @param String $from The source destination
* @param String $to The target destination
*/
function display($from='', $to='') {
$html = new Rejseplanen($from, $to);
$html->addHtml();
}
}
?>
</fieldset><br />
<p>Du kan finde mere information om Rejseplanen:</p>
<a id="Link51" class="baseLinkColor" href="http://www.rejseplanen.dk/" title="Planlæg din rejse via Rejseplanen"><img src="/images/rejseplanen.gif" width="96" height="40" alt="Rejseplanen" class="baseLinkColor" />
</a>
?>
Class methods
Her er 'klasse metoderne' for Rejseplanen klassen: