/** * 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 */ protected $from = '';
/** * @var String $to The to destination */ protected $to = '';
/** * Constructor * @param String $from The source destination * @param String $to The target destination */ function __construct($from='', $to='') { parent::__construct(); $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 */ public static function display($from='', $to='') { $html = new Rejseplanen($from, $to); $html->addHtml(); } } ?>
Rejseplanen, HTML source code
Den fulde HTML kildekode for Rejseplanen klassen
<?
<!-- DEBUG: Rejseplanen -->
<h1>Rejseplanen</h1>
<!-- DEBUG: Fieldset -->
<fieldset class="baseFieldset"><!-- DEBUG: Legend -->
<legend>Indtast hvor rejsen starter fra og hvor den slutter
</legend>
<!-- DEBUG: Form -->
<form action="http://www.rejseplanen.dk/bin/query.exe/mn/index.php" method="post" name="Form1" id="Form1" target="blank">
<!-- DEBUG: Label -->
<label for="Label2" accesskey="A" title="Accelerator key, use (Alt + A)">
<b>Fr<span class="baseColorDark">a</span>:</b> (Alt + A) </label><br />
</fieldset><br />
<p>Du kan finde mere information om Rejseplanen:</p>
<!-- DEBUG: ImageLink -->
<!-- DEBUG: Link -->
<a class="baseLinkColor" href="http://www.rejseplanen.dk/" title="Planlæg din rejse via Rejseplanen"><!-- DEBUG: Image -->
<img src="http://skadedyr.info/images/rejseplanen.gif" width="96" height="40" alt="Rejseplanen" class="baseLinkColor" />
</a>
?>
Rejseplanen, Class methods
Her er 'klasse metoderne' for Rejseplanen klassen: