$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); } } }
mysql_query($this->_query_closeweekend1); mysql_close(); $now = date("Y-m-d H:i:s"); echo "End CloseWeekendPromotion at {$now} .\n"; } private function CancelWeekendPromotion() { $now = date("Y-m-d H:i:s"); echo "Start CancelWeekendPromotion at {$now} .\n"; mysql_connect($this->_dbhost, $this->_username, $this->_password); @mysql_select_db($this->_dbname) or die(strftime('%c') . " Unable to select database"); mysql_query($this->_query_openweekend0); mysql_query($this->_query_closeweekend1); mysql_close(); $now = date("Y-m-d H:i:s"); echo "End CancelWeekendPromotion at {$now} .\n"; } private function getDBConfig() { $app = Mage::app('default'); $config = Mage::getConfig()->getResourceConnectionConfig("default_setup"); $dbinfo = array("host" => $config->host, "user" => $config->username, "pass" => $config->password, "dbname" => $config->dbname); var_dump($dbinfo); $this->_dbhost = $dbinfo["host"]; $this->_username = $dbinfo["user"]; $this->_password = $dbinfo["pass"]; $this->_dbname = $dbinfo["dbname"]; } } $promotion = new PromotionController(); $promotion->run();
<?php require_once "../../controller/PromotionController.php"; $promotion = PromotionController::GetById($_REQUEST["id"]); ?> <script type="text/javascript"> function addProduct() { var name = $("#name").val(); if(name.length<=0 ) { alert("Must input product name"); return false; } return true; //alert(name+"_"+description+"_"+type+"_"+present_type); //$("#info-panel").load("action/action_product.php?action=addNew",{'name':name,'description':description,'type':type,'sub_type':sub_type,'promotion_id':promotion_id,'present_type':present_type,'price':price}); //$("#lightbox, #info-panel").fadeIn(300); } function closePopupEdit() { $("#lightbox, #lightbox-panel, #info-panel, #info-addOk, #info-addFail").fadeOut(300); } function showMessageOk() { $("#lightbox, #info-addOk").fadeIn(300); } function showMessageFail() { $("#lightbox, #info-addFail").fadeIn(300);
var array = $("ul#nav > li"); for ( var int = 0; int < array.length; int++) { $(array[5]).attr("id", "selected"); } </script>'; include_once '../../controller/PromotionController.php'; require_once "../../utility/Utils.php"; include_once "../../controller/config.php"; $maxItems = 10; $curPage = ""; if (isset($_GET["page"])) { $curPage = (int) $_GET["page"]; } $curPage = $curPage > 0 ? $curPage : 1; $curItem = ($curPage - 1) * $maxItems; $promotionController = new PromotionController(); $promotionList = $promotionController->Get($curItem, $maxItems); $totalItems = $promotionController->Count(); ?> <div id="contain" class="contain contain box-transparent"> <?php if (!empty($promotionList) && $promotionList != null) { ?> <?php foreach ($promotionList as $promotion) { ?> <div class="promotion"> <?php echo $promotion['Detail']; ?> </div>
<thead> <tr> <th width="40px"><a href="#">ID<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></a></th> <th><a href="#">Name</a></th> <th><a href="#">Detail</a></th> <th width="90px"><a href="#">Start Date</a></th> <th width="70px"><a href="#">End Date</a></th> <th width="60px"><a href="#">Action</a></th> </tr> </thead> <tbody> <?php require_once "../../controller/PromotionController.php"; $products = PromotionController::Get($curItem, $maxItems); $totalItems = PromotionController::Count(); if ($totalItems != 0) { foreach ($products as $product) { ?> <tr> <td class="a-center"><?php echo $product["ID"]; ?> </td> <td><a href="?action=view&<?php echo "id=" . $product["ID"]; ?> "><?php echo $product["Name"]; ?> </a></td>