public function handleMakeRouteActive($routeId)
 {
     if ($route = $this->routeDao->findRouteById($routeId)) {
         $this->routeDao->setCurrentRouteForTarget($route->target, $route);
     }
     if ($this->presenter->isAjax()) {
         $this->redrawControl("route-list");
         $this->redrawControl("route-list-" . $route->target->id);
     } else {
         $this->redirect("this");
     }
 }
 public function saveChanges()
 {
     $values = $this->getValues();
     $target = $this->targetDao->findTarget($this->target);
     if (!$target) {
         $target = new Brabijan\SeoComponents\Entity\Target();
         $target->targetPresenter = $this->target->presenter;
         $target->targetAction = $this->target->action;
         $target->targetId = $this->target->id;
         $this->targetDao->save($target);
     }
     if (!$target->meta) {
         $meta = new Brabijan\SeoComponents\Entity\Meta();
         $meta->target = $target;
         $target->meta = $meta;
         $this->metaDao->save($meta);
         $this->targetDao->save($target);
     }
     $meta = $target->meta;
     $meta->seoTitle = $values->seoTitle;
     $meta->seoKeywords = $values->seoKeywords;
     $meta->seoDescription = $values->seoDescription;
     $meta->seoRobots = $values->seoRobots;
     $meta->sitemapChangeFreq = $values->sitemapChangeFreq;
     $meta->sitemapPriority = $values->sitemapPriority;
     $this->metaDao->save($meta);
     $currentRoute = $this->routeDao->findCurrentRouteByTarget($this->target);
     if ($values->route && (!$currentRoute || $currentRoute->slug !== $values->route)) {
         $this->routeDao->addRoute($target, $values->route);
     }
 }
 /**
  * Constructs absolute URL from Request object.
  *
  * @param Request $appRequest
  * @param Nette\Http\Url $refUrl
  * @return NULL|string
  */
 public function constructUrl(Request $appRequest, Nette\Http\Url $refUrl)
 {
     if ($appRequest->presenterName == "Seo:Meta") {
         $action = $appRequest->parameters["action"];
         if ($action == "sitemap") {
             return "/sitemap.xml";
         } elseif ($action == "robots") {
             return "/robots.txt";
         } elseif ($action == "googleWebmasterTools" and $webmasterToolsName = $this->settingsDao->getWebmasterToolsName()) {
             return "/" . $webmasterToolsName;
         }
     }
     $id = isset($appRequest->parameters["id"]) ? $appRequest->parameters["id"] : NULL;
     $target = new Target($appRequest->presenterName, $appRequest->parameters["action"], $id);
     if ($this->defaultRoute == $target) {
         $slug = "/";
     } else {
         $slug = $this->routeDao->findCurrentSlugByTarget($target);
         if (!$slug) {
             return NULL;
         }
         $slug = "/" . $slug;
     }
     $parameters = $appRequest->parameters;
     unset($parameters["action"], $parameters["id"]);
     $url = clone $refUrl;
     $url->setPath($slug);
     $url->setQuery($parameters);
     return $url;
 }
 public function processForm(Form $form)
 {
     $this->routeDao->addRoute($this->targetEntity, $form->values->route);
     $form["route"]->setValue("");
 }