[ PHPXref.com ] [ Generated: Sun Jul 20 21:14:02 2008 ] [ Zen Cart 1.3.0.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/admin/ -> salemaker.php (source)

   1  <?php
   2  /**

   3   * @package admin

   4   * @copyright Copyright 2003-2006 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: salemaker.php 3474 2006-04-21 02:20:40Z drbyte $

   8   */
   9  //

  10  define('AUTOCHECK', 'False');
  11  
  12    require ('includes/application_top.php');
  13  
  14    require (DIR_WS_CLASSES . 'currencies.php');
  15    $currencies = new currencies();
  16  
  17    $specials_condition_array = array(array('id' => '0', 'text' => SPECIALS_CONDITION_DROPDOWN_0),
  18                                      array('id' => '1', 'text' => SPECIALS_CONDITION_DROPDOWN_1),
  19                                      array('id' => '2', 'text' => SPECIALS_CONDITION_DROPDOWN_2));
  20  
  21    $deduction_type_array = array(array('id' => '0', 'text' => DEDUCTION_TYPE_DROPDOWN_0),
  22                                  array('id' => '1', 'text' => DEDUCTION_TYPE_DROPDOWN_1),
  23                                  array('id' => '2', 'text' => DEDUCTION_TYPE_DROPDOWN_2));
  24  
  25    $action = (isset($_GET['action']) ? $_GET['action'] : '');
  26  
  27    if (zen_not_null($action)) {
  28      switch ($action) {
  29        case 'setflag':
  30          $salemaker_data_array = array('sale_status' => zen_db_prepare_input($_GET['flag']),
  31                                        'sale_date_last_modified' => 'now()',
  32                                        'sale_date_status_change' => 'now()');
  33  
  34          zen_db_perform(TABLE_SALEMAKER_SALES, $salemaker_data_array, 'update', "sale_id = '" . zen_db_prepare_input($_GET['sID']) . "'");
  35  
  36          // update prices for products in sale

  37          zen_update_salemaker_product_prices($_GET['sID']);
  38  
  39          zen_redirect(zen_href_link(FILENAME_SALEMAKER, '', 'NONSSL'));
  40          break;
  41        case 'insert':
  42        case 'update':
  43  // insert a new sale or update an existing sale

  44  
  45  // Create a string of all affected (sub-)categories

  46          if (zen_not_null($_POST['categories'])) {
  47              $categories_selected = array();
  48            $categories_all = array();
  49            foreach(zen_db_prepare_input($_POST['categories']) as $category_path) {
  50              $tmp = explode('_', substr($category_path,0,strlen($category_path)-1));
  51              $category = array_pop($tmp);
  52              $categories_selected[] = $category;
  53              $categories_all[] = $category;
  54              foreach(zen_get_category_tree($category) as $subcategory) {
  55                if ($subcategory['id'] != '0') {
  56                  $categories_all[] = $subcategory['id'];
  57                }
  58              }
  59            }
  60            asort($categories_selected);
  61            $categories_selected_string = implode(',', array_unique($categories_selected));
  62            asort($categories_all);
  63            $categories_all_string = ',' . implode(',', array_unique($categories_all)) . ',';
  64          } else {
  65            $categories_selected_string = 'null';
  66            $categories_all_string = 'null';
  67          }
  68  
  69          $salemaker_sales_data_array = array('sale_name' => zen_db_prepare_input($_POST['name']),
  70                                              'sale_deduction_value' => zen_db_prepare_input((float)$_POST['deduction']),
  71                                              'sale_deduction_type' => zen_db_prepare_input($_POST['type']),
  72                                              'sale_pricerange_from' => zen_db_prepare_input((float)$_POST['from']),
  73                                              'sale_pricerange_to' => zen_db_prepare_input((float)$_POST['to']),
  74                                              'sale_specials_condition' => zen_db_prepare_input($_POST['condition']),
  75                                              'sale_categories_selected' => $categories_selected_string,
  76                                              'sale_categories_all' => $categories_all_string,
  77                                              'sale_date_start' => ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start'])),
  78                                              'sale_date_end' => ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end'])));
  79  
  80          if ($action == 'insert') {
  81            $salemaker_sales['sale_status'] = 0;
  82            $salemaker_sales_data_array['sale_date_added'] = 'now()';
  83            $salemaker_sales_data_array['sale_date_last_modified'] = '0001-01-01';
  84            $salemaker_sales_data_array['sale_date_status_change'] = '0001-01-01';
  85            zen_db_perform(TABLE_SALEMAKER_SALES, $salemaker_sales_data_array, 'insert');
  86  
  87            $_POST['sID'] = $db->Insert_ID();
  88  
  89          } else {
  90              $salemaker_sales_data_array['sale_date_last_modified'] = 'now()';
  91            zen_db_perform(TABLE_SALEMAKER_SALES, $salemaker_sales_data_array, 'update', "sale_id = '" . zen_db_input($_POST['sID']) . "'");
  92          }
  93  
  94          // update prices for products in sale

  95          zen_update_salemaker_product_prices($_POST['sID']);
  96  
  97          zen_redirect(zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $_POST['sID']));
  98          break;
  99        case 'copyconfirm':
 100          $newname = zen_db_prepare_input($_POST['newname']);
 101          if (zen_not_null($newname)) {
 102            $salemaker_sales = $db->Execute("select * from " . TABLE_SALEMAKER_SALES . " where sale_id = '" . zen_db_input($_GET['sID']) . "'");
 103            if ($salemaker_sales->RecordCount() > 0) {
 104  
 105            $sql_data_array = array('sale_id' => 'null',
 106                                    'sale_status' => 0,
 107                                    'sale_name' => $newname,
 108                                    'sale_date_added' => 'now()',
 109                                    'sale_date_last_modified' => '0001-01-01',
 110                                    'sale_date_status_change' => '0001-01-01',
 111                                    'sale_deduction_value' => (float)$salemaker_sales->fields['sale_deduction_value'],
 112                                    'sale_deduction_type' => (float)$salemaker_sales->fields['sale_deduction_type'],
 113                                    'sale_pricerange_from' => (float)$salemaker_sales->fields['sale_pricerange_from'],
 114                                    'sale_pricerange_to' => (float)$salemaker_sales->fields['sale_pricerange_to'],
 115                                    'sale_specials_condition' => (int)$salemaker_sales->fields['sale_specials_condition'],
 116                                    'sale_categories_selected' => $salemaker_sales->fields['sale_categories_selected'],
 117                                    'sale_categories_all' => $salemaker_sales->fields['sale_categories_all'],
 118                                    'sale_date_start' => $salemaker_sales->fields['sale_date_start'],
 119                                    'sale_date_end' => $salemaker_sales->fields['sale_date_end']
 120                                    );
 121  
 122              zen_db_perform(TABLE_SALEMAKER_SALES, $sql_data_array, 'insert');
 123  
 124              $sale_id = $db->Insert_ID();
 125              // update prices for products in sale

 126              zen_update_salemaker_product_prices($sale_id);
 127            }
 128          }
 129  
 130          zen_redirect(zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $db->Insert_ID()));
 131          break;
 132        case 'deleteconfirm':
 133            $sale_id = zen_db_prepare_input($_GET['sID']);
 134  
 135          // set sale off to update prices before removing

 136          $db->Execute("update " . TABLE_SALEMAKER_SALES . " set sale_status=0 where sale_id='" . $sale_id . "'");
 137  
 138          // update prices for products in sale

 139          zen_update_salemaker_product_prices($sale_id);
 140  
 141          $db->Execute("delete from " . TABLE_SALEMAKER_SALES . " where sale_id = '" . (int)$sale_id . "'");
 142  
 143          zen_redirect(zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page']));
 144          break;
 145      }
 146    }
 147  ?>
 148  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 149  <html <?php echo HTML_PARAMS; ?>>
 150  <head>
 151  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 152  <title><?php echo TITLE; ?></title>
 153  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 154  <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
 155  <script language="javascript" src="includes/menu.js"></script>
 156  <script language="javascript" src="includes/general.js"></script>
 157  <script type="text/javascript">
 158    <!--
 159    function init()
 160    {
 161      cssjsmenu('navbar');
 162      if (document.getElementById)
 163      {
 164        var kill = document.getElementById('hoverJS');
 165        kill.disabled = true;
 166      }
 167    }
 168    // -->

 169  </script>
 170  <?php
 171    if ( ($action == 'new') || ($action == 'edit') ) {
 172  ?>
 173  <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
 174  <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
 175  <script language="JavaScript">
 176  function session_win() {
 177    window.open("<?php echo zen_href_link(FILENAME_SALEMAKER_INFO); ?>","salemaker_info","height=460,width=600,scrollbars=yes,resizable=yes").focus();
 178  }
 179  function popupWindow(url) {
 180    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=460,screenX=150,screenY=150,top=150,left=150')
 181  }
 182  function session_win1() {
 183    window.open("<?php echo zen_href_link(FILENAME_SALEMAKER_POPUP, 'cid='.$category['categories_id']); ?>","salemaker_info","height=460,width=600,scrollbars=yes,resizable=yes").focus();
 184  }
 185  function init() {
 186    cssjsmenu('navbar');
 187    if (document.getElementById) {
 188      var kill = document.getElementById('hoverJS');
 189      kill.disabled = true;
 190    }
 191  }
 192  function RowClick(RowValue) {
 193    for (i=0; i<document.sale_form.length; i++) {
 194      if(document.sale_form.elements[i].type == 'checkbox') {
 195        if(document.sale_form.elements[i].value == RowValue) {
 196          if(document.sale_form.elements[i].disabled == false) {
 197           document.sale_form.elements[i].checked = !document.sale_form.elements[i].checked;
 198          }
 199        }
 200      }
 201    }
 202    SetCategories()
 203  }
 204  
 205  function CheckBoxClick() {
 206    if(this.disabled == false) {
 207      this.checked = !this.checked;
 208    }
 209    SetCategories()
 210  }
 211  
 212  function SetCategories() {
 213    for (i=0; i<document.sale_form.length; i++) {
 214      if(document.sale_form.elements[i].type == 'checkbox') {
 215        document.sale_form.elements[i].disabled = false;
 216        document.sale_form.elements[i].onclick = CheckBoxClick;
 217        document.sale_form.elements[i].parentNode.parentNode.className = 'SaleMakerOver';
 218      }
 219    }
 220    change = true;
 221    while(change) {
 222      change = false;
 223      for (i=0; i<document.sale_form.length; i++) {
 224        if(document.sale_form.elements[i].type == 'checkbox') {
 225          currentcheckbox = document.sale_form.elements[i];
 226          currentrow = currentcheckbox.parentNode.parentNode;
 227          if ( (currentcheckbox.checked) && (currentrow.className == 'SaleMakerOver') ) {
 228            currentrow.className = 'SaleMakerSelected';
 229            for (j=0; j<document.sale_form.length; j++) {
 230              if(document.sale_form.elements[j].type == 'checkbox') {
 231                relatedcheckbox = document.sale_form.elements[j];
 232                relatedrow = relatedcheckbox.parentNode.parentNode;
 233                if( (relatedcheckbox != currentcheckbox) && (relatedcheckbox.value.substr(0, currentcheckbox.value.length) == currentcheckbox.value) ) {
 234                  if(!relatedcheckbox.disabled) {
 235  <?php
 236      if ( (defined('AUTOCHECK')) && (AUTOCHECK == 'True') ) {
 237  ?>
 238                    relatedcheckbox.checked = true;
 239  <?php
 240      }
 241  ?>
 242                    relatedcheckbox.disabled = true;
 243                    relatedrow.className = 'SaleMakerDisabled';
 244                    change = true;
 245                  }
 246                }
 247              }
 248            }
 249          }
 250        }
 251      }
 252    }
 253  }
 254  
 255  </script>
 256  </head>
 257  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetCategories();SetFocus();init()">
 258  <div id="spiffycalendar" class="text"></div>
 259  <?php
 260    } else {
 261  ?>
 262  </head>
 263  <?php
 264    }
 265  ?>
 266  <!-- header //-->
 267  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 268  <!-- header_eof //-->
 269  
 270  <!-- body //-->
 271  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 272    <tr>
 273  <!-- body_text //-->
 274      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 275        <tr>
 276          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 277            <tr>
 278              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 279              <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 280            </tr>
 281          </table></td>
 282        </tr>
 283  <?php
 284    if ( ($action == 'new') || ($action == 'edit') ) {
 285      $form_action = 'insert';
 286      if ( ($action == 'edit') && ($_GET['sID']) ) {
 287        $form_action = 'update';
 288  
 289        $salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_categories_all, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " where sale_id = '" . (int)$_GET['sID'] . "'");
 290  
 291        $sInfo = new objectInfo($salemaker_sales->fields);
 292      } else {
 293        $sInfo = new objectInfo(array());
 294      }
 295  ?>
 296  <script language="javascript">
 297  var StartDate = new ctlSpiffyCalendarBox("StartDate", "sale_form", "start", "btnDate1","<?php echo (($sInfo->sale_date_start == '0001-01-01') ? '' : zen_date_short($sInfo->sale_date_start)); ?>",scBTNMODE_CUSTOMBLUE);
 298  var EndDate = new ctlSpiffyCalendarBox("EndDate", "sale_form", "end", "btnDate2","<?php echo (($sInfo->sale_date_end == '0001-01-01') ? '' : zen_date_short($sInfo->sale_date_end)); ?>",scBTNMODE_CUSTOMBLUE);
 299  </script>
 300        <tr><form name="sale_form" <?php echo 'action="' . zen_href_link(FILENAME_SALEMAKER, zen_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo zen_draw_hidden_field('sID', $_GET['sID']); ?>
 301          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 302            <tr>
 303              <td class="main"><?php echo TEXT_SALEMAKER_POPUP; ?></td>
 304              <td class="main" align="right" valign="top"><br><?php echo (($form_action == 'insert') ? zen_image_submit('button_insert.gif', IMAGE_INSERT) : zen_image_submit('button_update.gif', IMAGE_UPDATE)). '&nbsp;&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . ($_GET['sID'] > 0 ? '&sID=' . $_GET['sID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></td>
 305            </tr>
 306          </table></td>
 307        </tr>
 308        <tr>
 309          <td><table border="0" cellspacing="0" cellpadding="2">
 310            <tr>
 311              <td class="main"><?php echo TEXT_SALEMAKER_NAME; ?>&nbsp;</td>
 312              <td class="main"><?php echo zen_draw_input_field('name', $sInfo->sale_name, 'size="37"'); ?></td>
 313            </tr>
 314            <tr>
 315              <td class="main"><?php echo TEXT_SALEMAKER_DEDUCTION; ?>&nbsp;</td>
 316              <td class="main"><?php echo zen_draw_input_field('deduction', $sInfo->sale_deduction_value, 'size="8"') . TEXT_SALEMAKER_DEDUCTION_TYPE . zen_draw_pull_down_menu('type', $deduction_type_array, $sInfo->sale_deduction_type); ?></td>
 317            </tr>
 318            <tr>
 319              <td class="main"><?php echo TEXT_SALEMAKER_PRICERANGE_FROM; ?>&nbsp;</td>
 320              <td class="main"><?php echo zen_draw_input_field('from', $sInfo->sale_pricerange_from, 'size="8"') . TEXT_SALEMAKER_PRICERANGE_TO . zen_draw_input_field('to', $sInfo->sale_pricerange_to, 'size="8"'); ?></td>
 321            </tr>
 322            <tr>
 323              <td class="main"><?php echo TEXT_SALEMAKER_SPECIALS_CONDITION; ?>&nbsp;</td>
 324              <td class="main"><?php echo zen_draw_pull_down_menu('condition', $specials_condition_array, $sInfo->sale_specials_condition); ?></td>
 325            </tr>
 326            <tr>
 327              <td class="main"><?php echo TEXT_SALEMAKER_DATE_START; ?>&nbsp;</td>
 328              <td class="main"><script language="javascript">StartDate.writeControl(); StartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
 329            </tr>
 330            <tr>
 331              <td class="main"><?php echo TEXT_SALEMAKER_DATE_END; ?>&nbsp;</td>
 332              <td class="main"><script language="javascript">EndDate.writeControl(); EndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
 333            </tr>
 334          </table>
 335        </tr>
 336  <tr><table width="750" border="0" cellspacing="2" cellpadding="2">
 337  <?php
 338      $categories_array = zen_get_category_tree('0','&nbsp;&nbsp;','0');
 339      $n = sizeof($categories_array);
 340      for($i = 0; $i < $n; $i++) {
 341        $parents = $db->Execute("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . $categories_array[$i]['id'] . "' ");
 342        $categories_array[$i]['parent_id'] = $parents->fields['parent_id'];
 343        $categories_array[$i]['categories_id'] = $categories_array[$i]['id'];
 344        $categories_array[$i]['path'] = $categories_array[$i]['categories_id'];
 345        $categories_array[$i]['indent'] = 0;
 346        $parent = $categories_array[$i]['parent_id'];
 347        while($parent != 0) {
 348          $categories_array[$i]['indent']++;
 349          for($j = 0; $j < $n; $j++) {
 350            if($categories_array[$j]['categories_id'] == $parent) {
 351              $categories_array[$i]['path'] = $parent . '_' . $categories_array[$i]['path'];
 352              $parent = $categories_array[$j]['parent_id'];
 353              break;
 354            }
 355          }
 356        }
 357        $categories_array[$i]['path'] = $categories_array[$i]['path'] . '_';
 358      }
 359      $categories_selected = explode(',', $sInfo->sale_categories_selected);
 360      if (zen_not_null($sInfo->sale_categories_selected)) {
 361        $selected = in_array(0, $categories_selected);
 362      } else {
 363        $selected = false;
 364      }
 365  
 366      $prev_sales = $db->Execute("select sale_categories_all from " . TABLE_SALEMAKER_SALES);
 367      while (!$prev_sales->EOF) {
 368        $prev_categories = explode(',', $prev_sales->fields['sale_categories_all']);
 369        while(list($key,$value) = each($prev_categories)) {
 370          if ($value) $prev_categories_array[$value]++;
 371        }
 372        $prev_sales->MoveNext();
 373      }
 374      echo "      <tr>\n";
 375      echo '        <td valign="bottom" class="main">' . zen_draw_separator('pixel_trans.gif', '4', '1') . zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif') . "</td>\n";
 376      echo '        <td class="main" colspan="2"><br>' . TEXT_SALEMAKER_ENTIRE_CATALOG . "</td>\n";
 377      echo "      </tr>\n";
 378      echo '      <tr onClick="RowClick(\'0\')">' . "\n";
 379      echo '        <td width="10" class="main">' . zen_draw_checkbox_field('categories[]', '0', $selected) . "</td>\n";
 380      echo '        <td class="main" colspan="2">' . TEXT_SALEMAKER_TOP . "</td>\n";
 381      echo "      </tr>\n";
 382      echo "      <tr>\n";
 383      echo '        <td valign="bottom" class="main">' . zen_draw_separator('pixel_trans.gif', '4', '1') . zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif') . "</td>\n";
 384      echo '        <td class="main" colspan="2"><br>' . TEXT_SALEMAKER_CATEGORIES . "</td>\n";
 385      echo "      </tr>\n";
 386      echo "      </table></tr>\n";
 387      echo '      <tr valign="top"><table width="80%" border ="0" cellspacing="2" cellpadding="2">' . "\n";
 388      foreach($categories_array as $category) {
 389        if (zen_not_null($sInfo->sale_categories_selected)) {
 390          $selected = in_array($category['categories_id'], $categories_selected);
 391        } else {
 392          $selected = false;
 393        }
 394      echo '        <tr valign="top"><td><table border="0" cellspacing="2" cellpadding="2">' . "\n";
 395        echo '      <tr onClick="RowClick(\'' . $category['path'] . '\')">' . "\n";
 396        echo '        <td width="10">' . zen_draw_checkbox_field('categories[]', $category['path'], $selected) . "</td>\n";
 397        echo '        <td width="40%">' . $category['text']. "</td>\n";
 398        echo '<td width="70%">';
 399        if ($prev_categories_array[$category['categories_id']]) {
 400          echo '&nbsp;Warning : ' . $prev_categories_array[$category['categories_id']] . ' sales already include this category';
 401        }
 402        echo "</td>\n";
 403        echo '      </tr>' . "\n";
 404  
 405      echo '        </table></td>' . "\n";
 406      echo '        <td align="right"><table border="0" cellspacing="2" cellpadding="2">' . "\n";
 407      echo '        <tr>' . "\n";
 408        if ($prev_categories_array[$category['categories_id']]) {
 409        echo '        <td>' . "\n";
 410  ?>
 411  <script language="javascript" type="text/javascript"><!--
 412  document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_SALEMAKER_POPUP, 'cid=' . $category['categories_id'] . '&cname='.$category['categories_name']) . '\\\')">'.'(More Info)'.'</a>'; ?>');
 413  //--></script>

 414  <?php
 415        }
 416        echo "</td>\n";
 417      echo '        </tr>' . "\n";
 418      echo '        </table></td>' . "\n";
 419      echo '        </tr>' . "\n";
 420      }
 421      echo '        </table></tr>' . "\n";
 422  /*

 423        echo "";

 424        echo "<td align=''left''>";

 425        if ($prev_categories_array[$category['categories_id']]) {

 426          echo '&nbsp;Warning : ' . $prev_categories_array[$category['categories_id']] . ' sales already include this category';

 427  ?>

 428  <script language="javascript" type="text/javascript"><!--

 429  document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_SALEMAKER_POPUP, 'cid=' . $category['categories_id'] . '&cname='.$category['categories_name']) . '\\\')">'.'(More Info)'.'</a>'; ?>');

 430  //--></script>

 431  <?php

 432        }

 433        echo "</td>\n";

 434      }

 435  echo '</table></tr>';

 436  */
 437  ?>
 438          </table></td>
 439        </form></tr>
 440  <?php
 441    } else {
 442  ?>
 443        <tr>
 444          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 445            <tr>
 446              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 447                <tr class="dataTableHeadingRow">
 448                  <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_SALE_NAME; ?></td>
 449                  <td class="dataTableHeadingContent" align="center" colspan="2"><?php echo TABLE_HEADING_SALE_DEDUCTION; ?></td>
 450                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SALE_DATE_START; ?></td>
 451                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SALE_DATE_END; ?></td>
 452                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
 453                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 454                </tr>
 455  <?php
 456      $salemaker_sales_query_raw = "select sale_id, sale_status, sale_name, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_categories_all, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " order by sale_name";
 457      $salemaker_sales_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $salemaker_sales_query_raw, $salemaker_sales_query_numrows);
 458      $salemaker_sales = $db->Execute($salemaker_sales_query_raw);
 459      while (!$salemaker_sales->EOF) {
 460        if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $salemaker_sales->fields['sale_id']))) && !isset($sInfo)) {
 461          $sInfo_array = $salemaker_sales->fields;
 462          $sInfo = new objectInfo($sInfo_array);
 463        }
 464  
 465        if (isset($sInfo) && is_object($sInfo) && ($salemaker_sales->fields['sale_id'] == $sInfo->sale_id)) {
 466          echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=edit') . '\'">' . "\n";
 467        } else {
 468          echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $salemaker_sales->fields['sale_id']) . '\'">' . "\n";
 469        }
 470  ?>
 471                  <td  class="dataTableContent" align="left"><?php echo $salemaker_sales->fields['sale_name']; ?></td>
 472                  <td  class="dataTableContent" align="right"><?php echo $salemaker_sales->fields['sale_deduction_value']; ?></td>
 473                  <td  class="dataTableContent" align="left"><?php echo $deduction_type_array[$salemaker_sales->fields['sale_deduction_type']]['text']; ?></td>
 474                  <td  class="dataTableContent" align="center"><?php echo (($salemaker_sales->fields['sale_date_start'] == '0001-01-01') ? TEXT_SALEMAKER_IMMEDIATELY : zen_date_short($salemaker_sales->fields['sale_date_start'])); ?></td>
 475                  <td  class="dataTableContent" align="center"><?php echo (($salemaker_sales->fields['sale_date_end'] == '0001-01-01') ? TEXT_SALEMAKER_NEVER : zen_date_short($salemaker_sales->fields['sale_date_end'])); ?></td>
 476                  <td  class="dataTableContent" align="center">
 477  <?php
 478        if ($salemaker_sales->fields['sale_status'] == '1') {
 479          echo '<a href="' . zen_href_link(FILENAME_SALEMAKER, 'action=setflag&flag=0&sID=' . $salemaker_sales->fields['sale_id'], 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
 480        } else {
 481          echo '<a href="' . zen_href_link(FILENAME_SALEMAKER, 'action=setflag&flag=1&sID=' . $salemaker_sales->fields['sale_id'], 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
 482        }
 483  ?>
 484                  </td>
 485                  <td class="dataTableContent" align="right"><?php if ( (is_object($sInfo)) && ($salemaker_sales->fields['sale_id'] == $sInfo->sale_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $salemaker_sales->fields['sale_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 486        </tr>
 487  <?php
 488        $salemaker_sales->MoveNext();
 489      }
 490  ?>
 491                <tr>
 492                  <td colspan="7"><table border="0" width="100%" cellpadding="0"cellspacing="2">
 493                    <tr>
 494                      <td class="smallText" valign="top"><?php echo $salemaker_sales_split->display_count($salemaker_sales_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_SALES); ?></td>
 495                      <td class="smallText" align="right"><?php echo $salemaker_sales_split->display_links($salemaker_sales_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
 496                    </tr>
 497  <?php
 498    if (empty($action)) {
 499  ?>
 500                    <tr>
 501                      <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_sale.gif', IMAGE_NEW_SALE) . '</a>'; ?></td>
 502                    </tr>
 503  <?php
 504    }
 505  ?>
 506                  </table></td>
 507                </tr>
 508              </table></td>
 509  <?php
 510    $heading = array();
 511    $contents = array();
 512  
 513    switch ($action) {
 514      case 'copy':
 515        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_SALE . '</b>');
 516  
 517        $contents = array('form' => zen_draw_form('sales', FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=copyconfirm'));
 518        $contents[] = array('text' => sprintf(TEXT_INFO_COPY_INTRO, $sInfo->sale_name));
 519        $contents[] = array('text' => '<br>&nbsp;' . zen_draw_input_field('newname', $sInfo->sale_name . '_', 'size="31"'));
 520        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_copy.gif', IMAGE_COPY) . '&nbsp;<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 521        break;
 522      case 'delete':
 523        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SALE . '</b>');
 524  
 525        $contents = array('form' => zen_draw_form('sales', FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=deleteconfirm'));
 526        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
 527        $contents[] = array('text' => '<br><b>' . $sInfo->sale_name . '</b>');
 528        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 529        break;
 530      default:
 531        if (is_object($sInfo)) {
 532          $heading[] = array('text' => '<b>' . $sInfo->sale_name . '</b>');
 533  
 534          $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=copy') . '">' . zen_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a> <a href="' . zen_href_link(FILENAME_SALEMAKER, 'page=' . $_GET['page'] . '&sID=' . $sInfo->sale_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 535          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->sale_date_added));
 536          $contents[] = array('text' => '' . TEXT_INFO_DATE_MODIFIED . ' ' . (($sInfo->sale_date_last_modified == '0001-01-01') ? TEXT_SALEMAKER_NEVER : zen_date_short($sInfo->sale_date_last_modified)));
 537          $contents[] = array('text' => '' . TEXT_INFO_DATE_STATUS_CHANGE . ' ' . (($sInfo->sale_date_status_change == '0001-01-01') ? TEXT_SALEMAKER_NEVER : zen_date_short($sInfo->sale_date_status_change)));
 538  
 539          $contents[] = array('text' => '<br>' . TEXT_INFO_DEDUCTION . ' ' . $sInfo->sale_deduction_value . ' ' . $deduction_type_array[$sInfo->sale_deduction_type]['text']);
 540          $contents[] = array('text' => '' . TEXT_INFO_PRICERANGE_FROM . ' ' . $currencies->format($sInfo->sale_pricerange_from) . TEXT_INFO_PRICERANGE_TO . $currencies->format($sInfo->sale_pricerange_to));
 541          $contents[] = array('text' => '<table class="dataTableContent" border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td valign="top">' . TEXT_INFO_SPECIALS_CONDITION . '&nbsp;</td><td>' . $specials_condition_array[$sInfo->sale_specials_condition]['text'] . '</td></tr></table>');
 542  
 543          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_START . ' ' . (($sInfo->sale_date_start == '0001-01-01') ? TEXT_SALEMAKER_IMMEDIATELY : zen_date_short($sInfo->sale_date_start)));
 544          $contents[] = array('text' => '' . TEXT_INFO_DATE_END . ' ' . (($sInfo->sale_date_end == '0001-01-01') ? TEXT_SALEMAKER_NEVER : zen_date_short($sInfo->sale_date_end)));
 545        }
 546        break;
 547    }
 548    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
 549      echo '            <td valign="top">' . "\n";
 550  
 551      $box = new box;
 552      echo $box->infoBox($heading, $contents);
 553      echo '            </td>' . "\n";
 554    }
 555  }
 556  ?>
 557            </tr>
 558          </table></td>
 559        </tr>
 560      </table></td>
 561  <!-- body_text_eof //-->
 562    </tr>
 563  </table>
 564  <!-- body_eof //-->
 565  
 566  <!-- footer //-->
 567  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 568  <!-- footer_eof //-->
 569  </body>
 570  </html>
 571  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]