|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
|
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
/** |
|
13
|
|
|
* tdmcreate module. |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
|
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
17
|
|
|
* |
|
18
|
|
|
* @since 2.5.0 |
|
19
|
|
|
* |
|
20
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
21
|
|
|
* |
|
22
|
|
|
* @version $Id: AdminPhpCode.php 12258 2014-01-02 09:33:29Z timgno $ |
|
23
|
|
|
*/ |
|
24
|
|
|
defined('XOOPS_ROOT_PATH') or die('Restricted access'); |
|
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class AdminPhpCode. |
|
27
|
|
|
*/ |
|
28
|
|
|
class AdminPhpCode extends AdminObjects |
|
|
|
|
|
|
29
|
|
|
{ |
|
30
|
|
|
/* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $adminphpcode; |
|
34
|
|
|
|
|
35
|
|
|
/* |
|
36
|
|
|
* @public function constructor |
|
37
|
|
|
* @param null |
|
38
|
|
|
*/ |
|
39
|
|
|
/** |
|
40
|
|
|
* |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct() |
|
43
|
|
|
{ |
|
44
|
|
|
parent::__construct(); |
|
45
|
|
|
$this->adminobjects = AdminObjects::getInstance(); |
|
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/* |
|
49
|
|
|
* @static function &getInstance |
|
50
|
|
|
* @param null |
|
51
|
|
|
*/ |
|
52
|
|
|
/** |
|
53
|
|
|
* @return AdminPhpCode |
|
54
|
|
|
*/ |
|
55
|
|
|
public static function &getInstance() |
|
56
|
|
|
{ |
|
57
|
|
|
static $instance = false; |
|
58
|
|
|
if (!$instance) { |
|
59
|
|
|
$instance = new self(); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
return $instance; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/* |
|
66
|
|
|
* @public function getAdminIncludeHeader |
|
67
|
|
|
* @param null |
|
68
|
|
|
* @return string |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getAdminIncludeHeader() |
|
71
|
|
|
{ |
|
72
|
|
|
return "include __DIR__ . '/header.php';\n"; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @public function getAdminSwitch |
|
77
|
|
|
* |
|
78
|
|
|
* @param $content |
|
79
|
|
|
* |
|
80
|
|
|
* @return string |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getAdminSwitch($content) |
|
83
|
|
|
{ |
|
84
|
|
|
$ret = <<<EOT |
|
85
|
|
|
switch {\n |
|
86
|
|
|
\t{$content} |
|
87
|
|
|
}\n |
|
88
|
|
|
EOT; |
|
89
|
|
|
|
|
90
|
|
|
return $ret; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @public function getAdminStringCaseDefaultSwitch |
|
95
|
|
|
* |
|
96
|
|
|
* @param $case |
|
97
|
|
|
* @param $content |
|
98
|
|
|
* |
|
99
|
|
|
* @return string |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getAdminStringCaseDefaultSwitch($case = 'list', $content) |
|
102
|
|
|
{ |
|
103
|
|
|
$ret = <<<EOT |
|
104
|
|
|
case '{$case}': |
|
105
|
|
|
default:\n |
|
106
|
|
|
\t\t{$content} |
|
107
|
|
|
break;\n |
|
108
|
|
|
EOT; |
|
109
|
|
|
|
|
110
|
|
|
return $ret; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @public function getAdminStringCaseSwitch |
|
115
|
|
|
* |
|
116
|
|
|
* @param $case |
|
117
|
|
|
* @param $content |
|
118
|
|
|
* |
|
119
|
|
|
* @return string |
|
120
|
|
|
*/ |
|
121
|
|
|
public function getAdminStringCaseSwitch($case = 'list', $content) |
|
122
|
|
|
{ |
|
123
|
|
|
$ret = <<<EOT |
|
124
|
|
|
case '{$case}':\n |
|
125
|
|
|
\t\t{$content} |
|
126
|
|
|
break;\n |
|
127
|
|
|
EOT; |
|
128
|
|
|
|
|
129
|
|
|
return $ret; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/* |
|
133
|
|
|
* @public function getAdminNumericCaseDefaultSwitch |
|
134
|
|
|
* @param $case |
|
135
|
|
|
* @return string |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getAdminNumericCaseDefaultSwitch($case = 1) |
|
138
|
|
|
{ |
|
139
|
|
|
$ret = <<<EOT |
|
140
|
|
|
case {$case}: |
|
141
|
|
|
default:\n |
|
142
|
|
|
\t\t{$content} |
|
|
|
|
|
|
143
|
|
|
break;\n |
|
144
|
|
|
EOT; |
|
145
|
|
|
|
|
146
|
|
|
return $ret; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/* |
|
150
|
|
|
* @public function getAdminNumericCaseSwitch |
|
151
|
|
|
* @param $case |
|
152
|
|
|
* @return string |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getAdminNumericCaseSwitch($case = 1) |
|
155
|
|
|
{ |
|
156
|
|
|
$ret = <<<EOT |
|
157
|
|
|
case {$case}:\n |
|
158
|
|
|
\t\t{$content} |
|
|
|
|
|
|
159
|
|
|
break;\n |
|
160
|
|
|
EOT; |
|
161
|
|
|
|
|
162
|
|
|
return $ret; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/* |
|
166
|
|
|
* @public function getAdminTemplateMain |
|
167
|
|
|
* @param $moduleDirname |
|
168
|
|
|
* @param $tableName |
|
169
|
|
|
* @return string |
|
170
|
|
|
*/ |
|
171
|
|
|
public function getAdminTemplateMain($moduleDirname, $tableName) |
|
172
|
|
|
{ |
|
173
|
|
|
$ret = <<<EOT |
|
174
|
|
|
\$templateMain = '{$moduleDirname}_admin_{$tableName}.tpl';\n |
|
175
|
|
|
EOT; |
|
176
|
|
|
|
|
177
|
|
|
return $ret; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @public function getAdminXoopsTplAssign |
|
182
|
|
|
* |
|
183
|
|
|
* @param string $tplString |
|
184
|
|
|
* @param string $phpRender |
|
185
|
|
|
* |
|
186
|
|
|
* @return string |
|
187
|
|
|
*/ |
|
188
|
|
|
public function getAdminXoopsTplAssign($tplString, $phpRender) |
|
189
|
|
|
{ |
|
190
|
|
|
$ret = <<<EOT |
|
191
|
|
|
\$GLOBALS['xoopsTpl']->assign('{$tplString}', \${$phpRender});\n |
|
192
|
|
|
EOT; |
|
193
|
|
|
|
|
194
|
|
|
return $ret; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @public function getAdminXoopsTplAppend |
|
199
|
|
|
* |
|
200
|
|
|
* @param string $tplString |
|
201
|
|
|
* @param string $phpRender |
|
202
|
|
|
* |
|
203
|
|
|
* @return string |
|
204
|
|
|
*/ |
|
205
|
|
|
public function getAdminXoopsTplAppend($tplString, $phpRender) |
|
206
|
|
|
{ |
|
207
|
|
|
$ret = <<<EOT |
|
208
|
|
|
\$GLOBALS['xoopsTpl']->append('{$tplString}', \${$phpRender});\n |
|
209
|
|
|
EOT; |
|
210
|
|
|
|
|
211
|
|
|
return $ret; |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @public function getAdminXoopsTplAppendByRef |
|
216
|
|
|
* |
|
217
|
|
|
* @param string $tplString |
|
218
|
|
|
* @param string $phpRender |
|
219
|
|
|
* |
|
220
|
|
|
* @return string |
|
221
|
|
|
*/ |
|
222
|
|
|
public function getAdminXoopsTplAppendByRef($tplString, $phpRender) |
|
223
|
|
|
{ |
|
224
|
|
|
$ret = <<<EOT |
|
225
|
|
|
\$GLOBALS['xoopsTpl']->appendByRef('{$tplString}', \${$phpRender});\n |
|
226
|
|
|
EOT; |
|
227
|
|
|
|
|
228
|
|
|
return $ret; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/* |
|
232
|
|
|
* @public function getAdminTemplateMain |
|
233
|
|
|
* @param $moduleDirname |
|
234
|
|
|
* @param $tableName |
|
235
|
|
|
* @param $admin |
|
236
|
|
|
* @return string |
|
237
|
|
|
*/ |
|
238
|
|
|
public function getAdminItemButton($moduleDirname, $tableName, $admin = false) |
|
|
|
|
|
|
239
|
|
|
{ |
|
240
|
|
|
$ret = <<<EOT |
|
241
|
|
|
\$adminMenu->addItemButton({$language}ADD_{$stuTableSoleName}, '{$tableName}.php?op=new', 'add'); |
|
|
|
|
|
|
242
|
|
|
\$adminMenu->addItemButton({$language}{$stuTableName}_LIST, '{$tableName}.php', 'list'); |
|
|
|
|
|
|
243
|
|
|
\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php')); |
|
244
|
|
|
\$GLOBALS['xoopsTpl']->assign('buttons', \$adminMenu->renderButton());\n |
|
245
|
|
|
EOT; |
|
246
|
|
|
|
|
247
|
|
|
return $ret; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @public function getAdminAddNavigation |
|
252
|
|
|
* |
|
253
|
|
|
* @param $tableName |
|
254
|
|
|
* |
|
255
|
|
|
* @return string |
|
256
|
|
|
*/ |
|
257
|
|
|
public function getAdminAddNavigation($tableName) |
|
258
|
|
|
{ |
|
259
|
|
|
$ret = <<<EOT |
|
260
|
|
|
\$GLOBALS['xoopsTpl']->assign('navigation', \$adminMenu->addNavigation('{$tableName}.php'));\n |
|
261
|
|
|
EOT; |
|
262
|
|
|
|
|
263
|
|
|
return $ret; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @public function getAdminObjHandlerCreate |
|
268
|
|
|
* |
|
269
|
|
|
* @param string $tableName |
|
270
|
|
|
* |
|
271
|
|
|
* @return string |
|
272
|
|
|
*/ |
|
273
|
|
|
public function getAdminObjHandlerCreate($tableName) |
|
274
|
|
|
{ |
|
275
|
|
|
$ret = <<<EOT |
|
276
|
|
|
\${$tableName}Obj =& \${$tableName}Handler->create();\n |
|
277
|
|
|
EOT; |
|
278
|
|
|
|
|
279
|
|
|
return $ret; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
/** |
|
283
|
|
|
* @public function getAdminPhpCodeSetVarsObjects |
|
284
|
|
|
* |
|
285
|
|
|
* @param $moduleDirname |
|
286
|
|
|
* @param $tableName |
|
287
|
|
|
* @param $fields |
|
288
|
|
|
* |
|
289
|
|
|
* @return string |
|
290
|
|
|
*/ |
|
291
|
|
|
public function getAdminPhpCodeSetVarsObjects($moduleDirname, $tableName, $fields) |
|
292
|
|
|
{ |
|
293
|
|
|
$ret = <<<EOT |
|
294
|
|
|
// Set Vars\n |
|
295
|
|
|
EOT; |
|
296
|
|
|
foreach (array_keys($fields) as $f) { |
|
297
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
|
298
|
|
|
$fieldElement = $fields[$f]->getVar('field_element'); |
|
299
|
|
|
if ($f > 0) { // If we want to hide field id |
|
300
|
|
|
switch ($fieldElement) { |
|
301
|
|
|
case 5: |
|
302
|
|
|
case 6: |
|
303
|
|
|
$ret .= $this->adminobjects->getCheckBoxOrRadioYNSetVar($tableName, $fieldName); |
|
|
|
|
|
|
304
|
|
|
break; |
|
305
|
|
|
case 11: |
|
306
|
|
|
$ret .= $this->adminobjects->getImageListSetVar($moduleDirname, $tableName, $fieldName); |
|
|
|
|
|
|
307
|
|
|
break; |
|
308
|
|
|
case 12: |
|
309
|
|
|
$ret .= $this->adminobjects->getUrlFileSetVar($moduleDirname, $tableName, $fieldName); |
|
|
|
|
|
|
310
|
|
|
break; |
|
311
|
|
|
case 13: |
|
312
|
|
|
if (1 == $fields[$f]->getVar('field_main')) { |
|
313
|
|
|
$fieldMain = $fieldName; |
|
314
|
|
|
} |
|
315
|
|
|
$ret .= $this->adminobjects->getUploadImageSetVar($moduleDirname, $tableName, $fieldName, $fieldMain); |
|
|
|
|
|
|
316
|
|
|
break; |
|
317
|
|
|
case 14: |
|
318
|
|
|
$ret .= $this->adminobjects->getUploadFileSetVar($moduleDirname, $tableName, $fieldName); |
|
|
|
|
|
|
319
|
|
|
break; |
|
320
|
|
|
case 15: |
|
321
|
|
|
$ret .= $this->adminobjects->getTextDateSelectSetVar($tableName, $fieldName); |
|
|
|
|
|
|
322
|
|
|
break; |
|
323
|
|
|
default: |
|
324
|
|
|
$ret .= $this->adminobjects->getSimpleSetVar($tableName, $fieldName); |
|
|
|
|
|
|
325
|
|
|
break; |
|
326
|
|
|
} |
|
327
|
|
|
} |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
return $ret; |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
/** |
|
334
|
|
|
* @public function getAdminPhpCodeXoopsSecurity |
|
335
|
|
|
* |
|
336
|
|
|
* @param $tableName |
|
337
|
|
|
* |
|
338
|
|
|
* @return string |
|
339
|
|
|
*/ |
|
340
|
|
|
public function getAdminPhpCodeXoopsSecurity($tableName) |
|
341
|
|
|
{ |
|
342
|
|
|
$ret = <<<EOT |
|
343
|
|
|
if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
344
|
|
|
redirect_header('{$tableName}.php', 3, implode(',', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
345
|
|
|
}\n |
|
346
|
|
|
EOT; |
|
347
|
|
|
|
|
348
|
|
|
return $ret; |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/* |
|
352
|
|
|
* @public function getAdminPhpCodeInsertData |
|
353
|
|
|
* @param $tableName |
|
354
|
|
|
* @param $language |
|
355
|
|
|
* @return string |
|
356
|
|
|
*/ |
|
357
|
|
|
public function getAdminPhpCodeInsertData($tableName, $language) |
|
358
|
|
|
{ |
|
359
|
|
|
$ret = <<<EOT |
|
360
|
|
|
// Insert Data |
|
361
|
|
|
if (\${$tableName}Handler->insert(\${$tableName}Obj)) { |
|
362
|
|
|
redirect_header('{$tableName}.php?op=list', 2, {$language}FORM_OK); |
|
363
|
|
|
}\n |
|
364
|
|
|
EOT; |
|
365
|
|
|
|
|
366
|
|
|
return $ret; |
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
/** |
|
370
|
|
|
* @public function getAdminPhpCodeGetFormError |
|
371
|
|
|
* |
|
372
|
|
|
* @param $tableName |
|
373
|
|
|
* |
|
374
|
|
|
* @return string |
|
375
|
|
|
*/ |
|
376
|
|
|
public function getAdminPhpCodeGetFormError($tableName) |
|
377
|
|
|
{ |
|
378
|
|
|
$ret = <<<EOT |
|
379
|
|
|
// Get Form |
|
380
|
|
|
\$GLOBALS['xoopsTpl']->assign('error', \${$tableName}Obj->getHtmlErrors()); |
|
381
|
|
|
\$form =& \${$tableName}Obj->getForm(); |
|
382
|
|
|
\$GLOBALS['xoopsTpl']->assign('form', \$form->render());\n |
|
383
|
|
|
EOT; |
|
384
|
|
|
|
|
385
|
|
|
return $ret; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
/** |
|
389
|
|
|
* @public function getAdminPhpCodeGetFormId |
|
390
|
|
|
* |
|
391
|
|
|
* @param string $tableName |
|
392
|
|
|
* @param string $fieldId |
|
393
|
|
|
* |
|
394
|
|
|
* @return string |
|
395
|
|
|
*/ |
|
396
|
|
|
public function getAdminPhpCodeGetFormId($tableName, $fieldId) |
|
397
|
|
|
{ |
|
398
|
|
|
$ret = <<<EOT |
|
399
|
|
|
// Get Form |
|
400
|
|
|
\${$tableName}Obj = \${$tableName}Handler->get(\${$fieldId}); |
|
401
|
|
|
\$form = \${$tableName}Obj->getForm(); |
|
402
|
|
|
\$GLOBALS['xoopsTpl']->assign('form', \$form->render());\n |
|
403
|
|
|
EOT; |
|
404
|
|
|
|
|
405
|
|
|
return $ret; |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
/** |
|
409
|
|
|
* @public function getAdminPhpCodeGetObjHandlerId |
|
410
|
|
|
* |
|
411
|
|
|
* @param string $tableName |
|
412
|
|
|
* @param string $fieldId |
|
413
|
|
|
* |
|
414
|
|
|
* @return string |
|
415
|
|
|
*/ |
|
416
|
|
|
public function getAdminPhpCodeGetObjHandlerId($tableName, $fieldId) |
|
417
|
|
|
{ |
|
418
|
|
|
$ret = <<<EOT |
|
419
|
|
|
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId});\n |
|
420
|
|
|
EOT; |
|
421
|
|
|
|
|
422
|
|
|
return $ret; |
|
423
|
|
|
} |
|
424
|
|
|
|
|
425
|
|
|
/* |
|
426
|
|
|
* @public function getAdminPhpCodeDelete |
|
427
|
|
|
* @param string $tableName |
|
428
|
|
|
* @param string $language |
|
429
|
|
|
* @param string $fieldId |
|
430
|
|
|
* @param string $fieldMain |
|
431
|
|
|
* @return string |
|
432
|
|
|
*/ |
|
433
|
|
|
public function getAdminPhpCodeDelete($tableName, $language, $fieldId, $fieldMain) |
|
434
|
|
|
{ |
|
435
|
|
|
$ret = <<<EOT |
|
436
|
|
|
case 'delete': |
|
437
|
|
|
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
438
|
|
|
if (isset(\$_REQUEST['ok']) && 1 == \$_REQUEST['ok']) { |
|
439
|
|
|
if ( !\$GLOBALS['xoopsSecurity']->check() ) { |
|
440
|
|
|
redirect_header('{$tableName}.php', 3, implode(', ', \$GLOBALS['xoopsSecurity']->getErrors())); |
|
441
|
|
|
} |
|
442
|
|
|
if (\${$tableName}Handler->delete(\${$tableName}Obj)) { |
|
443
|
|
|
redirect_header('{$tableName}.php', 3, {$language}FORMDELOK); |
|
444
|
|
|
} else { |
|
445
|
|
|
echo \${$tableName}Obj->getHtmlErrors(); |
|
446
|
|
|
} |
|
447
|
|
|
} else { |
|
448
|
|
|
xoops_confirm(array('ok' => 1, '{$fieldId}' => \${$fieldId}, 'op' => 'delete'), \$_SERVER['REQUEST_URI'], sprintf({$language}FORMSUREDEL, \${$tableName}Obj->getVar('{$fieldMain}'))); |
|
449
|
|
|
} |
|
450
|
|
|
break;\n |
|
451
|
|
|
EOT; |
|
452
|
|
|
|
|
453
|
|
|
return $ret; |
|
454
|
|
|
} |
|
455
|
|
|
|
|
456
|
|
|
/* |
|
457
|
|
|
* @public function getAdminPhpCodeUpdate |
|
458
|
|
|
* @param string $moduleDirname |
|
459
|
|
|
* @param string $tableName |
|
460
|
|
|
* @param string $language |
|
461
|
|
|
* @param string $fieldId |
|
462
|
|
|
* @param string $fieldMain |
|
463
|
|
|
* @return string |
|
464
|
|
|
*/ |
|
465
|
|
|
public function getAdminPhpCodeUpdate($moduleDirname, $tableName, $language, $fieldId, $fieldMain) |
|
|
|
|
|
|
466
|
|
|
{ |
|
467
|
|
|
$upModuleName = strtoupper($moduleDirname); |
|
468
|
|
|
$ret = <<<EOT |
|
469
|
|
|
case 'update': |
|
470
|
|
|
if (isset(\${$fieldId})) { |
|
471
|
|
|
\${$tableName}Obj =& \${$tableName}Handler->get(\${$fieldId}); |
|
472
|
|
|
} |
|
473
|
|
|
\${$tableName}Obj->setVar("\${$tableName}_display", \$_POST["\${$tableName}_display"]); |
|
474
|
|
|
|
|
475
|
|
|
if (\${$tableName}Handler->insert(\${$tableName}Obj)) { |
|
476
|
|
|
redirect_header("\${$tableName}.php", 3, _AM_{$upModuleName}_FORMOK); |
|
477
|
|
|
} |
|
478
|
|
|
echo \${$tableName}Obj->getHtmlErrors(); |
|
479
|
|
|
break;\n |
|
480
|
|
|
EOT; |
|
481
|
|
|
|
|
482
|
|
|
return $ret; |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
/** |
|
486
|
|
|
* @public function getAdminPhpCodeGetDisplayTpl |
|
487
|
|
|
* |
|
488
|
|
|
* @param null |
|
489
|
|
|
* |
|
490
|
|
|
* @return string |
|
491
|
|
|
*/ |
|
492
|
|
|
public function getAdminPhpCodeGetDisplayTpl() |
|
493
|
|
|
{ |
|
494
|
|
|
return "\t\t\$GLOBALS['xoopsTpl']->display(\"db:{\$templateMain}\");\n"; |
|
495
|
|
|
} |
|
496
|
|
|
|
|
497
|
|
|
/* |
|
498
|
|
|
* @public function getAdminIncludeFooter |
|
499
|
|
|
* @param null |
|
500
|
|
|
*/ |
|
501
|
|
|
/** |
|
502
|
|
|
* @return string |
|
503
|
|
|
*/ |
|
504
|
|
|
public function getAdminIncludeFooter() |
|
505
|
|
|
{ |
|
506
|
|
|
return "include __DIR__ . '/footer.php';"; |
|
507
|
|
|
} |
|
508
|
|
|
} |
|
509
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.