????

Your IP : 216.73.216.152


Current Path : /home2/morganrand/www/ecommerce/os/catalog/
Upload File :
Current File : /home2/morganrand/www/ecommerce/os/catalog/designs_history_14.php

<?php
/*
  $Id: designs_history.php,v 1.2 $
  $Id: account_history.php,v 1.2 2004/08/25 22:39:50 akhan Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 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_DESIGNS_HISTORY);

  $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_DESIGNS_HISTORY, '', 'SSL'));
//ag

  $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  if (tep_not_null($action)) {
    switch ($action) {
      case 'update_design':
        $dID = tep_db_prepare_input($HTTP_GET_VARS['design_id']);
        $design_updated = false;
        $check_status_query = tep_db_query("select designs_name, designs_description, designs_comment, designs_data, date_expires, designs_event_name, designs_event_date, designs_event_type from " . TABLE_DESIGNS . " where designs_id = '" . (int)$dID . "'");
        $check_status = tep_db_fetch_array($check_status_query);

        if (isset($HTTP_GET_VARS['data'])) {
          $d_data = tep_db_prepare_input($HTTP_GET_VARS['data']);
          if (($check_status['designs_data'] != $d_data)) {
            if (isset($HTTP_GET_VARS['name'])) {
              $d_name = tep_db_prepare_input($HTTP_GET_VARS['name']);
              tep_db_query("update " . TABLE_DESIGNS . " set designs_name = '" . tep_db_input($d_name) . "', designs_data = '" . tep_db_input($d_data) . "' where designs_id = '" . (int)$dID . "'");
            } else {
              tep_db_query("update " . TABLE_DESIGNS . " set designs_data = '" . tep_db_input($d_data) . "' where designs_id = '" . (int)$dID . "'");
              $keep_quiet = true;
            }
            $design_updated = true;
          }
        } else {
          $d_name = tep_db_prepare_input($HTTP_POST_VARS['design_name']);
          $d_event_name = tep_db_prepare_input($HTTP_POST_VARS['event_name']);
          $d_event_date = tep_db_prepare_input($HTTP_POST_VARS['event_date']);
          $d_event_type = tep_db_prepare_input($HTTP_POST_VARS['event_type']);
          $d_description = tep_db_prepare_input($HTTP_POST_VARS['description']);
          $d_comments = tep_db_prepare_input($HTTP_POST_VARS['comment']);

          if ( ($check_status['designs_name'] != $d_name) || ($check_status['designs_description'] != $d_description) || ($check_status['designs_comment'] != $comments) || ($check_status['event_name'] != $d_event_name) || ($check_status['event_date'] != $d_event_date) || ($check_status['event_type'] != $d_event_type)) {
            tep_db_query("update " . TABLE_DESIGNS . " set designs_name = '" . tep_db_input($d_name) . "', designs_description = '" . tep_db_input($d_description) . "', designs_comment = '" . tep_db_input($d_comments) . "', designs_event_name = '" . tep_db_input($d_event_name) . "', designs_event_date = '" . tep_db_input($d_event_date) . "', designs_event_type = '" . tep_db_input($d_event_type) . "' where designs_id = '" . (int)$dID . "'");
            $design_updated = true;
          }
        }



 
        if ($design_updated == true) {
          $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
        } else {
          $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
        }

        if ($keep_quiet == false) {
          tep_redirect(tep_href_link(FILENAME_DESIGNS_HISTORY_INFO, tep_get_all_get_params(array('action', 'data')), 'SSL'));
        }
        break;
      case 'new_design':
        $d_data = 'A102BUIVXXXXXXXX200SLXXXXMGCOMSXXXXXXGLSL';

        $design_updated = false;
        tep_db_query("insert into " . TABLE_DESIGNS . " (customers_id, date_created, designs_event_date, designs_data) values ('" . (int)$customer_id . "', now(), now(),'" . tep_db_input($d_data) . "')");
        $design_updated = true;

        if (design_updated == true) {
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
        } else {
          $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
        }

        tep_redirect(tep_href_link(FILENAME_DESIGNS_HISTORY, tep_get_all_get_params(array('dID', 'action'))));
        break;
    }
  }


?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head><script src="//cdn.optimizely.com/js/1865631164.js"></script>
<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="stylesheet.css">
</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="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_history.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td>
<?php
//  $orders_total = tep_count_customer_orders();
  $orders_total = tep_count_customer_designs();

  if ($orders_total > 0) {
//    $history_query_raw = "select o.orders_id, o.date_purchased, o.delivery_name, o.billing_name, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id DESC";
    $history_query_raw = "select d.designs_id, d.date_created, d.designs_name, d.designs_description, d.designs_event_name, d.designs_event_date from " . TABLE_DESIGNS . " d where d.customers_id = '" . (int)$customer_id . "' order by designs_id DESC";
    $history_split = new splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY);
    $history_query = tep_db_query($history_split->sql_query);

    while ($history = tep_db_fetch_array($history_query)) {
//      $products_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$history['orders_id'] . "'");
//      $products = tep_db_fetch_array($products_query);

//      if (tep_not_null($history['delivery_name'])) {
//        $order_type = TEXT_ORDER_SHIPPED_TO;
//        $order_name = $history['delivery_name'];
//      } else {
//        $order_type = TEXT_ORDER_BILLED_TO;
//        $order_name = $history['billing_name'];
//      }
?>
          <table border="0" width="100%" cellspacing="0" cellpadding="2">
            <tr>
              <td class="main" width="75%"><?php echo '<b>' . TEXT_DESIGN_NAME . '</b> ' . $history['designs_name']; ?></td>
              <td class="main" width="25%"><?php echo ' ' . TEXT_DESIGN_DATE . ' ' . tep_date_short($history['date_created']); ?></td>
            </tr>
          </table>
          <table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
            <tr class="infoBoxContents">
              <td><table border="0" width="100%" cellspacing="2" cellpadding="4">
                <tr>
                  <td class="main" width="40%" valign="top"><?php echo '<b>' . TEXT_EVENT_NAME . '</b> ' . $history['designs_event_name'] . '<br><b>' . TEXT_EVENT_DATE . '</b> ' . tep_date_long($history['designs_event_date']); ?></td>
                  <td class="main" width="40%" valign="top"><?php echo '<b>' . TEXT_DESIGN_DESCRIPTION . '</b> ' . $history['designs_description']; ?></td>
                  <td class="main" width="10%"><?php echo '<a href="' . tep_href_link(FILENAME_DESIGNS_HISTORY_INFO, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'design_id=' . $history['designs_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>
<?php
  if (tep_get_customer_plevel()  == 'A') {
?>
                  <td class="main" width="10%"><?php echo '<a href="' . tep_href_link(FILENAME_DESIGNS_HISTORY_INFO, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'design_id=' . $history['designs_id'], 'SSL') . '">' . tep_image_button('small_delete.gif', SMALL_IMAGE_BUTTON_DELETE) . '</a>'; ?></td>
<?php
  }
?>
                </tr>
              </table></td>
            </tr>
          </table>
          <table border="0" width="100%" cellspacing="0" cellpadding="2">
            <tr>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
          </table>
<?php
    }
  } else {
?>
          <table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
            <tr class="infoBoxContents">
              <td><table border="0" width="100%" cellspacing="2" cellpadding="4">
                <tr>
                  <td class="main"><?php echo TEXT_NO_DESIGNS; ?></td>
                </tr>
              </table></td>
            </tr>
          </table>
<?php
  }
?>
        </td>
      </tr>
<?php
  if ($orders_total > 0) {
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="smallText" valign="top"><?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
            <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $history_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <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><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
<?php
  if (tep_get_customer_plevel()  == 'A') {
?>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DESIGNS_HISTORY, 'action=new_design', 'SSL') . '">' . tep_image_button('button_new_design.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
<?php
  }
?>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
<!-- Hotjar Tracking Code for wanderfuls.com -->
<script>
    (function(h,o,t,j,a,r){
        h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
        h._hjSettings={hjid:78806,hjsv:5};
        a=o.getElementsByTagName('head')[0];
        r=o.createElement('script');r.async=1;
        r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
        a.appendChild(r);
    })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
</script></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>