1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Songlist; |
4
|
|
|
|
5
|
|
|
use XoopsObject; |
6
|
|
|
|
7
|
|
|
\defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
8
|
|
|
|
9
|
|
|
require_once \dirname(__DIR__) . '/include/songlist.object.php'; |
10
|
|
|
// require_once \dirname(__DIR__) . '/include/songlist.form.php'; |
11
|
|
|
use XoopsModules\Songlist\Form\FormController; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Utf8map |
15
|
|
|
*/ |
16
|
|
|
class Utf8map extends XoopsObject |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Utf8map constructor. |
20
|
|
|
* @param null $fid |
|
|
|
|
21
|
|
|
*/ |
22
|
|
|
public function __construct($fid = null) |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
$this->initVar('utfid', \XOBJ_DTYPE_INT, 0, false); |
25
|
|
|
$this->initVar('from', \XOBJ_DTYPE_TXTBOX, null, false, 2); |
26
|
|
|
$this->initVar('to', \XOBJ_DTYPE_TXTBOX, null, false, 2); |
27
|
|
|
$this->initVar('created', \XOBJ_DTYPE_INT, 0, false); |
28
|
|
|
$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param bool $as_array |
33
|
|
|
* @return array|string |
34
|
|
|
*/ |
35
|
|
|
public function getForm($as_array = false) |
36
|
|
|
{ |
37
|
|
|
return FormController::getFormUtf8map($this, $as_array); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return array |
42
|
|
|
*/ |
43
|
|
|
public function toArray(): array |
44
|
|
|
{ |
45
|
|
|
$ret = parent::toArray(); |
46
|
|
|
$form = $this->getForm(true); |
47
|
|
|
foreach ($form as $key => $element) { |
48
|
|
|
$ret['form'][$key] = $element->render(); |
49
|
|
|
} |
50
|
|
|
foreach (['created', 'updated'] as $key) { |
51
|
|
|
if ($this->getVar($key) > 0) { |
52
|
|
|
$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key)); |
53
|
|
|
$ret[$key] = \date(_DATESTRING, $this->getVar($key)); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return $ret; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|