/** * Returns each category ID and label in a module given user can see * * @access public * @param CMS_profile $cms_user, the profile concerned by these restrictions * @param string $cms_module, the module codename * @param CMS_language $cms_language, the language of the labels * @param mixed $clearanceLevel * - false : CLEARANCE_MODULE_VIEW * - true : CLEARANCE_MODULE_EDIT * - constant value : clearanceLevel value * @param boolean $strict return only categories from this clearance (default : false, else, return complete categories tree until given clearance) * @return array(string) the statements or false if profile hasn't any access to any categories * @static */ function getSiblingCategoriesAsArray(&$category, $count, &$cms_user, $cms_module, $cms_language, $clearanceLevel = false, $strict = false) { $count++; $attrs = array("module" => $cms_module, "language" => $cms_language, "level" => $category->getID(), "root" => false, "cms_user" => &$cms_user, "clearanceLevel" => $clearanceLevel, "strict" => $strict); $siblings = CMS_module::getModuleCategories($attrs); if (is_array($siblings) && $siblings) { $ctgs = array(); foreach ($siblings as $obj) { $ctgs[$obj->getID()] = str_repeat('- ', $count) . '' . io::htmlspecialchars($obj->getLabel()); if (false !== ($a_sibling = CMS_moduleCategories_catalog::getSiblingCategoriesAsArray($obj, $count, $cms_user, $cms_module, $cms_language, $clearanceLevel, $strict))) { while (list($id, $lbl) = each($a_sibling)) { if ($id) { $ctgs[$id] = $lbl; } } } } if (is_array($ctgs) && $ctgs) { return $ctgs; } } return false; }