Пример #1
0
 /**
  * @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;
     }
 }
Пример #2
0
 /**
  * @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;
     }
 }