1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Xhelp; |
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
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
17
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
18
|
|
|
* @author Brian Wahoff <[email protected]> |
19
|
|
|
* @author XOOPS Development Team |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* class Form |
26
|
|
|
*/ |
27
|
|
|
class Form extends \XoopsForm |
28
|
|
|
{ |
29
|
|
|
public $_labelWidth; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param string $width |
33
|
|
|
*/ |
34
|
|
|
public function setLabelWidth(string $width): void |
35
|
|
|
{ |
36
|
|
|
$this->_labelWidth = $width; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return mixed |
41
|
|
|
*/ |
42
|
|
|
public function getLabelWidth() |
43
|
|
|
{ |
44
|
|
|
return $this->_labelWidth; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* create HTML to output the form as a theme-enabled table with validation. |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
public function render(): string |
53
|
|
|
{ |
54
|
|
|
$ret = "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "' " . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'><tr><th colspan='2'>" . $this->getTitle() . '</th></tr>'; |
55
|
|
|
|
56
|
|
|
$width = $this->getLabelWidth(); |
57
|
|
|
if ($width) { |
58
|
|
|
$labelWidth = ' width="' . $width . '"'; |
59
|
|
|
} else { |
60
|
|
|
$labelWidth = ''; |
61
|
|
|
} |
62
|
|
|
foreach ($this->getElements() as $ele) { |
63
|
|
|
if (!\is_object($ele)) { |
64
|
|
|
$ret .= $ele; |
65
|
|
|
} elseif ($ele->isHidden()) { |
66
|
|
|
$ret .= $ele->render(); |
|
|
|
|
67
|
|
|
} else { |
68
|
|
|
$class = 'even'; |
69
|
|
|
|
70
|
|
|
$ret .= "<tr><td class='head' valign='top' $labelWidth><label for='" . $ele->getName(false) . "'>" . $ele->getCaption() . '</label>'; |
71
|
|
|
if ('' != $ele->getDescription()) { |
72
|
|
|
$ret .= '<br><br><span style="font-weight: normal;">' . $ele->getDescription() . '</span>'; |
73
|
|
|
} |
74
|
|
|
$ret .= "</td><td class='$class'>" . $ele->render() . '</td></tr>'; |
|
|
|
|
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
$ret .= "</table></form>\n"; |
78
|
|
|
|
79
|
|
|
return $ret; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.