public function generateLayout() { list($layout, $hidden) = $this->getLayout(); $array = array(); $table = new MTable('table_' . $this->getId(), $this->getAttributes()); $table->style = clone $this->style; $i = 0; $tr = array(); foreach ($layout as $control) { if ($control instanceof MHContainer) { if ($control->checkAccess()) { $mtr = new MTR(); $mtr->style = clone $control->style; $controls = $control->getControls(); $j = 0; $td = array(); $n = count($controls) - 1; foreach ($controls as $content) { $pos = 'cell' . $j . ($j == 0 ? ' firstCell' : ($j == $n ? ' lastCell' : '')); $mtd = new MTD(); $mtd->setClass($pos); $mtd->addControl($content); $width = $content->getColumnWidth(); if ($width) { $mtd->width = $width; } $td[] = $mtd; $j++; } $mtr->addControl($td); $tr[] = $mtr; $i++; } } } $table->addControl($tr); return array($table, $hidden); }