ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/coupon_restrict.php
Go to the documentation of this file.
00001 <?php
00009   //define('MAX_DISPLAY_RESTRICT_ENTRIES', 10);
00010   require('includes/application_top.php');
00011   $restrict_array = array();
00012   $restrict_array[] = array('id'=>'Deny', text=>'Deny');
00013   $restrict_array[] = array('id'=>'Allow', text=>'Allow');
00014 
00015   if (isset($_GET['cid'])) $_GET['cid'] = (int)$_GET['cid'];
00016   if (isset($_GET['info'])) $_GET['info'] = (int)$_GET['info'];
00017   if (isset($_POST['cPath'])) $_POST['cPath'] = (int)$_POST['cPath'];
00018   if (isset($_POST['cPath_prod'])) $_POST['cPath_prod'] = (int)$_POST['cPath_prod'];
00019   if (isset($_GET['build_cat'])) $_GET['build_cat'] = (int)$_GET['build_cat'];
00020 
00021   $the_path = $_POST['cPath'];
00022   if (isset($_GET['action']) && $_GET['action']=='switch_status') {
00023     if (isset($_POST['switchStatusProto']))
00024     {
00025       $status = $db->Execute("select coupon_restrict
00026                               from " . TABLE_COUPON_RESTRICT . "
00027                               where restrict_id = '" . $_GET['info'] . "'");
00028 
00029       $new_status = 'N';
00030       if ($status->fields['coupon_restrict'] == 'N') $new_status = 'Y';
00031       $db->Execute("update " . TABLE_COUPON_RESTRICT . "
00032                     set coupon_restrict = '" . $new_status . "'
00033                     where restrict_id = '" . $_GET['info'] . "'");
00034     }
00035   }
00036   if ($_GET['action']=='add_category' && isset($_POST['cPath'])) {
00037         if ($_POST['cPath'] == 0) $_POST['cPath'] = -1;
00038     $test_query=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . "
00039                               where coupon_id = '" . $_GET['cid'] . "'
00040                               and category_id = '" . $_POST['cPath'] . "'");
00041 
00042     if ($test_query->RecordCount() < 1) {
00043       $status = 'N';
00044       if ($_POST['restrict_status']=='Deny') $status = 'Y';
00045       $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
00046                   (coupon_id, category_id, coupon_restrict)
00047                   values ('" . $_GET['cid'] . "', '" . $_POST['cPath'] . "', '" . $status . "')");
00048     } else {
00049       // message that nothing is done
00050       $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_CATEGORY . ' ' . $_POST['cPath'], 'caution');
00051     }
00052   }
00053 
00054 
00055 // from products dropdown selection
00056   if ($_GET['action']=='add_product' && $_POST['products_drop']) {
00057     $test_query=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and product_id = '" . (int)$_POST['products_drop'] . "'");
00058     if ($test_query->RecordCount() < 1) {
00059       $status = 'N';
00060       if ($_POST['restrict_status']=='Deny') $status = 'Y';
00061 
00062 // ==================================
00063 // bof: ALL ADD/DELETE of Products in one Category
00064         if ($_POST['products_drop'] < 0) {
00065         // adding new records
00066           if ($_POST['products_drop'] == -1) {
00067           // to insert new products from a given categories_id for a coupon_code that are not already in the table
00068           // products in the table from the catategories_id are skipped
00069             $new_products_query = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $_GET['build_cat'] . "' and products_id not in (select product_id from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "')";
00070             $new_products = $db->Execute($new_products_query);
00071           }
00072 
00073           if ($_POST['products_drop'] == -2) {
00074           // to delete existing products from a given categories_id for a coupon_code that are already in the table
00075           // products in the table from the catategories_id are skipped
00076             $new_products_query = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $_GET['build_cat'] . "' and products_id in (select product_id from " . TABLE_COUPON_RESTRICT . " where coupon_restrict = '" . $status . "' and coupon_id = '" . $_GET['cid'] . "')";
00077             $new_products = $db->Execute($new_products_query);
00078           }
00079 
00080           // nothing to be done
00081           if ($new_products->RecordCount() == 0) {
00082             $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_CATEGORY . ' ' . $_POST['cPath'], 'caution');
00083           }
00084           while(!$new_products->EOF) {
00085             // product passed and needs to be added/deleted
00086             // add all products from select category for each product not already defined in coupons_restrict
00087             if ($_POST['products_drop'] == -1) {
00088               $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
00089                           (coupon_id, product_id, coupon_restrict)
00090                           values ('" . $_GET['cid'] . "', '" . $new_products->fields['products_id'] . "', '" . $status . "')");
00091             } else {
00092             // removed as defined in coupons_restrict for either DENY or ALLOW
00093               $db->Execute("delete from " . TABLE_COUPON_RESTRICT . "
00094                             WHERE coupon_id = '" . $_GET['cid'] . "'
00095                             and product_id = '" . $new_products->fields['products_id'] . "'
00096                             and coupon_restrict = '" . $status . "'");
00097             }
00098 
00099             $new_products->MoveNext();
00100           }
00101 // eof: ALL ADD/DELETE of Products in one Category
00102 // ==================================
00103 
00104       } else {
00105 // normal insert of product one by one allow/deny to coupon
00106       $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
00107                   (coupon_id, product_id, coupon_restrict)
00108                   values ('" . $_GET['cid'] . "', '" . (int)$_POST['products_drop'] . "', '" . $status . "')");
00109       } // not all deny allow
00110     } else {
00111       $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_PRODUCT . ' ' . (int)$_POST['products_drop'], 'caution');
00112     }
00113   }
00114   if ($_GET['action']=='remove') { 
00115     if (isset($_GET['info']) && isset($_POST['actionRemoveProto'])) {
00116       $db->Execute("delete from " . TABLE_COUPON_RESTRICT . " where restrict_id = '" . $_GET['info'] . "'");
00117     }
00118   }
00119 ?>
00120 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00121 <html <?php echo HTML_PARAMS; ?>>
00122 <head>
00123 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00124 <title><?php echo TITLE; ?></title>
00125 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00126 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00127 <script language="javascript" src="includes/menu.js"></script>
00128 <script type="text/javascript">
00129   <!--
00130   function init()
00131   {
00132     cssjsmenu('navbar');
00133     if (document.getElementById)
00134     {
00135       var kill = document.getElementById('hoverJS');
00136       kill.disabled = true;
00137     }
00138   }
00139   // -->
00140 </script>
00141 </head>
00142 <body onload="init()">
00143 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
00144 <!-- header //-->
00145 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00146 <!-- header_eof //-->
00147 <!-- body //-->
00148 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00149   <tr>
00150 <!-- body_text //-->
00151     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00152       <tr>
00153         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00154           <tr>
00155             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00156             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00157           </tr>
00158         </table></td>
00159       </tr>
00160       <tr>
00161         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00162           <tr>
00163             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00164               <tr>
00165                 <td class="pageHeading"><?php echo HEADING_TITLE_CATEGORY; ?></td>
00166               </tr>
00167             </table></td>
00168           </tr>
00169           <tr>
00170             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00171               <tr>
00172                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00173                   <tr class="dataTableHeadingRow">
00174                     <td class="dataTableHeadingContent"><?php echo HEADER_COUPON_ID; ?></td>
00175                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_COUPON_NAME; ?></td>
00176                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_CATEGORY_ID; ?></td>
00177                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_CATEGORY_NAME; ?></td>
00178                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_ALLOW; ?></td>
00179                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_DENY; ?></td>
00180                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_REMOVE; ?></td>
00181                   </tr>
00182 <?php
00183     $cr_query_raw = "select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and category_id != '0'";
00184     $cr_split = new splitPageResults($_GET['cpage'], MAX_DISPLAY_RESTRICT_ENTRIES, $cr_query_raw, $cr_query_numrows);
00185     $cr_list = $db->Execute($cr_query_raw);
00186     while (!$cr_list->EOF) {
00187       $rows++;
00188       if (strlen($rows) < 2) {
00189         $rows = '0' . $rows;
00190       }
00191       if (((!$_GET['cid']) || (@$_GET['cid'] == $cr_list->fields['restrict_id'])) && (!$cInfo)) {
00192         $cInfo = new objectInfo($cr_list->fields);
00193       }
00194         echo '          <tr class="dataTableRow">' . "\n";
00195      if ($cr_list->fields['category_id'] != -1) {
00196      $coupon = $db->Execute("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . "
00197                              where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'");
00198      $category_name = zen_get_category_name($cr_list->fields['category_id'], $_SESSION['languages_id']);
00199      } else {
00200         $category_name = TEXT_ALL_CATEGORIES;
00201      }
00202 ?>
00203                 <td class="dataTableContent"><?php echo $_GET['cid']; ?></td>
00204                 <td class="dataTableContent" align="center"><?php echo $coupon->fields['coupon_name']; ?></td>
00205                 <td class="dataTableContent" align="center"><?php echo $cr_list->fields['category_id']; ?></td>
00206                 <td class="dataTableContent" align="center"><?php echo $category_name; ?></td>
00207 <?php
00208                 if ($cr_list->fields['coupon_restrict']=='N') {
00209                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
00210                 } else {
00211                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
00212                 }
00213                 if ($cr_list->fields['coupon_restrict']=='Y') {
00214                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '"  onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
00215                 } else {
00216                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '"  onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
00217                 }
00218                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=remove&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickActionRemove(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icons/delete.gif', IMAGE_REMOVE) . '</a></td>';
00219 ?>
00220               </tr>
00221 <?php
00222     $cr_list->MoveNext();
00223     }
00224 ?>
00225               <tr>
00226                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00227                   <tr>
00228                     <td class="smallText" valign="top"><?php echo $cr_split->display_count($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['cpage'], TEXT_DISPLAY_NUMBER_OF_CATEGORIES); ?></td>
00229                     <td class="smallText" align="right"><?php echo $cr_split->display_links($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['cpage'],zen_get_all_get_params(array('cpage','action', 'x', 'y')),'cpage'); ?></td>
00230                   </tr>
00231                 </table></td>
00232               </tr>
00233               <tr><form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_category&info=' . $cInfo->restrict_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00234                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00235                   <tr>
00236                     <td class="smallText" valign="top"><?php echo HEADER_CATEGORY_NAME; ?></td>
00237                     <td class="smallText" align="left"></td>
00238                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id); ?></td>
00239                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('restrict_status', $restrict_array, $current_category_id); ?></td>
00240                     <td class="smallText" align="left"><input type="submit" name="add" value="Add"></td>
00241                     <td class="smallText" align="left">&nbsp;</td>
00242                     <td class="smallText" align="left">&nbsp;</td>
00243                   </tr>
00244                 </table></td>
00245               </tr></form>
00246                 </table></td>
00247               </tr>
00248             </table></td>
00249           </tr>
00250           <tr>
00251             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00252           </tr>
00253           <tr>
00254             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00255           </tr>
00256           <tr>
00257             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00258               <tr>
00259                 <td class="pageHeading"><?php echo HEADING_TITLE_PRODUCT; ?></td>
00260               </tr>
00261             </table></td>
00262           </tr>
00263           <tr>
00264             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00265               <tr>
00266                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00267                   <tr class="dataTableHeadingRow">
00268                     <td class="dataTableHeadingContent"><?php echo HEADER_COUPON_ID; ?></td>
00269                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_COUPON_NAME; ?></td>
00270                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_PRODUCT_ID; ?></td>
00271                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_PRODUCT_NAME; ?></td>
00272                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_ALLOW; ?></td>
00273                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_DENY; ?></td>
00274                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_REMOVE; ?></td>
00275                   </tr>
00276 <?php
00277     $pr_query_raw = "select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and product_id != '0'";
00278     $pr_split = new splitPageResults($_GET['ppage'], MAX_DISPLAY_RESTRICT_ENTRIES, $pr_query_raw, $pr_query_numrows);
00279     $pr_list = $db->Execute($pr_query_raw);
00280     while (!$pr_list->EOF) {
00281       $rows++;
00282       if (strlen($rows) < 2) {
00283         $rows = '0' . $rows;
00284       }
00285       if (((!$_GET['cid']) || (@$_GET['cid'] == $cr_list->fields['restrict_id'])) && (!$pInfo)) {
00286         $pInfo = new objectInfo($pr_list);
00287       }
00288         echo '          <tr class="dataTableRow">' . "\n";
00289 
00290      $coupon = $db->Execute("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'");
00291      $product_name = zen_get_products_name($pr_list->fields['product_id'], $_SESSION['languages_id']);
00292 ?>
00293                 <td class="dataTableContent"><?php echo $_GET['cid']; ?></td>
00294                 <td class="dataTableContent" align="center"><?php echo $coupon->fields['coupon_name']; ?></td>
00295                 <td class="dataTableContent" align="center"><?php echo $pr_list->fields['product_id']; ?></td>
00296                 <td class="dataTableContent" align="left"><?php echo '<strong>' . $product_name . '</strong><br />' . TEXT_CATEGORY . zen_get_categories_name_from_product($pr_list->fields['product_id']) . '<br />' . TEXT_MANUFACTURER . zen_get_products_manufacturers_name($pr_list->fields['product_id']); ?></td>
00297 <?php
00298                 if ($pr_list->fields['coupon_restrict']=='N') {
00299                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
00300                 } else {
00301                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
00302                 }
00303                 if ($pr_list->fields['coupon_restrict']=='Y') {
00304                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_DENY) . '</a></td>';
00305                 } else {
00306                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ALLOW) . '</a></td>';
00307                 }
00308                   echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=remove&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickActionRemove(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icons/delete.gif', IMAGE_REMOVE) . '</a></td>';
00309 ?>
00310               </tr>
00311 <?php
00312     $pr_list->MoveNext();
00313     }
00314 ?>
00315               <tr>
00316                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00317                   <tr>
00318                     <td class="smallText" valign="top"><?php echo $pr_split->display_count($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['ppage'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
00319                     <td class="smallText" align="right"><?php echo $pr_split->display_links($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['ppage'],zen_get_all_get_params(array('ppage','action', 'x', 'y')),'ppage'); ?></td>
00320                   </tr>
00321                 </table></td>
00322               </tr>
00323               <tr><form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_category&info=' . $cInfo->restrict_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00324                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00325                   <tr>
00326 <?php
00327       if (isset($_POST['cPath_prod'])) $current_category_id = $_POST['cPath_prod'];
00328       $products = $db->Execute("select p.products_id, pd.products_name from " .
00329       TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
00330       where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00331       and p.products_id = p2c.products_id and p2c.categories_id = '" . $_POST['cPath_prod'] . "'
00332       order by pd.products_name");
00333       $products_array = array();
00334 
00335       if (!$products->EOF) {
00336         $products_array[] = array('id' => '-1',
00337                                    'text' => TEXT_ALL_PRODUCTS_ADD);
00338         $products_array[] = array('id' => '-2',
00339                                    'text' => TEXT_ALL_PRODUCTS_REMOVE);
00340       }
00341 
00342       while (!$products->EOF) {
00343         $products_array[] = array('id'=>$products->fields['products_id'],
00344                                    'text'=>$products->fields['products_name']);
00345         $products->MoveNext();
00346       }
00347 ?>
00348                     <td class="smallText" valign="top"><?php echo HEADER_CATEGORY_NAME; ?></td>
00349                     <td class="smallText" align="left"></td><form name="restrict_product" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'info=' . $cInfo->restrict_id, 'NONSSL'); ?>">
00350                     <?php echo zen_hide_session_id(); ?>
00351                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('cPath_prod', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); ?></td></form>
00352 <?php if (sizeof($products_array) > 0) { ?>
00353                     <form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_product&info=' . $cInfo->restrict_id . '&build_cat=' . $current_category_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00354                     <td class="smallText" valign="top"><?php echo HEADER_PRODUCT_NAME; ?></td>
00355                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('products_drop', $products_array, $current_category_id); ?></td>
00356                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('restrict_status', $restrict_array); ?></td>
00357                     <td class="smallText" align="left"><input type="submit" name="add" value="Update"></td>
00358                     <td class="smallText" align="left">&nbsp;</td>
00359                     <td class="smallText" align="left">&nbsp;</td>
00360 <?php } else { ?>
00361                     <td class="smallText" align="left" colspan="6">&nbsp;</td>
00362 <?php } ?>
00363                   </tr>
00364                   <tr>
00365                     <td class="smallText" align="left" colspan = "9"><?php echo TEXT_INFO_ADD_DENY_ALL; ?></td>
00366                   </tr>
00367                 </table></td>
00368               </tr></form>
00369                 </table></td>
00370               </tr>
00371             </table></td>
00372           </tr>
00373           <tr>
00374             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00375           </tr>
00376           <tr>
00377             <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_COUPON_ADMIN, 'page=' . $_GET['page'] . '&cid=' . (!empty($cInfo->coupon_id) ? $cInfo->coupon_id : $_GET['cid']) . (isset($_GET['status']) ? '&status=' . $_GET['status'] : '')) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
00378           </tr>
00379         </table></td>
00380       </tr>
00381       <tr>
00382         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00383       </tr>
00384     </table></td>
00385 <!-- body_text_eof //-->
00386   </tr>
00387 </table>
00388 <!-- body_eof //-->
00389 
00390 <!-- footer //-->
00391 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00392 <!-- footer_eof //-->
00393 <br>
00394 <form name="actionRemove" id="actionRemove" action="#" method="post">
00395 <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
00396 <input type="hidden" name="actionRemoveProto" value="" />
00397 </form>
00398 <form name="switchStatus" id="switchStatus" action="#" method="post">
00399 <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
00400 <input type="hidden" name="switchStatusProto" value="" />
00401 </form>
00402 <script type="text/javascript">
00403 function divertClickActionRemove(href)
00404 {
00405         document.getElementById('actionRemove').action = href;
00406         document.getElementById('actionRemove').submit();
00407         return false;
00408 }
00409 function divertClickSwitchStatus(href)
00410 {
00411         document.getElementById('switchStatus').action = href;
00412         document.getElementById('switchStatus').submit();
00413         return false;
00414 }
00415 </script>
00416 </body>
00417 </html>
00418 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations