00001 <?php
00002
00017 class TKLabel extends TKComponent {
00024 public function __construct($text, $inline = false) {
00025 parent::__construct();
00026
00027 if(!is_string($text))
00028 $text = "";
00029
00030 $this->addProperty('text', self::PROP_STRING);
00031 $this->addProperty('inline', self::PROP_BOOLEAN);
00032 $this->addProperty('title', self::PROP_STRING);
00033
00034 $this->set('text', $text);
00035 $this->set('title', "");
00036 $this->set('inline', $inline);
00037 }
00038
00040 protected function renderComponent($class, $style, $events, $id) {
00041 $title = $this->get('title');
00042 if($title != "")
00043 $title = " title=\"$title\"";
00044 else
00045 $title = "";
00046 if($class[0] != "" || $style[0] != "" || $events != "" || $title != "" || Toolkit::isTarget($this->getId())) {
00047 if($this->get('inline') == true) $tag = 'span';
00048 else $tag = 'div';
00049 return "<$tag $id$title$class[0]$style[0]$events>" . $this->get('text') . "</$tag>\n";
00050 }
00051 else
00052 return $this->get('text');
00053 }
00054
00056 public static function createFromXML($attrs, $contents, $node) {
00057 $obj = new TKLabel($contents);
00058 self::convertStdAttributes($obj, $attrs);
00059 self::convertStdEvents($obj, $node);
00060 return $obj;
00061 }
00062 }
00063
00064 ?>