本文整理汇总了PHP中Category::deleteCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::deleteCategory方法的具体用法?PHP Category::deleteCategory怎么用?PHP Category::deleteCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::deleteCategory方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
public function deleteAction()
{
$request = new Request();
$id = $request->getParam('id');
$Category = new Category();
$Category->deleteCategory($id);
header('location: ' . Url::getUrl('category', 'list', array('status' => 10)));
}
示例2: actionDelete
public function actionDelete($category_id)
{
if (isset($_POST['submit'])) {
Category::deleteCategory($category_id);
header('Location: /admin/category');
}
require_once ROOT . '/views/admin_category/delete.php';
return true;
}
示例3: deleteCategory
function deleteCategory()
{
$category = new Category();
$category->setCategoryId($_REQUEST['id']);
if ($category->deleteCategory()) {
Common::jsonSuccess("Category Deleted Successfully");
} else {
Common::jsonError("Error");
}
}
示例4: deleteCategory
function deleteCategory($id)
{
global $bdd, $_TABLES;
if (!is_null($bdd) && !is_null($_TABLES)) {
$objCategory = new Category($bdd, $_TABLES);
$objCategory->deleteCategory($id);
} else {
error_log("BDD ERROR : " . json_encode($bdd));
error_log("TABLES ERROR : " . json_encode($_TABLES));
}
}
示例5: actionDelete
public function actionDelete($id)
{
if (isset($_POST['submit'])) {
$result = Category::deleteCategory($id);
if (!$result) {
$_SESSION['message'] = 'Произошла ошибка при удалении.';
}
FunctionLibrary::redirectTo('/admin/category');
}
return true;
}
示例6: actionDelete
/**
* Action для страницы "Удалить категорию"
*/
public function actionDelete($id)
{
// Обработка формы
if (isset($_POST['submit'])) {
// Если форма отправлена
// Удаляем категорию
Category::deleteCategory($id);
// Перенаправляем пользователя на страницу управлениями категориями
header('Location: /admin/category/');
}
require_once ROOT . '/views/admin_category/delete.php';
return true;
}
示例7: elseif
admin_redirect('category.php?act=add', '当前商品分类已经存在');
}
} elseif ($act == 'delete') {
//删除商品分类
//获取要删除商品分类id
$c_id = isset($_GET['id']) ? $_GET['id'] : 0;
//判断数据合法性
if ($c_id == 0) {
admin_redirect('category.php', '没有选中要删除的分类!');
}
//验证商品分类是否可以被删除
$category = new Category();
$res = $category->isDelete($c_id);
if ($res === true) {
//可以删除
if ($category->deleteCategory($c_id)) {
//删除成功
admin_redirect('category.php', '删除成功!', 1);
} else {
//删除失败
admin_redirect('category.php', '删除失败');
}
} else {
//不能删除
admin_redirect('category.php', $res);
}
} elseif ($act == 'edit') {
//删除商品分类
//获取要删除商品分类id
$c_id = isset($_GET['id']) ? $_GET['id'] : 0;
$category = new Category();
示例8: admin_delete_category
public function admin_delete_category($admin)
{
if (!Visitor::current()->group()->can("manage_categorize")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to manage categories.", "categorize"));
}
Category::deleteCategory($_REQUEST['id']);
Flash::notice(__("Category deleted.", "categorize"), "/admin/?action=manage_category");
}
示例9: isset
<?php
session_start();
require_once '../classes/connection.class.php';
require_once '../classes/category.class.php';
require_once '../classes/locate.class.php';
$category_id = isset($_GET['category_id']) ? (int) $_GET['category_id'] : '';
$deleteCategoryObj = new Category();
$deleteCategoryObj->setCategoryID($category_id);
$flag = $deleteCategoryObj->deleteCategory();
/*echo '<pre>';
print_r($deleteBlogObj);
echo '</pre>';
exit;*/
if ($flag) {
header('location:../index.php?page=category&action=view');
$_SESSION['category_deleted'] = $deleteCategoryObj->msg = "The category successfully deleted";
} else {
header('location:../index.php?page=category&action=view');
$_SESSION['category_not_deleted'] = $deleteCategoryObj->msg = "The category couldn't be successfully deleted";
}
示例10: header
header("Location: restaurants");
exit;
}
$responseuri = $_POST['responseuri'];
if (!isset($_POST['id'])) {
header("Location: restaurants");
exit;
}
$categoryid = $_POST['id'];
try {
$category = Category::get($categoryid, $userid);
if ($category->hasParent()) {
throw new ExceptionCustom('Invalid category.', ERROR_INVALID_VALUE);
}
$categoryname = $category->getProperty('name');
Category::deleteCategory($categoryid, $userid);
$formmessage = 'Category "' . $categoryname . '" deleted.';
$formmessageclass = 'green';
break;
} catch (Exception $e) {
$formmessage = $e->getMessage();
trigger_error($formmessage);
$formmessageclass = 'red';
break;
}
} else {
header("Location: logout");
exit;
}
} while (1 == 0);
include "common/sessionmessage.php";
示例11: Category
// Include common functions and declarations
require_once "../../include/common.php";
// Create Category object
$category = new Category(getGetValue("categoryId"));
// Check if current user has edit permissions
if (!$category->hasEditPermission()) {
$login->printLoginForm();
exit;
}
// Get referer value if any
$referer = getPostValue("referer");
// Delete category
if (!empty($_POST["deleteCategory"])) {
// Delete category
$category->deleteCategory();
// Redirect to referer
redirect(!empty($referer) ? $referer : scriptUrl . "/" . folderCategory . "/" . fileCategoryIndex);
} else {
if (!empty($_GET["save"])) {
$errors = $category->saveCategory();
// Redirect to category index
if ($errors->getNumberOfErrors() == 0) {
redirect(!empty($referer) ? $referer : scriptUrl . "/" . folderCategory . "/" . fileCategoryIndex);
}
}
}
// Generate navigation info
$site->addNavigationLink(scriptUrl . "/" . folderAdmin, $lAdminIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderCategory, $lCategoryIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderCategory . "/" . fileCategoryEdit . (!empty($category->id) ? "?categoryId=" . $category->id : ""), empty($category->id) ? $lCategoryEdit["NewCategory"] : $lCategoryEdit["EditCategory"]);
示例12:
<?php
include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/Category.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
//delete photo
if (isset($_REQUEST['delete'])) {
Category::deleteCategory($_REQUEST['delete']);
$updates = 'Delete product category content';
AdminAction::addAdminAction($_SESSION['admin_name'], $updates);
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>
_admin/_assets/css/modules.css" />
</head>
示例13: Database
$db = new Database();
$ca = new Category();
$category = $db->select($ca->getCategoryById($id))->fetch_assoc();
if (isset($_POST['submit'])) {
//assign post variables
$name = mysqli_real_escape_string($db->link, $_POST['name']);
// simple validation
if ($name == '') {
// set error
$error = 'Please fill out all required fields.';
} else {
$update_row = $db->update($ca->updateCategory($name, $id));
}
}
if (isset($_POST['delete'])) {
$delete_row = $db->delete($ca->deleteCategory($id));
}
?>
<form method="post" action="edit_category.php?id=<?php
echo $id;
?>
">
<div class="form-group">
<label>Category Name</label>
<input name="name" type="text" class="form-control" placeholder="Category" value="<?php
echo $category['Name'];
?>
">
</div>
<div>