[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> gv_queue.php (source)

   1  <?php
   2  /*

   3  $Id: gv_queue.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    require (DIR_WS_CLASSES . 'currencies.php');
  16    $currencies = new currencies();
  17  
  18    if ($HTTP_GET_VARS['action']=='confirmrelease' && isset($HTTP_GET_VARS['gid'])) {
  19      $gv_query=tep_db_query("select release_flag from " . TABLE_COUPON_GV_QUEUE . " where unique_id='".$HTTP_GET_VARS['gid']."'");
  20      $gv_result=tep_db_fetch_array($gv_query);
  21      if ($gv_result['release_flag']=='N') {
  22        $gv_query=tep_db_query("select customer_id, amount from " . TABLE_COUPON_GV_QUEUE ." where unique_id='".$HTTP_GET_VARS['gid']."'");
  23        if ($gv_resulta=tep_db_fetch_array($gv_query)) {
  24        $gv_amount = $gv_resulta['amount'];
  25        //Let's build a message object using the email class

  26        $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $gv_resulta['customer_id'] . "'");
  27        $mail = tep_db_fetch_array($mail_query);
  28        $message = TEXT_REDEEM_COUPON_MESSAGE_HEADER;
  29        $message .= sprintf(TEXT_REDEEM_COUPON_MESSAGE_AMOUNT, $currencies->format($gv_amount));
  30        $message .= TEXT_REDEEM_COUPON_MESSAGE_BODY;
  31        $message .= TEXT_REDEEM_COUPON_MESSAGE_FOOTER;
  32        $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  33        // add the message to the object

  34        $mimemessage->add_text($message);
  35        $mimemessage->build_message();
  36  
  37        $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, TEXT_REDEEM_COUPON_SUBJECT );
  38        $gv_amount=$gv_resulta['amount'];
  39        $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id='".$gv_resulta['customer_id']."'");
  40        $customer_gv=false;
  41        $total_gv_amount=0;
  42        if ($gv_result=tep_db_fetch_array($gv_query)) {
  43          $total_gv_amount=$gv_result['amount'];
  44          $customer_gv=true;
  45        }
  46        $total_gv_amount=$total_gv_amount+$gv_amount;
  47        if ($customer_gv) {
  48          $gv_update=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount='".$total_gv_amount."' where customer_id='".$gv_resulta['customer_id']."'");
  49        } else {
  50          $gv_insert=tep_db_query("insert into " .TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('".$gv_resulta['customer_id']."','".$total_gv_amount."')");
  51        }
  52          $gv_update=tep_db_query("update " . TABLE_COUPON_GV_QUEUE . " set release_flag='Y' where unique_id='".$HTTP_GET_VARS['gid']."'");
  53        }
  54      }
  55    }
  56  ?>
  57  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  58  <html <?php echo HTML_PARAMS; ?>>
  59  <head>
  60  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  61  <title><?php echo TITLE; ?></title>
  62  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  63  </head>
  64  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  65  <!-- header //-->
  66  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  67  <!-- header_eof //-->
  68  
  69  <!-- body //-->
  70  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  71    <tr>
  72      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  73  <!-- left_navigation //-->
  74  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  75  <!-- left_navigation_eof //-->
  76      </table></td>
  77  <!-- body_text //-->
  78      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  79        <tr>
  80          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  81            <tr>
  82              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  83              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  84            </tr>
  85          </table></td>
  86        </tr>
  87        <tr>
  88          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  89            <tr>
  90              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  91                <tr class="dataTableHeadingRow">
  92                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
  93                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td>
  94                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VOUCHER_VALUE; ?></td>
  95                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
  96                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  97                </tr>
  98  <?php
  99    $gv_query_raw = "select c.customers_firstname, c.customers_lastname, gv.unique_id, gv.date_created, gv.amount, gv.order_id from " . TABLE_CUSTOMERS . " c, " . TABLE_COUPON_GV_QUEUE . " gv where (gv.customer_id = c.customers_id and gv.release_flag = 'N')";
 100    $gv_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $gv_query_raw, $gv_query_numrows);
 101    $gv_query = tep_db_query($gv_query_raw);
 102    while ($gv_list = tep_db_fetch_array($gv_query)) {
 103      if (((!$HTTP_GET_VARS['gid']) || (@$HTTP_GET_VARS['gid'] == $gv_list['unique_id'])) && (!$gInfo)) {
 104        $gInfo = new objectInfo($gv_list);
 105      }
 106      if ( (is_object($gInfo)) && ($gv_list['unique_id'] == $gInfo->unique_id) ) {
 107        echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link('gv_queue.php', tep_get_all_get_params(array('gid', 'action')) . 'gid=' . $gInfo->unique_id . '&action=edit') . '\'">' . "\n";
 108      } else {
 109        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link('gv_queue.php', tep_get_all_get_params(array('gid', 'action')) . 'gid=' . $gv_list['unique_id']) . '\'">' . "\n";
 110      }
 111  ?>
 112                  <td class="dataTableContent"><?php echo $gv_list['customers_firstname'] . ' ' . $gv_list['customers_lastname']; ?></td>
 113                  <td class="dataTableContent" align="center"><?php echo $gv_list['order_id']; ?></td>
 114                  <td class="dataTableContent" align="right"><?php echo $currencies->format($gv_list['amount']); ?></td>
 115                  <td class="dataTableContent" align="right"><?php echo tep_datetime_short($gv_list['date_created']); ?></td>
 116                  <td class="dataTableContent" align="right"><?php if ( (is_object($gInfo)) && ($gv_list['unique_id'] == $gInfo->unique_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_GV_QUEUE, 'page=' . $HTTP_GET_VARS['page'] . '&gid=' . $gv_list['unique_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 117                </tr>
 118  <?php
 119    }
 120  ?>
 121                <tr>
 122                  <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 123                    <tr>
 124                      <td class="smallText" valign="top"><?php echo $gv_split->display_count($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_GIFT_VOUCHERS); ?></td>
 125                      <td class="smallText" align="right"><?php echo $gv_split->display_links($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
 126                    </tr>
 127                  </table></td>
 128                </tr>
 129              </table></td>
 130  <?php
 131    $heading = array();
 132    $contents = array();
 133    switch ($HTTP_GET_VARS['action']) {
 134      case 'release':
 135        $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . tep_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount));
 136  
 137        $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('gv_queue.php','action=confirmrelease&gid='.$gInfo->unique_id,'NONSSL').'">'.tep_image_button('button_confirm_red.gif', IMAGE_CONFIRM) . '</a> <a href="' . tep_href_link('gv_queue.php','action=cancel&gid=' . $gInfo->unique_id,'NONSSL') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 138        break;
 139      default:
 140        $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . tep_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount));
 141  
 142        $contents[] = array('align' => 'center','text' => '<a href="' . tep_href_link('gv_queue.php','action=release&gid=' . $gInfo->unique_id,'NONSSL'). '">' . tep_image_button('button_release.gif', IMAGE_RELEASE) . '</a>');
 143        break;
 144     }
 145  
 146    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 147      echo '            <td width="25%" valign="top">' . "\n";
 148  
 149      $box = new box;
 150      echo $box->infoBox($heading, $contents);
 151  
 152      echo '            </td>' . "\n";
 153    }
 154  ?>
 155            </tr>
 156          </table></td>
 157        </tr>
 158      </table></td>
 159  <!-- body_text_eof //-->
 160    </tr>
 161  </table>
 162  <!-- body_eof //-->
 163  
 164  <!-- footer //-->
 165  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 166  <!-- footer_eof //-->
 167  <br>
 168  </body>
 169  </html>
 170  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7