本文整理汇总了PHP中tag::get_delete_form方法的典型用法代码示例。如果您正苦于以下问题:PHP tag::get_delete_form方法的具体用法?PHP tag::get_delete_form怎么用?PHP tag::get_delete_form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tag
的用法示例。
在下文中一共展示了tag::get_delete_form方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
access::verify_csrf();
$tag = ORM::factory("tag", $id);
if (!$tag->loaded()) {
throw new Kohana_404_Exception();
}
$form = tag::get_delete_form($tag);
if ($form->validate()) {
$name = $tag->name;
$tag->delete();
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
json::reply(array("result" => "success", "location" => url::site("admin/tags")));
} else {
json::reply(array("result" => "error", "html" => (string) $form));
}
}
示例2: delete
public function delete($id)
{
access::verify_csrf();
$tag = ORM::factory("tag", $id);
if (!$tag->loaded) {
kohana::show_404();
}
$form = tag::get_delete_form($tag);
if ($form->validate()) {
$name = $tag->name;
Database::instance()->delete("items_tags", array("tag_id" => "{$tag->id}"));
$tag->delete();
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
print json_encode(array("result" => "success", "location" => url::site("admin/tags")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例3: delete
public function delete($id)
{
access::verify_csrf();
$tag = ORM::factory("tag", $id);
if (!$tag->loaded()) {
throw new Kohana_404_Exception();
}
$form = tag::get_delete_form($tag);
if ($form->validate()) {
$name = $tag->name;
db::build()->delete("items_tags")->where("tag_id", "=", $tag->id)->execute();
$tag->delete();
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
print json_encode(array("result" => "success", "location" => url::site("admin/tags")));
} else {
print json_encode(array("result" => "error", "form" => (string) $form));
}
}