/**
* The required files
*/
require_once(HTML_BASE_COMMON_PATH.'/Html.php');
/**
* Generates an <span class="$class" align="$align" style="$style">$text</span>
* <code>
* Usage:
* $html = new Span($text, $class, $align, $style);
* print $html->getHtml();
* Or
* Span::display($text, $class, $align, $style);
* Or
* Span::start($text, $class, $align, $style);
* Link::display();
* Span::end();
* </code>
* @package base
*/
class Span extends Html {
var $text = ''; // Text or an object
var $class = '';
var $align = '';
var $style = '';
/**
* Constructor
* @param String $text The text for the Span tag or an object
* @param String $class The css class name
* @param String $align The align attribute
* @param String $style The style attribute
*/
function Span($text='',$class='',$align='',$style='') {
$this->Html();
$this->text = $text;
$this->class = $class;
$this->align = $align;
$this->style = $style;
}
/**
* Returns the start for the span html element
* @return String the complete html
*/
function getStart() {
$html = '';
$html .= '<span';
$html .= $this->getAttribute('class');
$html .= $this->getAttribute('align');
$html .= $this->getAttribute('style');
$html .= '>';
if (is_object($this->text)) {
$html .= $this->text->getHtml();
} else {
$html .= $this->text;
}
$html .= $this->getElements();
return $html;
}
/**
* Returns the end for the span html element
* @return String the complete html
*/
function getEnd() {
return "</span>"; // 2008-03-26 removed \r\n
}
/**
* Returns the html for the span html element
* @return String the complete html
*/
function getHtml() {
$html = '';
$html .= $this->getStart();
$html .= $this->getEnd();
return $html;
}
/**
* Display start
* <code>
* Usage:
* Span::start($text,$class,$align,$style);
* </code>
* @static
* @param String $text The text for the span or an object
* @param String $class The css class of the span
* @param String $align The align attribute
* @param String $style The style attribute
*/
function start($text='',$class='',$align='',$style='') {
$html = new Span($text,$class,$align,$style);
$html->addHtml($html->getStart());
}
/**
* Display end
* <code>
* Usage:
* Span::end();
* </code>
* @static
*/
function end() {
$html = new Html();
$html->addHtml(Span::getEnd());
}
/**
* Display html
* <code>
* Usage:
* Span::display($text,$class,$align,$style);
* </code>
* @static
* @param String $text The text for the span or an object
* @param String $class The css class of the span
* @param String $align The align attribute
* @param String $style The style attribute
*/
function display($text='',$class='',$align='',$style='') {
$html = new Span($text,$class,$align,$style);
$html->addHtml();
}
}
?>