00001 <?php
00002
00013 class TKFormInput extends TKFormElement {
00023 public function __construct($type, $name, $value = "") {
00024 parent::__construct($name, $value);
00025
00026 $this->addProperty('type', self::PROP_STRING);
00027 $this->addProperty('size', self::PROP_NUMERIC);
00028 $this->addProperty('maxlength', self::PROP_NUMERIC);
00029
00030 $this->set('type', $type);
00031 $this->set('size', 0);
00032 $this->set('maxlength', 0);
00033 }
00034
00036 protected function renderComponent($class, $style, $events, $id) {
00037 list($name, $disabled, $value) = $this->getStandardProperties();
00038 if($this->size != 0)
00039 $events .= " size=\"$this->size\"";
00040 if($this->maxlength != 0)
00041 $events .= " maxlength=\"$this->maxlength\"";
00042 $collect = "<input $id type=\"" . $this->getType()
00043 . "\"$name$disabled$value$class[0]$style[0]$events />";
00044 return $collect;
00045 }
00046
00048 public static function createFromXML($attrs, $contents, $node) {
00049 $type = $attrs['type'];
00050 $name = $attrs['name'];
00051 $value = isset($attrs['value']) ? $attrs['value'] : "";
00052 $obj = new TKFormElement($type, $name, $value);
00053 self::convertStdAttributes($obj, $attrs);
00054 self::convertStdEvents($obj, $node);
00055 return $obj;
00056 }
00057 }
00058
00059 ?>