1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Modulebuilder\Files\Classes; |
4
|
|
|
|
5
|
|
|
use XoopsModules\Modulebuilder; |
6
|
|
|
|
7
|
|
|
/* |
8
|
|
|
You may not change or alter any portion of this comment or credits |
9
|
|
|
of supporting developers from this source code or any supporting source code |
10
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
11
|
|
|
|
12
|
|
|
This program is distributed in the hope that it will be useful, |
13
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15
|
|
|
*/ |
16
|
|
|
/** |
17
|
|
|
* tc module. |
18
|
|
|
* |
19
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
20
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
21
|
|
|
* |
22
|
|
|
* @since 2.5.0 |
23
|
|
|
* |
24
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
25
|
|
|
* |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class ClassFormElements. |
30
|
|
|
*/ |
31
|
|
|
class ClassFormElements extends Modulebuilder\Files\CreateAbstractClass |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var mixed |
35
|
|
|
*/ |
36
|
|
|
private $cf = null; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var mixed |
40
|
|
|
*/ |
41
|
|
|
private $tf = null; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var mixed |
45
|
|
|
*/ |
46
|
|
|
private $uxc = null; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var mixed |
50
|
|
|
*/ |
51
|
|
|
private $cxc = null; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var mixed |
55
|
|
|
*/ |
56
|
|
|
private $xc = null; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var mixed |
60
|
|
|
*/ |
61
|
|
|
private $pc = null; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var mixed |
65
|
|
|
*/ |
66
|
|
|
private $helper = null; |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @public function constructor |
71
|
|
|
* @param null |
72
|
|
|
*/ |
73
|
|
|
public function __construct() |
74
|
|
|
{ |
75
|
|
|
$this->helper = Modulebuilder\Helper::getInstance(); |
76
|
|
|
$this->cf = Modulebuilder\Files\CreateFile::getInstance(); |
77
|
|
|
$this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); |
78
|
|
|
$this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); |
79
|
|
|
$this->tf = Modulebuilder\Files\CreateTableFields::getInstance(); |
80
|
|
|
$this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); |
81
|
|
|
$this->cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @static function getInstance |
86
|
|
|
* @param null |
87
|
|
|
* |
88
|
|
|
* @return ClassFormElements |
89
|
|
|
*/ |
90
|
|
|
public static function getInstance() |
91
|
|
|
{ |
92
|
|
|
static $instance = false; |
93
|
|
|
if (!$instance) { |
94
|
|
|
$instance = new self(); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
return $instance; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @public function initForm |
102
|
|
|
* |
103
|
|
|
* @param $module |
104
|
|
|
* @param $table |
105
|
|
|
*/ |
106
|
|
|
public function initForm($module, $table) |
107
|
|
|
{ |
108
|
|
|
$this->setModule($module); |
109
|
|
|
$this->setTable($table); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @private function getXoopsFormText |
114
|
|
|
* |
115
|
|
|
* @param $language |
116
|
|
|
* @param $fieldName |
117
|
|
|
* @param $fieldDefault |
118
|
|
|
* @param string $required |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
|
|
private function getXoopsFormText($language, $fieldName, $fieldDefault, $required = 'false') |
122
|
|
|
{ |
123
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
124
|
|
|
if ('' != $fieldDefault) { |
125
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); |
126
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", "\t\t"); |
127
|
|
|
$formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); |
128
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formText . $required); |
129
|
|
|
} else { |
130
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text', $ccFieldName, "\t\t"); |
131
|
|
|
$formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 255, "this->getVar('{$fieldName}')", true); |
132
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formText . $required); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
return $ret; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @private function getXoopsFormText |
140
|
|
|
* |
141
|
|
|
* @param $language |
142
|
|
|
* @param $fieldName |
143
|
|
|
* @param $required |
144
|
|
|
* |
145
|
|
|
* @return string |
146
|
|
|
*/ |
147
|
|
|
private function getXoopsFormTextArea($language, $fieldName, $required = 'false') |
148
|
|
|
{ |
149
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
150
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'TextArea ' . $ccFieldName, "\t\t"); |
151
|
|
|
$formTextArea = $this->cxc->getClassXoopsFormTextArea('', $language, $fieldName, 4, 47, true); |
152
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formTextArea . $required); |
153
|
|
|
|
154
|
|
|
return $ret; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @private function getXoopsFormDhtmlTextArea |
159
|
|
|
* |
160
|
|
|
* @param $language |
161
|
|
|
* @param $fieldName |
162
|
|
|
* @param $required |
163
|
|
|
* |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'false') |
167
|
|
|
{ |
168
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
169
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t"); |
170
|
|
|
$ret .= $this->pc->getPhpCodeArray('editorConfigs', null, false, "\t\t"); |
171
|
|
|
$getConfig = $this->xc->getXcGetConfig('editor_admin'); |
172
|
|
|
$contIf = $this->xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t"); |
173
|
|
|
$getConfig = $this->xc->getXcGetConfig('editor_user'); |
174
|
|
|
$contElse = $this->xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t"); |
175
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$isAdmin','','', $contIf, $contElse, "\t\t"); |
176
|
|
|
|
177
|
|
|
|
178
|
|
|
$configs = [ |
179
|
|
|
'name' => "'{$fieldName}'", |
180
|
|
|
'value' => "\$this->getVar('{$fieldName}', 'e')", |
181
|
|
|
'rows' => 5, |
182
|
|
|
'cols' => 40, |
183
|
|
|
'width' => "'100%'", |
184
|
|
|
'height' => "'400px'", |
185
|
|
|
'editor' => '$editor', |
186
|
|
|
]; |
187
|
|
|
foreach ($configs as $c => $d) { |
188
|
|
|
$ret .= $this->xc->getXcEqualsOperator("\$editorConfigs['{$c}']", $d, null, "\t\t"); |
189
|
|
|
} |
190
|
|
|
$formEditor = $this->cxc->getClassXoopsFormEditor('', $language, $fieldName, 'editorConfigs', true); |
191
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formEditor . $required); |
192
|
|
|
|
193
|
|
|
return $ret; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @private function getXoopsFormCheckBox |
198
|
|
|
* |
199
|
|
|
* @param $language |
200
|
|
|
* @param $tableSoleName |
201
|
|
|
* @param $fieldName |
202
|
|
|
* @param $fieldElementId |
203
|
|
|
* @param string $required |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
private function getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, $required = 'false') |
207
|
|
|
{ |
208
|
|
|
$stuTableSoleName = \mb_strtoupper($tableSoleName); |
209
|
|
|
$ucfFieldName = $this->cf->getCamelCase($fieldName, true); |
210
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
211
|
|
|
$t = "\t\t"; |
212
|
|
|
if (\in_array(5, $fieldElementId) > 1) { |
213
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Check Box', 'List Options ' . $ccFieldName, $t); |
214
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$checkOption', '$this->getOptions()'); |
215
|
|
|
$foreach = $this->cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, '<hr />', $tableSoleName . '_option', '$checkOption', false, $t . "\t"); |
216
|
|
|
$foreach .= $this->cxc->getClassSetDescription('check' . $ucfFieldName, "{$language}{$stuTableSoleName}_OPTIONS_DESC", $t . "\t"); |
217
|
|
|
$foreach .= $this->cxc->getClassAddOption('check' . $ucfFieldName, "\$option, {$language}{$stuTableSoleName}_ . strtoupper(\$option)", $t . "\t"); |
218
|
|
|
$ret .= $this->pc->getPhpCodeForeach("{$tableSoleName}All", false, false, 'option', $foreach, $t); |
219
|
|
|
$intElem = "\$check{$ucfFieldName}{$required}"; |
220
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $intElem, $t); |
221
|
|
|
} else { |
222
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Check Box', $ccFieldName, $t); |
223
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); |
224
|
|
|
$ret .= $this->cxc->getClassXoopsFormCheckBox('check' . $ucfFieldName, (string)$language, $fieldName, "\${$ccFieldName}", false, $t); |
225
|
|
|
$option = "1, {$language}"; |
226
|
|
|
$ret .= $this->cxc->getClassAddOption('check' . $ucfFieldName, $option, $t); |
227
|
|
|
$intElem = "\$check{$ucfFieldName}{$required}"; |
228
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $intElem, $t); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
return $ret; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @private function getXoopsFormHidden |
236
|
|
|
* |
237
|
|
|
* @param $fieldName |
238
|
|
|
* |
239
|
|
|
* @return string |
240
|
|
|
*/ |
241
|
|
|
private function getXoopsFormHidden($fieldName) |
242
|
|
|
{ |
243
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
244
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Hidden', $ccFieldName, "\t\t"); |
245
|
|
|
$formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $fieldName, true, true); |
246
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formHidden); |
247
|
|
|
|
248
|
|
|
return $ret; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @private function getXoopsFormImageList |
253
|
|
|
* provides listbox for select image, a preview of image and an upload field |
254
|
|
|
* |
255
|
|
|
* @param $language |
256
|
|
|
* @param $moduleDirname |
257
|
|
|
* @param $fieldName |
258
|
|
|
* @param $required |
259
|
|
|
* |
260
|
|
|
* @return string |
261
|
|
|
*/ |
262
|
|
|
private function getXoopsFormImageList($language, $moduleDirname, $fieldName, $required = 'false') |
263
|
|
|
{ |
264
|
|
|
$ucfFieldName = $this->cf->getCamelCase($fieldName, true); |
265
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
266
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
267
|
|
|
$t = "\t\t"; |
268
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Frameworks Images', 'Files ' . $ccFieldName, $t); |
269
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Select Uploaded Image', $t); |
270
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); |
271
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); |
272
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$imageDirectory', "'/Frameworks/moduleclasses/icons/32'", null, $t); |
273
|
|
|
$ret .= $this->cxc->getClassXoopsFormElementTray('imageTray', $language, '<br>', $t); |
274
|
|
|
$sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); |
275
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); |
276
|
|
|
$ret .= $this->xc->getXcXoopsListImgListArray('imageArray', 'XOOPS_ROOT_PATH . $imageDirectory', $t); |
277
|
|
|
$contForeach = $this->cxc->getClassAddOption('imageSelect', '(string)($image1), $image1', $t . "\t"); |
278
|
|
|
$ret .= $this->pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); |
279
|
|
|
$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . XOOPS_URL . \"\\\")'\""; |
280
|
|
|
$ret .= $this->cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); |
281
|
|
|
$ret .= $this->cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); |
282
|
|
|
$paramLabel = "\"<br><img src='\" . XOOPS_URL . '/' . \$imageDirectory . '/' . \${$ccFieldName} . \"' id='imglabel_{$fieldName}' alt='' style='max-width:100px' />\""; |
283
|
|
|
$xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); |
284
|
|
|
$ret .= $this->cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); |
285
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Form Frameworks Images', $ccFieldName .': Upload new image', $t); |
286
|
|
|
$ret .= $this->cxc->getClassXoopsFormElementTray('fileSelectTray', "''", '<br>', $t); |
287
|
|
|
$getConfig = $this->xc->getXcGetConfig('maxsize_image'); |
288
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD_NEW', $fieldName, $getConfig, true, ''); |
289
|
|
|
$ret .= $this->cxc->getClassAddElement('fileSelectTray', $xoopsFormFile, $t); |
290
|
|
|
$xoopsFormLabel1 = $this->cxc->getClassXoopsFormLabel('', "''", null, true, $t); |
291
|
|
|
$ret .= $this->cxc->getClassAddElement('fileSelectTray', $xoopsFormLabel1, $t); |
292
|
|
|
$ret .= $this->cxc->getClassAddElement('imageTray', '$fileSelectTray', $t); |
293
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); |
294
|
|
|
|
295
|
|
|
return $ret; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @private function getXoopsFormSelectFile |
300
|
|
|
* provides listbox for select file and an upload field |
301
|
|
|
* |
302
|
|
|
* @param $language |
303
|
|
|
* @param $moduleDirname |
304
|
|
|
* @param $tableName |
305
|
|
|
* @param $fieldName |
306
|
|
|
* @param $required |
307
|
|
|
* |
308
|
|
|
* @return string |
309
|
|
|
*/ |
310
|
|
|
private function getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') |
311
|
|
|
{ |
312
|
|
|
$ucfFieldName = $this->cf->getCamelCase($fieldName, true); |
313
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
314
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
315
|
|
|
$t = "\t\t"; |
316
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form File', $ccFieldName, $t); |
317
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Select Uploaded File ', $t); |
318
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); |
319
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); |
320
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); |
321
|
|
|
$ret .= $this->cxc->getClassXoopsFormElementTray('fileTray', $language, '<br>', $t); |
322
|
|
|
$sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); |
323
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect('fileSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); |
324
|
|
|
$ret .= $this->xc->getXcXoopsListImgListArray('fileArray', 'XOOPS_ROOT_PATH . $fileDirectory', $t); |
325
|
|
|
$contForeach = $this->cxc->getClassAddOption('fileSelect', '(string)($file1), $file1', $t . "\t"); |
326
|
|
|
$ret .= $this->pc->getPhpCodeForeach('fileArray', false, false, 'file1', $contForeach, $t); |
327
|
|
|
//TODO: make preview for images or show "no preview possible" |
328
|
|
|
//$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . XOOPS_URL . \"\\\")'\""; |
329
|
|
|
//$ret .= $cc->getClassSetExtra('fileSelect', $setExtraParam, $t); |
330
|
|
|
$ret .= $this->cxc->getClassAddElement('fileTray', '$fileSelect, false', $t); |
331
|
|
|
//$paramLabel = "\"<br><img src='\" . XOOPS_URL . '/' . \$imageDirectory . '/' . \${$ccFieldName} . \"' id='imglabel_{$fieldName}' alt='' style='max-width:100px' />\""; |
332
|
|
|
//$xoopsFormLabel = $cc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); |
333
|
|
|
//$ret .= $cc->getClassAddElement('fileTray', $xoopsFormLabel, $t); |
334
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine("Form File {$ccFieldName}:", 'Upload new file', $t); |
335
|
|
|
$getConfigSize = $this->xc->getXcGetConfig('maxsize_file'); |
336
|
|
|
$contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); |
337
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormFile('fileTray', "'<br>' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); |
338
|
|
|
$contIf .= $this->cxc->getClassAddElement('fileTray', $xoopsFormFile, $t . "\t"); |
339
|
|
|
$configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; |
340
|
|
|
$labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); |
341
|
|
|
$contIf .= $this->cxc->getClassAddElement('fileTray', $labelInfo1, $t . "\t"); |
342
|
|
|
$formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); |
343
|
|
|
$contElse = $this->cxc->getClassAddElement('fileTray', $formHidden, $t . "\t"); |
344
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); |
345
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\$fileTray{$required}", $t); |
346
|
|
|
|
347
|
|
|
return $ret; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @private function getXoopsFormUrlFile |
352
|
|
|
* provides textbox with last uploaded url and an upload field |
353
|
|
|
* |
354
|
|
|
* @param $language |
355
|
|
|
* @param $moduleDirname |
356
|
|
|
* @param $fieldName |
357
|
|
|
* @param $fieldDefault |
358
|
|
|
* @param $required |
359
|
|
|
* |
360
|
|
|
* @return string |
361
|
|
|
*/ |
362
|
|
|
private function getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required = 'false') |
363
|
|
|
{ |
364
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
365
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
366
|
|
|
$t = "\t\t"; |
367
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Url', 'Text File ' . $ccFieldName, $t); |
368
|
|
|
$ret .= $this->cxc->getClassXoopsFormElementTray('formUrlFile', $language, '<br><br>', $t); |
369
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator('formUrl', '$this->isNew()', "'{$fieldDefault}'", "\$this->getVar('{$fieldName}')", $t); |
370
|
|
|
$ret .= $this->cxc->getClassXoopsFormText('formText', $language . '_UPLOADS', $fieldName, 75, 255, 'formUrl', false, $t); |
371
|
|
|
$ret .= $this->cxc->getClassAddElement('formUrlFile', '$formText' . $required, $t); |
372
|
|
|
$getConfig = $this->xc->getXcGetConfig('maxsize_file'); |
373
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormFile('', $languageShort . 'FORM_UPLOAD', $fieldName, $getConfig, true, ''); |
374
|
|
|
$ret .= $this->cxc->getClassAddElement('formUrlFile', $xoopsFormFile . $required, $t); |
375
|
|
|
$ret .= $this->cxc->getClassAddElement('form', '$formUrlFile', $t); |
376
|
|
|
|
377
|
|
|
return $ret; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @private function getXoopsFormUploadImage |
382
|
|
|
* provides listbox for select image, a preview of image and an upload field |
383
|
|
|
* |
384
|
|
|
* @param $language |
385
|
|
|
* @param $moduleDirname |
386
|
|
|
* @param $tableName |
387
|
|
|
* @param $fieldName |
388
|
|
|
* @param string $required |
389
|
|
|
* @return string |
390
|
|
|
*/ |
391
|
|
|
private function getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required = 'false') |
392
|
|
|
{ |
393
|
|
|
$ucfFieldName = $this->cf->getCamelCase($fieldName, true); |
394
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
395
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
396
|
|
|
$t = "\t\t"; |
397
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Image', $ccFieldName, $t); |
398
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Select Uploaded Image ', $t); |
399
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$get' . $ucfFieldName, "\$this->getVar('{$fieldName}')", null, $t); |
400
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$get' . $ucfFieldName, '', "'blank.gif'", $t); |
401
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$imageDirectory', "'/uploads/{$moduleDirname}/images/{$tableName}'", null, $t); |
402
|
|
|
$ret .= $this->cxc->getClassXoopsFormElementTray('imageTray', $language, '<br>', $t); |
403
|
|
|
$sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$imageDirectory}/"'); |
404
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect('imageSelect', $sprintf, $fieldName, $ccFieldName, 5, 'false', false, $t); |
405
|
|
|
$ret .= $this->xc->getXcXoopsListImgListArray('imageArray', 'XOOPS_ROOT_PATH . $imageDirectory', $t); |
406
|
|
|
$contForeach = $this->cxc->getClassAddOption('imageSelect', '(string)($image1), $image1', $t . "\t"); |
407
|
|
|
$ret .= $this->pc->getPhpCodeForeach('imageArray', false, false, 'image1', $contForeach, $t); |
408
|
|
|
$setExtraParam = "\"onchange='showImgSelected(\\\"imglabel_{$fieldName}\\\", \\\"{$fieldName}\\\", \\\"\" . \$imageDirectory . '\", \"\", \"' . XOOPS_URL . \"\\\")'\""; |
409
|
|
|
$ret .= $this->cxc->getClassSetExtra('imageSelect', $setExtraParam, $t); |
410
|
|
|
$ret .= $this->cxc->getClassAddElement('imageTray', '$imageSelect, false', $t); |
411
|
|
|
$paramLabel = "\"<br><img src='\" . XOOPS_URL . '/' . \$imageDirectory . '/' . \${$ccFieldName} . \"' id='imglabel_{$fieldName}' alt='' style='max-width:100px' />\""; |
412
|
|
|
$xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', "''", $paramLabel, true, ''); |
413
|
|
|
$ret .= $this->cxc->getClassAddElement('imageTray', $xoopsFormLabel, $t); |
414
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine("Form Image {$ccFieldName}:", 'Upload new image', $t); |
415
|
|
|
$getConfigSize = $this->xc->getXcGetConfig('maxsize_image'); |
416
|
|
|
$contIf = $this->xc->getXcEqualsOperator('$maxsize', $getConfigSize,'', "\t\t\t"); |
417
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormFile('imageTray', "'<br>' . " . $languageShort . 'FORM_UPLOAD_NEW', $fieldName, '$maxsize', true, ''); |
418
|
|
|
$contIf .= $this->cxc->getClassAddElement('imageTray', $xoopsFormFile, $t . "\t"); |
419
|
|
|
$configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; |
420
|
|
|
$labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); |
421
|
|
|
$contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo1, $t . "\t"); |
422
|
|
|
$getConfig = $this->xc->getXcGetConfig('maxwidth_image'); |
423
|
|
|
$labelInfo2 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_WIDTH', $getConfig . " . ' px'", true, ''); |
424
|
|
|
$contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo2, $t . "\t"); |
425
|
|
|
$getConfig = $this->xc->getXcGetConfig('maxheight_image'); |
426
|
|
|
$labelInfo3 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_IMG_HEIGHT', $getConfig . " . ' px'", true, ''); |
427
|
|
|
$contIf .= $this->cxc->getClassAddElement('imageTray', $labelInfo3, $t . "\t"); |
428
|
|
|
$formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, $t, true); |
429
|
|
|
$contElse = $this->cxc->getClassAddElement('imageTray', $formHidden, $t . "\t"); |
430
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $contIf, $contElse, "\t\t"); |
431
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\$imageTray{$required}", $t); |
432
|
|
|
|
433
|
|
|
return $ret; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* @private function getXoopsFormUploadFile |
438
|
|
|
* provides label with last uploaded file and an upload field |
439
|
|
|
* |
440
|
|
|
* @param $language |
441
|
|
|
* @param $moduleDirname |
442
|
|
|
* @param $tableName |
443
|
|
|
* @param $fieldName |
444
|
|
|
* |
445
|
|
|
* @param string $required |
446
|
|
|
* @return string |
447
|
|
|
*/ |
448
|
|
|
private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required = 'false') |
449
|
|
|
{ |
450
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
451
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
452
|
|
|
$t = "\t\t\t"; |
453
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form File:', 'Upload ' . $ccFieldName, "\t\t"); |
454
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', "''", "\$this->getVar('{$fieldName}')", "\t\t"); |
455
|
|
|
$uForm = $this->cxc->getClassXoopsFormElementTray('fileUploadTray', $language, '<br>', $t); |
456
|
|
|
$uForm .= $this->xc->getXcEqualsOperator('$fileDirectory', "'/uploads/{$moduleDirname}/files/{$tableName}'", null, $t); |
457
|
|
|
$sprintf = $this->pc->getPhpCodeSprintf($language . '_UPLOADS', '".{$fileDirectory}/"'); |
458
|
|
|
$xoopsFormLabel = $this->cxc->getClassXoopsFormLabel('', $sprintf, $ccFieldName, true, "\t\t", true); |
459
|
|
|
$condIf = $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormLabel, $t . "\t"); |
460
|
|
|
$uForm .= $this->pc->getPhpCodeConditions('!$this->isNew()', null, null, $condIf, false, "\t\t\t"); |
461
|
|
|
$getConfig = $this->xc->getXcGetConfig('maxsize_file'); |
462
|
|
|
$uForm .= $this->xc->getXcEqualsOperator('$maxsize', $getConfig,'', "\t\t\t"); |
463
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormFile('', "''", $fieldName, '$maxsize', true, ''); |
464
|
|
|
$uForm .= $this->cxc->getClassAddElement('fileUploadTray', $xoopsFormFile, $t); |
465
|
|
|
$configText = "(\$maxsize / 1048576) . ' ' . " . $languageShort . 'FORM_UPLOAD_SIZE_MB'; |
466
|
|
|
$labelInfo1 = $this->cxc->getClassXoopsFormLabel('', $languageShort . 'FORM_UPLOAD_SIZE', $configText, true, ''); |
467
|
|
|
$uForm .= $this->cxc->getClassAddElement('fileUploadTray', $labelInfo1, $t ); |
468
|
|
|
$uForm .= $this->cxc->getClassAddElement('form', "\$fileUploadTray{$required}", $t); |
469
|
|
|
$formHidden = $this->cxc->getClassXoopsFormHidden('', $fieldName, $ccFieldName, true, true, "\t\t", true); |
470
|
|
|
$contElse = $this->cxc->getClassAddElement('form', $formHidden, $t); |
471
|
|
|
|
472
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$permissionUpload', null, null, $uForm, $contElse, "\t\t"); |
473
|
|
|
|
474
|
|
|
return $ret; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* @private function getXoopsFormColorPicker |
479
|
|
|
* |
480
|
|
|
* @param $language |
481
|
|
|
* @param $fieldName |
482
|
|
|
* |
483
|
|
|
* @param string $required |
484
|
|
|
* @return string |
485
|
|
|
*/ |
486
|
|
|
private function getXoopsFormColorPicker($language, $fieldName, $required = 'false') |
487
|
|
|
{ |
488
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
489
|
|
|
$t = "\t\t"; |
490
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Color', 'Picker ' . $ccFieldName, $t); |
491
|
|
|
$getVar = $this->xc->getXcGetVar('', 'this', $fieldName, true); |
492
|
|
|
$xoopsFormFile = $this->cxc->getClassXoopsFormColorPicker('', $language, $fieldName, $getVar, true, ''); |
493
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsFormFile. $required, $t); |
494
|
|
|
|
495
|
|
|
return $ret; |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
/** |
499
|
|
|
* @private function getXoopsFormSelectBox |
500
|
|
|
* |
501
|
|
|
* @param $language |
502
|
|
|
* @param $tableName |
503
|
|
|
* @param $fieldName |
504
|
|
|
* @param $required |
505
|
|
|
* |
506
|
|
|
* @return string |
507
|
|
|
*/ |
508
|
|
|
private function getXoopsFormSelectBox($language, $tableName, $fieldName, $required = 'false') |
509
|
|
|
{ |
510
|
|
|
$ucfTableName = \ucfirst($tableName); |
511
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
512
|
|
|
$t = "\t\t"; |
513
|
|
|
$ret = $this->pc->getPhpCodeCommentLine($ucfTableName, 'Handler', $t); |
514
|
|
|
$ret .= $this->xc->getXcHandlerLine($tableName, $t); |
515
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); |
516
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); |
517
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'Empty'", $t); |
518
|
|
|
$ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$tableName}Handler->getList()", $t); |
519
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
520
|
|
|
|
521
|
|
|
return $ret; |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
/** |
525
|
|
|
* @private function getXoopsFormSelectUser |
526
|
|
|
* |
527
|
|
|
* @param $language |
528
|
|
|
* @param $fieldName |
529
|
|
|
* @param string $required |
530
|
|
|
* @return string |
531
|
|
|
*/ |
532
|
|
|
private function getXoopsFormSelectUser($language, $fieldName, $required = 'false') |
533
|
|
|
{ |
534
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
535
|
|
|
$t = "\t\t"; |
536
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Select', 'User ' . $ccFieldName, $t); |
537
|
|
|
$xoopsSelectUser = $this->cxc->getClassXoopsFormSelectUser('', $language, $fieldName, 'false', $fieldName, true, $t); |
538
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsSelectUser . $required, $t); |
539
|
|
|
|
540
|
|
|
return $ret; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* @private function getXoopsFormRadioYN |
545
|
|
|
* |
546
|
|
|
* @param $language |
547
|
|
|
* @param $fieldName |
548
|
|
|
* @param $required |
549
|
|
|
* |
550
|
|
|
* @return string |
551
|
|
|
*/ |
552
|
|
|
private function getXoopsFormRadioYN($language, $fieldName, $required = 'false') |
553
|
|
|
{ |
554
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
555
|
|
|
$t = "\t\t"; |
556
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Radio', 'Yes/No ' . $ccFieldName, $t); |
557
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); |
558
|
|
|
$xoopsRadioYN = $this->cxc->getClassXoopsFormRadioYN('', $language, $fieldName, $ccFieldName, true, $t); |
559
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsRadioYN . $required, $t); |
560
|
|
|
|
561
|
|
|
return $ret; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
/** |
565
|
|
|
* @private function getXoopsFormTextDateSelect |
566
|
|
|
* |
567
|
|
|
* @param $language |
568
|
|
|
* @param $fieldName |
569
|
|
|
* @param $required |
570
|
|
|
* |
571
|
|
|
* @return string |
572
|
|
|
*/ |
573
|
|
|
private function getXoopsFormTextDateSelect($language, $fieldName, $required = 'false') |
574
|
|
|
{ |
575
|
|
|
$t = "\t\t"; |
576
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
577
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); |
578
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); |
579
|
|
|
$xoopsTextDateSelect = $this->cxc->getClassXoopsFormTextDateSelect('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); |
580
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); |
581
|
|
|
|
582
|
|
|
return $ret; |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
/** |
586
|
|
|
* @private function getXoopsFormDateTime |
587
|
|
|
* |
588
|
|
|
* @param $language |
589
|
|
|
* @param $fieldName |
590
|
|
|
* @param $required |
591
|
|
|
* |
592
|
|
|
* @return string |
593
|
|
|
*/ |
594
|
|
|
private function getXoopsFormDateTime($language, $fieldName, $required = 'false') |
595
|
|
|
{ |
596
|
|
|
$t = "\t\t"; |
597
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
598
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Date Select ' . $ccFieldName, $t); |
599
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', 0, "\$this->getVar('{$fieldName}')", $t); |
600
|
|
|
$xoopsTextDateSelect = $this->cxc->getClassXoopsFormDateTime('', $language, $fieldName, $fieldName, $ccFieldName, true, $t); |
601
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsTextDateSelect . $required, $t); |
602
|
|
|
|
603
|
|
|
return $ret; |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
/** |
607
|
|
|
* @private function getXoopsFormSelectStatus |
608
|
|
|
* |
609
|
|
|
* @param $language |
610
|
|
|
* @param $moduleDirname |
611
|
|
|
* @param $fieldName |
612
|
|
|
* @param $tablePermissions |
613
|
|
|
* @param string $required |
614
|
|
|
* |
615
|
|
|
* @return string |
616
|
|
|
*/ |
617
|
|
|
private function getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required = 'false') |
618
|
|
|
{ |
619
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
620
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
621
|
|
|
$t = "\t\t"; |
622
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Status ' . $ccFieldName, $t); |
623
|
|
|
if (1 == $tablePermissions) { |
624
|
|
|
$ret .= $this->xc->getXcHandlerLine('permissions', $t); |
625
|
|
|
} |
626
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); |
627
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_NONE') . ", {$languageShort}STATUS_NONE", $t); |
628
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_OFFLINE') . ", {$languageShort}STATUS_OFFLINE", $t); |
629
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_SUBMITTED') . ", {$languageShort}STATUS_SUBMITTED", $t); |
630
|
|
|
if (1 == $tablePermissions) { |
631
|
|
|
$contIf = $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_APPROVED') . ", {$languageShort}STATUS_APPROVED", $t . "\t"); |
632
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$permissionsHandler->getPermGlobalApprove()', '', '', $contIf, false, $t); |
633
|
|
|
} |
634
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', $this->xc->getXcGetConstants('STATUS_BROKEN') . ", {$languageShort}STATUS_BROKEN", $t); |
635
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
636
|
|
|
|
637
|
|
|
return $ret; |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
/** |
641
|
|
|
* @private function getXoopsFormPassword |
642
|
|
|
* |
643
|
|
|
* @param $language |
644
|
|
|
* @param $fieldName |
645
|
|
|
* @param $required |
646
|
|
|
* |
647
|
|
|
* @return string |
648
|
|
|
*/ |
649
|
|
|
private function getXoopsFormPassword($language, $fieldName, $required = 'false') |
650
|
|
|
{ |
651
|
|
|
$t = "\t\t"; |
652
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
653
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text', 'Enter Password ' . $ccFieldName, $t); |
654
|
|
|
$xoopsPassword = $this->cxc->getClassXoopsFormPassword('', $language, $fieldName, 10, 32, true, $t); |
655
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $xoopsPassword . $required, $t); |
656
|
|
|
|
657
|
|
|
return $ret; |
658
|
|
|
} |
659
|
|
|
|
660
|
|
|
/** |
661
|
|
|
* @private function getXoopsFormSelectCountry |
662
|
|
|
* |
663
|
|
|
* @param $language |
664
|
|
|
* @param $fieldName |
665
|
|
|
* @param string $required |
666
|
|
|
* |
667
|
|
|
* @return string |
668
|
|
|
*/ |
669
|
|
|
private function getXoopsFormSelectCountry($language, $fieldName, $required = 'false') |
670
|
|
|
{ |
671
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
672
|
|
|
$t = "\t\t"; |
673
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Country ' . $ccFieldName, $t); |
674
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); |
675
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', _NONE", $t); |
676
|
|
|
$ret .= $this->xc->getXcXoopsListCountryList('countryArray', $t); |
677
|
|
|
$ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$countryArray', $t); |
678
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
679
|
|
|
|
680
|
|
|
return $ret; |
681
|
|
|
} |
682
|
|
|
|
683
|
|
|
/** |
684
|
|
|
* @private function getXoopsFormSelectLang |
685
|
|
|
* |
686
|
|
|
* @param $language |
687
|
|
|
* @param $fieldName |
688
|
|
|
* @param string $required |
689
|
|
|
* |
690
|
|
|
* @return string |
691
|
|
|
*/ |
692
|
|
|
private function getXoopsFormSelectLang($language, $fieldName, $required = 'false') |
693
|
|
|
{ |
694
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
695
|
|
|
$t = "\t\t"; |
696
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Select', 'Lang ' . $ccFieldName, $t); |
697
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); |
698
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'', _NONE", $t); |
699
|
|
|
$ret .= $this->xc->getXcXoopsListLangList('langArray', $t); |
700
|
|
|
$ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', '$langArray', $t); |
701
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
702
|
|
|
|
703
|
|
|
return $ret; |
704
|
|
|
} |
705
|
|
|
|
706
|
|
|
/** |
707
|
|
|
* @private function getXoopsFormRadio |
708
|
|
|
* |
709
|
|
|
* @param $language |
710
|
|
|
* @param $moduleDirname |
711
|
|
|
* @param $fieldName |
712
|
|
|
* @param string $required |
713
|
|
|
* |
714
|
|
|
* @return string |
715
|
|
|
*/ |
716
|
|
|
private function getXoopsFormRadio($language, $moduleDirname, $fieldName, $required = 'false') |
717
|
|
|
{ |
718
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
719
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
720
|
|
|
$t = "\t\t"; |
721
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Radio', $ccFieldName, $t); |
722
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '0', "\$this->getVar('{$fieldName}')", $t); |
723
|
|
|
$ret .= $this->cxc->getClassXoopsFormRadio($ccFieldName . 'Select', $language, $fieldName, "{$ccFieldName}", false, $t); |
724
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'0', _NONE", $t); |
725
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); |
726
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); |
727
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); |
728
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
729
|
|
|
|
730
|
|
|
return $ret; |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* @private function getXoopsFormSelectCombo |
735
|
|
|
* |
736
|
|
|
* @param $language |
737
|
|
|
* @param $moduleDirname |
738
|
|
|
* @param $tableName |
739
|
|
|
* @param $fieldName |
740
|
|
|
* @param string $required |
741
|
|
|
* |
742
|
|
|
* @return string |
743
|
|
|
*/ |
744
|
|
|
private function getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required = 'false') |
745
|
|
|
{ |
746
|
|
|
$ucfTableName = \ucfirst($tableName); |
747
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
748
|
|
|
$languageShort = \substr($language, 0, 4) . \mb_strtoupper($moduleDirname) . '_'; |
749
|
|
|
$t = "\t\t"; |
750
|
|
|
$ret = $this->pc->getPhpCodeCommentLine($ucfTableName, 'Handler', $t); |
751
|
|
|
$ret .= $this->xc->getXcHandlerLine($tableName, $t); |
752
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Form', 'Select ' . $ccFieldName, $t); |
753
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", '5', '', false, $t); |
754
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'0', _NONE", $t); |
755
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'1', {$languageShort}LIST_1", $t); |
756
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'2', {$languageShort}LIST_2", $t); |
757
|
|
|
$ret .= $this->cxc->getClassAddOption($ccFieldName . 'Select', "'3', {$languageShort}LIST_3", $t); |
758
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
759
|
|
|
|
760
|
|
|
return $ret; |
761
|
|
|
} |
762
|
|
|
|
763
|
|
|
/** |
764
|
|
|
* @private function getXoopsFormTable |
765
|
|
|
* |
766
|
|
|
* @param $language |
767
|
|
|
* @param $fieldName |
768
|
|
|
* @param $fieldElement |
769
|
|
|
* @param $required |
770
|
|
|
* |
771
|
|
|
* @return string |
772
|
|
|
*/ |
773
|
|
|
private function getXoopsFormTable($language,$fieldName, $fieldElement, $required = 'false') |
774
|
|
|
{ |
775
|
|
|
$t = "\t\t"; |
776
|
|
|
$ret = ''; |
777
|
|
|
$fElement = $this->helper->getHandler('Fieldelements')->get($fieldElement); |
778
|
|
|
$rpFieldelementName = \mb_strtolower(\str_replace('Table : ', '', $fElement->getVar('fieldelement_name'))); |
779
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Form Table', $rpFieldelementName, $t); |
780
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
781
|
|
|
$ret .= $this->xc->getXcHandlerLine($rpFieldelementName, $t); |
782
|
|
|
$ret .= $this->cxc->getClassXoopsFormSelect($ccFieldName . 'Select', $language, $fieldName, "this->getVar('{$fieldName}')", null, '', false, $t); |
783
|
|
|
$ret .= $this->cxc->getClassAddOptionArray($ccFieldName . 'Select', "\${$rpFieldelementName}Handler->getList()", $t); |
784
|
|
|
$ret .= $this->cxc->getClassAddElement('form', "\${$ccFieldName}Select{$required}", $t); |
785
|
|
|
|
786
|
|
|
return $ret; |
787
|
|
|
} |
788
|
|
|
|
789
|
|
|
/** |
790
|
|
|
* @private function getXoopsFormTopic |
791
|
|
|
* |
792
|
|
|
* @param $language |
793
|
|
|
* @param $topicTableName |
794
|
|
|
* @param $fieldId |
795
|
|
|
* @param $fieldPid |
796
|
|
|
* @param $fieldMain |
797
|
|
|
* @return string |
798
|
|
|
*/ |
799
|
|
|
private function getXoopsFormTopic($language, $topicTableName, $fieldId, $fieldPid, $fieldMain) |
800
|
|
|
{ |
801
|
|
|
$ucfTopicTableName = \ucfirst($topicTableName); |
802
|
|
|
$stlTopicTableName = \mb_strtolower($topicTableName); |
803
|
|
|
$ccFieldPid = $this->cf->getCamelCase($fieldPid, false, true); |
804
|
|
|
$t = "\t\t"; |
805
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Table', $ucfTopicTableName, $t); |
806
|
|
|
$ret .= $this->xc->getXcHandlerLine($stlTopicTableName, $t); |
807
|
|
|
$ret .= $this->xc->getXcCriteriaCompo('cr' . $ucfTopicTableName, $t); |
808
|
|
|
$ret .= $this->xc->getXcHandlerCountClear($stlTopicTableName . 'Count', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t); |
809
|
|
|
$contIf = $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/tree', true, false, 'include', $t . "\t"); |
810
|
|
|
$contIf .= $this->xc->getXcHandlerAllClear($stlTopicTableName . 'All', $stlTopicTableName, '$cr' . $ucfTopicTableName, $t . "\t"); |
811
|
|
|
$contIf .= $this->cxc->getClassXoopsObjectTree($stlTopicTableName . 'Tree', $stlTopicTableName . 'All', $fieldId, $fieldPid, $t . "\t"); |
812
|
|
|
$contIf .= $this->cxc->getClassXoopsMakeSelBox($ccFieldPid, $stlTopicTableName . 'Tree', $fieldPid, $fieldMain, '--', $fieldPid, $t . "\t"); |
813
|
|
|
$formLabel = $this->cxc->getClassXoopsFormLabel('', $language, "\${$ccFieldPid}", true, ''); |
814
|
|
|
$contIf .= $this->cxc->getClassAddElement('form', $formLabel, $t . "\t"); |
815
|
|
|
$ret .= $this->pc->getPhpCodeConditions("\${$stlTopicTableName}Count", null, null, $contIf, false, $t); |
816
|
|
|
$ret .= $this->pc->getPhpCodeUnset('cr' . $ucfTopicTableName, $t); |
817
|
|
|
|
818
|
|
|
return $ret; |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
/** |
822
|
|
|
* @private function getXoopsFormTag |
823
|
|
|
* |
824
|
|
|
* @param $fieldId |
825
|
|
|
* @param $required |
826
|
|
|
* |
827
|
|
|
* @return string |
828
|
|
|
*/ |
829
|
|
|
private function getXoopsFormTag($fieldId, $required = 'false') |
830
|
|
|
{ |
831
|
|
|
$t = "\t\t"; |
832
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Use tag', 'module', $t); |
833
|
|
|
$isDir = $this->pc->getPhpCodeIsDir("XOOPS_ROOT_PATH . '/modules/tag'"); |
834
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator('dirTag', $isDir, 'true', 'false', $t); |
835
|
|
|
$paramIf = '(' . $this->xc->getXcGetConfig('usetag') . ' == 1)'; |
836
|
|
|
$condIf = $this->pc->getPhpCodeTernaryOperator('tagId', '$this->isNew()', '0', "\$this->getVar('{$fieldId}')", $t . "\t"); |
837
|
|
|
$condIf .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'modules/tag/include/formtag', true, false, $type = 'include', $t . "\t"); |
838
|
|
|
$paramElem = $this->cxc->getClassXoopsFormTag('', 'tag', 60, 255, 'tagId', 0, true, ''); |
839
|
|
|
$condIf .= $this->cxc->getClassAddElement('form', $paramElem . $required, $t . "\t"); |
840
|
|
|
$ret .= $this->pc->getPhpCodeConditions($paramIf, ' && ', '$dirTag', $condIf, false, $t); |
841
|
|
|
|
842
|
|
|
return $ret; |
843
|
|
|
} |
844
|
|
|
|
845
|
|
|
/** |
846
|
|
|
* @private function getXoopsFormTextUuid |
847
|
|
|
* |
848
|
|
|
* @param $language |
849
|
|
|
* @param $fieldName |
850
|
|
|
* @param string $required |
851
|
|
|
* @return string |
852
|
|
|
*/ |
853
|
|
|
private function getXoopsFormTextUuid($language, $fieldName, $required = 'false') |
854
|
|
|
{ |
855
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
856
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text Uuid', $ccFieldName, "\t\t"); |
857
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator($ccFieldName, '$this->isNew()', '\Xmf\Uuid::generate()', "\$this->getVar('{$fieldName}')", "\t\t"); |
858
|
|
|
$formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 50, 150, $ccFieldName, true); |
859
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formText . $required); |
860
|
|
|
|
861
|
|
|
|
862
|
|
|
return $ret; |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
/** |
866
|
|
|
* @private function getXoopsFormTextIp |
867
|
|
|
* |
868
|
|
|
* @param $language |
869
|
|
|
* @param $fieldName |
870
|
|
|
* @param string $required |
871
|
|
|
* @return string |
872
|
|
|
*/ |
873
|
|
|
private function getXoopsFormTextIp($language, $fieldName, $required = 'false') |
874
|
|
|
{ |
875
|
|
|
$ccFieldName = $this->cf->getCamelCase($fieldName, false, true); |
876
|
|
|
|
877
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Form Text IP', $ccFieldName, "\t\t"); |
878
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$' . $ccFieldName, "\$_SERVER['REMOTE_ADDR']", null, "\t\t"); |
879
|
|
|
$formText = $this->cxc->getClassXoopsFormText('', $language, $fieldName, 20, 150, $ccFieldName, true); |
880
|
|
|
$ret .= $this->cxc->getClassAddElement('form', $formText . $required); |
881
|
|
|
|
882
|
|
|
return $ret; |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
/** |
886
|
|
|
* @public function renderElements |
887
|
|
|
* @param null |
888
|
|
|
* @return string |
889
|
|
|
*/ |
890
|
|
|
public function renderElements() |
891
|
|
|
{ |
892
|
|
|
$module = $this->getModule(); |
893
|
|
|
$table = $this->getTable(); |
894
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
895
|
|
|
$tableName = $table->getVar('table_name'); |
896
|
|
|
$tableSoleName = $table->getVar('table_solename'); |
897
|
|
|
$tablePermissions = $table->getVar('table_permissions'); |
898
|
|
|
$languageFunct = $this->cf->getLanguage($moduleDirname, 'AM'); |
899
|
|
|
$ret = ''; |
900
|
|
|
$fields = $this->tf->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'), 'field_order ASC, field_id'); |
901
|
|
|
$fieldId = ''; |
902
|
|
|
$fieldIdTopic = ''; |
903
|
|
|
$fieldPidTopic = ''; |
904
|
|
|
$fieldMainTopic = ''; |
905
|
|
|
$fieldElementId = []; |
906
|
|
|
$counter = 0; |
907
|
|
|
foreach (\array_keys($fields) as $f) { |
908
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
909
|
|
|
$fieldDefault = $fields[$f]->getVar('field_default'); |
910
|
|
|
$fieldElement = $fields[$f]->getVar('field_element'); |
911
|
|
|
$fieldParent = $fields[$f]->getVar('field_parent'); |
912
|
|
|
$fieldInForm = $fields[$f]->getVar('field_inform'); |
913
|
|
|
if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { |
914
|
|
|
$fieldId = $fieldName; |
915
|
|
|
} |
916
|
|
|
$rpFieldName = $this->cf->getRightString($fieldName); |
917
|
|
|
$language = $languageFunct . \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName); |
918
|
|
|
$required = (1 == $fields[$f]->getVar('field_required')) ? ', true' : ''; |
919
|
|
|
|
920
|
|
|
$fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); |
921
|
|
|
$fieldElementId[] = $fieldElements->getVar('fieldelement_id'); |
922
|
|
|
|
923
|
|
|
if (1 == $fieldInForm) { |
924
|
|
|
$counter++; |
925
|
|
|
// Switch elements |
926
|
|
|
switch ($fieldElement) { |
927
|
|
|
case 1: |
928
|
|
|
break; |
929
|
|
|
case 2: |
930
|
|
|
$ret .= $this->getXoopsFormText($language, $fieldName, $fieldDefault, $required); |
931
|
|
|
break; |
932
|
|
|
case 3: |
933
|
|
|
$ret .= $this->getXoopsFormTextArea($language, $fieldName, $required); |
934
|
|
|
break; |
935
|
|
|
case 4: |
936
|
|
|
$ret .= $this->getXoopsFormDhtmlTextArea($language, $fieldName, $required); |
937
|
|
|
break; |
938
|
|
|
case 5: |
939
|
|
|
$ret .= $this->getXoopsFormCheckBox($language, $tableSoleName, $fieldName, $fieldElementId, $required); |
940
|
|
|
break; |
941
|
|
|
case 6: |
942
|
|
|
$ret .= $this->getXoopsFormRadioYN($language, $fieldName, $required); |
943
|
|
|
break; |
944
|
|
|
case 7: |
945
|
|
|
$ret .= $this->getXoopsFormSelectBox($language, $tableName, $fieldName, $required); |
946
|
|
|
break; |
947
|
|
|
case 8: |
948
|
|
|
$ret .= $this->getXoopsFormSelectUser($language, $fieldName, $required); |
949
|
|
|
break; |
950
|
|
|
case 9: |
951
|
|
|
$ret .= $this->getXoopsFormColorPicker($language, $fieldName, $required); |
952
|
|
|
break; |
953
|
|
|
case 10: |
954
|
|
|
$ret .= $this->getXoopsFormImageList($language, $moduleDirname, $fieldName, $required); |
955
|
|
|
break; |
956
|
|
|
case 11: |
957
|
|
|
$ret .= $this->getXoopsFormSelectFile($language, $moduleDirname, $tableName, $fieldName, $required); |
958
|
|
|
break; |
959
|
|
|
case 12: |
960
|
|
|
$ret .= $this->getXoopsFormUrlFile($language, $moduleDirname, $fieldName, $fieldDefault, $required); |
961
|
|
|
break; |
962
|
|
|
case 13: |
963
|
|
|
$ret .= $this->getXoopsFormUploadImage($language, $moduleDirname, $tableName, $fieldName, $required); |
964
|
|
|
break; |
965
|
|
|
case 14: |
966
|
|
|
$ret .= $this->getXoopsFormUploadFile($language, $moduleDirname, $tableName, $fieldName, $required); |
967
|
|
|
break; |
968
|
|
|
case 15: |
969
|
|
|
$ret .= $this->getXoopsFormTextDateSelect($language, $fieldName, $required); |
970
|
|
|
break; |
971
|
|
|
case 16: |
972
|
|
|
$ret .= $this->getXoopsFormSelectStatus($language, $moduleDirname, $fieldName, $tablePermissions, $required); |
973
|
|
|
break; |
974
|
|
|
case 17: |
975
|
|
|
$ret .= $this->getXoopsFormPassword($language, $fieldName, $required); |
976
|
|
|
break; |
977
|
|
|
case 18: |
978
|
|
|
$ret .= $this->getXoopsFormSelectCountry($language, $fieldName, $required); |
979
|
|
|
break; |
980
|
|
|
case 19: |
981
|
|
|
$ret .= $this->getXoopsFormSelectLang($language, $fieldName, $required); |
982
|
|
|
break; |
983
|
|
|
case 20: |
984
|
|
|
$ret .= $this->getXoopsFormRadio($language, $moduleDirname, $fieldName, $required); |
985
|
|
|
break; |
986
|
|
|
case 21: |
987
|
|
|
$ret .= $this->getXoopsFormDateTime($language, $fieldName, $required); |
988
|
|
|
break; |
989
|
|
|
case 22: |
990
|
|
|
$ret .= $this->getXoopsFormSelectCombo($language, $moduleDirname, $tableName, $fieldName, $required); |
991
|
|
|
break; |
992
|
|
|
case 23: |
993
|
|
|
$ret .= $this->getXoopsFormTextUuid($language, $fieldName, $required); |
994
|
|
|
break; |
995
|
|
|
case 24: |
996
|
|
|
$ret .= $this->getXoopsFormTextIp($language, $fieldName, $required); |
997
|
|
|
break; |
998
|
|
|
default: |
999
|
|
|
// If we use tag module |
1000
|
|
|
if (1 == $table->getVar('table_tag')) { |
1001
|
|
|
$ret .= $this->getXoopsFormTag($fieldId, $required); |
1002
|
|
|
} |
1003
|
|
|
// If we want to hide XoopsFormHidden() or field id |
1004
|
|
|
if ((0 == $f) && (1 == $table->getVar('table_autoincrement'))) { |
1005
|
|
|
$ret .= $this->getXoopsFormHidden($fieldName); |
1006
|
|
|
} |
1007
|
|
|
break; |
1008
|
|
|
} |
1009
|
|
|
|
1010
|
|
|
$fieldElements = $this->helper->getHandler('Fieldelements')->get($fieldElement); |
1011
|
|
|
$fieldElementTid = $fieldElements->getVar('fieldelement_tid'); |
1012
|
|
|
if ((int)$fieldElementTid > 0 ) { |
1013
|
|
|
if ((1 == $fieldParent) || 1 == $table->getVar('table_category')) { |
1014
|
|
|
$fieldElementMid = $fieldElements->getVar('fieldelement_mid'); |
1015
|
|
|
$fieldElementName = $fieldElements->getVar('fieldelement_name'); |
1016
|
|
|
$fieldNameDesc = mb_substr($fieldElementName, \mb_strrpos($fieldElementName, ':'), mb_strlen($fieldElementName)); |
1017
|
|
|
$topicTableName = \str_replace(': ', '', $fieldNameDesc); |
1018
|
|
|
$fieldsTopics = $this->tf->getTableFields($fieldElementMid, $fieldElementTid); |
1019
|
|
|
foreach (\array_keys($fieldsTopics) as $g) { |
1020
|
|
|
$fieldNameTopic = $fieldsTopics[$g]->getVar('field_name'); |
1021
|
|
|
if ((0 == $g) && (1 == $table->getVar('table_autoincrement'))) { |
1022
|
|
|
$fieldIdTopic = $fieldNameTopic; |
1023
|
|
|
} |
1024
|
|
|
if (1 == $fieldsTopics[$g]->getVar('field_parent')) { |
1025
|
|
|
$fieldPidTopic = $fieldNameTopic; |
1026
|
|
|
} |
1027
|
|
|
if (1 == $fieldsTopics[$g]->getVar('field_main')) { |
1028
|
|
|
$fieldMainTopic = $fieldNameTopic; |
1029
|
|
|
} |
1030
|
|
|
} |
1031
|
|
|
$ret .= $this->getXoopsFormTopic($language, $topicTableName, $fieldIdTopic, $fieldPidTopic, $fieldMainTopic); |
1032
|
|
|
} else { |
1033
|
|
|
$ret .= $this->getXoopsFormTable($language, $fieldName, $fieldElement, $required); |
1034
|
|
|
} |
1035
|
|
|
} |
1036
|
|
|
} |
1037
|
|
|
} |
1038
|
|
|
unset($fieldElementId); |
1039
|
|
|
|
1040
|
|
|
return $ret; |
1041
|
|
|
} |
1042
|
|
|
} |
1043
|
|
|
|