Пример #1
0
<?php

include_once "../utils/product_util.php";
include_once "../../../controller/CommentController.php";
include_once "../../../controller/ProductController.php";
include_once "../../../controller/ProductImageController.php";
if (isset($_POST["btnUpdateComment"])) {
    include_once "../../../controller/CommentController.php";
    $id = $_REQUEST["id"];
    $description = $_REQUEST["description"];
    $result = CommentController::Update($id, $description);
    if ($result) {
        header("Location:../comment_index.php?action=view&id=" . $id);
    } else {
        header("Location:../comment_index.php?action=view&id=" . $id);
    }
} else {
    if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "delete") {
        include_once "../../../controller/CommentController.php";
        require_once "../utils/product_util.php";
        $id = $_REQUEST["id"];
        $result = CommentController::Delete($id);
        if ($result) {
            echo ProductUtil::createMessageBox("DELETE PRODUCT", "Deletion completed!");
        } else {
            echo ProductUtil::createMessageBox("DELETE PRODUCT", "Deletion does not complete!");
        }
    }
}
Пример #2
0
    $result = PromotionController::Add($name, $description, $startdate, $enddate);
    if ($result >= 0) {
        header("Location:../promotion_index.php?action=add&result=ok");
        //echo ProductUtil::createMessageBox("ADD PRODUCT","Add completed!");
    } else {
        header("Location:../promotion_index.php?action=add&result=fail");
    }
} else {
    if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "delete") {
        include_once "../../../controller/PromotionController.php";
        require_once "../utils/product_util.php";
        $id = $_REQUEST["id"];
        $result = PromotionController::Delete($id);
        if ($result) {
            echo ProductUtil::createMessageBox("DELETE PROMOTION", "Delete completed!");
        } else {
            echo ProductUtil::createMessageBox("DELETE PROMOTION", "Delete does not complete!");
        }
    } else {
        if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "edit") {
            include_once "../../../controller/PromotionController.php";
            $id = $_REQUEST["id"];
            $name = $_REQUEST["name"];
            $description = $_REQUEST["description"];
            $startdate = $_REQUEST["startdate"];
            $enddate = $_REQUEST["enddate"];
            $result = PromotionController::Update($id, $name, $description, $startdate, $enddate);
            header("Location:../promotion_index.php?action=view&id=" . $id);
        }
    }
}
Пример #3
0
        } else {
            if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "deleteImage") {
                include_once "../../../controller/ProductImageController.php";
                require_once "../utils/product_util.php";
                $id = $_REQUEST["proId"];
                $imgType = $_REQUEST["imgType"];
                $img = ProductImageController::GetImageOfProductFromProductID($id);
                $result = ProductImageController::Update($id, $imgType, "");
                $result = true;
                if ($result) {
                    if (unlink("../../../" . $img[$imgType])) {
                        echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete completed!");
                        return;
                    }
                }
                echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete does not complete!");
            }
        }
    }
}
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "search") {
    $name = $_REQUEST["name"];
    $type = $_REQUEST["type"];
    $sub_type = $_REQUEST["sub_type"];
    $pricefrom = $_REQUEST["pricefrom"];
    $priceto = $_REQUEST["priceto"];
    $promotion_id = $_REQUEST["promotion_id"];
    $present_type = $_REQUEST["present_type"];
    $strSQL = "select * from product where 1=1 ";
    if (strlen($name) > 0) {
        $strSQL .= " and Name LIKE '%{$name}%' ";