forked from Public/pics
Management controllers: move table queries into models
This commit is contained in:
@@ -33,4 +33,20 @@ class ErrorLog
|
||||
SELECT COUNT(*)
|
||||
FROM log_errors');
|
||||
}
|
||||
|
||||
public static function getOffset($offset, $limit, $order, $direction)
|
||||
{
|
||||
assert(in_array($order, ['id_entry', 'file', 'line', 'time', 'ipaddress', 'id_user']));
|
||||
|
||||
return Registry::get('db')->queryAssocs('
|
||||
SELECT *
|
||||
FROM log_errors
|
||||
ORDER BY {raw:order}
|
||||
LIMIT {int:offset}, {int:limit}',
|
||||
[
|
||||
'order' => $order . ($direction === 'up' ? ' ASC' : ' DESC'),
|
||||
'offset' => $offset,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user