function getSelectFromTree($forTheSearchForm = FALSE, $noFilter = FALSE, $attrs = "") { global $gorumroll; $_S =& new AppSettings(); hasAdminRights($isAdm); $itemNumCond = $_S->cascadingCategorySelectEnabled() && $gorumroll->list != "customlist" && $forTheSearchForm ? "AND itemNum>0" : ""; if (!$attrs) { $attrs = "id, name, up, sortId, wholeName, allowAd, allowSubmitAdAdmin, itemNum, recursive, subCatNum"; } if ($_S->permaLinksEnabled()) { $attrs .= ", permaLink"; } $query = "SELECT {$attrs} FROM @category WHERE up=0 {$itemNumCond} ORDER BY sortId ASC"; G::load($cats, $query); // cascading eseten csak a main kategoriak kellenek: if ($_S->cascadingCategorySelectEnabled() && $gorumroll->list != "customlist" && $gorumroll->rollid !== "alternative") { return $cats; } $cat = new AppCategory(); $tree =& $cat->getCategoryTree($cats, $attrs); if ($noFilter) { $cond = TRUE; } else { $cond = $isAdm ? '$node["cat"]->allowAd==1' : '$node["cat"]->allowAd==1 && $node["cat"]->allowSubmitAdAdmin==0'; if ($forTheSearchForm) { $cond .= ' && $node["cat"]->itemNum>0'; } $cond = "(({$cond}) || \$node['cat']->recursive)"; } $categories = array(); $cat->getArrayFromCategoryTree($tree, $categories, $cond, 0); return $categories; }
function populateFullCategoryTree() { global $categoryTreeFormat, $categoryTreeMainClass, $categoryTreeMainTag, $categoryTreeActiveNodeClass, $categoryTreeParentNodeClass, $categoryTreeLeafNodeClass, $categoryTreeWithLinks; $attrs = "id, name, up, sortId, wholeName, itemNum, permaLink, subCatNum"; if ($categoryTreeFormat == "single_array") { $item = new Item(); $categories = $item->getSelectFromTree(FALSE, TRUE, $attrs); } else { $query = "SELECT {$attrs} FROM @category WHERE up=0 ORDER BY sortId ASC"; G::load($mainCats, $query); $cat = new AppCategory(); $categories =& $cat->getCategoryTree($mainCats, $attrs, FALSE); if ($categoryTreeFormat == "html") { $categories = $cat->getHtmlTree($categories, $categoryTreeMainTag, $categoryTreeMainClass, $categoryTreeActiveNodeClass, $categoryTreeWithLinks); } } View::assign("fullCategoryTree", $categories); }