/** * @param Route $Route * * @return bool */ private function getActive(Route $Route) { return 0 === strpos($this->getRequest()->getUrlBase() . $this->getRequest()->getPathInfo(), $Route->getValue()); }
/** * @param Link $Link * @param Link\Route $Restriction * * @return Display */ public function addModuleNavigation(Link $Link, Link\Route $Restriction = null) { // Is Link applicable? if ($Restriction !== null) { if (0 !== strpos($this->getRequest()->getPathInfo(), $Restriction->getValue())) { return $this; } } // Is Link suitable? $Target = explode('/', $Link->getRoute()->getValue()); $Current = explode('/', $this->getRequest()->getPathInfo()); $Branch = array_diff_assoc($Target, $Current); if ($Branch !== null) { reset($Branch); $Branch = key($Branch); } if ($Branch === null || $Branch >= 3) { if (Access::useService()->hasAuthorization($Link->getRoute()->getValue())) { if ($Link->isActive()) { $this->ModuleBreadcrumb = $Link->getName()->getValue(); } array_push($this->ModuleNavigation, $Link); } } return $this; }