[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> customers_groups.php (source)

   1  <?php
   2  /*

   3    $Id: catalog/admin/customers_groups.php v1.0 2005/02/22

   4    for Separate Pricing Per Customer

   5    

   6    adapted from the file of the same name from TotalB2B

   7    by hOZONE, hozone[at]tiscali.it, http://hozone.cjb.net

   8    

   9    who in turn credits:

  10    Discount_Groups_v1.1, by Enrico Drusiani, 2003/5/22

  11    setting of allowed payments inspired by b2bsuite_b097 but implemented differently

  12    

  13    osCMax Power E-Commerce

  14    http://oscdox.com

  15    

  16    Copyright 2006 osCMax2005 osCommerce

  17    

  18    Released under the GNU General Public License 

  19  */
  20  
  21    require ('includes/application_top.php');
  22    
  23      $cg_show_tax_array = array(array('id' => '1', 'text' => ENTRY_GROUP_SHOW_TAX_YES),
  24                                array('id' => '0', 'text' => ENTRY_GROUP_SHOW_TAX_NO));
  25      $cg_tax_exempt_array = array(array('id' => '1', 'text' => ENTRY_GROUP_TAX_EXEMPT_YES),
  26                                array('id' => '0', 'text' => ENTRY_GROUP_TAX_EXEMPT_NO));
  27    
  28    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  29  
  30    if (tep_not_null($action)) {
  31      switch ($action) {
  32  
  33        case 'update':
  34          $error = false;
  35          $customers_group_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
  36          $customers_group_name = tep_db_prepare_input($HTTP_POST_VARS['customers_group_name']);
  37          $customers_group_show_tax = tep_db_prepare_input($HTTP_POST_VARS['customers_group_show_tax']);
  38          $customers_group_tax_exempt = tep_db_prepare_input($HTTP_POST_VARS['customers_group_tax_exempt']);
  39          $group_payment_allowed = '';
  40          if ($HTTP_POST_VARS['payment_allowed'] && $HTTP_POST_VARS['group_payment_settings'] == '1') {
  41            while(list($key, $val) = each($HTTP_POST_VARS['payment_allowed'])) {
  42              if ($val == true) { 
  43              $group_payment_allowed .= tep_db_prepare_input($val).';'; 
  44              }
  45            } // end while

  46            $group_payment_allowed = substr($group_payment_allowed,0,strlen($group_payment_allowed)-1);
  47          } // end if ($HTTP_POST_VARS['payment_allowed'])

  48          $group_shipment_allowed = '';
  49          if ($HTTP_POST_VARS['shipping_allowed'] && $HTTP_POST_VARS['group_shipment_settings'] == '1') {
  50            while(list($key, $val) = each($HTTP_POST_VARS['shipping_allowed'])) {
  51              if ($val == true) { 
  52              $group_shipment_allowed .= tep_db_prepare_input($val).';'; 
  53              }
  54            } // end while

  55            $group_shipment_allowed = substr($group_shipment_allowed,0,strlen($group_shipment_allowed)-1);
  56          } // end if ($HTTP_POST_VARS['shipment_allowed'])

  57          tep_db_query("update " . TABLE_CUSTOMERS_GROUPS . " set customers_group_name='" . $customers_group_name . "', customers_group_show_tax = '" . $customers_group_show_tax . "', customers_group_tax_exempt = '" . $customers_group_tax_exempt . "', group_payment_allowed = '". $group_payment_allowed ."', group_shipment_allowed = '". $group_shipment_allowed ."' where customers_group_id = " . tep_db_input($customers_group_id) );
  58          tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_group_id));
  59          break;
  60          
  61        case 'deleteconfirm':
  62          $group_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
  63          tep_db_query("delete from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id= " . $group_id); 
  64          $customers_id_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_id=" . $group_id);
  65          while($customers_id = tep_db_fetch_array($customers_id_query)) {
  66              tep_db_query("UPDATE " . TABLE_CUSTOMERS . " set customers_group_id = '0' where customers_id=" . $customers_id['customers_id']);
  67          }     
  68          tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')))); 
  69          break;
  70          
  71        case 'newconfirm' :
  72          $customers_group_name = tep_db_prepare_input($HTTP_POST_VARS['customers_group_name']);
  73      $customers_group_tax_exempt = tep_db_prepare_input($HTTP_POST_VARS['customers_group_tax_exempt']);
  74      $group_payment_allowed = '';
  75      if ($HTTP_POST_VARS['payment_allowed']) {
  76            while(list($key, $val) = each($HTTP_POST_VARS['payment_allowed'])) {
  77               if ($val == true) { 
  78               $group_payment_allowed .= tep_db_prepare_input($val).';'; 
  79               }
  80            } // end while

  81         $group_payment_allowed = substr($group_payment_allowed,0,strlen($group_payment_allowed)-1);
  82      } // end if ($HTTP_POST_VARS['payment_allowed'])

  83          $group_shipment_allowed = '';
  84          if ($HTTP_POST_VARS['shipping_allowed'] && $HTTP_POST_VARS['group_shipment_settings'] == '1') {
  85            while(list($key, $val) = each($HTTP_POST_VARS['shipping_allowed'])) {
  86              if ($val == true) { 
  87              $group_shipment_allowed .= tep_db_prepare_input($val).';'; 
  88              }
  89            } // end while

  90            $group_shipment_allowed = substr($group_shipment_allowed,0,strlen($group_shipment_allowed)-1);
  91          } // end if ($HTTP_POST_VARS['shipment_allowed'])

  92          $last_id_query = tep_db_query("select MAX(customers_group_id) as last_cg_id from " . TABLE_CUSTOMERS_GROUPS . "");
  93          $last_cg_id_inserted = tep_db_fetch_array($last_id_query);
  94          $new_cg_id = $last_cg_id_inserted['last_cg_id'] +1;
  95          tep_db_query("insert into " . TABLE_CUSTOMERS_GROUPS . " set customers_group_id = " . $new_cg_id . ", customers_group_name = '" . $customers_group_name . "', customers_group_show_tax = '" . $customers_group_show_tax . "', customers_group_tax_exempt = '" . $customers_group_tax_exempt . "', group_payment_allowed = '". $group_payment_allowed ."', group_shipment_allowed = '". $group_shipment_allowed ."'");
  96          tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('action'))));
  97          break;
  98      }
  99    }
 100  ?>
 101  
 102  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 103  <html <?php echo HTML_PARAMS; ?>>
 104  <head>
 105  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 106  <title><?php echo TITLE; ?></title>
 107  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 108  <script language="javascript" src="includes/general.js"></script>
 109  </head>
 110  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
 111  <!-- header //-->
 112  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
 113  <!-- header_eof //-->
 114  
 115  <!-- body //-->
 116  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 117    <tr>
 118      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 119  <!-- left_navigation //-->
 120  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
 121  <!-- left_navigation_eof //-->
 122      </table></td>
 123  <!-- body_text //-->
 124      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 125  
 126  <?php
 127    if ($HTTP_GET_VARS['action'] == 'edit') {
 128      $customers_groups_query = tep_db_query("select c.customers_group_id, c.customers_group_name, c.customers_group_show_tax, c.customers_group_tax_exempt, c.group_payment_allowed, c.group_shipment_allowed from " . TABLE_CUSTOMERS_GROUPS . " c  where c.customers_group_id = '" . $HTTP_GET_VARS['cID'] . "'");
 129      $customers_groups = tep_db_fetch_array($customers_groups_query);
 130      $cInfo = new objectInfo($customers_groups);
 131     $payments_allowed = explode (";",$cInfo->group_payment_allowed);
 132     $shipment_allowed = explode (";",$cInfo->group_shipment_allowed);
 133     $module_directory = DIR_FS_CATALOG_MODULES . 'payment/';
 134     $ship_module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';
 135  
 136     $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
 137     $directory_array = array();
 138     if ($dir = @dir($module_directory)) {
 139      while ($file = $dir->read()) {
 140        if (!is_dir($module_directory . $file)) {
 141          if (substr($file, strrpos($file, '.')) == $file_extension) {
 142            $directory_array[] = $file; // array of all the payment modules present in includes/modules/payment

 143          }
 144        }
 145      }
 146      sort($directory_array);
 147      $dir->close();
 148    }
 149  
 150     $ship_directory_array = array();
 151     if ($dir = @dir($ship_module_directory)) {
 152      while ($file = $dir->read()) {
 153        if (!is_dir($ship_module_directory . $file)) {
 154          if (substr($file, strrpos($file, '.')) == $file_extension) {
 155            $ship_directory_array[] = $file; // array of all shipping modules present in includes/modules/shipping

 156          }
 157        }
 158      }
 159      sort($ship_directory_array);
 160      $dir->close();
 161    }
 162  ?>
 163  
 164  <script language="javascript"><!--
 165  function check_form() {
 166    var error = 0;
 167  
 168    var customers_group_name = document.customers.customers_group_name.value;
 169    
 170    if (customers_group_name == "") {
 171      error_message = "<?php echo ERROR_CUSTOMERS_GROUP_NAME; ?>";
 172      error = 1;
 173    }
 174  
 175    if (error == 1) {
 176      alert(error_message);
 177      return false;
 178    } else {
 179      return true;
 180    }
 181  }
 182  //--></script>

 183  
 184        <tr>
 185          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 186            <tr>
 187              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 188              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 189            </tr>
 190          </table></td>
 191        </tr>
 192        <tr>
 193          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 194        </tr>
 195  
 196        <tr><?php echo tep_draw_form('customers', 'customers_groups.php', tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"'); ?>
 197          <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
 198        </tr>
 199  
 200        <tr>
 201          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 202            <tr>
 203              <td class="main"><?php echo ENTRY_GROUPS_NAME; ?></td>
 204              <td class="main"><?php echo tep_draw_input_field('customers_group_name', $cInfo->customers_group_name, 'maxlength="32"', false); ?> &#160;&#160;Maximum length: 32 characters</td>
 205            </tr>
 206            <tr>
 207              <td class="main"><?php echo ENTRY_GROUP_SHOW_TAX; ?></td>
 208              <td class="main"><?php echo tep_draw_pull_down_menu('customers_group_show_tax', $cg_show_tax_array, (($cInfo->customers_group_show_tax == '1') ? '1' : '0')); ?> &#160;&#160;This Setting only works when 'Display Prices with Tax'</td>
 209            </tr>
 210            <tr>
 211              <td class="main">&#160;</td>
 212              <td class="main" style="line-height: 2">is set to true in the Configuration for your store and Tax Exempt (below) to 'No'. </td>
 213            </tr>
 214            <tr>
 215              <td class="main"><?php echo ENTRY_GROUP_TAX_EXEMPT; ?></td>
 216              <td class="main"><?php
 217              echo tep_draw_pull_down_menu('customers_group_tax_exempt', $cg_tax_exempt_array, (($cInfo->customers_group_tax_exempt == '1') ? '1' : '0')); ?></td>
 218            </tr>
 219      </table>
 220      </td>
 221        </tr>
 222        <tr>
 223          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 224        </tr>
 225        <tr>
 226          <td class="formAreaTitle"><?php include_once(DIR_WS_LANGUAGES . $language . '/modules.php');
 227      echo HEADING_TITLE_MODULES_PAYMENT; ?></td>
 228        </tr>
 229        <tr>
 230          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 231         <tr bgcolor="#DEE4E8">
 232              <td class="main"><?php echo tep_draw_radio_field('group_payment_settings', '1', false, (tep_not_null($cInfo->group_payment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_PAYMENT_SET . '&nbsp;&nbsp;' . tep_draw_radio_field('group_payment_settings', '0', false, (tep_not_null($cInfo->group_payment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_PAYMENT_DEFAULT ; ?></td>
 233            </tr>
 234  <?php
 235      $module_active = explode (";",MODULE_PAYMENT_INSTALLED);
 236      $installed_modules = array();
 237      for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
 238      $file = $directory_array[$i];
 239      if (in_array ($directory_array[$i], $module_active)) {
 240        include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/payment/' . $file);
 241        include($module_directory . $file);
 242  
 243       $class = substr($file, 0, strrpos($file, '.'));
 244       if (tep_class_exists($class)) {
 245         $module = new $class;
 246         if ($module->check() > 0) {
 247           $installed_modules[] = $file;
 248         }
 249       } // end if (tep_class_exists($class))

 250  ?>
 251         <tr>
 252              <td class="main"><?php echo tep_draw_checkbox_field('payment_allowed[' . $i . ']', $module->code.".php" , (in_array ($module->code.".php", $payments_allowed)) ?  1 : 0); ?>&#160;&#160;<?php echo $module->title; ?></td>
 253             </tr>
 254  <?php
 255    } // end if (in_array ($directory_array[$i], $module_active)) 

 256   } // end for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++)

 257  ?>
 258         <tr>
 259             <td class="main" style="padding-left: 30px; padding-right: 10px; padding-top: 10px;"><?php echo ENTRY_PAYMENT_SET_EXPLAIN ?></td>
 260             </tr>
 261          </table></td>
 262        </tr>
 263        <tr>
 264          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 265        </tr>
 266        <tr>
 267          <td class="formAreaTitle"><?php echo HEADING_TITLE_MODULES_SHIPPING; ?></td>
 268        </tr>
 269        <tr>
 270          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 271         <tr bgcolor="#DEE4E8">
 272              <td class="main"><?php echo tep_draw_radio_field('group_shipment_settings', '1', false, (tep_not_null($cInfo->group_shipment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_SHIPPING_SET . '&nbsp;&nbsp;' . tep_draw_radio_field('group_shipment_settings', '0', false, (tep_not_null($cInfo->group_shipment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_SHIPPING_DEFAULT ; ?></td>
 273            </tr>
 274  <?php
 275      $ship_module_active = explode (";",MODULE_SHIPPING_INSTALLED);
 276      $installed_shipping_modules = array();
 277      for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++) {
 278      $file = $ship_directory_array[$i];
 279      if (in_array ($ship_directory_array[$i], $ship_module_active)) {
 280        include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
 281        include($ship_module_directory . $file);
 282  
 283       $ship_class = substr($file, 0, strrpos($file, '.'));
 284       if (tep_class_exists($ship_class)) {
 285         $ship_module = new $ship_class;
 286         if ($ship_module->check() > 0) {
 287           $installed_shipping_modules[] = $file;
 288         }
 289       } // end if (tep_class_exists($ship_class))

 290  ?>
 291         <tr>
 292              <td class="main"><?php echo tep_draw_checkbox_field('shipping_allowed[' . $i . ']', $ship_module->code.".php" , (in_array ($ship_module->code.".php", $shipment_allowed)) ?  1 : 0); ?>&#160;&#160;<?php echo $ship_module->title; ?></td>
 293             </tr>
 294  <?php
 295    } // end if (in_array ($ship_directory_array[$i], $ship_module_active)) 

 296   } // end for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++)

 297  ?>
 298         <tr>
 299              <td class="main" style="padding-left: 30px; padding-right: 10px; padding-top: 10px;"><?php echo ENTRY_SHIPPING_SET_EXPLAIN ?></td>
 300             </tr>
 301          </table>
 302         </td>
 303        </tr>
 304        <tr>
 305          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 306        </tr>
 307        <tr>
 308          <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('action','cID'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
 309        </tr>
 310        </form>
 311  
 312        <tr>
 313          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '70'); ?></td>
 314        </tr>
 315  
 316  <?php
 317    } else if($HTTP_GET_VARS['action'] == 'newdiscount') {
 318  ?>
 319        <tr>
 320          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 321            <tr>
 322              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 323              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 324            </tr>
 325          </table></td>
 326        </tr>
 327        <tr>
 328          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 329        </tr>
 330        
 331  <?php
 332    } else if($HTTP_GET_VARS['action'] == 'new') {
 333       
 334  ?>
 335  <script language="javascript"><!--
 336  function check_form() {
 337    var error = 0;
 338  
 339    var customers_group_name = document.customers.customers_group_name.value;
 340    
 341    if (customers_group_name == "") {
 342      error_message = "<?php echo ERROR_CUSTOMERS_GROUP_NAME; ?>";
 343      error = 1;
 344    }
 345  
 346    if (error == 1) {
 347      alert(error_message);
 348      return false;
 349    } else {
 350      return true;
 351    }
 352  }
 353  //--></script>

 354  
 355        <tr>
 356          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 357            <tr>
 358              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 359              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 360            </tr>
 361          </table></td>
 362        </tr>
 363        <tr>
 364          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 365        </tr>
 366        <tr><?php echo tep_draw_form('customers', 'customers_groups.php', tep_get_all_get_params(array('action')) . 'action=newconfirm', 'post', 'onSubmit="return check_form();"'); ?>
 367          <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
 368        </tr>
 369        <tr>
 370          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 371            <tr>
 372              <td class="main"><?php echo ENTRY_GROUPS_NAME; ?></td>
 373              <td class="main"><?php echo tep_draw_input_field('customers_group_name', '', 'maxlength="32"', false); ?></td>
 374            </tr>
 375            <tr>
 376              <td class="main"><?php echo ENTRY_GROUP_SHOW_TAX; ?></td>
 377              <td class="main"><?php
 378              echo tep_draw_pull_down_menu('customers_group_show_tax', $cg_show_tax_array, '1'); ?>  This Setting only works when 'Display Prices with Tax'</td>
 379            </tr>
 380            <tr>
 381              <td class="main">&#160;</td>
 382              <td class="main" style="line-height: 2"> is set to true in the Configuration for your store and Tax Exempt (below) to 'No'.</td>
 383            </tr>
 384            <tr>
 385              <td class="main"><?php echo ENTRY_GROUP_TAX_EXEMPT; ?></td>
 386              <td class="main"><?php
 387              echo tep_draw_pull_down_menu('customers_group_tax_exempt', $cg_tax_exempt_array, '0'); ?></td>
 388            </tr>
 389       </table>
 390      </td>
 391        </tr>
 392        <tr>
 393          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 394        </tr>
 395        <tr>
 396          <td class="formAreaTitle"><?php include_once(DIR_WS_LANGUAGES . $language . '/modules.php');
 397      echo HEADING_TITLE_MODULES_PAYMENT; ?></td>
 398        </tr>
 399        <tr>
 400          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 401         <tr bgcolor="#DEE4E8">
 402              <td class="main"><?php echo tep_draw_radio_field('group_payment_settings', '1', false, '0') . '&nbsp;&nbsp;' . ENTRY_GROUP_PAYMENT_SET . '&nbsp;&nbsp;' . tep_draw_radio_field('group_payment_settings', '0', false, '0') . '&nbsp;&nbsp;' . ENTRY_GROUP_PAYMENT_DEFAULT ; ?></td>
 403            </tr>
 404  <?php
 405    $module_active = explode (";",MODULE_PAYMENT_INSTALLED);
 406    $ship_module_active = explode (";",MODULE_SHIPPING_INSTALLED);
 407    $module_directory = DIR_FS_CATALOG_MODULES . 'payment/';
 408    $ship_module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';
 409  
 410  // code slightly adapted from admin/modules.php

 411    $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
 412    $directory_array = array();
 413    if ($dir = @dir($module_directory)) {
 414      while ($file = $dir->read()) {
 415        if (!is_dir($module_directory . $file)) {
 416          if (substr($file, strrpos($file, '.')) == $file_extension) {
 417            $directory_array[] = $file; // array of all the payment modules present in includes/modules/payment

 418          }
 419        }
 420      }
 421      $dir->close();
 422    } // end if ($dir = @dir($module_directory))

 423  
 424     $ship_directory_array = array();
 425     if ($dir = @dir($ship_module_directory)) {
 426      while ($file = $dir->read()) {
 427        if (!is_dir($ship_module_directory . $file)) {
 428          if (substr($file, strrpos($file, '.')) == $file_extension) {
 429            $ship_directory_array[] = $file; // array of all shipping modules present in includes/modules/shipping

 430          }
 431        }
 432      }
 433      sort($ship_directory_array);
 434      $dir->close();
 435    }
 436      $installed_modules = array();
 437      for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
 438      $file = $directory_array[$i];
 439      if (in_array ($directory_array[$i], $module_active)) {
 440        include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/payment/' . $file);
 441        include($module_directory . $file);
 442  
 443       $class = substr($file, 0, strrpos($file, '.'));
 444       if (tep_class_exists($class)) {
 445         $module = new $class;
 446         if ($module->check() > 0) {
 447           $installed_modules[] = array('file_name' => $file, 'title' => $module->title);
 448         }
 449       } // end if (tep_class_exists($class))

 450     } // end if (in_array ($directory_array[$i], $module_active)) 

 451   } // end for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++)

 452  
 453    for ($y = 0; $y < sizeof($installed_modules) ; $y++) {
 454  ?>
 455              <tr>
 456              <td class="main"><?php echo tep_draw_checkbox_field('payment_allowed[' . $y . ']', $installed_modules[$y]['file_name'] , 0); ?>&#160;&#160;<?php echo $installed_modules[$y]['title']; ?></td>
 457            </tr>
 458  <?php
 459   } // end for ($y = 0; $y < sizeof($installed_modules) ; $y++)

 460  ?>
 461              <tr>
 462              <td class="main" style="padding-left: 30px; padding-right: 10px; padding-top: 10px;"><?php echo ENTRY_PAYMENT_SET_EXPLAIN ?></td>
 463            </tr>
 464          </table></td>
 465        <tr>
 466          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 467        </tr>
 468        <tr>
 469          <td class="formAreaTitle"><?php echo HEADING_TITLE_MODULES_SHIPPING; ?></td>
 470        </tr>
 471        <tr>
 472          <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
 473         <tr bgcolor="#DEE4E8">
 474              <td class="main"><?php echo tep_draw_radio_field('group_shipment_settings', '1', false, (tep_not_null($cInfo->group_shipment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_SHIPPING_SET . '&nbsp;&nbsp;' . tep_draw_radio_field('group_shipment_settings', '0', false, (tep_not_null($cInfo->group_shipment_allowed)? '1' : '0' )) . '&nbsp;&nbsp;' . ENTRY_GROUP_SHIPPING_DEFAULT ; ?></td>
 475            </tr>
 476  <?php
 477      $ship_module_active = explode (";",MODULE_SHIPPING_INSTALLED);
 478      $installed_shipping_modules = array();
 479      for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++) {
 480      $file = $ship_directory_array[$i];
 481      if (in_array ($ship_directory_array[$i], $ship_module_active)) {
 482        include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $file);
 483        include($ship_module_directory . $file);
 484  
 485       $ship_class = substr($file, 0, strrpos($file, '.'));
 486       if (tep_class_exists($ship_class)) {
 487         $ship_module = new $ship_class;
 488         if ($ship_module->check() > 0) {
 489           $installed_shipping_modules[] = array('file_name' => $file, 'title' => $ship_module->title);
 490         }
 491       } // end if (tep_class_exists($ship_class))

 492     } // end if (in_array ($ship_directory_array[$i], $ship_module_active))

 493   } // end for ($i = 0, $n = sizeof($ship_directory_array); $i < $n; $i++)

 494  
 495   for ($y = 0; $y < sizeof($installed_shipping_modules) ; $y++) {
 496  ?>
 497         <tr>
 498              <td class="main"><?php echo tep_draw_checkbox_field('shipping_allowed[' . $y . ']', $installed_shipping_modules[$y]['file_name'] , 0); ?>&#160;&#160;<?php echo $installed_shipping_modules[$y]['title']; ?></td>
 499             </tr>
 500  <?php
 501    } // end for ($y = 0; $y < sizeof($installed_modules) ; $y++) 

 502  ?>
 503         <tr>
 504              <td class="main" style="padding-left: 30px; padding-right: 10px; padding-top: 10px;"><?php echo ENTRY_SHIPPING_SET_EXPLAIN ?></td>
 505             </tr>
 506          </table>
 507         </td>
 508        </tr>
 509        </tr>
 510        <tr>
 511          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 512        </tr>
 513        <tr>
 514          <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('action','cID'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
 515        </tr>
 516        </form>
 517  <?php 
 518    } else {
 519  ?>
 520        <tr>
 521          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 522            <tr><?php echo tep_draw_form('search', 'customers_groups.php', '', 'get'); ?>
 523              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 524              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
 525              <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
 526            </form></tr>
 527          </table></td>
 528        </tr>
 529        <tr>
 530  
 531            <?php
 532            switch ($listing) {
 533                case "group":
 534                $order = "g.customers_group_name";
 535                break;
 536                case "group-desc":
 537                $order = "g.customers_group_name DESC";
 538                break;
 539                default:
 540                $order = "g.customers_group_id ASC";
 541            }
 542            ?>
 543          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 544            <tr>
 545              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 546                 <tr class="dataTableHeadingRow">
 547             <td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=group"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_NAME . ' --> A-B-C From Top '); ?></a>&nbsp;<a href="<?php echo "$PHP_SELF?listing=group-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_NAME . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_NAME; ?></td>
 548                     <td class="dataTableHeadingContent" align="right" valign="bottom"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 549                 </tr>
 550  
 551  <?php
 552      $search = '';
 553      if ( ($HTTP_GET_VARS['search']) && (tep_not_null($HTTP_GET_VARS['search'])) ) {
 554        $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search']));
 555        $search = "where g.customers_group_name like '%" . $keywords . "%'";
 556      }
 557  
 558      $customers_groups_query_raw = "select g.customers_group_id, g.customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " g  " . $search . " order by $order";
 559      $customers_groups_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_groups_query_raw, $customers_groups_query_numrows);
 560      $customers_groups_query = tep_db_query($customers_groups_query_raw);
 561  
 562      while ($customers_groups = tep_db_fetch_array($customers_groups_query)) {
 563        $info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers_groups['customers_group_id'] . "'");
 564        $info = tep_db_fetch_array($info_query);
 565  
 566        if ((!isset($HTTP_GET_VARS['cID']) || (@$HTTP_GET_VARS['cID'] == $customers_groups['customers_group_id'])) && (!$cInfo)) {
 567          $cInfo = new objectInfo($customers_groups);
 568        }
 569  
 570        if ( (is_object($cInfo)) && ($customers_groups['customers_group_id'] == $cInfo->customers_group_id) ) {
 571          echo '          <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_group_id . '&action=edit') . '\'">' . "\n";
 572        } else {
 573          echo '          <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID')) . 'cID=' . $customers_groups['customers_group_id']) . '\'">' . "\n";
 574        }
 575  ?>
 576                  <td class="dataTableContent"><?php echo $customers_groups['customers_group_name']; ?></td>
 577                  <td class="dataTableContent" align="right"><?php if ( (is_object($cInfo)) && ($customers_groups['customers_group_id'] == $cInfo->customers_group_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID')) . 'cID=' . $customers_groups['customers_group_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 578                </tr>
 579  <?php
 580      }
 581  ?>
 582                <tr>
 583                  <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 584                    <tr>
 585                      <td class="smallText" valign="top"><?php echo $customers_groups_split->display_count($customers_groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS_GROUPS); ?></td>
 586                      <td class="smallText" align="right"><?php echo $customers_groups_split->display_links($customers_groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
 587                    </tr>
 588  <?php
 589      if (tep_not_null($HTTP_GET_VARS['search'])) {
 590  ?>
 591                    <tr>
 592                      <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link('customers_groups.php') . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
 593                    </tr>
 594  <?php
 595      } else {
 596  ?>
 597                    <tr>
 598                      <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . tep_href_link('customers_groups.php', 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
 599                    </tr>
 600  <?php
 601      }
 602  ?>
 603                  </table></td>
 604                </tr>
 605              </table></td>
 606  <?php
 607    $heading = array();
 608    $contents = array();
 609    switch ($HTTP_GET_VARS['action']) {
 610      case 'confirm':
 611          if ($HTTP_GET_VARS['cID'] != '0') {
 612              $heading[] = array('text' => ''. tep_draw_separator('pixel_trans.gif', '11', '12') .'&nbsp;<br><b>' . TEXT_INFO_HEADING_DELETE_GROUP . '</b>');
 613              $contents = array('form' => tep_draw_form('customers_groups', 'customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_group_id . '&action=deleteconfirm'));
 614              $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_group_name . ' </b>');
 615              if ($cInfo->number_of_reviews > 0) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews));
 616              $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_group_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 617          } else {
 618              $heading[] = array('text' => ''. tep_draw_separator('pixel_trans.gif', '11', '12') .'&nbsp;<br><b>' . TEXT_INFO_HEADING_DELETE_GROUP . '</b>');
 619              $contents[] = array('text' => 'You are not allowed to delete this group:<br><br><b>' . $cInfo->customers_group_name . ' </b>');
 620          }
 621        break;
 622      default:
 623        if (is_object($cInfo)) {
 624          $heading[] = array('text' => ''. tep_draw_separator('pixel_trans.gif', '11', '12') .'&nbsp;<br><b>' . $cInfo->customers_group_name . '</b>');
 625          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_group_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_group_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 626  
 627        }
 628        break;
 629    }
 630  
 631    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 632      echo '            <td width="25%" valign="top">' . "\n";
 633  
 634      $box = new box;
 635      echo $box->infoBox($heading, $contents);
 636  
 637      echo '            </td>' . "\n";
 638    }
 639  ?>
 640            </tr>
 641          </table></td>
 642        </tr>
 643  <?php
 644    }
 645  ?>
 646      </table></td>
 647  <!-- body_text_eof //-->
 648    </tr>
 649  </table>
 650  <!-- body_eof //-->
 651  
 652  <!-- footer //-->
 653  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 654  <!-- footer_eof //-->
 655  <br>
 656  </body>
 657  </html>
 658  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


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