rendered paste body<?php
/*
$Id: my_points.php, v 2.00 2006/JULY/06 17:41:03 dsa_ Exp $
created by Ben Zukrel, Deep Silver Accessories
http://www.deep-silver.com
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2005 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_MY_POINTS);
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_MY_POINTS, '', 'SSL'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="style.css">
<script language="javascript"><!--
function rowOverEffect(object) {
if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}
function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="695" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
<tr>
<td colspan="3" width="100%" height="2px" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td width="159" valign="top"><table border="0" width="159" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left_index.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="520" valign="top">
<table border="0" width="520" cellspacing="0" cellpadding="0">
<tr>
<td width="412" valign="top"><table border="0" width="412" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php $info_box_contents = array();
$info_box_contents[] = array('text' => HEADING_TITLE);
new infoBoxHeadingProduct($info_box_contents,true,true,100); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBox">
<tr>
<td class="maint"><?php echo MY_POINTS_HELP_LINK; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
$points_query = tep_db_query("SELECT customers_shopping_points, customers_points_expires FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int)$customer_id . "' AND customers_points_expires > CURDATE()");
$points = tep_db_fetch_array($points_query);
if (tep_db_num_rows($points_query)) {
?>
<td class="main"><?php echo sprintf(MY_POINTS_CURRENT_BALANCE, number_format($points['customers_shopping_points'],POINTS_DECIMAL_PLACES),$currencies->format(tep_calc_shopping_pvalue($points['customers_shopping_points']))); ?></td>
<td class="main" align="right"><?php echo '<b>' . MY_POINTS_EXPIRE . '</b> ' . tep_date_short($points['customers_points_expires']); ?></td>
<?php
} else {
echo'<td class="main"><b>' . TEXT_NO_POINTS . '</b></td>';
}
?>
</tr>
</table>
<?php
$pending_points_query = "SELECT unique_id, orders_id, points_pending, points_comment, date_added, points_status, points_type from " . TABLE_CUSTOMERS_POINTS_PENDING . " WHERE customer_id = '" . (int)$customer_id . "' ORDER BY unique_id DESC";
$pending_points_split = new splitPageResults($pending_points_query, MAX_DISPLAY_POINTS_RECORD);
$pending_points_query = tep_db_query($pending_points_split->sql_query);
if (tep_db_num_rows($pending_points_query)) {
?>
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="productListing-heading">
<tr class="productListing-heading">
<td class="productListing-heading"width="13%"><?php echo HEADING_ORDER_DATE; ?></td>
<td class="productListing-heading"width="25%"><?php echo HEADING_ORDERS_NUMBER; ?></td>
<td class="productListing-heading" width="35%"><?php echo HEADING_POINTS_COMMENT; ?></td>
<td class="productListing-heading"><?php echo HEADING_POINTS_STATUS; ?></td>
<td class="productListing-heading" align="right"><?php echo HEADING_POINTS_TOTAL; ?></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="1" cellpadding="2">
<tr>
<?php
while ($pending_points = tep_db_fetch_array($pending_points_query)) {
$orders_status_query = tep_db_query("SELECT o.orders_id, o.orders_status, s.orders_status_name FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s WHERE o.customers_id = '" . (int)$customer_id . "' AND o.orders_id = '" . $pending_points['orders_id'] . "' AND o.orders_status = s.orders_status_id AND s.language_id = '" . (int)$languages_id . "'");
$orders_status = tep_db_fetch_array($orders_status_query);
if ($pending_points['points_status'] == 1) $points_status_name = TEXT_POINTS_PENDING;
if ($pending_points['points_status'] == 2) $points_status_name = TEXT_POINTS_CONFIRMED;
if ($pending_points['points_status'] == 3) $points_status_name = '<font color="FF0000">' . TEXT_POINTS_CANCELLED . '</font>';
if ($pending_points['points_status'] == 4) $points_status_name = '<font color="0000FF">' . TEXT_POINTS_REDEEMED . '</font>';
if ($orders_status['orders_status'] == 2 && $pending_points['points_status'] == 1 || $orders_status['orders_status'] == 3 && $pending_points['points_status'] == 1) {
$points_status_name = TEXT_POINTS_PROCESSING;
}
if (($pending_points['points_type'] == SP) && ($pending_points['points_comment'] == 'TEXT_DEFAULT_COMMENT')) {
$pending_points['points_comment'] = TEXT_DEFAULT_COMMENT;
}
if($pending_points['points_comment'] == 'TEXT_DEFAULT_REDEEMED') {
$pending_points['points_comment'] = TEXT_DEFAULT_REDEEMED;
}
if ($pending_points['points_type'] == RF) {
$referred_name_query = tep_db_query("SELECT customers_name FROM " . TABLE_ORDERS . " WHERE orders_id = '" . $pending_points['orders_id'] . "' LIMIT 1");
$referred_name = tep_db_fetch_array($referred_name_query);
if ($pending_points['points_comment'] == 'TEXT_DEFAULT_REFERRAL') {
$pending_points['points_comment'] = TEXT_DEFAULT_REFERRAL;
}
}
if (($pending_points['points_type'] == RV) && ($pending_points['points_comment'] == 'TEXT_DEFAULT_REVIEWS')) {
$pending_points['points_comment'] = TEXT_DEFAULT_REVIEWS;
}
if (($pending_points['orders_id'] > 0) && (($pending_points['points_type'] == SP)||($pending_points['points_type'] == RD))) {
?>
<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $pending_points['orders_id'], 'SSL'); ?>'" title="<?php echo TEXT_ORDER_HISTORY .' ' . $pending_points['orders_id']; ?>">
<?php
}
if ($pending_points['points_type'] == RV) {
?>
<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $pending_points['orders_id'], 'NONSSL'); ?>'" title="<?php echo TEXT_REVIEW_HISTORY; ?>">
<?php
}
if (($pending_points['orders_id'] == 0) || ($pending_points['points_type'] == RF) || ($pending_points['points_type'] == RV)) {
$orders_status['orders_status_name'] = '<font color="ff0000">' . TEXT_STATUS_ADMINISTATION . '</font>';
$pending_points['orders_id'] = '<font color="ff0000">' . TEXT_ORDER_ADMINISTATION . '</font>';
}
?>
<td class="productListing-data"width="13%"><?php echo tep_date_short($pending_points['date_added']); ?></td>
<td class="productListing-data"width="25%"><?php echo '#' . $pending_points['orders_id'] . ' ' . $orders_status['orders_status_name']; ?></td>
<td class="productListing-data" width="35%"><?php echo $pending_points['points_comment'] .' ' . $referred_name['customers_name']; ?></td>
<td class="productListing-data"><?php echo $points_status_name; ?></td>
<td class="productListing-data" align="right"><?php echo number_format($pending_points['points_pending'],POINTS_DECIMAL_PLACES); ?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
</table>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><a href="javascript:history.go(-1)"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK); ?></a></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
</table></td></tr>
<tr><td> <?php new infoBoxFooterProduct();?></td></tr>
</table></td>
<!-- body_text_eof //-->
<td width="124" valign="top" align="right"><table border="0" width="124" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table></td></tr>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>