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:
14: /**
15: * BlockForm - Form that will output formatted as a HTML table
16: *
17: * No styles and no JavaScript to check for required fields.
18: *
19: * @category Xoops\Form\BlockForm
20: * @package Xoops\Form
21: * @author trabis <lusopoemas@gmail.com>
22: * @copyright 2012-2015 XOOPS Project (http://xoops.org)
23: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
24: * @link http://xoops.org
25: */
26: class BlockForm extends Form
27: {
28: /**
29: * __construct
30: */
31: public function __construct()
32: {
33: parent::__construct('', '', '');
34: }
35:
36: /**
37: * render
38: *
39: * @return string
40: */
41: public function render()
42: {
43: $ret = '<div>';
44: /* @var $ele Element */
45: foreach ($this->getElements() as $ele) {
46: if (!$ele->isHidden()) {
47: $ret .= '<div class="row"><div class="span2"><strong>' . $ele->getCaption().'</strong></div>';
48: $ret .= '<div class="span4">' . $ele->render() . '<br />';
49: $ret .= '<em>' . $ele->getDescription() . '</em><br /></div></div>';
50: } else {
51: $ret .= $ele->render();
52: }
53: }
54: $ret .= '</div>';
55: return $ret;
56: }
57: }
58: