forked from Public/pics
Management controllers: move table queries into models
This commit is contained in:
@@ -680,6 +680,23 @@ class Asset
|
||||
FROM assets');
|
||||
}
|
||||
|
||||
public static function getOffset($offset, $limit, $order, $direction)
|
||||
{
|
||||
return Registry::get('db')->queryAssocs('
|
||||
SELECT a.id_asset, a.subdir, a.filename,
|
||||
a.image_width, a.image_height, a.mimetype,
|
||||
u.id_user, u.first_name, u.surname
|
||||
FROM assets AS a
|
||||
LEFT JOIN users AS u ON a.id_user_uploaded = u.id_user
|
||||
ORDER BY {raw:order}
|
||||
LIMIT {int:offset}, {int:limit}',
|
||||
[
|
||||
'order' => $order . ($direction == 'up' ? ' ASC' : ' DESC'),
|
||||
'offset' => $offset,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if (empty($this->id_asset))
|
||||
|
||||
Reference in New Issue
Block a user