|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Songlist; |
|
4
|
|
|
|
|
5
|
|
|
require_once \dirname(__DIR__) . '/include/songlist.object.php'; |
|
6
|
|
|
// require_once \dirname(__DIR__) . '/include/songlist.form.php'; |
|
7
|
|
|
use XoopsModules\Songlist\Form\FormController; |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class Votes |
|
13
|
|
|
*/ |
|
14
|
|
|
class Votes extends \XoopsObject |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* Votes constructor. |
|
18
|
|
|
* @param null $fid |
|
|
|
|
|
|
19
|
|
|
*/ |
|
20
|
|
|
public function __construct($fid = null) |
|
|
|
|
|
|
21
|
|
|
{ |
|
22
|
|
|
$this->initVar('vid', \XOBJ_DTYPE_INT, 0, false); |
|
23
|
|
|
$this->initVar('sid', \XOBJ_DTYPE_INT, 0, false); |
|
24
|
|
|
$this->initVar('uid', \XOBJ_DTYPE_INT, 0, false); |
|
25
|
|
|
$this->initVar('ip', \XOBJ_DTYPE_TXTBOX, null, false, 64); |
|
26
|
|
|
$this->initVar('netaddy', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
27
|
|
|
$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param bool $as_array |
|
32
|
|
|
* @return array|string |
|
33
|
|
|
*/ |
|
34
|
|
|
public function getForm($as_array = false) |
|
35
|
|
|
{ |
|
36
|
|
|
return FormController::votes_get_form($this, $as_array); |
|
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return array |
|
41
|
|
|
*/ |
|
42
|
|
|
public function toArray(): array |
|
43
|
|
|
{ |
|
44
|
|
|
$ret = parent::toArray(); |
|
45
|
|
|
$form = $this->getForm(true); |
|
46
|
|
|
foreach ($form as $key => $element) { |
|
47
|
|
|
$ret['form'][$key] = $element->render(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$ret['rank'] = \number_format($this->getVar('rank'), 2) . \_MI_SONGLIST_OFTEN; |
|
51
|
|
|
|
|
52
|
|
|
return $ret; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|