00001 <?php
00002
00012 class TKFormLabel extends TKComponent {
00019 public function __construct($text, $for='') {
00020 parent::__construct();
00021
00022 if(is_object($for)) {
00023 $for = $for->getId();
00024 }
00025
00026 $this->addProperty('text', self::PROP_STRING);
00027 $this->addProperty('for', self::PROP_STRING);
00028
00029 $this->set('text', (string)$text);
00030 $this->set('for', (string)$for);
00031 }
00032
00034 protected function renderComponent($class, $style, $events, $id) {
00035 $collect = "<label $id$class[0]$style[0]$events";
00036 $for = $this->get('for');
00037 if(!empty($for)) $collect.= ' for="' . $for . '"';
00038 $collect .= '>' . $this->get('text') . '</label>';
00039 return $collect;
00040 }
00041
00043 public static function createFromXML($attrs, $value, $node) {
00044 self::setStaticError("Cannot create a form label from XML!");
00045 return null;
00046 }
00047 }
00048
00049 ?>