[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/templates/template_default/templates/ -> tpl_modules_downloads.php (source)

   1  <?php
   2  /**

   3   * Module Template

   4   *

   5   * @package templateSystem

   6   * @copyright Copyright 2003-2006 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: tpl_modules_downloads.php 4829 2006-10-24 21:39:15Z drbyte $

  10   */
  11  /**

  12   * require the downloads module

  13   */
  14    require(DIR_WS_MODULES . zen_get_module_directory('downloads.php'));
  15  ?>
  16  
  17  <?php
  18  // download is available

  19    if ($downloads->RecordCount() > 0) {
  20  ?>
  21  
  22  <table border="0" width="100%" cellspacing="0" cellpadding="0" id="downloads">
  23  <caption><h4><?php echo HEADING_DOWNLOAD; ?></h4></caption>
  24    <tr class="tableHeading">
  25        <th scope="col" id="dlFileNameHeading"><?php echo TABLE_HEADING_PRODUCT_NAME; ?></th>
  26        <th scope="col" id="dlByteSize"><?php echo TABLE_HEADING_BYTE_SIZE; ?></th>
  27        <th scope="col" id="dlButtonHeading"><?php echo TABLE_HEADING_DOWNLOAD_FILENAME; ?></th>
  28        <th scope="col" id="dlDateHeading"><?php echo TABLE_HEADING_DOWNLOAD_DATE; ?></th>
  29        <th scope="col" id="dlCountHeading"><?php echo TABLE_HEADING_DOWNLOAD_COUNT; ?></th>
  30        <th scope="col" id="dlButtonHeading">&nbsp;</th>
  31            </tr>
  32  <!-- list of products -->
  33  <?php
  34      while (!$downloads->EOF) {
  35  // MySQL 3.22 does not have INTERVAL

  36        list($dt_year, $dt_month, $dt_day) = explode('-', $downloads->fields['date_purchased_day']);
  37        $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads->fields['download_maxdays'], $dt_year);
  38        $download_expiry = date('Y-m-d H:i:s', $download_timestamp);
  39  ?>
  40            <tr class="tableRow">
  41  <!-- left box -->
  42  <?php
  43  // The link will appear only if:

  44  // - Download remaining count is > 0, AND

  45  // - The file is present in the DOWNLOAD directory, AND EITHER

  46  // - No expiry date is enforced (maxdays == 0), OR

  47  // - The expiry date is not reached

  48  
  49  //      if ( ($downloads->fields['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename'])) && ( ($downloads->fields['download_maxdays'] == 0) || ($download_timestamp > time())) ) {

  50        if ( (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) {
  51          $zv_filesize = filesize (DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']);
  52          if ($zv_filesize >= 1024) {
  53            $zv_filesize = number_format($zv_filesize/1024/1000,2);
  54            $zv_filesize_units = TEXT_FILESIZE_MEGS;
  55          } else {
  56            $zv_filesize = number_format($zv_filesize);
  57            $zv_filesize_units = TEXT_FILESIZE_BYTES;
  58          }
  59  ?>
  60        <td class=""><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads->fields['orders_products_download_id']) . '">' . $downloads->fields['products_name'] . '</a>'; ?></td>
  61        <td class=""><?php echo $zv_filesize . $zv_filesize_units; ?></td>
  62        <td class=""><?php echo $downloads->fields['orders_products_filename']; ?></td>
  63  <?php } else { ?>
  64        <td class=""><?php echo $downloads->fields['products_name']; ?></td>
  65        <td class=""><?php echo $zv_filesize . $zv_filesize_units; ?></td>
  66        <td class=""><?php echo $downloads->fields['orders_products_filename']; ?></td>
  67  <?php
  68        }
  69  ?>
  70        <td class=""><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED : zen_date_short($download_expiry)); ?></td>
  71        <td class="centeredContent"><?php echo ($downloads->fields['download_maxdays'] == 0 ? TEXT_DOWNLOADS_UNLIMITED_COUNT : $downloads->fields['download_count']); ?></td>
  72        <td class="centeredContent"><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads->fields['orders_products_download_id']) . '">' . zen_image_button(BUTTON_IMAGE_DOWNLOAD, BUTTON_DOWNLOAD_ALT) . '</a>'; ?></td>
  73      </tr>
  74  <?php
  75      $downloads->MoveNext();
  76      }
  77  ?>
  78    </table>
  79  
  80  <?php
  81  // old way

  82  //    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

  83  // new way

  84        if (!($_GET['main_page']==FILENAME_ACCOUNT_HISTORY_INFO)) {
  85  ?>
  86  <p><?php printf(FOOTER_DOWNLOAD, '<a href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p>
  87  <?php } else { ?>
  88  <?php
  89  // other pages if needed

  90        }
  91  ?>
  92  
  93  <?php
  94  } // $downloads->RecordCount() > 0

  95  ?>
  96  
  97  <?php
  98  // download is not available yet

  99  if ($downloads_check_query->RecordCount() > 0 and $downloads->RecordCount() < 1) {
 100  ?>
 101   <fieldset><?php echo DOWNLOADS_CONTROLLER_ON_HOLD_MSG ?></fieldset>
 102  <?php
 103  }
 104  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics