1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Xoops\Form;
13:
14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
24: class Tab extends ElementTray
25: {
26: 27: 28: 29: 30: 31:
32: public function __construct($caption, $name = null)
33: {
34: if (is_array($caption)) {
35: parent::__construct($caption);
36: } else {
37: parent::__construct([]);
38: $this->setName($name);
39: $this->setCaption($caption);
40: }
41: }
42:
43: 44: 45: 46: 47:
48: public function render()
49: {
50: $ret = '';
51:
52: foreach ($this->getElements() as $ele) {
53: $ret .= "\n";
54: $ret .= '<tr>' . "\n";
55: $ret .= '<td class="head" width="30%">' . "\n";
56: $required = $ele->isRequired() ? '-required' : '';
57: $ret .= '<div class="xoops-form-element-caption' . $required . '">' . "\n";
58: $ret .= '<span class="caption-text">' . $ele->getCaption() . '</span>' . "\n";
59: $ret .= '<span class="caption-marker">*</span>' . "\n";
60: $ret .= '</div>' . "\n";
61: $description = $ele->getDescription();
62: if ($description) {
63: $ret .= '<div style="font-weight: normal">' . "\n";
64: $ret .= $description . "\n";
65: $ret .= '</div>' . "\n";
66: }
67: $ret .= '</td>' . "\n";
68: $ret .= '<td class="even">' . "\n";
69: $ret .= $ele->render() . "\n";
70: $ret .= '<span class="dsc_pattern_horizontal">'. $ele->getPatternDescription() . '</span>';
71: $ret .= '</td>' . "\n";
72: $ret .= '</tr>' . "\n";
73: }
74: return $ret;
75: }
76: }
77: