Code
if ($modvars['enablecategorization']) {
if (!($class = Loader::loadClass('CategoryUtil')) || !($class = Loader::loadClass('CategoryRegistryUtil'))) {
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryUtil | CategoryRegistryUtil')));
}
// get the categories registered for the News stories
$catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'stories');
$properties = array_keys($catregistry);
$lang = pnUserGetLang();
// validate the property
// and build the category filter - mateo
if (!empty($prop) && in_array($prop, $properties) && !empty($cat)) {
if (!is_numeric($cat)) {
$rootCat = CategoryUtil::getCategoryByID($catregistry[$prop]);
$cat = CategoryUtil::getCategoryByPath($rootCat['path'].'/'.$cat);
} else {
$cat = CategoryUtil::getCategoryByID($cat);
}
$catname = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
if (!empty($cat) && isset($cat['path'])) {
// include all it's subcategories and build the filter
$categories = CategoryUtil::getCategoriesByPath($cat['path'], '', 'path');
$catstofilter = array();
foreach ($categories as $category) {
$catstofilter[] = $category['id'];
}
$catFilter = array($prop => $catstofilter);
} else {
LogUtil::registerError(_NOTAVALIDCATEGORY);
}
}
}
if (!($class = Loader::loadClass('CategoryUtil')) || !($class = Loader::loadClass('CategoryRegistryUtil'))) {
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryUtil | CategoryRegistryUtil')));
}
// get the categories registered for the News stories
$catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'stories');
$properties = array_keys($catregistry);
$lang = pnUserGetLang();
// validate the property
// and build the category filter - mateo
if (!empty($prop) && in_array($prop, $properties) && !empty($cat)) {
if (!is_numeric($cat)) {
$rootCat = CategoryUtil::getCategoryByID($catregistry[$prop]);
$cat = CategoryUtil::getCategoryByPath($rootCat['path'].'/'.$cat);
} else {
$cat = CategoryUtil::getCategoryByID($cat);
}
$catname = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
if (!empty($cat) && isset($cat['path'])) {
// include all it's subcategories and build the filter
$categories = CategoryUtil::getCategoriesByPath($cat['path'], '', 'path');
$catstofilter = array();
foreach ($categories as $category) {
$catstofilter[] = $category['id'];
}
$catFilter = array($prop => $catstofilter);
} else {
LogUtil::registerError(_NOTAVALIDCATEGORY);
}
}
}
This uses getRegisteredModuleCategories, which takes a specific registry entry. I have multiple registry entries. Now how would I go about creating a filter that combines multiple registry entries?
