XOOPS  2.6.0
Tab.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 
25 class Tab extends ElementTray
26 {
33  public function __construct($caption, $name)
34  {
35  $this->setName($name);
36  $this->setCaption($caption);
37  }
38 
44  public function render()
45  {
46  $ret = '';
47  /* @var $ele Element */
48  foreach ($this->getElements() as $ele) {
49  $ret .= NWLINE;
50  $ret .= '<tr>' . NWLINE;
51  $ret .= '<td class="head" width="30%">' . NWLINE;
52  $required = $ele->isRequired() ? '-required' : '';
53  $ret .= '<div class="xoops-form-element-caption' . $required . '">' . NWLINE;
54  $ret .= '<span class="caption-text">' . $ele->getCaption() . '</span>' . NWLINE;
55  $ret .= '<span class="caption-marker">*</span>' . NWLINE;
56  $ret .= '</div>' . NWLINE;
57  $description = $ele->getDescription();
58  if ($description) {
59  $ret .= '<div style="font-weight: normal">' . NWLINE;
60  $ret .= $description . NWLINE;
61  $ret .= '</div>' . NWLINE;
62  }
63  $ret .= '</td>' . NWLINE;
64  $ret .= '<td class="even">' . NWLINE;
65  $ret .= $ele->render() . NWLINE;
66  $ret .= '<span class="dsc_pattern_horizontal">'. $ele->getPatternDescription() . '</span>';
67  $ret .= '</td>' . NWLINE;
68  $ret .= '</tr>' . NWLINE;
69  }
70  return $ret;
71  }
72 }
setCaption($caption)
Definition: Element.php:396
getElements($recursively=false)
__construct($caption, $name)
Definition: Tab.php:33