*/
public function modelAction( $actionData = false )
{
- $coupons = $categories = array();
+ $coupons = $categories = $printCoupons = array();
$where = "current_date BETWEEN T.start_date AND T.end_date AND T.status = 10";
$where .= " AND T.ref_dest = " . $_REQUEST['member'];
}
+ // check to see if Print selected is on
+ if (isset($_REQUEST['printSel']) && $_REQUEST['printSel']) {
+ $printAll = false;
+ foreach ($_REQUEST as $posted => $value) {
+ if (preg_match('%coupon-id-(\d+)%', $posted, $matches)) {
+ $printCoupons[] = $matches[1];
+ }
+ }
+ $where .= " AND T.id in (" . implode( ',', $printCoupons) . ")";
+ }
$coupons = $this->getList( $where );
if ( isset( $coupons ) && !empty( $coupons ) ) {
$address[] = $mInfo['city'];
}
if ( $mInfo['state'] ) {
- $address[] = $mInfo['state'];
+ $address[] = $mInfo['state']['name'];
}
if ( $mInfo['zip'] ) {
$address[] = $mInfo['zip'];
}
}
- //echo '<pre>$coupons: ' . print_r( $coupons, true ) . '</pre>';
- //exit;
-
$pdf = new glmCoupon('a4', 'portrait');
$pdf->selectFont(GLM_MEMBERS_COUPONS_PLUGIN_PATH . "/fonts/Helvetica.afm");
$pdf->ezSetMargins(90, 30, 30, 35);
$pdf->closeObject();
$pdf->addObject($all, 'all');
$coupon_lft_opt = array(
- 'left' => 5,
- 'right' => 280,
- 'justification'=>'left'
+ 'left' => 5,
+ 'right' => 280,
+ 'justification' =>'left'
);
$coupon_rgt_opt = array(
- 'left' => 290,
- 'justification'=>'left'
+ 'left' => 290,
+ 'justification' =>'left'
);
- // check to see if Print selected is on
- $printIds = array();
- if (isset($_REQUEST['printSel']) && $_REQUEST['printSel']) {
- $printAll = false;
- foreach ($_REQUEST as $posted => $value) {
- if (preg_match('%coupon-id-(\d+)%', $posted, $matches)) {
- //echo '<pre>' . print_r($matches, true) . '</pre>';
- $printIds[$matches[1]] = $matches[1];
- }
- }
- } else {
- $printAll = true;
- }
- $minY = $y // y is verticle position starting at lower left hand corner
+ $minY = $y // y is vertical position starting at lower left hand corner
= 800;
$x = 20; // x is horizontal position starting at lover left hand corner
$coupon_width = 265; //
$mycount = $count = 1; //
$options = $coupon_lft_opt;
- foreach ( $coupons as $coupon ) {
- if ( !$printAll && !in_array( $coupon['id'], $printIds ) ) {
- continue;
- } else if ( !$printAll && in_array( $coupon['id'], $printIds ) ) {
- unset( $printIds[$coupon['id']] );
- }
+ foreach ( $coupons as &$coupon ) {
$reset = $y;
$val = array();
$val['header'] = iconv('UTF-8', 'ISO-8859-1//IGNORE', $coupon['name']);
}
if ($y < 180 || ($mycount % 8 == 0)) {
$pdf->ezNewPage();
- $y = 800;
+ $y = 800;
$minY = $y;
}
} else {
$minY = $y;
- $y = $reset;
- $x = 300;
+ $y = $reset;
+ $x = 300;
}
$count++;
$mycount++;
<div id="glm-member-detail-coupons-toggle" class="glm-member-detail-content-toggle">Coupons</div>
<div id="glm-member-detail-coupons-container">
- <form id="glm-coupon-form" action="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=pdfCoupons&pdf=1&member={$member_id}" method="post">
+ <br clear="all">
+ <form id="glm-coupon-form" action="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=pdfCoupons&pdf=1&member={$member_id}" method="post"
+ style="margin-top: 20px;">
<input type="hidden" id="form-option" name="option" value="">
- <input type="submit" id="print-all-coupon" value="Print All" name="printAll" class="button success glm_coupon_print">
- <input type="submit" id="print-selected-coupon" value="Print Selected" name="printSel" class="button success glm_coupon_print">
+ <input type="submit" id="print-all-coupon" value="Print All" name="printAll" class="button tiny success glm_coupon_print">
+ <input type="submit" id="print-selected-coupon" value="Print Selected" name="printSel" class="button tiny success glm_coupon_print">
{if $categories}
{foreach $categories as $catName => $coupons}
{if $catName != '1-category'}