- <?
- /**
- * @package page
- * @filesource
- * @see HTML_PAGE_UTIL_PATH.'/Iframe.php'
- * @copyright (c) http://Finn-Rasmussen.com
- * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
- * @author http://Finn-Rasmussen.com
- * @version 1.9
- * @since 21-oct-2005
- */
-
- /**
- * The required files
- */
- require_once(HTML_PATH.'/Html.php');
- require_once(HTML_BASE_UTIL_PATH.'/Links.php');
- require_once(HTML_BASE_UTIL_PATH.'/Images.php');
-
- // TODO, use a default /nosrc/xxx.php if src=''
-
- /**
- * Returns a complete IFRAME as HTML
- * <code>
- * <iframe name="bannerIframe" src="Banneriframe.php" width="468" height="60"
- * title="todo" align="right" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">
- * <img src="/images/logo.gif" width="468" height="60" alt="todo" />
- * </iframe>
- * Usage:
- * $iframe = new Iframe($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
- * print $iframe->getHtml();
- * Or
- * Iframe::display($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
- * </code>
- * @package page
- */
-
- class Iframe extends Html {
- var $src = '';
- var $width = '';
- var $height = '';
- var $align = '';
- var $frameborder = '';
- var $marginheight = '';
- var $marginwidth = '';
- var $scrolling = '';
- var $name = '';
- var $title = '';
- var $class = '';
- var $target = '';
-
- /**
- * Constructor
- * @param String $src The html to use inside the iframe
- * @param String $width The width of the iframe
- * @param String $height The height of the iframe
- * @param String $align The align of the iframe
- * @param String $frameborder The frameborder of the iframe
- * @param String $marginheight The marginheight of the iframe
- * @param String $marginwidth The marginwidth of the iframe
- * @param String $scrolling The scrolling of the iframe
- * @param String $name The name of the iframe
- * @param String $title The title of the iframe
- * @param String $class The css class of the iframe
- */
- function Iframe($src='',$width='',$height='',$align='',$frameborder='',$marginheight='',$marginwidth='',$scrolling='',$name='',$title='',$class='') {
- $this->Html();
- $this->src = $src!=''?$src:IFRAME_SRC;
- $this->width = $width!=''?$width:IFRAME_WIDTH;
- $this->height = $height!=''?$height:IFRAME_HEIGHT;
- $this->align = $align!=''?$align:IFRAME_ALIGN;
- $this->frameborder = $frameborder!=''?$frameborder:IFRAME_FRAMEBORDER;
- $this->marginheight = $marginheight!=''?$marginheight:IFRAME_MARGINHEIGHT;
- $this->marginwidth = $marginwidth!=''?$marginwidth:IFRAME_MARGINWIDTH;
- $this->scrolling = $scrolling!=''?$scrolling:IFRAME_SCROLLING;
- $this->name = $name!=''?$name:IFRAME_NAME;
- $this->title = $title!=''?$title:IFRAME_TITLE;
- $this->class = $class!=''?$class:IFRAME_CLASS;
- $this->target = 'self';
- }
-
- /**
- * Get the complete html for an IFRAME
- * @return String, the html
- */
- function getHtml() {
- $html = $this->html;
- if ($this->src!='') {
- $html .= '<iframe';
- $html .= $this->getAttribute('src');
- $html .= $this->getAttribute('width');
- $html .= $this->getAttribute('height');
- $html .= $this->getAttribute('align');
- $html .= $this->getAttribute('frameborder');
- $html .= $this->getAttribute('marginwidth');
- $html .= $this->getAttribute('marginheight');
- $html .= $this->getAttribute('scrolling');
- $html .= $this->getAttribute('name');
- $html .= $this->getAttribute('title');
- $html .= $this->getAttribute('class');
- $html .= $this->getAttribute('target');
- $html .= ">\r\n";
- $link = new Links(LINK_MAIL);
- $link->add(new Images(IMAGE_LOGO,$this->width,$this->height,IFRAME_TITLE,CSS_BANNER));
- $html .= $link->getHtml();
- $html .= "</iframe>"; // DO NOT use \r\n if inside a td
- } else {
- $html .= '<!-- '.$this->getClassName()."->getHtml(), src is empty -->\r\n";
- }
- return $html;
- }
-
- /**
- * Display html
- * <code>
- * Usage:
- * Iframe::display($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
- * </code>
- * @static
- * @param String $src The html to use inside the iframe
- * @param String $width The width of the iframe
- * @param String $height The height of the iframe
- * @param String $align The align of the iframe
- * @param String $frameborder The frameborder of the iframe
- * @param String $marginheight The marginheight of the iframe
- * @param String $marginwidth The marginwidth of the iframe
- * @param String $scrolling The scrolling of the iframe
- * @param String $name The name of the iframe
- * @param String $title The title of the iframe
- * @param String $class The css class of the iframe
- */
- function display($src='',$width='',$height='',$align='',$frameborder='',$marginheight='',$marginwidth='',$scrolling='',$name='',$title='',$class='') {
- $html = new Iframe($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
- $html->addHtml();
- }
- }
- ?>