static function isVirtualCategoryExist($categoryName) { $result = false; if ($categoryName == GetMessage("WIKI_CATEGORY_NOCAT") || $categoryName == GetMessage("WIKI_CATEGORY_ALL")) { $result = true; } else { $categories = new CWikiCategories(); $rsHandlers = GetModuleEvents("wiki", "OnCategoryListCreate"); while ($arHandler = $rsHandlers->Fetch()) { ExecuteModuleEventEx($arHandler, array(&$categories, '')); } $arCats = $categories->GetItems(); foreach ($arCats as $category) { if ($category["NAME"] == $categoryName) { $result = true; break; } } } return $result; }
unset($arElementFilter["SECTION_ID"]); } $allCatCount = CIBlockElement::GetList(array(), $arElementFilter, array(), false, array("ID")); //All Pages in all categories $catParams->sName = GetMessage("WIKI_CATEGORY_ALL"); $catParams->sTitle = GetMessage("WIKI_CATEGORY_ALL_TITLE"); $catParams->iItemsCount = $allCatCount; $catParams->bIsRed = 'N'; $catParams->createLinkFromTemplate(); $categories->addItem($catParams); //Anyone can add custom virtual category to the list $rsHandlers = GetModuleEvents("wiki", "OnCategoryListCreate"); while ($arHandler = $rsHandlers->Fetch()) { ExecuteModuleEventEx($arHandler, array(&$categories, $arParams['PATH_TO_CATEGORY'])); } $arResult['CATEGORIES'] = $categories->GetItems(); sortByColumn($arResult['CATEGORIES'], "NAME"); //for pagination $dbCatList = new CDBResult(); $dbCatList->InitFromArray($arResult['CATEGORIES']); $arResult['CATEGORIES'] = array(); $dbCatList->NavStart($arParams['CATEGORY_COUNT'], false); while ($arCat = $dbCatList->GetNext()) { $arResult['CATEGORIES'][strtolower($arCat["NAME"])] = $arCat; } $arResult['DB_LIST'] =& $dbCatList; $arCatName = $categories->getItemsNames(); $arCatNameExists = array(); if (!empty($arCatName)) { // checking the category on the "red link" $arFilter = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N', 'ACTIVE' => 'Y', 'NAME' => $arCatName);