[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> tax_classes.php (source)

   1  <?php
   2  /*

   3  $Id: tax_classes.php 3 2006-05-27 04:59: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    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16  
  17    if (tep_not_null($action)) {
  18      switch ($action) {
  19        case 'insert':
  20          $tax_class_title = tep_db_prepare_input($HTTP_POST_VARS['tax_class_title']);
  21          $tax_class_description = tep_db_prepare_input($HTTP_POST_VARS['tax_class_description']);
  22  
  23          tep_db_query("insert into " . TABLE_TAX_CLASS . " (tax_class_title, tax_class_description, date_added) values ('" . tep_db_input($tax_class_title) . "', '" . tep_db_input($tax_class_description) . "', now())");
  24  
  25          tep_redirect(tep_href_link(FILENAME_TAX_CLASSES));
  26          break;
  27        case 'save':
  28          $tax_class_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
  29          $tax_class_title = tep_db_prepare_input($HTTP_POST_VARS['tax_class_title']);
  30          $tax_class_description = tep_db_prepare_input($HTTP_POST_VARS['tax_class_description']);
  31  
  32          tep_db_query("update " . TABLE_TAX_CLASS . " set tax_class_id = '" . (int)$tax_class_id . "', tax_class_title = '" . tep_db_input($tax_class_title) . "', tax_class_description = '" . tep_db_input($tax_class_description) . "', last_modified = now() where tax_class_id = '" . (int)$tax_class_id . "'");
  33  
  34          tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tax_class_id));
  35          break;
  36        case 'deleteconfirm':
  37          $tax_class_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
  38  
  39          tep_db_query("delete from " . TABLE_TAX_CLASS . " where tax_class_id = '" . (int)$tax_class_id . "'");
  40  
  41          tep_redirect(tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page']));
  42          break;
  43      }
  44    }
  45  ?>
  46  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  47  <html <?php echo HTML_PARAMS; ?>>
  48  <head>
  49  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  50  <title><?php echo TITLE; ?></title>
  51  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  52  <script language="javascript" src="includes/general.js"></script>
  53  </head>
  54  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
  55  <!-- header //-->
  56  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  57  <!-- header_eof //-->
  58  
  59  <!-- body //-->
  60  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  61    <tr>
  62      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  63  <!-- left_navigation //-->
  64  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  65  <!-- left_navigation_eof //-->
  66      </table></td>
  67  <!-- body_text //-->
  68      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  69        <tr>
  70          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  71            <tr>
  72              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  73              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  74            </tr>
  75          </table></td>
  76        </tr>
  77        <tr>
  78          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  79            <tr>
  80              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  81                <tr class="dataTableHeadingRow">
  82                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASSES; ?></td>
  83                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  84                </tr>
  85  <?php
  86    $classes_query_raw = "select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from " . TABLE_TAX_CLASS . " order by tax_class_title";
  87    $classes_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows);
  88    $classes_query = tep_db_query($classes_query_raw);
  89    while ($classes = tep_db_fetch_array($classes_query)) {
  90      if ((!isset($HTTP_GET_VARS['tID']) || (isset($HTTP_GET_VARS['tID']) && ($HTTP_GET_VARS['tID'] == $classes['tax_class_id']))) && !isset($tcInfo) && (substr($action, 0, 3) != 'new')) {
  91        $tcInfo = new objectInfo($classes);
  92      }
  93  
  94      if (isset($tcInfo) && is_object($tcInfo) && ($classes['tax_class_id'] == $tcInfo->tax_class_id)) {
  95        echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '\'">' . "\n";
  96      } else {
  97        echo'              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $classes['tax_class_id']) . '\'">' . "\n";
  98      }
  99  ?>
 100                  <td class="dataTableContent"><?php echo $classes['tax_class_title']; ?></td>
 101                  <td class="dataTableContent" align="right"><?php if (isset($tcInfo) && is_object($tcInfo) && ($classes['tax_class_id'] == $tcInfo->tax_class_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $classes['tax_class_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 102                </tr>
 103  <?php
 104    }
 105  ?>
 106                <tr>
 107                  <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 108                    <tr>
 109                      <td class="smallText" valign="top"><?php echo $classes_split->display_count($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td>
 110                      <td class="smallText" align="right"><?php echo $classes_split->display_links($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
 111                    </tr>
 112  <?php
 113    if (empty($action)) {
 114  ?>
 115                    <tr>
 116                      <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_tax_class.gif', IMAGE_NEW_TAX_CLASS) . '</a>'; ?></td>
 117                    </tr>
 118  <?php
 119    }
 120  ?>
 121                  </table></td>
 122                </tr>
 123              </table></td>
 124  <?php
 125    $heading = array();
 126    $contents = array();
 127  
 128    switch ($action) {
 129      case 'new':
 130        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_CLASS . '</b>');
 131  
 132        $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert'));
 133        $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
 134        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_draw_input_field('tax_class_title'));
 135        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . tep_draw_input_field('tax_class_description'));
 136        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 137        break;
 138      case 'edit':
 139        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_CLASS . '</b>');
 140  
 141        $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=save'));
 142        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
 143        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_draw_input_field('tax_class_title', $tcInfo->tax_class_title));
 144        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . tep_draw_input_field('tax_class_description', $tcInfo->tax_class_description));
 145        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 146        break;
 147      case 'delete':
 148        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_CLASS . '</b>');
 149  
 150        $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=deleteconfirm'));
 151        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
 152        $contents[] = array('text' => '<br><b>' . $tcInfo->tax_class_title . '</b>');
 153        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 154        break;
 155      default:
 156        if (isset($tcInfo) && is_object($tcInfo)) {
 157          $heading[] = array('text' => '<b>' . $tcInfo->tax_class_title . '</b>');
 158  
 159          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 160          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($tcInfo->date_added));
 161          $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($tcInfo->last_modified));
 162          $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . $tcInfo->tax_class_description);
 163        }
 164        break;
 165    }
 166    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 167      echo '            <td width="25%" valign="top">' . "\n";
 168  
 169      $box = new box;
 170      echo $box->infoBox($heading, $contents);
 171  
 172      echo '            </td>' . "\n";
 173    }
 174  ?>
 175            </tr>
 176          </table></td>
 177        </tr>
 178      </table></td>
 179  <!-- body_text_eof //-->
 180    </tr>
 181  </table>
 182  <!-- body_eof //-->
 183  
 184  <!-- footer //-->
 185  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 186  <!-- footer_eof //-->
 187  <br>
 188  </body>
 189  </html>
 190  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


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