public function deleteLinkAction(Users $user, Links $link) { if ($this->request->isPost()) { $link->delete(); return $this->redirectByRoute(['for' => 'users.showLinks', 'user' => $user->id]); } }
/** * 删除 */ public function actionDelete($id) { $id = (int) $id; $Links = new Links(); $Links->delete(array('lid' => $id)); $this->Common->exportResult(true, '成功!'); }
$context['page_title'] = i18n::s('Delete a link'); // not found if (!isset($item['id'])) { include '../error.php'; // permission denied } elseif (!$permitted) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // deletion is confirmed } elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') { // touch the related anchor before actual deletion, since the link has to be accessible at that time if (is_object($anchor)) { $anchor->touch('link:delete', $item['id']); } // if no error, back to the anchor or to the index page if (Links::delete($item['id'])) { Links::clear($item); if (is_object($anchor)) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url() . '#_attachments'); } else { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'links/'); } } // deletion has to be confirmed } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { Logger::error(i18n::s('The action has not been confirmed.')); } else { // commands $menu = array(); $menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this link'), NULL, NULL, 'confirmed'); if (is_object($anchor)) {
$menuId = $database->escapeString($_POST['menuId']); // CHANGE TITLE $menu->setTitle($menuTitle); $menu->setMenuId($menuId); $menu->updateTitle($database); $menu->setLangId($menu->getMenuLang($database)); // UPDATE isMain if ($_POST['isMain'] == "true") { $menu->updateIsMain($database); } // DELETE LINKS if (isset($_POST['deletedList'])) { $deletedList = $_POST['deletedList']; foreach ($deletedList as $del) { $links->setLinkId($database->escapeString($del)); if ($links->delete($database)) { } } } // EDIT POSITIONS $count = 0; foreach ($linksArray as $link) { $links->setLinkId($database->escapeString($link)); $links->setPosition($database->escapeString($positionArray[$count])); if ($links->updatePosition($database)) { } $count++; } echo "true"; } else { echo "false";
public function deleteLinkFromEpisodeAction($movie, $episode, Links $link) { $link->delete(); return $this->redirectByRoute(['for' => 'movies.showEpisode', 'movie' => $movie, 'episode' => $episode]); }