Admin: switch topics to tree editing layout

Render topics as a two-level tree so editing is clearer and limit updates to name/sort while parent selection stays create-only. Keep topic deletion safe with FK cascades and ensure photo tag links are cleaned automatically when a topic is removed.
This commit is contained in:
2026-02-21 12:29:28 +03:00
parent f9b949a7bf
commit 2d1f37d9eb
2 changed files with 74 additions and 54 deletions
-7
View File
@@ -119,13 +119,6 @@ function topicUpdate(int $topicId, string $name, ?int $parentId, int $sortOrder
$st->execute();
}
function topicChildrenCount(int $topicId): int
{
$st = db()->prepare('SELECT COUNT(*) FROM topics WHERE parent_id=:id');
$st->execute(['id' => $topicId]);
return (int)$st->fetchColumn();
}
function topicDelete(int $topicId): void
{
$st = db()->prepare('DELETE FROM topics WHERE id=:id');