Exemple #1
0
 private function deleteLink(LinkRepository $linkRepo, Text $text)
 {
     $linkRepo->deleteLink($this->link);
     $text->addMessage($text->t("main.link") . " " . $text->t("editor.is_deleted"), Link::of($text->getUrlPage("edit_menu", $this->link->getMenuId()), $text->t("links.menu.go_back")));
     $this->link = null;
     // mark as deleted
 }
 private function deleteCategory(CategoryRepository $categoryRepo, ArticleRepository $articleRepo, Text $text)
 {
     $categoryRepo->deleteCategory($articleRepo, $this->category);
     $viewAll = Link::of($text->getUrlPage("category_list"), $text->t("categories.view_all"));
     $text->addMessage($text->t("main.category") . " " . $text->t("editor.is_deleted"), $viewAll);
     $this->deleted = true;
 }
Exemple #3
0
 private function trySwitchTheme(ThemeManager $themeManager, Text $text, Request $request)
 {
     $themeDirectory = $request->getRequestString("theme", "");
     if (!$themeManager->themeExists($themeDirectory)) {
         $text->addError($text->t("themes.does_not_exist"));
         return false;
     }
     $themeManager->setActiveTheme($themeDirectory);
     $text->addMessage($text->t("themes.successfully_switched"));
     return true;
 }
Exemple #4
0
 private function addSaveMessage(PlacedWidget $placedWidget, Text $text)
 {
     $homeLink = Link::of($text->getUrlMain(), $text->t("main.home"));
     $documentLink = Link::of($text->getUrlPage("edit_document", $placedWidget->getDocumentId()), $text->t("widgets.view_in_document"));
     $message = "";
     if ($placedWidget->getId() === 0) {
         // New widget
         $message = $text->t("main.widget") . " " . $text->t("editor.is_created");
     } else {
         // Updating existing widget
         $message = $text->t("main.widget") . " " . $text->t("editor.is_edited");
     }
     $text->addMessage($message, $homeLink, $documentLink);
 }
Exemple #5
0
 private function respondToRequest(LinkRepository $linkRepo, MenuRepository $menuRepo, Text $text, Request $request)
 {
     if (!Validate::requestToken($request)) {
         return;
     }
     $moveLinksToMenuId = $request->getRequestInt("move_option", 0);
     if ($moveLinksToMenuId === 0) {
         $linkRepo->deleteLinksInMenu($this->menu);
     } else {
         $linkRepo->moveLinks($this->menu, $this->allMenus[$moveLinksToMenuId]);
     }
     $menuRepo->deleteMenu($this->menu->getId());
     $text->addMessage($text->t("links.menu") . " " . $text->t("editor.is_deleted"), Link::of($text->getUrlPage("links"), $text->t("links.overview")));
     $this->deleted = true;
 }