/** * @copydoc PluginGridHandler::loadCategoryData() */ function loadCategoryData($request, $categoryDataElement, $filter) { $plugins = parent::loadCategoryData($request, $categoryDataElement, $filter); $pressDao = DAORegistry::getDAO('PressDAO'); $presses = $pressDao->getAll(); $singlePress = false; if ($presses->getCount() == 1) { $singlePress = true; } $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); $showSitePlugins = false; if ($singlePress && in_array(ROLE_ID_SITE_ADMIN, $userRoles)) { $showSitePlugins = true; } if ($showSitePlugins) { return $plugins; } else { $contextLevelPlugins = array(); foreach ($plugins as $plugin) { if (!$plugin->isSitePlugin()) { $contextLevelPlugins[$plugin->getName()] = $plugin; } unset($plugin); } return $contextLevelPlugins; } }
/** * @copydoc PluginGridHandler::loadData() */ function loadCategoryData($request, $categoryDataElement, $filter) { $plugins = parent::loadCategoryData($request, $categoryDataElement, $filter); $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); $showSitePlugins = false; if (in_array(ROLE_ID_SITE_ADMIN, $userRoles)) { $showSitePlugins = true; } if ($showSitePlugins) { return $plugins; } else { $contextLevelPlugins = array(); foreach ($plugins as $plugin) { if (!$plugin->isSitePlugin()) { $contextLevelPlugins[$plugin->getName()] = $plugin; } unset($plugin); } return $contextLevelPlugins; } }