/**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
 }
Пример #2
0
 /**
  * Display the header.
  * @param $args array
  * @param $request PKPRequest
  */
 function header($args, $request)
 {
     $this->setupTemplate($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
     // Management menu items
     $templateMgr = TemplateManager::getManager($request);
     $workingContexts = $this->getWorkingContexts($request);
     $multipleContexts = false;
     if ($workingContexts && $workingContexts->getCount() > 1) {
         $templateMgr->assign('multipleContexts', true);
         $multipleContexts = true;
     } else {
         if (!$workingContexts) {
             $templateMgr->assign('noContextsConfigured', true);
             $templateMgr->assign('notInstalled', true);
         } elseif ($workingContexts->getCount() == 0) {
             // no contexts configured or installing
             $templateMgr->assign('noContextsConfigured', true);
         }
     }
     if ($multipleContexts) {
         $dispatcher = $request->getDispatcher();
         $contextsNameAndUrl = array();
         while ($workingContext = $workingContexts->next()) {
             $contextUrl = $dispatcher->url($request, ROUTE_PAGE, $workingContext->getPath());
             $contextsNameAndUrl[$contextUrl] = $workingContext->getLocalizedName();
         }
         // Get the current context switcher value. We don´t need to worry about the
         // value when there is no current context, because then the switcher will not
         // be visible.
         $currentContextUrl = null;
         if ($currentContext = $request->getContext()) {
             $currentContextUrl = $dispatcher->url($request, ROUTE_PAGE, $currentContext->getPath());
         } else {
             $contextsNameAndUrl = array(__('context.select')) + $contextsNameAndUrl;
         }
         $templateMgr->assign('currentContextUrl', $currentContextUrl);
         $templateMgr->assign('contextsNameAndUrl', $contextsNameAndUrl);
     }
     if ($context = $request->getContext()) {
         import('pages.about.AboutContextHandler');
         if (in_array('IAboutContextInfoProvider', class_implements('AboutContextHandler'))) {
             $templateMgr->assign('contextInfo', AboutContextHandler::getAboutInfo($context));
         } else {
             $settingsDao = $context->getSettingsDAO();
             $templateMgr->assign('contextSettings', $settingsDao->getSettings($context->getId()));
         }
     }
     if (!defined('SESSION_DISABLE_INIT') && ($user = $request->getUser())) {
         // Get a count of unread tasks.
         $notificationDao = DAORegistry::getDAO('NotificationDAO');
         // Don't include certain tasks, defined in the notifications grid handler
         import('lib.pkp.controllers.grid.notifications.NotificationsGridHandler');
         $templateMgr->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK, NotificationsGridHandler::getNotListableTaskTypes()));
     }
     return $templateMgr->fetchJson('controllers/page/header.tpl');
 }
 /**
  * Constructor
  */
 function TaskNotificationsGridHandler()
 {
     parent::NotificationsGridHandler();
 }
 /**
  * Setup and assign variables for the tasks component.
  * @param $args array
  * @param $request PKPRequest
  * @param $templateMgr TemplateManager
  * @return TemplateManager
  */
 private function setupTasks($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     if (!defined('SESSION_DISABLE_INIT') && ($user = $request->getUser())) {
         // Get a count of unread tasks.
         $notificationDao = DAORegistry::getDAO('NotificationDAO');
         // Exclude certain tasks, defined in the notifications grid handler
         import('lib.pkp.controllers.grid.notifications.NotificationsGridHandler');
         $templateMgr->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK, NotificationsGridHandler::getNotListableTaskTypes()));
     }
 }
 /**
  * Constructor
  */
 function NormalNotificationsGridHandler()
 {
     parent::NotificationsGridHandler();
 }