From 5cff62836e28dca61079c5e43e7a7a0c8daea59d Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 Mar 2023 20:39:55 +0100 Subject: [PATCH] ManageTags: display owning user in table --- controllers/ManageTags.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/controllers/ManageTags.php b/controllers/ManageTags.php index 26f2b490..cb1ffd23 100644 --- a/controllers/ManageTags.php +++ b/controllers/ManageTags.php @@ -50,10 +50,18 @@ class ManageTags extends HTMLController 'data' => 'slug', ], ], - 'kind' => [ - 'header' => 'Kind', + 'id_user_owner' => [ + 'header' => 'Owning user', 'is_sortable' => true, - 'value' => 'kind', + 'parse' => [ + 'type' => 'function', + 'data' => function($row) { + if (!empty($row['first_name'])) + return $row['first_name'] . ' ' . $row['surname']; + else + return 'n/a'; + }, + ], ], 'count' => [ 'header' => 'Cardinality', @@ -76,8 +84,9 @@ class ManageTags extends HTMLController $direction = 'up'; $data = Registry::get('db')->queryAssocs(' - SELECT * - FROM tags + SELECT t.*, u.id_user, u.first_name, u.surname + FROM tags AS t + LEFT JOIN users AS u ON t.id_user_owner = u.id_user WHERE kind != {string:album} ORDER BY {raw:order} LIMIT {int:offset}, {int:limit}',