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
|
|
|
* ThemeForm - Form that will output as a theme-enabled HTML table |
16
|
|
|
* |
17
|
|
|
* Also adds JavaScript to validate required fields |
18
|
|
|
* |
19
|
|
|
* @category Xoops\Form\ThemeForm |
20
|
|
|
* @package Xoops\Form |
21
|
|
|
* @author Xoops Team |
22
|
|
|
* @copyright 2001-2016 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 ThemeForm extends Form |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Insert an empty row in the table to serve as a separator. |
30
|
|
|
* |
31
|
|
|
* @param string $extra HTML to be displayed in the empty row. |
32
|
|
|
* @param string $class CSS class name for <td> tag |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
public function insertBreak($extra = '', $class = '') |
37
|
|
|
{ |
38
|
|
|
$class = ($class != '' ? " class=\"" . $class . "\"" : " class=\"break\""); |
39
|
|
|
// Fix for $extra tag not showing |
40
|
|
|
if ($extra) { |
41
|
|
|
$value = '<div' . $class . '>' . $extra . '</div>'; |
42
|
|
|
$ele = new Raw($value); |
43
|
|
|
$this->addElement($ele); |
44
|
|
|
} else { |
45
|
|
|
$value = '<div' . $class . '> </div>'; |
46
|
|
|
$ele = new Raw($value); |
47
|
|
|
$this->addElement($ele); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* create HTML to output the form as a theme-enabled table with validation. |
53
|
|
|
* |
54
|
|
|
* @return string rendered form |
55
|
|
|
*/ |
56
|
|
|
public function render() |
57
|
|
|
{ |
58
|
|
|
$xoops = \Xoops::getInstance(); |
59
|
|
|
$xoops->theme()->addStylesheet('media/xoops/css/form.css'); |
60
|
|
|
switch ($this->getDisplay()) { |
61
|
|
|
case '': |
62
|
|
|
case 'horizontal': |
63
|
|
|
default: |
64
|
|
|
$xoops->tpl()->assign('type', 'horizontal'); |
65
|
|
|
break; |
66
|
|
|
|
67
|
|
|
case 'vertical': |
68
|
|
|
$xoops->tpl()->assign('type', 'vertical'); |
69
|
|
|
break; |
70
|
|
|
|
71
|
|
|
case 'inline': |
72
|
|
|
$xoops->tpl()->assign('type', 'inline'); |
73
|
|
|
break; |
74
|
|
|
|
75
|
|
|
case 'personalized': |
76
|
|
|
$xoops->tpl()->assign('type', 'personalized'); |
77
|
|
|
break; |
78
|
|
|
} |
79
|
|
|
$xoops->tpl()->assign('title', $this->getTitle()); |
80
|
|
|
$xoops->tpl()->assign('name', $this->getName()); |
81
|
|
|
$xoops->tpl()->assign('action', $this->getAction()); |
82
|
|
|
$xoops->tpl()->assign('method', $this->getMethod()); |
83
|
|
|
$xoops->tpl()->assign('extra', $this->getExtra()); |
84
|
|
|
$hidden = ''; |
85
|
|
|
foreach ($this->getElements() as $ele) { |
86
|
|
|
/* @var $ele Element */ |
87
|
|
|
if (!$ele->isHidden()) { |
88
|
|
|
$input['name'] = $ele->getName(); |
89
|
|
|
$input['caption'] = $ele->getCaption(); |
90
|
|
|
$input['description'] = $ele->getDescription(); |
91
|
|
|
$input['ele'] = $ele->render(); |
92
|
|
|
$input['required'] = $ele->isRequired(); |
93
|
|
|
$input['pattern_description'] = $ele->getPatternDescription(); |
94
|
|
|
$input['datalist'] = $ele->renderDatalist(); |
95
|
|
|
$xoops->tpl()->appendByRef('xo_input', $input); |
|
|
|
|
96
|
|
|
unset($input); |
97
|
|
|
} else { |
98
|
|
|
$hidden .= $ele->render(). "\n"; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
$xoops->tpl()->assign('hidden', $hidden); |
103
|
|
|
$xoops->tpl()->assign('validationJS', $this->renderValidationJS(true)); |
104
|
|
|
$ret = $xoops->tpl()->fetch('module:system/system_form.tpl'); |
105
|
|
|
$xoops->tpl()->clearAssign('xo_input'); |
|
|
|
|
106
|
|
|
return $ret; |
107
|
|
|
|
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.