home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 90 / PIWD90.iso / pc / contents / ecommerce / software / osCommerce.exe / oscommerce-2.2ms2 / catalog / reviews.php < prev    next >
PHP Script  |  2003-06-09  |  7KB  |  155 lines

  1. <?php
  2. /*
  3.   $Id: reviews.php,v 1.51 2003/06/09 23:03:55 hpdl Exp $
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2003 osCommerce
  9.  
  10.   Released under the GNU General Public License
  11. */
  12.  
  13.   require('includes/application_top.php');
  14.  
  15.   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_REVIEWS);
  16.  
  17.   $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_REVIEWS));
  18. ?>
  19. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  20. <html <?php echo HTML_PARAMS; ?>>
  21. <head>
  22. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  23. <title><?php echo TITLE; ?></title>
  24. <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  25. <link rel="stylesheet" type="text/css" href="stylesheet.css">
  26. </head>
  27. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  28. <!-- header //-->
  29. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  30. <!-- header_eof //-->
  31.  
  32. <!-- body //-->
  33. <table border="0" width="100%" cellspacing="3" cellpadding="3">
  34.   <tr>
  35.     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  36. <!-- left_navigation //-->
  37. <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  38. <!-- left_navigation_eof //-->
  39.     </table></td>
  40. <!-- body_text //-->
  41.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  42.       <tr>
  43.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  44.           <tr>
  45.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  46.             <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_reviews_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  47.           </tr>
  48.         </table></td>
  49.       </tr>
  50.       <tr>
  51.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  52.       </tr>
  53.       <tr>
  54.         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  55. <?php
  56.   $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id DESC";
  57.   $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
  58.  
  59.   if ($reviews_split->number_of_rows > 0) {
  60.     if ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')) {
  61. ?>
  62.           <tr>
  63.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  64.               <tr>
  65.                 <td class="smallText"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></td>
  66.                 <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
  67.               </tr>
  68.             </table></td>
  69.           </tr>
  70.           <tr>
  71.             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  72.           </tr>
  73. <?php
  74.     }
  75.  
  76.     $reviews_query = tep_db_query($reviews_split->sql_query);
  77.     while ($reviews = tep_db_fetch_array($reviews_query)) {
  78. ?>
  79.           <tr>
  80.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  81.               <tr>
  82.                 <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $reviews['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '"><u><b>' . $reviews['products_name'] . '</b></u></a> <span class="smallText">' . sprintf(TEXT_REVIEW_BY, tep_output_string_protected($reviews['customers_name'])) . '</span>'; ?></td>
  83.                 <td class="smallText" align="right"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, tep_date_long($reviews['date_added'])); ?></td>
  84.               </tr>
  85.             </table></td>
  86.           </tr>
  87.           <tr>
  88.             <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  89.               <tr class="infoBoxContents">
  90.                 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  91.                   <tr>
  92.                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  93.                     <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" align="center" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $reviews['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '">' . tep_image(DIR_WS_IMAGES . $reviews['products_image'], $reviews['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
  94.                     <td valign="top" class="main"><?php echo tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>') . ((strlen($reviews['reviews_text']) >= 100) ? '..' : '') . '<br><br><i>' . sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</i>'; ?></td>
  95.                     <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  96.                   </tr>
  97.                 </table></td>
  98.               </tr>
  99.             </table></td>
  100.           </tr>
  101.           <tr>
  102.             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  103.           </tr>
  104. <?php
  105.     }
  106. ?>
  107. <?php
  108.   } else {
  109. ?>
  110.           <tr>
  111.             <td><?php new infoBox(array(array('text' => TEXT_NO_REVIEWS))); ?></td>
  112.           </tr>
  113.           <tr>
  114.             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  115.           </tr>
  116. <?php
  117.   }
  118.  
  119.   if (($reviews_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
  120. ?>
  121.           <tr>
  122.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  123.               <tr>
  124.                 <td class="smallText"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></td>
  125.                 <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
  126.               </tr>
  127.             </table></td>
  128.           </tr>
  129.           <tr>
  130.             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  131.           </tr>
  132. <?php
  133.   }
  134. ?>
  135.         </table></td>
  136.       </tr>
  137.     </table></td>
  138. <!-- body_text_eof //-->
  139.     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  140. <!-- right_navigation //-->
  141. <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
  142. <!-- right_navigation_eof //-->
  143.     </table></td>
  144.   </tr>
  145. </table>
  146. <!-- body_eof //-->
  147.  
  148. <!-- footer //-->
  149. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  150. <!-- footer_eof //-->
  151. <br>
  152. </body>
  153. </html>
  154. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  155.