diff --git a/config.php b/config.php index 50a4543..4d615ad 100755 --- a/config.php +++ b/config.php @@ -48,68 +48,5 @@ $twig->addGlobal('delete_part_confirm', $translator->trans('Are you sure you wan $twig->addGlobal('delete_category_confirm', $translator->trans('Are you sure you want to delete this category?')); // Build category tree for sidebar -try { - $db = App\Database\Database::getInstance(); - $categories = App\Models\Category::getAll($db); - $items = App\Models\Item::getAll($db); - - function buildTree($categories, $items, $parentId = null, &$visited = [], $depth = 0) { - if ($depth > 5) return []; // Limit depth - $tree = []; - foreach ($categories as $cat) { - if ($cat['parent_id'] == $parentId && !in_array($cat['id'], $visited)) { - $visited[] = $cat['id']; - $node = [ - 'id' => $cat['id'], - 'name' => $cat['name'], - 'children' => buildTree($categories, $items, $cat['id'], $visited, $depth + 1), - 'items' => [] - ]; - // Limit items to 20 per category - $itemCount = 0; - foreach ($items as $item) { - if ($item['category_id'] == $cat['id'] && $itemCount < 20) { - $node['items'][] = $item; - $itemCount++; - } - } - $tree[] = $node; - } - } - return $tree; - } - - $categoryTree = buildTree($categories, $items); - - function renderTree($nodes, $depth = 0) { - if ($depth > 5) return ''; - $html = ''; - foreach ($nodes as $node) { - $html .= '