if (isset($_SESSION["UserID"]) == false) { header("Location:recipePage.php?message=signIn&RecipeID=" . $iRecipeID); exit; // terminates request } $oReplyForm->data = $_POST; $oComment = new Comment(); $oComment->comment = $_POST["replyCommentBox"]; $oComment->userID = $oCustomer->userID; $oComment->originalID = $_POST["commentID"]; $oComment->saveReply(); header("Location:recipePage.php?message=commentAdded&RecipeID=" . $iRecipeID); exit; // terminates request } $oReplyForm->makeHiddenField("commentID", 0); $oReplyForm->makeCommentBoxTextArea("replyCommentBox"); $oReplyForm->makeSubmit("reply", "Reply", "displayBlock blueButton2 bgBlue marginBottom10 paddingTop10 paddingBottom10 floatRight"); // recipe nav echo View::renderRecipeNav($aAllTypes); //recipe page echo View::renderRecipePage($oRecipe); ?> <div class="clearBoth sixteen columns"> <!-- add comment --> <h3>Comments</h3> <div class="commentBox bgCC selfClear marginBottom20"> <?php echo $oCommentForm->HTML; if (isset($_GET["message"]) == true) { if ($_GET["message"] == "commentAdded") {
$oProduct = new Product(); $oProduct->load($_POST["productID"]); $oProduct->stockLevel = $_POST["stockLevel"]; $oProduct->save(); // redirect after adding new page successfully to that new location header("Location:editProductStock.php?message=stockUpdated"); exit; // terminates request } $aForms = array(); $aAllProducts = ProductManager::getAllProducts(); for ($iCount = 0; $iCount < count($aAllProducts); $iCount++) { $oProduct = $aAllProducts[$iCount]; $oStockLevelForm = new Form(); $aStickyData = array(); $aStickyData["stockLevel"] = $oProduct->stockLevel; $oStockLevelForm->data = $aStickyData; // form markup: $oStockLevelForm->stockInput("stockLevel", "", "floatLeft"); $oStockLevelForm->makeHiddenField("productID", $oProduct->productID); $oStockLevelForm->makeSubmit("save", "Save", "blueButton bgBlue selfClear"); $aForms[] = $oStockLevelForm; } // stock level form echo View::renderProductStockMgtEdit($aAllProducts, $aForms); if (isset($_GET["message"]) == true) { if ($_GET["message"] == "stockUpdated") { echo '<div class="stockUpdate formSuccess textAlignCenter">Stock level has now been updated.</div>'; } } require_once "includes/footerAdmin.php";
<?php require_once "includes/header.php"; require_once "includes/product.php"; require_once "includes/productManager.php"; require_once "includes/form.php"; $iProductID = 1; if (isset($_GET["ProductID"])) { $iProductID = $_GET["ProductID"]; } $oProduct = new Product(); $oProduct->load($iProductID); $oBasketForm = new Form("addToBasket.php"); // form markup: $oBasketForm->makeHiddenField("ProductID", $iProductID); $oBasketForm->quantityInput("quantity", "Quantity", "addQuantity"); $oBasketForm->makeSubmit("addToBasket", "Add to Basket", "displayBlock clearBoth blueButton2 bgBlue marginTop10 marginBottom10"); // main product info: echo View::renderShopItem($oProduct, $oBasketForm); if (isset($_GET["message"]) == true) { if ($_GET["message"] == "itemAdded") { echo '<div class="addToBasket formSuccess">Item has been added to basket.</div>'; } if ($_GET["message"] == "noQuantity") { echo '<div class="addToBasket formError">* Must select quantity.</div>'; } } $aAllProducts = ProductManager::getAllProducts(); ?>