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; }
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 }
public function getTemplate(Text $text) { if ($this->loggedIn) { return new LoggedInTemplate($text, $this->loggedInAsAdmin); } else { // Return a login view, but without the "Must be logged in" message // at the top. return new LoginFormTemplate($text, $text->getUrlPage("login"), [], $this->errorMessage, $this->canCreateAccounts); } }
/** * Gets an array of links to all categories. * @param Text $text The text object, of URL structure. * @return Link[] The array of links. */ public function getCategoryLinks(Text $text) { $categories = $this->getCategories(); $links = []; foreach ($categories as $category) { if ($category->isStandardCategory()) { continue; // Don't display "No categories" } $links[] = Link::of($text->getUrlPage("category", $category->getId()), $category->getName()); } return $links; }
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); }
public function getUrl(Text $text) { return $text->getUrlPage("article", $this->getArticleId())->withFragment("comment_" . $this->getId()); }
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; }
/** * Gets the URL for this document. * @param Text $text The text object, for URL structure. * @return UriInterface The URL. */ public function getUrl(Text $text) { if ($this->isForWidgetArea()) { return $text->getUrlMain(); } return $text->getUrlPage("document", $this->id); }
public function getTemplate(Text $text) { if ($this->accountCreated) { return new LoginFormTemplate($text, $text->getUrlPage("login"), [], "", false); } return new AccountCreationTemplate($text, $this->newUser, $this->requestToken); }