1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Modulebuilder; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* morefiles class. |
17
|
|
|
* |
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
19
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
20
|
|
|
* |
21
|
|
|
* @since 2.5.7 |
22
|
|
|
* |
23
|
|
|
* @author Txmod Xoops <[email protected]> - <https://xoops.org/> |
24
|
|
|
* |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @Class MorefilesHandler |
29
|
|
|
* @extends \XoopsPersistableObjectHandler |
30
|
|
|
*/ |
31
|
|
|
class MorefilesHandler extends \XoopsPersistableObjectHandler |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @public function constructor class |
35
|
|
|
* |
36
|
|
|
* @param null|\XoopsDatabase|\XoopsMySQLDatabase $db |
37
|
|
|
*/ |
38
|
|
|
public function __construct(\XoopsDatabase $db) |
39
|
|
|
{ |
40
|
|
|
parent::__construct($db, 'modulebuilder_morefiles', Morefiles::class, 'file_id', 'file_name'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param bool $isNew |
45
|
|
|
* |
46
|
|
|
* @return \XoopsObject |
47
|
|
|
*/ |
48
|
|
|
public function create($isNew = true) |
49
|
|
|
{ |
50
|
|
|
return parent::create($isNew); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* retrieve a field. |
55
|
|
|
* |
56
|
|
|
* @param int $i field id |
57
|
|
|
* @param null $fields |
|
|
|
|
58
|
|
|
* |
59
|
|
|
* @return mixed reference to the <a href='psi_element://Fields'>Fields</a> object |
60
|
|
|
* object |
61
|
|
|
*/ |
62
|
|
|
public function get($i = null, $fields = null) |
63
|
|
|
{ |
64
|
|
|
return parent::get($i, $fields); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* get inserted id. |
69
|
|
|
* |
70
|
|
|
* @param null |
71
|
|
|
* |
72
|
|
|
* @return int reference to the {@link Tables} object |
73
|
|
|
*/ |
74
|
|
|
public function getInsertId() |
75
|
|
|
{ |
76
|
|
|
return $this->db->getInsertId(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get Count Morefiles. |
81
|
|
|
* |
82
|
|
|
* @param int $start |
83
|
|
|
* @param int $limit |
84
|
|
|
* @param string $sort |
85
|
|
|
* @param string $order |
86
|
|
|
* |
87
|
|
|
* @return int |
88
|
|
|
*/ |
89
|
|
|
public function getCountMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
90
|
|
|
{ |
91
|
|
|
$crMorefilesCount = new \CriteriaCompo(); |
92
|
|
|
$crMorefilesCount = $this->getMorefilesCriteria($crMorefilesCount, $start, $limit, $sort, $order); |
93
|
|
|
|
94
|
|
|
return $this->getCount($crMorefilesCount); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Get All Morefiles. |
99
|
|
|
* |
100
|
|
|
* @param int $start |
101
|
|
|
* @param int $limit |
102
|
|
|
* @param string $sort |
103
|
|
|
* @param string $order |
104
|
|
|
* |
105
|
|
|
* @return array |
106
|
|
|
*/ |
107
|
|
|
public function getAllMorefiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
108
|
|
|
{ |
109
|
|
|
$crMorefilesAdd = new \CriteriaCompo(); |
110
|
|
|
$crMorefilesAdd = $this->getMorefilesCriteria($crMorefilesAdd, $start, $limit, $sort, $order); |
111
|
|
|
|
112
|
|
|
return $this->getAll($crMorefilesAdd); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Get All Morefiles By Module Id. |
117
|
|
|
* |
118
|
|
|
* @param $modId |
119
|
|
|
* @param int $start |
120
|
|
|
* @param int $limit |
121
|
|
|
* @param string $sort |
122
|
|
|
* @param string $order |
123
|
|
|
* |
124
|
|
|
* @return array |
125
|
|
|
*/ |
126
|
|
|
public function getAllMorefilesByModuleId($modId, $start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
127
|
|
|
{ |
128
|
|
|
$crMorefilesByModuleId = new \CriteriaCompo(); |
129
|
|
|
$crMorefilesByModuleId->add(new \Criteria('file_mid', $modId)); |
130
|
|
|
$crMorefilesByModuleId = $this->getMorefilesCriteria($crMorefilesByModuleId, $start, $limit, $sort, $order); |
131
|
|
|
|
132
|
|
|
return $this->getAll($crMorefilesByModuleId); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Get Morefiles Criteria. |
137
|
|
|
* |
138
|
|
|
* @param $crMorefiles |
139
|
|
|
* @param $start |
140
|
|
|
* @param $limit |
141
|
|
|
* @param $sort |
142
|
|
|
* @param $order |
143
|
|
|
* |
144
|
|
|
* @return mixed |
145
|
|
|
*/ |
146
|
|
|
private function getMorefilesCriteria($crMorefiles, $start, $limit, $sort, $order) |
147
|
|
|
{ |
148
|
|
|
$crMorefiles->setStart($start); |
149
|
|
|
$crMorefiles->setLimit($limit); |
150
|
|
|
$crMorefiles->setSort($sort); |
151
|
|
|
$crMorefiles->setOrder($order); |
152
|
|
|
|
153
|
|
|
return $crMorefiles; |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|