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