00001 <?php
00002
00012 class TKTextArea extends TKFormElement {
00021 public function __construct($name, $value = "", $rows = -1, $cols = -1) {
00022 parent::__construct($name, $value);
00023
00024 $this->addProperty('rows', self::PROP_NUMERIC);
00025 $this->addProperty('cols', self::PROP_NUMERIC);
00026
00027 $this->set('rows', $rows);
00028 $this->set('cols', $cols);
00029 }
00030
00032 protected function renderComponent($class, $style, $events, $id) {
00033 list($name, $disabled, $value) = $this->getStandardProperties();
00034
00035 $rows = $this->get('rows');
00036 if($rows !== -1)
00037 $rows = " rows=\"$rows\"";
00038 else
00039 $rows = "";
00040 $cols = $this->get('cols');
00041 if($cols !== -1)
00042 $cols = " cols=\"$cols\"";
00043 else
00044 $cols = "";
00045 $value = $this->getValue();
00046
00047 $collect = "<textarea $id name=\"" . $this->getName() . "\"$rows$cols$name$disabled$class[0]$style[0]$events>"
00048 . "$value</textarea>";
00049
00050 return $collect;
00051 }
00052
00054 public static function createFromXML($attrs, $contents, $node) {
00055 $name = $attrs['name'];
00056 $value = isset($attrs['value']) ? $attrs['value'] : "";
00057 $rows = isset($attrs['rows']) ? $attrs['rows'] : -1;
00058 $cols = isset($attrs['cols']) ? $attrs['cols'] : -1;
00059 $obj = new TKTextArea($name, $value, $rows, $cols);
00060 self::convertStdAttributes($obj, $attrs);
00061 self::convertStdEvents($obj, $node);
00062 return $obj;
00063 }
00064 }
00065
00066 ?>