diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-10 09:28:51 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-10 09:28:51 +0100 |
| commit | 2a0ea930de9d59e29bf4ddeb1585e61061109d7d (patch) | |
| tree | d6d2d74e84d62e38cf3969c4d016a4365e7e61af /list_kitlocker.php | |
| parent | 8566070da24cd53845c64cdf2cd2104c847e450c (diff) | |
| download | stock-2a0ea930de9d59e29bf4ddeb1585e61061109d7d.tar.gz stock-2a0ea930de9d59e29bf4ddeb1585e61061109d7d.tar.bz2 stock-2a0ea930de9d59e29bf4ddeb1585e61061109d7d.zip | |
stock: add list_kitlocker.php — combined assembly/component kitlocker list with stgrp filter; gallery links to list_kitlocker; breadcrumb back link in header
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'list_kitlocker.php')
| -rw-r--r-- | list_kitlocker.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/list_kitlocker.php b/list_kitlocker.php new file mode 100644 index 0000000..7598c53 --- /dev/null +++ b/list_kitlocker.php @@ -0,0 +1,55 @@ +<?php +/** + * Combined kitlocker listing — assemblies and components filtered by stgrp tag. + * @package stock + */ + +namespace Bitweaver\Stock; + +use Bitweaver\KernelTools; + +require_once '../kernel/includes/setup_inc.php'; + +$gBitSystem->verifyPackage( 'stock' ); + +global $gBitSystem, $gBitSmarty, $gBitDb; + +$stgrp = !empty( $_REQUEST['stgrp'] ) ? trim( $_REQUEST['stgrp'] ) : null; + +$X = BIT_DB_PREFIX; +$bindVars = []; +$whereSql = "AND lc.`content_type_guid` IN ('stockassembly','stockcomponent')"; + +if( $stgrp ) { + $whereSql .= " AND EXISTS (SELECT 1 FROM `{$X}liberty_xref` sx WHERE sx.`content_id` = lc.`content_id` AND sx.`item` = ?)"; + $bindVars[] = $stgrp; + $groupTitle = $gBitDb->getOne( + "SELECT `cross_ref_title` FROM `{$X}liberty_xref_item` WHERE `item` = ? AND `x_group` = 'stgrp'", + [ $stgrp ] + ); +} else { + $whereSql .= " AND EXISTS (SELECT 1 FROM `{$X}liberty_xref` sx + INNER JOIN `{$X}liberty_xref_item` xi ON xi.`item` = sx.`item` AND xi.`x_group` = 'stgrp' + WHERE sx.`content_id` = lc.`content_id`)"; + $groupTitle = null; +} + +$items = $gBitDb->getAll( + "SELECT lc.`content_id`, lc.`title`, lc.`data`, lc.`content_type_guid`, + (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x + WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLID') AS klid, + (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x + WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLPR') AS klpr + FROM `{$X}liberty_content` lc + WHERE 1=1 $whereSql + ORDER BY lc.`title`", + $bindVars +); + +$gBitSmarty->assign( 'kitlockerItems', $items ); +$gBitSmarty->assign( 'stgrp', $stgrp ); +$gBitSmarty->assign( 'groupTitle', $groupTitle ); + +$pageTitle = $groupTitle ?: KernelTools::tra( 'Kitlocker' ); +$gBitSystem->setBrowserTitle( $pageTitle ); +$gBitSystem->display( 'bitpackage:stock/list_kitlocker.tpl', null, [ 'display_mode' => 'list' ] ); |
