00001 <?php
00002
00015 class TKForm extends TKContainer {
00022 public function __construct($action = "", $method = "post") {
00023 parent::__construct();
00024
00025 if($action == "")
00026 $action = "#";
00027
00028 $this->addProperty('action', self::PROP_STRING);
00029 $this->addProperty('method', self::PROP_STRING);
00030
00031 $this->set('action', $action);
00032 $this->set('method', $method);
00033
00034 $this->addEvent('onsubmit');
00035 }
00036
00038 protected function renderContainer($class, $style, $events, $id) {
00039 $collect = "<form $id$class[0]$style[0]$events action=\"" . $this->get('action')
00040 . "\" method=\"" . $this->get('method')
00041 . "\" enctype=\"multipart/form-data\">\n";
00042
00043 foreach($this->getChildrenBySlot('main') as $c) {
00044 if(is_object($c))
00045 $collect .= $c->render();
00046 else
00047 $collect .= $c;
00048 }
00049
00050 $collect .= "</form>\n";
00051 return $collect;
00052 }
00053
00055 public static function convertFromXML($attrs, $contents, $node) {
00056 $action = isset($attrs['action']) ? $attrs['action'] : "";
00057 $method = isset($attrs['method']) ? $attrs['method'] : "post";
00058 unset($attrs['action']);
00059 unset($attrs['method']);
00060 $obj = new TKForm($action, $method);
00061 $children = $node['children'];
00062 self::convertStdAttributes($obj, $attrs);
00063 self::convertStdEvents($obj, $node);
00064 self::convertStdChildren($obj, $node['children']);
00065 return $obj;
00066 }
00067 }
00068
00069 ?>