예제 #1
0
파일: coupons.php 프로젝트: huynp/Critical
    $archiveActions = "";
    if (!MM_Coupon::isBeingUsed($coupon->getId())) {
        $actions .= MM_Utils::getDeleteIcon("Delete Coupon", 'margin-left:5px;', $deleteActionUrl);
    } else {
        $actions .= MM_Utils::getDeleteIcon("This coupon is currently being used and cannot be deleted.", 'margin-left:5px;', '', true);
        if (!$coupon->isArchived()) {
            $archiveMsg = "Archive this coupon to hide it and disable it from being used.";
            $archiveActions .= MM_Utils::getArchiveIcon($archiveMsg, 'margin-left:5px;', $archiveActionUrl);
        } else {
            if ($coupon->isArchived()) {
                $archiveMsg = "Unarchive this coupon to enable it to be used.";
                $archiveActions .= MM_Utils::getArchiveIcon($archiveMsg, 'margin-left:5px;', $unarchiveActionUrl, true);
            }
        }
    }
    $rows[] = array(array('content' => "<span title='ID [" . $coupon->getId() . "]'>" . $coupon->getCouponName() . "</span>"), array('content' => "<span style='font-family:courier;'>" . strtoupper($coupon->getCouponCode()) . "</span>"), array('content' => $description), array('content' => $quantityDescription), array('content' => $availableDates), array('content' => empty($item->product_restrictions) ? MM_NO_DATA : $item->product_restrictions), array('content' => $actions), array('content' => $archiveActions));
}
$headers = array('name' => array('content' => '<a onclick="mmjs.sort(\'c.coupon_name\');" href="#">Name</a>'), 'coupon_code' => array('content' => '<a onclick="mmjs.sort(\'c.coupon_code\');" href="#">Coupon Code</a>'), 'description' => array('content' => 'Description'), 'quantity_used' => array('content' => '<a onclick="mmjs.sort(\'quantity_used\');" href="#"># Used</a>'), 'start_date_end_date' => array('content' => '<a onclick="mmjs.sort(\'c.start_date\');" href="#">Valid Dates</a>'), 'product_restrictions' => array('content' => 'Product Restrictions'), 'actions' => array('content' => 'Actions', "attr" => "style='width:50px;'"), 'archive' => array('content' => 'Archive', "attr" => "style='width:20px;'"));
$dataGrid->setHeaders($headers);
$dataGrid->setRows($rows);
$dgHtml = $dataGrid->generateHtml();
if ($dgHtml == "") {
    $dgHtml = "<p><i>No coupons.</i></p>";
}
?>
<div class="mm-wrap">
	<?php 
if (MM_Response::isError($couponsSupported)) {
    ?>
	<div class="error">
		<p><?php 
예제 #2
0
$editable = "";
if (MM_Coupon::isBeingUsed($coupon->getId())) {
    $editable = "disabled='disabled'";
}
$products = MM_HtmlUtils::createCheckboxGroup(MM_Product::getAll(), "mm_products", $prods);
?>
<div id="mm-coupons-container">
	<table cellspacing="10">
		<tr>
			<td width="140">Name*</td>
			<td><input type='hidden' id='id' value='<?php 
echo $coupon->getId();
?>
' />
				<input id="mm_coupon_name" type="text" value='<?php 
echo $coupon->getCouponName();
?>
' style='width:300px;' />
			</td>
		</tr>
		<tr>
			<td width="140">Coupon Code*</td>
			<td>
				<input id="mm_coupon_code" <?php 
echo $editable;
?>
  type="text" value='<?php 
echo strtoupper($coupon->getCouponCode());
?>
' />
			</td>