00001 <?php
00002
00043 class TKBorderPanel extends TKContainer {
00044 const LAYOUT_DEFAULT = 0;
00045 const LAYOUT_SQUASH_NS = 1;
00046
00054 public function __construct() {
00055 parent::__construct();
00056
00057 $this->addSlot('north');
00058 $this->addSlot('south');
00059 $this->addSlot('west');
00060 $this->addSlot('east');
00061 $this->addSlot('center');
00062
00063 $this->removeSlot('main');
00064 $this->setDefaultSlot('center');
00065
00066 $this->addProperty('layout', self::PROP_NUMERIC);
00067
00068 $this->addProperty('north_class', self::PROP_CLASS);
00069 $this->addProperty('north_style', self::PROP_STYLE);
00070 $this->addProperty('south_class', self::PROP_CLASS);
00071 $this->addProperty('south_style', self::PROP_STYLE);
00072 $this->addProperty('west_class', self::PROP_CLASS);
00073 $this->addProperty('west_style', self::PROP_STYLE);
00074 $this->addProperty('east_class', self::PROP_CLASS);
00075 $this->addProperty('east_style', self::PROP_STYLE);
00076 $this->addProperty('center_class', self::PROP_CLASS);
00077 $this->addProperty('center_style', self::PROP_STYLE);
00078
00079 $this->set('layout', self::LAYOUT_DEFAULT);
00080 }
00082 protected function renderContainer($class, $style, $events, $id) {
00083 $collect = "<table$id$class[0]$style[0]$events>\n";
00084 $layout = $this->get('layout');
00085 if($layout == self::LAYOUT_SQUASH_NS) {
00086 $north = "<td$class[north]$style[north]>\n";
00087 $south = "<td$class[south]$style[south]>\n";
00088 }
00089 else {
00090 $north = "<tr>\n<td$class[north]$style[north] colspan=\"3\">\n";
00091 $south = "<tr>\n<td$class[south]$style[south] colspan=\"3\">\n";
00092 }
00093 $west = "<tr>\n<td$class[west]$style[west]>\n";
00094 $east = "<td$class[east]$style[east]>\n";
00095 $center = "<td$class[center]$style[center]>\n";
00096
00097 foreach($this->getChildrenBySlot('north') as $c)
00098 $north .= is_object($c) ? $c->render() : $c;
00099 foreach($this->getChildrenBySlot('south') as $c)
00100 $south .= is_object($c) ? $c->render() : $c;
00101 foreach($this->getChildrenBySlot('west') as $c)
00102 $west .= is_object($c) ? $c->render() : $c;
00103 foreach($this->getChildrenBySlot('east') as $c)
00104 $east .= is_object($c) ? $c->render() : $c;
00105 foreach($this->getChildrenBySlot('center') as $c)
00106 $center .= is_object($c) ? $c->render() : $c;
00107
00108 if($layout == self::LAYOUT_SQUASH_NS) {
00109 $collect = "$west</td>$north</td>$east</td></tr><tr>$center</td></tr><tr>$south</td></tr></table>\n";
00110 }
00111 else {
00112 $collect = "$north</td></tr>$west</td>$center</td>$east</td></tr>$south</td></tr></table>\n";
00113 }
00114
00115 return $collect;
00116 }
00117 }
00118
00119 ?>