/**
  * @param Request $request Request
  * @param string  $slug    Page slug
  * @return Response
  */
 public function indexAction(Request $request, $slug = 'index')
 {
     $this->initRepositories();
     $slug = str_replace('.html', '', $slug);
     // Retrieve page and process it
     if ($page = $this->pageRepo->getPageFromSlug($slug)) {
         $this->processPageBlocks($request, $page);
         // Register analytics
         Analytics::registerPageHit($this->getManager(), $request->getClientIp(), $request->headers->get('user-agent'), $page);
     }
     list($response, $page) = $this->processPageResponse($request, $page);
     return $this->renderPage($page, $response);
 }
예제 #2
0
 /**
  * Check if the logged in user
  * has edit/delete rights on a page model/collection
  *
  * @param string         $type  Access type:
  *                              get_one, get_all, create,
  *                              update, bulk_update or delete.
  * @param ModelInterface $model The model accessed.
  *
  * @return void
  *
  * @throws AccessDeniedException
  * @throws ItemInactiveException
  */
 protected function checkUserAccess($type = 'create', ModelInterface $model = null)
 {
     parent::checkUserAccess($type, $model);
     // Register a new hit for non-admin users
     if ($type === 'get_one' && !$this->isAdmin()) {
         Analytics::registerPageHit($this->getManager(), $this->getRequest()->getClientIp(), $this->getRequest()->headers->get('user-agent'), $model);
     }
 }