ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/featured.php
Go to the documentation of this file.
00001 <?php
00010   require('includes/application_top.php');
00011 
00012   require(DIR_WS_CLASSES . 'currencies.php');
00013   $currencies = new currencies();
00014 
00015   $action = (isset($_GET['action']) ? $_GET['action'] : '');
00016 
00017   if (zen_not_null($action)) {
00018     switch ($action) {
00019       case 'setflag':
00020         if (isset($_POST['flag']) && ($_POST['flag'] == 1 || $_POST['flag'] == 0))
00021         {
00022           zen_set_featured_status($_GET['id'], $_POST['flag']);
00023           zen_redirect(zen_href_link(FILENAME_FEATURED, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'fID=' . $_GET['id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''), 'NONSSL'));
00024         }
00025         break;
00026       case 'insert':
00027         if ($_POST['products_id'] < 1) {
00028           $messageStack->add_session(ERROR_NOTHING_SELECTED, 'caution');
00029         } else {
00030         $products_id = zen_db_prepare_input($_POST['products_id']);
00031 
00032         $featured_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start']));
00033         $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end']));
00034 
00035         $db->Execute("insert into " . TABLE_FEATURED . "
00036                     (products_id, featured_date_added, expires_date, status, featured_date_available)
00037                     values ('" . (int)$products_id . "',
00038                             now(),
00039                             '" . zen_db_input($expires_date) . "', '1', '" . zen_db_input($featured_date_available) . "')");
00040 
00041         $new_featured = $db->Execute("select featured_id from " . TABLE_FEATURED . " where products_id='" . (int)$products_id . "'");
00042         } // nothing selected to add
00043         if ($_GET['go_back'] == 'ON'){
00044           zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_id . '&current_category_id=' . $_GET['current_category_id']));
00045         } else {
00046           zen_redirect(zen_href_link(FILENAME_FEATURED, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'fID=' . $new_featured->fields['featured_id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')));
00047         }
00048         break;
00049       case 'update':
00050         $featured_id = zen_db_prepare_input($_POST['featured_id']);
00051 
00052         $featured_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start']));
00053         $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end']));
00054 
00055         $db->Execute("update " . TABLE_FEATURED . "
00056                       set featured_last_modified = now(),
00057                           expires_date = '" . zen_db_input($expires_date) . "',
00058                           featured_date_available = '" . zen_db_input($featured_date_available) . "'
00059                       where featured_id = '" . (int)$featured_id . "'");
00060 
00061         zen_redirect(zen_href_link(FILENAME_FEATURED, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . 'fID=' . (int)$featured_id . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')));
00062         break;
00063       case 'deleteconfirm':
00064         // demo active test
00065         if (zen_admin_demo()) {
00066           $_GET['action']= '';
00067           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00068           zen_redirect(zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')));
00069         }
00070         $featured_id = zen_db_prepare_input($_POST['fID']);
00071 
00072         $db->Execute("delete from " . TABLE_FEATURED . "
00073                       where featured_id = '" . (int)$featured_id . "'");
00074 
00075         zen_redirect(zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')));
00076         break;
00077       case 'pre_add_confirmation':
00078       // check for blank or existing featured
00079         $skip_featured = false;
00080         if (empty($_POST['pre_add_products_id'])) {
00081           $skip_featured = true;
00082           $messageStack->add_session(WARNING_FEATURED_PRE_ADD_EMPTY, 'caution');
00083         }
00084 
00085         if ($skip_featured == false) {
00086           $sql = "select products_id from " . TABLE_PRODUCTS . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'";
00087           $check_featured = $db->Execute($sql);
00088           if ($check_featured->RecordCount() < 1) {
00089             $skip_featured = true;
00090             $messageStack->add_session(WARNING_FEATURED_PRE_ADD_BAD_PRODUCTS_ID, 'caution');
00091           }
00092         }
00093 
00094         if ($skip_featured == false) {
00095           $sql = "select featured_id from " . TABLE_FEATURED . " where products_id='" . (int)$_POST['pre_add_products_id'] . "'";
00096           $check_featured = $db->Execute($sql);
00097           if ($check_featured->RecordCount() > 0) {
00098             $skip_featured = true;
00099             $messageStack->add_session(WARNING_FEATURED_PRE_ADD_DUPLICATE, 'caution');
00100           }
00101         }
00102 
00103         if ($skip_featured == true) {
00104           zen_redirect(zen_href_link(FILENAME_FEATURED, (isset($_GET['page']) && $_GET['page'] > 0 ? 'page=' . $_GET['page'] . '&' : '') . ((int)$check_featured->fields['featured_id'] > 0 ? 'fID=' . (int)$check_featured->fields['featured_id'] : '' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))));
00105         }
00106       // add empty featured
00107 
00108         $featured_date_available = ((zen_db_prepare_input($_POST['start']) == '') ? '0001-01-01' : zen_date_raw($_POST['start']));
00109         $expires_date = ((zen_db_prepare_input($_POST['end']) == '') ? '0001-01-01' : zen_date_raw($_POST['end']));
00110 
00111         $products_id = zen_db_prepare_input($_POST['pre_add_products_id']);
00112         $db->Execute("insert into " . TABLE_FEATURED . "
00113                     (products_id, featured_date_added, expires_date, status, featured_date_available)
00114                     values ('" . (int)$products_id . "',
00115                             now(),
00116                             '" . zen_db_input($expires_date) . "', '1', '" . zen_db_input($featured_date_available) . "')");
00117 
00118         $new_featured = $db->Execute("select featured_id from " . TABLE_FEATURED . " where products_id='" . (int)$products_id . "'");
00119 
00120         $messageStack->add_session(SUCCESS_FEATURED_PRE_ADD, 'success');
00121         zen_redirect(zen_href_link(FILENAME_FEATURED, 'action=edit' . '&fID=' . $new_featured->fields['featured_id'] . '&manual=1'));
00122         break;
00123 
00124     }
00125   }
00126 ?>
00127 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00128 <html <?php echo HTML_PARAMS; ?>>
00129 <head>
00130 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00131 <title><?php echo TITLE; ?></title>
00132 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00133 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00134 <script language="javascript" src="includes/menu.js"></script>
00135 <script language="javascript" src="includes/general.js"></script>
00136 <?php
00137   if ( ($action == 'new') || ($action == 'edit') ) {
00138 ?>
00139 <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
00140 <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
00141 <?php
00142   }
00143 ?>
00144 <script type="text/javascript">
00145   <!--
00146   function init()
00147   {
00148     cssjsmenu('navbar');
00149     if (document.getElementById)
00150     {
00151       var kill = document.getElementById('hoverJS');
00152       kill.disabled = true;
00153     }
00154   }
00155   // -->
00156 </script>
00157 </head>
00158 <body onload="init()">
00159 <div id="spiffycalendar" class="text"></div>
00160 <!-- header //-->
00161 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00162 <!-- header_eof //-->
00163 
00164 <!-- body //-->
00165 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00166   <tr>
00167 <!-- body_text //-->
00168     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00169 
00170       <tr>
00171         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00172          <tr><?php echo zen_draw_form('search', FILENAME_FEATURED, '', 'get'); ?>
00173             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00174             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
00175             <td class="smallText" align="right">
00176 <?php
00177 // show reset search
00178   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00179     echo '<a href="' . zen_href_link(FILENAME_FEATURED) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
00180   }
00181   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
00182   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00183     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00184     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
00185   }
00186 ?>
00187             </td>
00188           </form></tr>
00189           <tr>
00190             <td colspan="3" class="main"><?php echo TEXT_STATUS_WARNING; ?></td>
00191           </tr>
00192         </table></td>
00193       </tr>
00194 
00195 <?php
00196   if (empty($action)) {
00197 ?>
00198                     <td align="center"><?php echo '<a href="' . zen_href_link(FILENAME_FEATURED, ((isset($_GET['page']) && $_GET['page'] > 0) ? 'page=' . $_GET['page'] . '&' : '') . 'action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td>
00199 <?php
00200   }
00201 ?>
00202 <?php
00203   if ( ($action == 'new') || ($action == 'edit') ) {
00204     $form_action = 'insert';
00205     if ( ($action == 'edit') && isset($_GET['fID']) ) {
00206       $form_action = 'update';
00207 
00208       $product = $db->Execute("select p.products_id, pd.products_name, p.products_price, p.products_priced_by_attribute,
00209                                       f.expires_date, f.featured_date_available
00210                                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
00211                                         TABLE_FEATURED . " f
00212                                where p.products_id = pd.products_id
00213                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00214                                and p.products_id = f.products_id
00215                                and f.featured_id = '" . (int)$_GET['fID'] . "'");
00216 
00217       $fInfo = new objectInfo($product->fields);
00218 
00219       if ($fInfo->products_priced_by_attribute == '1') {
00220         $fInfo->products_price = zen_get_products_base_price($product->fields['products_id']);
00221       }
00222 
00223     } else {
00224       $fInfo = new objectInfo(array());
00225 
00226 // create an array of featured products, which will be excluded from the pull down menu of products
00227 // (when creating a new featured product)
00228       $featured_array = array();
00229       $featured = $db->Execute("select p.products_id, p.products_model
00230                                 from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " f
00231                                 where f.products_id = p.products_id");
00232 
00233       while (!$featured->EOF) {
00234         $featured_array[] = $featured->fields['products_id'];
00235         $featured->MoveNext();
00236       }
00237 
00238 // do not include things that cannot go in the cart
00239       $not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'");
00240 
00241       while (!$not_for_cart->EOF) {
00242         $featured_array[] = $not_for_cart->fields['products_id'];
00243         $not_for_cart->MoveNext();
00244       }
00245     }
00246 ?>
00247 <script language="javascript">
00248 var StartDate = new ctlSpiffyCalendarBox("StartDate", "new_featured", "start", "btnDate1","<?php echo (($fInfo->featured_date_available == '0001-01-01') ? '' : zen_date_short($fInfo->featured_date_available)); ?>",scBTNMODE_CUSTOMBLUE);
00249 var EndDate = new ctlSpiffyCalendarBox("EndDate", "new_featured", "end", "btnDate2","<?php echo (($fInfo->expires_date == '0001-01-01') ? '' : zen_date_short($fInfo->expires_date)); ?>",scBTNMODE_CUSTOMBLUE);
00250 </script>
00251 
00252       <tr>
00253       <?php echo zen_draw_form('new_featured', FILENAME_FEATURED, zen_get_all_get_params(array('action', 'info', 'fID')) . 'action=' . $form_action . '&go_back=' . $_GET['go_back']); ?><?php if ($form_action == 'update') echo zen_draw_hidden_field('featured_id', $_GET['fID']); ?>
00254         <td><br><table border="0" cellspacing="0" cellpadding="2">
00255           <tr>
00256             <td class="main"><?php echo TEXT_FEATURED_PRODUCT; ?>&nbsp;</td>
00257             <td class="main"><?php echo (isset($fInfo->products_name)) ? $fInfo->products_name . ' <small>(' . $currencies->format($fInfo->products_price) . ')</small>' : zen_draw_products_pull_down('products_id', 'size="15" style="font-size:12px"', $featured_array, true, $_GET['add_products_id'], true); echo zen_draw_hidden_field('products_price', (isset($fInfo->products_price) ? $fInfo->products_price : '')); ?></td>
00258           </tr>
00259           <tr>
00260             <td class="main"><?php echo TEXT_FEATURED_AVAILABLE_DATE; ?>&nbsp;</td>
00261             <td class="main"><script language="javascript">StartDate.writeControl(); StartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
00262           </tr>
00263           <tr>
00264             <td class="main"><?php echo TEXT_FEATURED_EXPIRES_DATE; ?>&nbsp;</td>
00265             <td class="main"><script language="javascript">EndDate.writeControl(); EndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
00266           </tr>
00267         </table></td>
00268       </tr>
00269       <tr>
00270         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
00271           <tr>
00272             <td colspan="2" 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)). ((int)$_GET['manual'] == 0 ? '&nbsp;&nbsp;&nbsp;<a href="' . ($_GET['go_back'] == 'ON' ? zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $_GET['add_products_id'] . '&current_category_id=' . $_GET['current_category_id']) : zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . (isset($_GET['fID']) ? '&fID=' . $_GET['fID'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''))) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>' : ''); ?></td>
00273           </tr>
00274         </table></td>
00275       </form></tr>
00276 <?php
00277   } else {
00278 ?>
00279       <tr>
00280         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00281           <tr>
00282             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00283               <tr class="dataTableHeadingRow">
00284                 <td class="dataTableHeadingContent" align="right"><?php echo 'ID#'; ?>&nbsp;</td>
00285                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
00286                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
00287                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_AVAILABLE_DATE; ?></td>
00288                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_EXPIRES_DATE; ?></td>
00289                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
00290                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00291               </tr>
00292 <?php
00293 // create search filter
00294   $search = '';
00295   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00296     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00297     $search = " and (pd.products_name like '%" . $keywords . "%' or pd.products_description like '%" . $keywords . "%' or p.products_model like '%" . $keywords . "%')";
00298   }
00299 
00300 // order of display
00301   $order_by = " order by pd.products_name ";
00302   $featured_query_raw = "select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_priced_by_attribute, f.featured_id, f.featured_date_added, f.featured_last_modified, f.expires_date, f.date_status_change, f.status, f.featured_date_available from " . TABLE_PRODUCTS . " p, " . TABLE_FEATURED . " f, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_id = f.products_id"  . $search . $order_by;
00303 
00304 // Split Page
00305 // reset page when page is unknown
00306 if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['fID'] != '') {
00307   $old_page = $_GET['page'];
00308   $check_page = $db->Execute($featured_query_raw);
00309   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) {
00310     $check_count=1;
00311     while (!$check_page->EOF) {
00312       if ($check_page->fields['featured_id'] == $_GET['fID']) {
00313         break;
00314       }
00315       $check_count++;
00316       $check_page->MoveNext();
00317     }
00318     $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) !=0 ? .5 : 0)),0);
00319     $page = $_GET['page'];
00320     if ($old_page != $_GET['page']) {
00321 // do nothing
00322     }
00323   } else {
00324     $_GET['page'] = 1;
00325   }
00326 }
00327 
00328 
00329 // create split page control
00330     $featured_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN, $featured_query_raw, $featured_query_numrows);
00331     $featured = $db->Execute($featured_query_raw);
00332     while (!$featured->EOF) {
00333       if ((!isset($_GET['fID']) || (isset($_GET['fID']) && ($_GET['fID'] == $featured->fields['featured_id']))) && !isset($fInfo)) {
00334         $products = $db->Execute("select products_image
00335                                   from " . TABLE_PRODUCTS . "
00336                                   where products_id = '" . (int)$featured->fields['products_id'] . "'");
00337 
00338         $fInfo_array = array_merge($featured->fields, $products->fields);
00339         $fInfo = new objectInfo($fInfo_array);
00340       }
00341 
00342       if (isset($fInfo) && is_object($fInfo) && ($featured->fields['featured_id'] == $fInfo->featured_id)) {
00343         echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $fInfo->featured_id . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n";
00344       } else {
00345         echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $featured->fields['featured_id'] . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n";
00346       }
00347 
00348 ?>
00349                 <td  class="dataTableContent" align="right"><?php echo $featured->fields['products_id']; ?>&nbsp;</td>
00350                 <td  class="dataTableContent"><?php echo $featured->fields['products_name']; ?></td>
00351                 <td  class="dataTableContent" align="left"><?php echo $featured->fields['products_model']; ?>&nbsp;</td>
00352                 <td  class="dataTableContent" align="center"><?php echo (($featured->fields['featured_date_available'] != '0001-01-01' and $featured->fields['featured_date_available'] !='') ? zen_date_short($featured->fields['featured_date_available']) : TEXT_NONE); ?></td>
00353                 <td  class="dataTableContent" align="center"><?php echo (($featured->fields['expires_date'] != '0001-01-01' and $featured->fields['expires_date'] !='') ? zen_date_short($featured->fields['expires_date']) : TEXT_NONE); ?></td>
00354                 <td  class="dataTableContent" align="center">
00355 <?php
00356       if ($featured->fields['status'] == '1') {
00357         echo zen_draw_form('setflag_products', FILENAME_FEATURED, 'action=setflag&id=' . $featured->fields['featured_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''));?>
00358         <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_green_on.gif" title="<?php echo IMAGE_ICON_STATUS_ON; ?>" />
00359         <input type="hidden" name="flag" value="0" />
00360         </form>
00361 <?php
00362 //        echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'action=setflag&flag=0&id=' . $featured->fields['featured_id'] . '&page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''), 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
00363       } else {
00364         echo zen_draw_form('setflag_products', FILENAME_FEATURED, 'action=setflag&id=' . $featured->fields['featured_id'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''));?>
00365         <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_red_on.gif" title="<?php echo IMAGE_ICON_STATUS_OFF; ?>" />
00366         <input type="hidden" name="flag" value="1" />
00367         </form>
00368 <?php
00369 //        echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'action=setflag&flag=1&id=' . $featured->fields['featured_id'] . '&page=' . $_GET['page'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''), 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
00370       }
00371 ?>
00372                 </td>
00373                 <td class="dataTableContent" align="right">
00374                   <?php echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $featured->fields['featured_id'] . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
00375                                           <?php echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $featured->fields['featured_id'] . '&action=delete' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
00376                   <?php if (isset($fInfo) && is_object($fInfo) && ($featured->fields['featured_id'] == $fInfo->featured_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_FEATURED, zen_get_all_get_params(array('fID')) . 'fID=' . $featured->fields['featured_id'] . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
00377                                         </td>
00378       </tr>
00379 <?php
00380       $featured->MoveNext();
00381     }
00382 ?>
00383               <tr>
00384                 <td colspan="4"><table border="0" width="100%" cellpadding="0"cellspacing="2">
00385                   <tr>
00386                     <td class="smallText" valign="top"><?php echo $featured_split->display_count($featured_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_FEATURED); ?></td>
00387                     <td class="smallText" align="right"><?php echo $featured_split->display_links($featured_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params( array( 'page', 'fID' ))); ?></td>
00388                   </tr>
00389 <?php
00390   if (empty($action)) {
00391 ?>
00392                   <tr>
00393                     <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?></td>
00394                   </tr>
00395 <?php
00396   }
00397 ?>
00398                 </table></td>
00399               </tr>
00400             </table></td>
00401 <?php
00402   $heading = array();
00403   $contents = array();
00404 
00405   switch ($action) {
00406     case 'delete':
00407       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_FEATURED . '</b>');
00408 
00409       $contents = array('form' => zen_draw_form('featured', FILENAME_FEATURED, 'page=' . $_GET['page'] . '&action=deleteconfirm' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . zen_draw_hidden_field('fID', $fInfo->featured_id));
00410       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
00411       $contents[] = array('text' => '<br /><b>' . $fInfo->products_name . '</b>');
00412       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $fInfo->featured_id . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
00413       break;
00414     case 'pre_add':
00415       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_PRE_ADD_FEATURED . '</b>');
00416       $contents = array('form' => zen_draw_form('featured', FILENAME_FEATURED, 'action=pre_add_confirmation' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')));
00417       $contents[] = array('text' => TEXT_INFO_PRE_ADD_INTRO);
00418       $contents[] = array('text' => '<br />' . TEXT_PRE_ADD_PRODUCTS_ID . '<br>' . zen_draw_input_field('pre_add_products_id', '', zen_set_field_length(TABLE_FEATURED, 'products_id')));
00419       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '&nbsp;<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . ($fInfo->featured_id > 0 ? '&fID=' . $fInfo->featured_id : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
00420       break;
00421     default:
00422       if (is_object($fInfo)) {
00423         $heading[] = array('text' => '<b>' . $fInfo->products_name . '</b>');
00424 
00425         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $fInfo->featured_id . '&action=edit' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_FEATURED, 'page=' . $_GET['page'] . '&fID=' . $fInfo->featured_id . '&action=delete' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
00426         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'action=edit&products_filter=' . $fInfo->products_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '</a>');
00427         $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($fInfo->featured_date_added));
00428         $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($fInfo->featured_last_modified));
00429         $contents[] = array('align' => 'center', 'text' => '<br />' . zen_info_image($fInfo->products_image, $fInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT));
00430 
00431         $contents[] = array('text' => '<br />' . TEXT_INFO_AVAILABLE_DATE . ' <b>' . (($fInfo->featured_date_available != '0001-01-01' and $fInfo->featured_date_available !='') ? zen_date_short($fInfo->featured_date_available) : TEXT_NONE) . '</b>');
00432         $contents[] = array('text' => TEXT_INFO_EXPIRES_DATE . ' <b>' . (($fInfo->expires_date != '0001-01-01' and $fInfo->expires_date !='') ? zen_date_short($fInfo->expires_date) : TEXT_NONE) . '</b>');
00433         $contents[] = array('text' => '<br />' . TEXT_INFO_STATUS_CHANGE . ' ' . zen_date_short($fInfo->date_status_change));
00434         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CATEGORIES, '&action=new_product' . '&cPath=' . zen_get_product_path($fInfo->products_id, 'override') . '&pID=' . $fInfo->products_id . '&product_type=' . zen_get_products_type($fInfo->products_id)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . '</a>');
00435 
00436         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_FEATURED, 'action=pre_add' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_select.gif', IMAGE_SELECT) . '<br />' . TEXT_INFO_MANUAL . '</a><br /><br />');
00437       } else {
00438         $heading[] = array('text' => '<b>' . TEXT_NONE . '</b>');
00439         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_FEATURED, 'action=pre_add' . ((isset($_GET['page']) && $_GET['page'] > 0) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_select.gif', IMAGE_SELECT) . '<br />' . TEXT_INFO_MANUAL . '</a><br /><br />');
00440       }
00441       break;
00442   }
00443   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00444     echo '            <td width="25%" valign="top">' . "\n";
00445 
00446     $box = new box;
00447     echo $box->infoBox($heading, $contents);
00448 
00449     echo '            </td>' . "\n";
00450   }
00451 }
00452 ?>
00453           </tr>
00454         </table></td>
00455       </tr>
00456     </table></td>
00457 <!-- body_text_eof //-->
00458   </tr>
00459 </table>
00460 <!-- body_eof //-->
00461 
00462 <!-- footer //-->
00463 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00464 <!-- footer_eof //-->
00465 </body>
00466 </html>
00467 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations