/**
  * @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);
         }
     }
 }
 /**
  * @copydoc GridHandler::authorize()
  */
 function authorize($request, &$args, $roleAssignments)
 {
     import('lib.pkp.classes.security.authorization.ContextAccessPolicy');
     $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments));
     return parent::authorize($request, $args, $roleAssignments, false);
 }