Completed
Push — master ( 658b35...b781ca )
by Richard
28s queued 23s
created

BlockForm   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A render() 0 14 3
1
<?php
2
3
namespace XoopsModules\Publisher;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 *  Publisher class
17
 *
18
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
19
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
20
 * @package         Publisher
21
 * @since           1.0
22
 * @author          trabis <[email protected]>
23
 * @version         $Id$
24
 */
25
use Xoops\Form\Form;
26
use XoopsModules\Publisher;
27
28
/**
29
 * Form that will output formatted as a HTML table
30
 *
31
 * No styles and no JavaScript to check for required fields.
32
 */
33
class BlockForm extends Form
34
{
35
    public function __construct()
36
    {
37
        parent::__construct('', '', '');
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function render()
44
    {
45
        $ret = '<table border="0" width="100%">' . NWLINE;
46
        /* @var \Xoops\Form\Element $ele */
47
        foreach ($this->getElements() as $ele) {
48
            if (!$ele->isHidden()) {
49
                $ret .= '<tr><td colspan="2">';
50
                $ret .= '<span style="font-weight: bold;">' . $ele->getCaption() . '</span>';
51
                $ret .= '</td></tr><tr><td>' . $ele->render() . '</td></tr>';
52
            }
53
        }
54
        $ret .= '</table>';
55
56
        return $ret;
57
    }
58
}
59