Ejemplo n.º 1
0
Archivo: Route.php Proyecto: fraym/core
 /**
  * @param null $menuItemTranslation
  */
 public function renderSite($menuItemTranslation = null)
 {
     $tpl = $this->template;
     if (is_object($menuItemTranslation)) {
         $this->loadRoutes();
         $menuItemTranslation = $this->db->getRepository('\\Fraym\\Menu\\Entity\\MenuItemTranslation')->findOneById($menuItemTranslation->id);
         // must set before check route, because the locale must be set
         $this->setupPage($menuItemTranslation);
         if (!$this->getCurrentDomain()) {
             $this->setCurrentDomain($this->getRequestDomain());
         }
         $virtualRouteContent = $this->getVirtualRouteContent();
         $this->sitefullRoute = $this->currentMenuItem->getUrl(true);
         if ($virtualRouteContent !== false) {
             // virtual route content
             $this->response->send($virtualRouteContent, true);
         }
         if ($this->currentMenuItem->checkPermission === true && $this->currentMenuItem->parent !== null && $this->user->isLoggedIn() === false) {
             return $this->menuItemNotFound();
         }
         if ($this->getFoundUri(false) === trim($this->getRequestRoute(false, false), '/') || $this->getVirtualRouteContent(true)) {
             $this->siteManager->addAdminPanel();
             $tpl->renderMainTemplate();
         } else {
             return $this->menuItemNotFound();
         }
         if ($this->template->isCachingDisabled() === false) {
             // cache page if cache enable
             $this->cache->setCacheContent();
         }
     } else {
         $this->menuItemNotFound();
     }
 }
Ejemplo n.º 2
0
 /**
  * @return mixed
  */
 public function getMenuPath()
 {
     return $this->currentMenuItem->getUrl();
 }