ManageAssets: trade filename for user uploaded field

This commit is contained in:
Aaron van Geffen 2023-03-11 17:53:53 +01:00
parent 54df35073d
commit fa01bf8961

View File

@ -38,13 +38,17 @@ class ManageAssets extends HTMLController
'data' => 'filename', 'data' => 'filename',
], ],
], ],
'title' => [ 'id_user_uploaded' => [
'header' => 'Title', 'header' => 'User uploaded',
'is_sortable' => true, 'is_sortable' => true,
'parse' => [ 'parse' => [
'type' => 'value', 'type' => 'function',
'link' => BASEURL . '/editasset/?id={ID_ASSET}', 'data' => function($row) {
'data' => 'title', if (!empty($row['first_name']))
return $row['first_name'] . ' ' . $row['surname'];
else
return 'n/a';
},
], ],
], ],
'dimensions' => [ 'dimensions' => [
@ -69,12 +73,15 @@ class ManageAssets extends HTMLController
'items_per_page' => 30, 'items_per_page' => 30,
'base_url' => BASEURL . '/manageassets/', 'base_url' => BASEURL . '/manageassets/',
'get_data' => function($offset = 0, $limit = 30, $order = '', $direction = 'down') { 'get_data' => function($offset = 0, $limit = 30, $order = '', $direction = 'down') {
if (!in_array($order, ['id_asset', 'title', 'subdir', 'filename'])) if (!in_array($order, ['id_asset', 'id_user_uploaded', 'title', 'subdir', 'filename']))
$order = 'id_asset'; $order = 'id_asset';
$data = Registry::get('db')->queryAssocs(' $data = Registry::get('db')->queryAssocs('
SELECT id_asset, title, subdir, filename, image_width, image_height SELECT a.id_asset, a.subdir, a.filename,
FROM assets a.image_width, a.image_height,
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} ORDER BY {raw:order}
LIMIT {int:offset}, {int:limit}', LIMIT {int:offset}, {int:limit}',
[ [