XOOPS  2.6.0
TableForm.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Form;
13 
27 class TableForm extends Form
28 {
37  public function insertBreak($extra = '', $class = '')
38  {
39  $value = '<tr valign="top" align="left"><td></td></tr>';
40  $ele = new Raw($value);
41  $this->addElement($ele);
42  }
43 
49  public function render()
50  {
51  $ret = $this->getTitle() . NWLINE . '<form name="' . $this->getName() . '" id="'
52  . $this->getName() . '" action="' . $this->getAction() . '" method="' . $this->getMethod()
53  . '"' . $this->getExtra() . '>' . NWLINE . '<table border="0" width="100%">' . NWLINE;
54  $hidden = "";
55  foreach ($this->getElements() as $ele) {
56  /* @var $ele Element */
57  if (!$ele->isHidden()) {
58  if (!$ele instanceof Raw) {
59  $ret .= '<tr valign="top" align="left"><td>' . $ele->getCaption();
60  if ($ele_desc = $ele->getDescription()) {
61  $ret .= '<br /><br /><span style="font-weight: normal;">' . $ele_desc . '</span>';
62  }
63  $ret .= '</td><td>' . $ele->render() . '</td></tr>';
64  } else {
65  $ret .= $ele->render();
66  }
67  } else {
68  $hidden .= $ele->render() . NWLINE;
69  }
70  }
71  $ret .= '</table>' . NWLINE . ' ' . $hidden . '</form>' . NWLINE;
72  return $ret;
73  }
74 }
insertBreak($extra= '', $class= '')
Definition: TableForm.php:37
addElement(Element $formElement, $required=false)
Definition: Form.php:206
getAction($encode=true)
Definition: Form.php:182
getName($encode=true)
Definition: Form.php:158
getTitle($encode=false)
Definition: Form.php:132
getElements($recurse=false)
Definition: Form.php:232