<?php
/*
 osCommRes, Services Oline 
http://www.oscommres.com 
Copyright (c) 2005 osCommRes 

Freeway eCommerce 
http://www.zac-ware.com/freeway 
Copyright (c) 2007 ZacWare 

Released under the GNU General Public License 
*/

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();


  $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS);

  if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_EVENTS); ?></td>
    <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y','events_id'))); ?></td>
  </tr>
</table>
<?php
  }
  $list_box_contents = array();
  if ($listing_split->number_of_rows > 0) {
    $listing_query = tep_db_query($listing_split->sql_query);

    $row = 0;
    $column = 0;
    while ($listing = tep_db_fetch_array($listing_query)) {

      $event_contents = array();
      for ($col=0, $n=sizeof($column_events_list); $col<$n; $col++) {
        switch ($column_events_list[$col]) {
          case 'EVENT_LIST_NAME':
            $lc_align = 'center';
            $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_SESSION_DETAILS, ($ecPath ? 'ecPath=' . $ecPath . '&' : '') . 'events_id=' . $listing['events_id']) . '">' . $listing['events_name'] . '</a><br>';
	    $event_contents[] = $lc_text;
            break;
	  case 'EVENT_LIST_FEES':
            $lc_align = 'center';
            $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_SESSION_DETAILS, ($ecPath ? 'ecPath=' . $ecPath . '&' : '') . 'events_id=' . $listing['events_id']) . '">' . $currencies->display_price($listing['events_fees'], tep_get_tax_rate($listing['events_tax_class_id'])) . '</a><br>';
	    $event_contents[] = $lc_text;
            break;	    
          case 'EVENT_LIST_IMAGE':
            $lc_align = 'left';
            $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_SESSION_DETAILS, ($ecPath ? 'ecPath=' . $ecPath . '&' : '') . 'events_id=' . $listing['events_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['events_image'], $listing['events_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
	    $event_contents[] = $lc_text;
            break;
        }
        

      }
      $lc_text = implode('<br>', $event_contents);
      $list_box_contents[$row][$column] = array('align' => 'center',
                                                'params' => 'class="productListing-data"',
                                                'text'  => $lc_text);
      $column ++;
      if ($column >= 3) {
        $row ++;
        $column = 0;
      }
    }

    new productListingBox($list_box_contents);
  } else {
    $list_box_contents = array();

    $list_box_contents[0] = array('params' => 'class="productListing-odd"');
    $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                   'text' => TEXT_NO_EVENTS);

    new productListingBox($list_box_contents);
  }

  if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_EVENTS); ?></td>
    <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
  </tr>
  
</table>
<?php
  }
?>