/**
  * @copydoc AnnouncementGridHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     $this->setTitle('announcement.announcements');
     // Load language components
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
     // Add grid action.
     $router = $request->getRouter();
     import('lib.pkp.classes.linkAction.request.AjaxModal');
     $this->addAction(new LinkAction('addAnnouncement', new AjaxModal($router->url($request, null, null, 'addAnnouncement', null, null), __('grid.action.addAnnouncement'), 'modal_add_item', true), __('grid.action.addAnnouncement'), 'add_item'));
 }
 /**
  * @copydoc AnnouncementGridHandler::initialize()
  * @param $request PKPRequest
  */
 function initialize($request)
 {
     parent::initialize($request);
     $displayLimit = (bool) $request->getUserVar('displayLimit');
     if ($displayLimit) {
         $context = $request->getContext();
         $numAnnouncementsHomepage = $context->getSetting('numAnnouncementsHomepage');
         $gridElements = $this->getGridDataElements($request);
         if (count($gridElements) > $numAnnouncementsHomepage) {
             $dispatcher = $request->getDispatcher();
             import('lib.pkp.classes.linkAction.request.RedirectAction');
             $actionRequest = new RedirectAction($dispatcher->url($request, ROUTE_PAGE, null, 'announcement'));
             $moreAnnouncementsAction = new LinkAction('moreAnnouncements', $actionRequest, __('announcement.moreAnnouncements'));
             $this->addAction($moreAnnouncementsAction, GRID_ACTION_POSITION_BELOW);
             $limitedElements = array();
             for ($i = 0; $i < $numAnnouncementsHomepage; $i++) {
                 $limitedElements[key($gridElements)] = current($gridElements);
                 next($gridElements);
             }
             $this->setGridDataElements($limitedElements);
         }
     }
 }