本文整理汇总了PHP中Link::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::delete方法的具体用法?PHP Link::delete怎么用?PHP Link::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteLink
public function deleteLink(Link $link)
{
/** @var myModel $this */
$link->delete();
if (property_exists($this, 'linkCount')) {
$this->decreaseCount('linkCount');
}
return $this;
}
示例2: GETPOST
}
$linkid = GETPOST('linkid', 'int');
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if ($urlfile) {
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", $urlfile));
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
}
} elseif ($linkid) {
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($db);
$link->id = $linkid;
$link->fetch();
$res = $link->delete($user);
$langs->load('link');
if ($res) {
setEventMessage($langs->trans("LinkRemoved", $link->label));
} else {
setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors');
}
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (!empty($withproject) ? '&withproject=1' : ''));
exit;
}
} elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) {
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$langs->load('link');
$link = new Link($db);
$link->id = GETPOST('linkid', 'int');
示例3: elseif
?>
" />
</p>
<p>
<label for="descripcion">Descripción</label>
<textarea id="descripcion" name="descripcion"><?php
echo $link->getDescription();
?>
</textarea>
</p>
<input type="hidden" name="accion" value="doedit" />
<input type="submit" value="Guardar">
</form>
<?php
} elseif ($_GET['accion'] == 'delete') {
$link->delete();
header("Location: index.php");
}
} else {
?>
<form action="#" method="post">
<p>
<label for="enlace">Enlace: </label>
<input id="enlace" type="text" name="enlace">
</p>
<p>
<label for="descripcion">Descripción</label>
<textarea id="descripcion" name="descripcion"></textarea>
</p>
<input type="submit" name="accion" value="Crear">
示例4: Link
*/
include '../inc/includes.php';
Session::checkRight("link", READ);
if (empty($_GET["id"])) {
$_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
$link->check(-1, CREATE);
$newID = $link->add($_POST);
Event::log($newID, "links", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
Html::redirect(Toolbox::getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
if (isset($_POST["purge"])) {
$link->check($_POST["id"], PURGE);
$link->delete($_POST, 1);
Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
$link->redirectToList();
} else {
if (isset($_POST["update"])) {
$link->check($_POST["id"], UPDATE);
$link->update($_POST);
Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
Html::back();
} else {
Html::header(Link::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "config", "link");
$link->display(array('id' => $_GET["id"]));
Html::footer();
}
}
}
示例5: Link
*/
include '../inc/includes.php';
Session::checkRight("link", "r");
if (empty($_GET["id"])) {
$_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
$link->check(-1, 'w');
$newID = $link->add($_POST);
Event::log($newID, "links", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
Html::redirect(Toolbox::getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
if (isset($_POST["delete"])) {
$link->check($_POST["id"], 'd');
$link->delete($_POST);
Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
$link->redirectToList();
} else {
if (isset($_POST["update"])) {
$link->check($_POST["id"], 'w');
$link->update($_POST);
Event::log($_POST["id"], "links", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
Html::back();
} else {
Html::header(Link::getTypeName(2), $_SERVER['PHP_SELF'], "config", "link");
$link->showForm($_GET["id"]);
Html::footer();
}
}
}