Management controllers: move table queries into models

This commit is contained in:
2025-01-08 17:17:53 +01:00
parent 2d2ef38422
commit cc0ff71ef7
10 changed files with 144 additions and 156 deletions

View File

@@ -105,20 +105,7 @@ class ManageErrors extends HTMLController
'index_class' => 'col-md-6',
'base_url' => BASEURL . '/manageerrors/',
'get_count' => 'ErrorLog::getCount',
'get_data' => function($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,
]);
},
'get_data' => 'ErrorLog::getOffset',
];
$error_log = new GenericTable($options);