/** * This function checks if a user has access to a specific site part. It checks the users level * and uses levelHasAccess() to determine access. * @param Medlem $medlem This Medlem object is the member for whom access should be checked * @param string $sajtdel This string should be a sajtdel for which access should be checked. * @return bool True or false depending on access * @see $sajtDelar * @see levelHasAccess() */ public static function medlemHasAccess($medlem, $sajtdel) { if (!isset($medlem)) { return false; } $levelId = $medlem->getLevelId(); if (!$levelId) { // no level chosen, use default $level = Level::getDefault(); } else { // load the members levelid $level = Level::loadById($levelId); } return self::levelHasAccess($level, $sajtdel); }