From 41612c4481111969367d1a228ad4875d781558a2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 30 Nov 2021 15:27:59 +0100 Subject: [locations] Modularize additional column handling Additional columns are now added through a hook, moving specialized code where it belongs. --- .../hooks/locations-column.inc.php | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 modules-available/serversetup-bwlp-ipxe/hooks/locations-column.inc.php (limited to 'modules-available/serversetup-bwlp-ipxe/hooks') diff --git a/modules-available/serversetup-bwlp-ipxe/hooks/locations-column.inc.php b/modules-available/serversetup-bwlp-ipxe/hooks/locations-column.inc.php new file mode 100644 index 00000000..d3290b62 --- /dev/null +++ b/modules-available/serversetup-bwlp-ipxe/hooks/locations-column.inc.php @@ -0,0 +1,57 @@ +lookup[$lid] = $row['title']; + } + } + + public function getColumnHtml(int $locationId): string + { + return htmlspecialchars($this->lookup[$locationId] ?? ''); + } + + public function getEditUrl(int $locationId): string + { + if (!User::hasPermission('.serversetup.ipxe.menu.assign', $locationId)) + return ''; + return '?do=serversetup&show=assignlocation&locationid=' . $locationId; + } + + public function header(): string + { + return Dictionary::translateFileModule('serversetup', 'module', 'location-column-header'); + } + + public function priority(): int + { + return 3000; + } + + public function propagateColumn(): bool + { + return true; + } + +} + +return new IpxeLocationColumn($allowedLocationIds); \ No newline at end of file -- cgit v1.2.3-55-g7522