/** * row * create a table TR and TD elements * * this example will add a single ROW (TR) containing two TD elements. * * table->row( * 'single value', * array('text'=>'td content', 'htmlOptions'=>array(...)) * ); * * htmlOptions is an array of valid html options, as an example: * array('style'=>'color: red', 'alt'=>'abc', 'id'=>'mycell') * * * @param mixed $def definition for each TD * @param array $commonHtmlOptions common htmlOptions for each TD * @return the new JamElement created (the TR row) */ public function row($def, $commonHtmlOptions = array()) { $row = new JamHorzPanel('tr'); $row->setHtmlOption('class', ''); foreach ($def as $item) { if (is_array($item)) { $col = $row->add(new JamElement('td', $item['text']), false); // default options $col->setHtmlOption('style', $this->tdStyle); // common options if ($commonHtmlOptions != null) { foreach ($commonHtmlOptions as $opt => $val) { $col->addHtmlOption($opt, $val); } } // specific options if (isset($item['htmlOptions'])) { if (is_array($item['htmlOptions'])) { foreach ($item['htmlOptions'] as $opt => $value) { $col->addHtmlOption($opt, $value); } } } } else { $col = $row->add(new JamElement('td', $item), false); // default option $col->setHtmlOption('style', $this->tdStyle); // common options if ($commonHtmlOptions != null) { foreach ($commonHtmlOptions as $opt => $val) { $col->addHtmlOption($opt, $val); } } } } return $this->add($row, false); }