[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 group_pricing.php

Zen Cart 源代码 group_pricing.php




下载文件

文件名: group_pricing.php
文件类型: PHP文件
文件大小: 14.5 KiB
MD5: 1e2254c19968af596c6addaee0f8c841

group_pricing.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: group_pricing.php 19330 2011-08-07 06:32:56Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  13.  
  14.   if (zen_not_null($action)) {
  15.     switch ($action) {
  16.       case 'insert':
  17.       case 'save':
  18.         if (isset($_GET['gID'])) $group_id = zen_db_prepare_input($_GET['gID']);
  19.         $group_name = zen_db_prepare_input($_POST['group_name']);
  20.         $group_percentage = zen_db_prepare_input((float)$_POST['group_percentage']);
  21.         if ($group_name) {
  22.           $sql_data_array = array('group_name' => $group_name,
  23.                                   'group_percentage' => $group_percentage);
  24.           if ($action == 'insert') {
  25.             $insert_sql_data = array('date_added' => 'now()');
  26.             $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  27.             zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array);
  28.             $group_id = $db->insert_ID();
  29.           } elseif ($action == 'save') {
  30.             $update_sql_data = array('last_modified' => 'now()');
  31.             $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  32.             zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array, 'update', "group_id = '" . (int)$group_id . "'");
  33.           }
  34.         }
  35.         zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'gID=' . $group_id));
  36.       break;
  37.       case 'deleteconfirm':
  38.         if (zen_admin_demo()) {
  39.           $_GET['action']= '';
  40.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  41.           zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page']));
  42.         }
  43.  
  44.         $delete_cust_confirmed = (isset($_POST['delete_customers']) && $_POST['delete_customers'] =='on') ? true : false ;
  45.  
  46.         $group_id = zen_db_prepare_input($_POST['gID']);
  47.         $customers_query = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int)$group_id . "'");
  48.  
  49.         if ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == true) {
  50.           $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'");
  51.           $db->Execute("update " . TABLE_CUSTOMERS ." set customers_group_pricing=0 where customers_group_pricing = '" . (int)$group_id . "'");
  52.         } elseif ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == false) {
  53.           $messageStack->add_session(ERROR_GROUP_PRICING_CUSTOMERS_EXIST,'error');
  54.         } elseif($customers_query->RecordCount() == 0) {
  55.           $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'");
  56.         }
  57.         zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page']));
  58.       break;
  59.     }
  60.   }
  61.  
  62.   $query = $db->Execute("select count(*) as count from " . TABLE_GROUP_PRICING );
  63.   if ($query->fields['count'] > 0 && (!defined('MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS') || MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS !='true')) {
  64.     $messageStack->add(ERROR_MODULE_NOT_CONFIGURED,'error');
  65.   }
  66.  
  67. ?>
  68. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  69. <html <?php echo HTML_PARAMS; ?>>
  70. <head>
  71. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  72. <title><?php echo TITLE; ?></title>
  73. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  74. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  75. <script language="javascript" src="includes/menu.js"></script>
  76. <script language="javascript" src="includes/general.js"></script>
  77. <script type="text/javascript">
  78.   <!--
  79.   function init()
  80.   {
  81.     cssjsmenu('navbar');
  82.     if (document.getElementById)
  83.     {
  84.       var kill = document.getElementById('hoverJS');
  85.       kill.disabled = true;
  86.     }
  87.   }
  88.   // -->
  89. </script>
  90. </head>
  91. <body onload="init()">
  92. <!-- header //-->
  93. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  94. <!-- header_eof //-->
  95.  
  96. <!-- body //-->
  97. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  98.   <tr>
  99. <!-- body_text //-->
  100.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  101.       <tr>
  102.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  103.           <tr>
  104.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  105.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  106.           </tr>
  107.         </table></td>
  108.       </tr>
  109.       <tr>
  110.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  111.           <tr>
  112.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  113.               <tr class="dataTableHeadingRow">
  114.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_ID; ?></td>
  115.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_NAME; ?></td>
  116.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_AMOUNT; ?>&nbsp;</td>
  117.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  118.               </tr>
  119. <?php
  120.   $groups_query_raw = "select * from " . TABLE_GROUP_PRICING;
  121.  
  122. // Split Page
  123. // reset page when page is unknown
  124. if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['gID'] != '') {
  125.   $check_page = $db->Execute($groups_query_raw);
  126.   $check_count=1;
  127.   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
  128.     while (!$check_page->EOF) {
  129.       if ($check_page->fields['group_id'] == $_GET['gID']) {
  130.         break;
  131.       }
  132.       $check_count++;
  133.       $check_page->MoveNext();
  134.     }
  135.     $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
  136. //    zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $_GET['cID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'NONSSL'));
  137.   } else {
  138.     $_GET['page'] = 1;
  139.   }
  140. }
  141.  
  142.   $groups_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $groups_query_raw, $groups_query_numrows);
  143.   $groups = $db->Execute($groups_query_raw);
  144.   while (!$groups->EOF) {
  145.     if ((!isset($_GET['gID']) || (isset($_GET['gID']) && ($_GET['gID'] == $groups->fields['group_id']))) && !isset($gInfo) && (substr($action, 0, 3) != 'new')) {
  146.       $group_customers = $db->Execute("select count(*) as customer_count from " . TABLE_CUSTOMERS .
  147.                                        " where customers_group_pricing = '" . (int)$groups->fields['group_id'] . "'");
  148.       $gInfo_array = array_merge($groups->fields, $group_customers->fields);
  149.       $gInfo = new objectInfo($gInfo_array);
  150.     }
  151.  
  152.     if (isset($gInfo) && is_object($gInfo) && ($groups->fields['group_id'] == $gInfo->group_id)) {
  153.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '\'">' . "\n";
  154.     } else {
  155.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '\'">' . "\n";
  156.     }
  157. ?>
  158.                 <td class="dataTableContent"><?php echo $groups->fields['group_id']; ?></td>
  159.                 <td class="dataTableContent"><?php echo $groups->fields['group_name']; ?></td>
  160.                 <td class="dataTableContent"><?php echo $groups->fields['group_percentage']; ?></td>
  161.                 <td class="dataTableContent" align="right">
  162.                   <?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
  163.                   <?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
  164.                   <?php if (isset($gInfo) && is_object($gInfo) && ($groups->fields['group_id'] == $gInfo->group_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, zen_get_all_get_params(array('gID')) . 'gID=' . $groups->fields['group_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  165.                 </td>
  166.               </tr>
  167. <?php
  168.     $groups->MoveNext();
  169.   }
  170. ?>
  171.               <tr>
  172.                 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  173.                   <tr>
  174.                     <td class="smallText" valign="top"><?php echo $groups_split->display_count($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRICING_GROUPS); ?></td>
  175.                     <td class="smallText" align="right"><?php echo $groups_split->display_links($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  176.                   </tr>
  177.                 </table></td>
  178.               </tr>
  179. <?php
  180.   if (empty($action)) {
  181. ?>
  182.               <tr>
  183.                 <td align="right" colspan="4" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  184.               </tr>
  185. <?php
  186.   }
  187. ?>
  188.             </table></td>
  189. <?php
  190.   $heading = array();
  191.   $contents = array();
  192.  
  193.   switch ($action) {
  194.     case 'new':
  195.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_PRICING_GROUP . '</b>');
  196.  
  197.       $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'action=insert', 'post'));
  198.       $contents[] = array('text' => TEXT_NEW_INTRO);
  199.       $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_NAME . '<br>' . zen_draw_input_field('group_name', '', zen_set_field_length(TABLE_GROUP_PRICING, 'group_name')));
  200.       $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_AMOUNT . '<br>' . zen_draw_input_field('group_percentage', ''));
  201.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $_GET['gID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  202.       break;
  203.     case 'edit':
  204.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_PRICING_GROUP . '</b>');
  205.  
  206.       $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=save', 'post'));
  207.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  208.       $contents[] = array('text' => '<br />' . TEXT_GROUP_PRICING_NAME . '<br>' . zen_draw_input_field('group_name', htmlspecialchars($gInfo->group_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_GROUP_PRICING, 'group_name')));
  209.       $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_AMOUNT . '<br>' . zen_draw_input_field('group_percentage', $gInfo->group_percentage));
  210.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  211.       break;
  212.     case 'delete':
  213.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_PRICING_GROUP . '</b>');
  214.  
  215.       $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('gID', $gInfo->group_id));
  216.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  217.       $contents[] = array('text' => '<br><b>' . $gInfo->group_name . '</b>');
  218.  
  219.       if ($gInfo->customer_count > 0) {
  220.         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_customers') . ' ' . TEXT_DELETE_PRICING_GROUP);
  221.         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_GROUP_MEMBERS, $gInfo->customer_count));
  222.       }
  223.  
  224.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  225.       break;
  226.     default:
  227.       if (isset($gInfo) && is_object($gInfo)) {
  228.         $heading[] = array('text' => '<b>' . $gInfo->group_name . '</b>');
  229.  
  230.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  231.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($gInfo->date_added));
  232.         if (zen_not_null($gInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($gInfo->last_modified));
  233.         $contents[] = array('text' => '<br>' . TEXT_CUSTOMERS . ' ' . $gInfo->customer_count);
  234.       }
  235.       break;
  236.   }
  237.  
  238.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  239.     echo '            <td width="25%" valign="top">' . "\n";
  240.  
  241.     $box = new box;
  242.     echo $box->infoBox($heading, $contents);
  243.  
  244.     echo '            </td>' . "\n";
  245.   }
  246. ?>
  247.           </tr>
  248.         </table></td>
  249.       </tr>
  250.     </table></td>
  251. <!-- body_text_eof //-->
  252.   </tr>
  253. </table>
  254. <!-- body_eof //-->
  255.  
  256. <!-- footer //-->
  257. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  258. <!-- footer_eof //-->
  259. <br>
  260. </body>
  261. </html>
  262. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  263.  


cron