PHP Code:
<?php
/**
* Request Restock Alpha 3/2
* By RubikIntegration team @ RubikIntegration.com
* Made for ZC 1.3.7
* Released under the GNU General Public License
*/
require('includes/application_top.php');
$options = array (0 => array(id => 1,
text => 'List total requested quantity per product'),
1 => array(id => 2,
text => 'List all requests sort by product'),
2 => array(id => 3,
text => 'Check and Update deleted products'),
3 => array(id => 4,
text => 'Send notices to customers'),
4 => array(id => 5,
text => 'Clean up requests')
);
if (!isset($_GET['option']) || !is_numeric($_GET['option']) || (int)$_GET['option'] < 1 || $_GET['option'] > 5)
$_GET['option'] = 1;
switch($_GET['option']){
case 1:
$products_query_raw = "select r.product_id, sum(r.request_quantity) as request_quantity, d.products_name from ".TABLE_PRODUCTS_REQUEST_RESTOCK_RECORDS." r,".TABLE_PRODUCTS_DESCRIPTION." d WHERE r.request_status = 0 and d.products_id = r.product_id group by r.product_id order by d.products_name asc";
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
$products_values = $db->Execute($products_query_raw);
break;
case 2:
$requests_query_raw = "select c.name, c.email_address, r.request_quantity, r.request_message, r.product_id, d.products_name from ".TABLE_PRODUCTS_REQUEST_RESTOCK_RECORDS." r,".TABLE_PRODUCTS_REQUEST_RESTOCK_CUSTOMERS." c,".TABLE_PRODUCTS_DESCRIPTION." d WHERE r.request_status = 0 and d.products_id = r.product_id AND c.id = r.customer_id order by r.product_id asc";
$requests_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $requests_query_raw, $requests_query_numrows);
$requests_values = $db->Execute($requests_query_raw);
break;
case 3:
update_requests();
break;
case 4:
process_notices();
break;
case 5:
clean_up_requests();
break;
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
<script type="text/javascript">
<!--
function init()
{
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
}
// -->
</script>
</head>
<body onload="init()">
<div class="header_area">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
</div>
<!-- header_eof //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10');?></td>
</tr>
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
</tr>
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '100%', '15');?></td>
</tr>
</table>
<div id="actionSelector">
<?php echo zen_draw_form('request_restock', FILENAME_REQUEST_RESTOCK, '', 'GET'); ?>
<fieldset id="actionSelectorForm">
<label class="inputLabel" for="option" style="float:left; width: 7em;"><?php echo OPTION_NAME; ?></label>
<input type="hidden" name="action" value="send" />
<?php echo zen_draw_pull_down_menu('option', $options, $_GET['option']); ?>
</fieldset>
<div><input type="submit" value="Go!" /></div>
</form>
</div>
<?php if (isset($_GET['option']) and $_GET['option'] == 1){ ?>
<table border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<td colspan="2">
<span class="forward">
<?php
echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS);
echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'action')));
?>
</span>
</td>
</tr>
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_REQUEST_QUANTITY;?></td>
<!--<td class="dataTableHeadingContent"><?php //echo TABLE_HEADING_UPDATE_REQUEST;?></td>-->
</tr>
<?php
while (!$products_values->EOF) {
?>
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
<td class="dataTableContent">
<?php echo process_product_name($products_values->fields['products_name'],$products_values->fields['product_id']);?>
</td>
<td class="dataTableContent">
<?php echo $products_values->fields['request_quantity'];?>
</td>
<!--<td class="dataTableContent">
<?php //zen_draw_checkbox_field('selections[]', 1, 1); ?>
</td>-->
</tr>
<?php
$products_values->MoveNext();
}
?>
<tr>
<td colspan="2">
<span class="forward">
<?php
echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS);
echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'action')));
?>
</span>
</td>
</tr>
</table>
<?php } elseif(isset($_GET['option']) and $_GET['option'] == 2) { ?>
<table border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<td colspan="5">
<span class="forward">
<?php
echo $requests_split->display_count($requests_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_REQESTS);
echo $requests_split->display_links($requests_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'action')));
?>
</span>
</td>
</tr>
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_REQUEST_QUANTITY;?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMER_NAME;?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMER_EMAIL;?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_REQUEST_MESSAGE;?></td>
</tr>
<?php
while (!$requests_values->EOF) {
?>
<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
<td class="dataTableContent">
<?php echo process_product_name($requests_values->fields['products_name'],$requests_values->fields['product_id']);?>
</td>
<td class="dataTableContent">
<?php echo $requests_values->fields['request_quantity'];?>
</td>
<td class="dataTableContent">
<?php echo $requests_values->fields['name'];?>
</td>
<td class="dataTableContent">
<?php echo $requests_values->fields['email_address'];?>
</td>
<td class="dataTableContent">
<?php echo $requests_values->fields['request_message'];?>
</td>
</tr>
<?php
$requests_values->MoveNext();
}
?>
<tr>
<td colspan="5">
<span class="forward">
<?php
echo $requests_split->display_count($requests_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_REQESTS);
echo $requests_split->display_links($requests_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'action')));
?>
</span>
</td>
</tr>
</table>
<?php } ?>
<!-- body_eof //-->
<!-- footer //-->
<div class="footer-area">
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</div>
<!-- footer_eof //-->
<br />
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
this is the source of the page in admin section: