ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/downloads_manager.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   $languages = zen_get_languages();
00016 
00017   $action = (isset($_GET['action']) ? $_GET['action'] : '');
00018 
00019   if (zen_not_null($action)) {
00020     switch ($action) {
00021       case 'insert':
00022       case 'save':
00023         $sql = "update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_filename=:filename:, products_attributes_maxdays=:maxdays:, products_attributes_maxcount=:maxcount: where products_attributes_id='" . (int)$_GET['padID'] . "'";
00024         $sql = $db->bindVars($sql, ':filename:', $_POST['products_attributes_filename'], 'string');
00025         $sql = $db->bindVars($sql, ':maxdays:', $_POST['products_attributes_maxdays'], 'string');
00026         $sql = $db->bindVars($sql, ':maxcount:', $_POST['products_attributes_maxcount'], 'string');
00027         $db->Execute($sql);
00028         zen_redirect(zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . (int)$_GET['padID'] . '&page=' . (int)$_GET['page']));
00029         break;
00030     }
00031   }
00032 
00033 ?>
00034 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00035 <html <?php echo HTML_PARAMS; ?>>
00036 <head>
00037 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00038 <title><?php echo TITLE; ?></title>
00039 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00040 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00041 <script language="javascript" src="includes/menu.js"></script>
00042 <script language="javascript" src="includes/general.js"></script>
00043 <script language="javascript"><!--
00044 function go_option() {
00045   if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
00046     location = "<?php echo zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'option_page=' . ($_GET['option_page'] ? (int)$_GET['option_page'] : 1)); ?>&option_order_by="+document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value;
00047   }
00048 }
00049 //--></script>
00050 <script type="text/javascript">
00051   <!--
00052   function init()
00053   {
00054     cssjsmenu('navbar');
00055     if (document.getElementById)
00056     {
00057       var kill = document.getElementById('hoverJS');
00058       kill.disabled = true;
00059     }
00060   }
00061   // -->
00062 </script>
00063 </head>
00064 <!-- <body onload="init()"> -->
00065 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
00066 <!-- header //-->
00067 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00068 <!-- header_eof //-->
00069 
00070 <!-- body //-->
00071 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00072   <tr>
00073 <!-- body_text //-->
00074     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00075       <tr>
00076         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00077          <tr><?php echo zen_draw_form('search', FILENAME_DOWNLOADS_MANAGER, '', 'get'); ?>
00078             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00079             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
00080             <td class="smallText" align="right">
00081 <?php
00082 // show reset search
00083   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00084     echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
00085   }
00086   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
00087   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00088     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00089     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
00090   }
00091 ?>
00092             </td>
00093           </form></tr>
00094         </table></td>
00095       </tr>
00096 
00097       <tr>
00098         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
00099           <tr>
00100             <td class="smallText" align="center">
00101               <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . TEXT_INFO_FILENAME_MISSING; ?> &nbsp;&nbsp;&nbsp;<?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . TEXT_INFO_FILENAME_GOOD; ?>
00102             </td>
00103           </tr>
00104         </table></td>
00105       </tr>
00106 
00107 <!-- downloads by product_name//-->
00108       <tr>
00109         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
00110           <tr>
00111             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00112 
00113               <tr class="dataTableHeadingRow">
00114                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ATTRIBUTES_ID; ?></td>
00115                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_ID; ?></td>
00116                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT; ?></td>
00117                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODEL; ?></td>
00118                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_OPT_NAME; ?></td>
00119                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_OPT_VALUE; ?></td>
00120                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_FILENAME; ?></td>
00121                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
00122                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
00123                 <td class="dataTableHeadingContent">&nbsp;</td>
00124               </tr>
00125 
00126 <?php
00127 // create search filter
00128   $search = '';
00129   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00130     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00131     $search = " and pd.products_name like '%" . $keywords . "%' or pad.products_attributes_filename like '%" . $keywords . "%' or pd.products_description like '%" . $keywords . "%' or p.products_model like '%" . $keywords . "%'";
00132   }
00133 
00134 // order of display
00135   $order_by = " order by pd.products_name ";
00136 
00137 // create split page control
00138   $products_downloads_query_raw = ("select pad.*, pa.*, pd.*, p.* from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa on pad.products_attributes_id = pa.products_attributes_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id ='" . (int)$_SESSION['languages_id'] . "' left join " . TABLE_PRODUCTS . " p on p.products_id= pd.products_id " . " where pa.products_attributes_id = pad.products_attributes_id" . $search . $order_by);
00139   $products_downloads_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, $products_downloads_query_raw, $products_downloads_query_numrows);
00140   $products_downloads_query = $db->Execute($products_downloads_query_raw);
00141 
00142   while (!$products_downloads_query->EOF) {
00143 
00144     if ((!isset($_GET['padID']) || (isset($_GET['padID']) && ($_GET['padID'] == $products_downloads_query->fields['products_attributes_id']))) && !isset($padInfo)) {
00145       $padInfo_array = $products_downloads_query->fields;
00146       $padInfo = new objectInfo($padInfo_array);
00147     }
00148 
00149 // Moved to /admin/includes/configure.php
00150   if (!defined('DIR_FS_DOWNLOAD')) define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
00151 
00152   $filename_is_missing='';
00153   if ( !file_exists(DIR_FS_DOWNLOAD . $products_downloads_query->fields['products_attributes_filename']) ) {
00154     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
00155   } else {
00156     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
00157   }
00158 ?>
00159 <?php
00160       if (isset($padInfo) && is_object($padInfo) && ($products_downloads_query->fields['products_attributes_id'] == $padInfo->products_attributes_id)) {
00161         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&action=edit' . '&page=' . $_GET['page']) . '\'">' . "\n";
00162       } else {
00163         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID')) . 'padID=' . $products_downloads_query->fields['products_attributes_id'] . '&page=' . $_GET['page']) . '\'">' . "\n";
00164       }
00165 ?>
00166 
00167                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_id']; ?></td>
00168                 <td class="smallText"><?php echo $products_downloads_query->fields['products_id']; ?></td>
00169                 <td class="smallText"><?php echo $products_downloads_query->fields['products_name']; ?></td>
00170                 <td class="smallText"><?php echo $products_downloads_query->fields['products_model']; ?></td>
00171                 <td class="smallText"><?php echo zen_options_name($products_downloads_query->fields['options_id']); ?></td>
00172                 <td class="smallText"><?php echo zen_values_name($products_downloads_query->fields['options_values_id']); ?></td>
00173                 <td class="smallText"><?php echo $filename_is_missing . '&nbsp;' . $products_downloads_query->fields['products_attributes_filename']; ?></td>
00174                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_maxdays']; ?></td>
00175                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_maxcount']; ?></td>
00176                 <td class="dataTableContent" align="right"><?php if (isset($padInfo) && is_object($padInfo) && ($products_downloads_query->fields['products_attributes_id'] == $padInfo->products_attributes_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID')) . 'padID=' . $products_downloads_query->fields['products_attributes_id'] . '&page=' . $_GET['page']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
00177               </tr>
00178 <?php
00179   $products_downloads_query->MoveNext();
00180   }
00181 ?>
00182 <?php
00183 // bof: split page control and search filter
00184 ?>
00185               <tr>
00186                 <td colspan="10"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00187                   <tr>
00188                     <td class="smallText" valign="top"><?php echo $products_downloads_split->display_count($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_DOWNLOADS_MANAGER); ?></td>
00189 <!--
00190                     <td class="smallText" align="right"><?php echo $products_downloads_split->display_links($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
00191 -->
00192                     <td class="smallText" align="right"><?php echo $products_downloads_split->display_links($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
00193 
00194 
00195                   </tr>
00196 <?php
00197   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00198 ?>
00199                   <tr>
00200                     <td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
00201                   </tr>
00202 <?php
00203   }
00204 ?>
00205                 </table></td>
00206               </tr>
00207 <?php
00208 // eof: split page control
00209 ?>
00210             </table></td>
00211 
00212 <?php
00213   $heading = array();
00214   $contents = array();
00215 
00216   switch ($action) {
00217     case 'edit':
00218       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_PRODUCTS_DOWNLOAD . '</b>');
00219 
00220       $contents = array('form' => zen_draw_form('products_downloads_edit', FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&action=save' . '&page=' . $_GET['page']));
00221       $contents[] = array('text' => '<b>' . TEXT_PRODUCTS_NAME . $padInfo->products_name . '<br />' . TEXT_PRODUCTS_MODEL . $padInfo->products_model . '</b>');
00222       $contents[] = array('text' => '<br />' . TEXT_INFO_EDIT_INTRO);
00223       $contents[] = array('text' => '<br />' . TEXT_INFO_FILENAME . '<br />' . zen_draw_input_field('products_attributes_filename', $padInfo->products_attributes_filename));
00224       $contents[] = array('text' => '<br />' . TEXT_INFO_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $padInfo->products_attributes_maxdays));
00225       $contents[] = array('text' => '<br />' . TEXT_INFO_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $padInfo->products_attributes_maxcount));
00226       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . $padInfo->products_attributes_id) . '&page=' . $_GET['page'] . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
00227       break;
00228     default:
00229       if (isset($padInfo) && is_object($padInfo)) {
00230         $heading[] = array('text' => '<b>' . $padInfo->products_attributes_id . ' ' . $padInfo->products_attributes_filename . '</b>');
00231 
00232         $contents[] = array('align' => 'center', 'text' =>
00233           '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&page=' . $_GET['page'].'&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>' .
00234           '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $padInfo->products_id . '&current_categories_id=' . $padInfo->master_categories_id) . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '</a>'
00235           );
00236         $contents[] = array('text' => '<br />' . TEXT_PRODUCTS_NAME . $padInfo->products_name);
00237         $contents[] = array('text' => TEXT_PRODUCTS_MODEL . $padInfo->products_model);
00238         $contents[] = array('text' => TEXT_INFO_FILENAME . $padInfo->products_attributes_filename);
00239         $contents[] = array('text' => TEXT_INFO_MAX_DAYS . $padInfo->products_attributes_maxdays);
00240         $contents[] = array('text' => TEXT_INFO_MAX_COUNT . $padInfo->products_attributes_maxcount);
00241 
00242       }
00243       break;
00244   }
00245 
00246   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00247     echo '            <td width="25%" valign="top">' . "\n";
00248 
00249     $box = new box;
00250     echo $box->infoBox($heading, $contents);
00251 
00252     echo '            </td>' . "\n";
00253   }
00254 ?>
00255           </tr>
00256         </td></table>
00257       </tr>
00258 
00259     </table></td>
00260 <!-- downloads by product_name_eof //-->
00261   </tr>
00262 </table>
00263 <!-- body_text_eof //-->
00264 <!-- footer //-->
00265 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00266 <!-- footer_eof //-->
00267 </body>
00268 </html>
00269 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations