pages/manager/PluginHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.manager.ManagerHandler');
00018 
00019 class PluginHandler extends ManagerHandler {
00023    function PluginHandler() {
00024       parent::ManagerHandler();
00025    }
00029    function plugins($args) {
00030       $category = isset($args[0])?$args[0]:null;
00031       $categories = PluginRegistry::getCategories();
00032 
00033       $templateMgr =& TemplateManager::getManager();
00034       $this->validate();
00035 
00036       if (isset($category)) {
00037          // The user specified a category of plugins to view;
00038          // get the plugins in that category only.
00039          $mainPage = false;
00040          $plugins =& PluginRegistry::loadCategory($category);
00041          
00042          $this->setupTemplate(false);
00043          $templateMgr->assign('pageTitle', 'plugins.categories.' . $category);
00044          $templateMgr->assign('pageHierarchy', PluginHandler::setBreadcrumbs(true));
00045       } else {
00046          // No plugin specified; display all.
00047          $mainPage = true;
00048          $plugins = array();
00049          foreach ($categories as $category) {
00050             $newPlugins =& PluginRegistry::loadCategory($category);
00051             if (isset($newPlugins)) {
00052                $plugins = array_merge($plugins, PluginRegistry::loadCategory($category));
00053             }
00054          }
00055          
00056          $this->setupTemplate(true);
00057          $templateMgr->assign('pageTitle', 'manager.plugins.pluginManagement');
00058          $templateMgr->assign('pageHierarchy', PluginHandler::setBreadcrumbs(false));
00059       }
00060 
00061 
00062       
00063       $templateMgr->assign_by_ref('plugins', $plugins);
00064       $templateMgr->assign_by_ref('categories', $categories);
00065       $templateMgr->assign('mainPage', $mainPage);
00066       $templateMgr->assign('isSiteAdmin', Validation::isSiteAdmin());
00067       $templateMgr->assign('helpTopicId', 'conference.generalManagement.plugins');
00068 
00069       $templateMgr->display('manager/plugins/plugins.tpl');
00070    }
00071 
00077    function plugin($args, &$request) {
00078       $category = array_shift($args);
00079       $plugin = array_shift($args);
00080       $verb = array_shift($args);
00081 
00082       $this->validate();
00083       $this->setupTemplate(true);
00084 
00085       $plugins =& PluginRegistry::loadCategory($category);
00086       $message = null;
00087       if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args, $message)) {
00088          if ($message) {
00089             import('notification.NotificationManager');
00090             $notificationManager = new NotificationManager();
00091             $notificationManager->createTrivialNotification(__('notification.notification'), $message, NOTIFICATION_TYPE_SUCCESS, null, 0);
00092          }
00093          $request->redirect(null, null, null, 'plugins', array($category));
00094       }
00095    }
00096    
00101    function setBreadcrumbs($subclass = false) {
00102       $templateMgr =& TemplateManager::getManager();
00103       $pageCrumbs = array(
00104          array(
00105             Request::url(null, null, 'user'),
00106             'navigation.user',
00107             false
00108          ),
00109          array(
00110             Request::url(null, null, 'manager'),
00111             'manager.conferenceSiteManagement',
00112             false
00113          )
00114       );
00115       
00116       if ($subclass) {
00117          $pageCrumbs[] = array(
00118             Request::url(null, null, 'manager', 'plugins'),
00119             'manager.plugins.pluginManagement',
00120             false
00121          );
00122       }
00123 
00124       return $pageCrumbs;
00125    }
00126 }
00127 
00128 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7