<?php 

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


echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?>

<table border="0" width="100%" cellspacing="3" cellpadding="0">
	<tr>
		<td class="cat_description"><?php echo TABLE_HEADING_TOPICS; ?></td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator(); ?></td>
	</tr>
	<tr>
<?php
$listing_numrows_sql = $listing_sql;
$listing_split = new splitPageResultsOLD($HTTP_GET_VARS['page'], MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, $listing_sql, $listing_numrows);
// fix counted faqs
$listing_numrows = tep_db_query($listing_numrows_sql);
$listing_numrows = tep_db_num_rows($listing_numrows);

if ($listing_numrows > 0 && (FAQDESK_PREV_NEXT_BAR_LOCATION == '1' || FAQDESK_PREV_NEXT_BAR_LOCATION == '3')) {
?>

	<tr>
		<td>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
	<tr>
		<td class="smallText">&nbsp;
<?php 
echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_ARTICLES);
?>
		&nbsp;</td>
		<td align="right" class="smallText">&nbsp;
<?php
echo TEXT_RESULT_PAGE;
echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, MAX_DISPLAY_FAQDESK_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y')));
?>
		&nbsp;</td>
	</tr>
</table>

		</td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator(); ?></td>
	</tr>

<?php
}
?>

	<tr>
		<td>

<?php
$list_box_contents = array();
$list_box_contents[] = array('params' => 'class="productListing-heading"');
$cur_row = sizeof($list_box_contents) - 1;

$cl_size = sizeof($column_list);
for ($col=0; $col<$cl_size; $col++) {
	switch ($column_list[$col]) {
	case 'FAQDESK_DATE_AVAILABLE':
		$lc_text = TABLE_HEADING_DATE_AVAILABLE;
		$lc_align = 'left';
		break;
	case 'FAQDESK_ANSWER_SHORT':
		$lc_text = TABLE_HEADING_ARTICLE_SHORTTEXT;
		$lc_align = 'left';
		break;
	case 'FAQDESK_ANSWER_LONG':
		$lc_text = TABLE_HEADING_ARTICLE_DESCRIPTION;
		$lc_align = 'left';
		break;
	case 'FAQDESK_QUESTION':
		$lc_text = TABLE_HEADING_ARTICLE_NAME;
		$lc_align = 'left';
		break;
}

// --------------------------------------------------------------------------------------------------------------------------------------------
// turn off links -- dummy value is set at "FAQDESK_ARTICLE_URL" since I want to keep all the links active
// --------------------------------------------------------------------------------------------------------------------------------------------
if ($column_list[$col] != 'FAQDESK_ARTICLE_URL' && $column_list[$col] )
	$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
	$list_box_contents[$cur_row][] = array(
		'align' => $lc_align,
		'params' => 'class="productListing-heading"',
		'text'  => "&nbsp;" . $lc_text . "&nbsp;"
		);
}
// --------------------------------------------------------------------------------------------------------------------------------------------

if ($listing_numrows > 0) {
	$number_of_faqs = '0';
	$listing = tep_db_query($listing_sql);
	while ($listing_values = tep_db_fetch_array($listing)) {
		$number_of_faqs++;

		if ( ($number_of_faqs/2) == floor($number_of_faqs/2) ) {
			$list_box_contents[] = array('params' => 'class="productListing-even"');
		} else {
			$list_box_contents[] = array('params' => 'class="productListing-odd"');
		}

		$cur_row = sizeof($list_box_contents) - 1;
		$cl_size = sizeof($column_list);
		for ($col=0; $col<$cl_size; $col++) {
			$lc_align = '';
			switch ($column_list[$col]) {
		case 'FAQDESK_DATE_AVAILABLE':
			$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') 
			. 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_date_added'] . '</a>&nbsp;';
			break;
		case 'FAQDESK_ANSWER_LONG':
			$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') 
			. 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_answer_long'] . '</a>&nbsp;';
			break;
		case 'FAQDESK_ANSWER_SHORT':
			$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') 
			. 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_answer_short'] . '</a>&nbsp;';
			break;
		case 'FAQDESK_QUESTION':
			$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_FAQDESK_INFO, ($faqPath ? 'faqPath=' . $faqPath . '&' : '') 
			. 'faqdesk_id=' . $listing_values['faqdesk_id']) . '">' . $listing_values['faqdesk_question'] . '</a>&nbsp;';
			break;
		}

			$list_box_contents[$cur_row][] = array(
				'align' => $lc_align,
				'params' => 'class="productListing-data"',
				'text'  => $lc_text
				);

		}
	}

	new tableBox($list_box_contents, true);

	echo '</td>' . "\n";
	echo '</tr>' . "\n";
	} else {
?>

	<tr class="productListing-odd">
		<td class="smallText">&nbsp;<?php echo TEXT_NO_ARTICLES ?>&nbsp;</td>
	</tr>

<?php
}
?>

	<tr>
		<td><?php echo tep_draw_separator(); ?></td>
	</tr>

<?php
if ($listing_numrows > 0 && (FAQDESK_PREV_NEXT_BAR_LOCATION == '2' || FAQDESK_PREV_NEXT_BAR_LOCATION == '3')) {
?>

	<tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
	<tr>
		<td class="smallText">&nbsp;
<?php
echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_ARTICLES);
?>
		&nbsp;</td>
		<td align="right" class="smallText">&nbsp;
<?php
echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_FAQDESK_SEARCH_RESULTS, MAX_DISPLAY_FAQDESK_PAGE_LINKS, 
$HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y')));
?>
		&nbsp;</td>
	</tr>
</table>
		</td>
	</tr>

<?php
}
?>

</table>

<?php
/*

	osCommerce, Open Source E-Commerce Solutions ---- http://www.oscommerce.com
	Copyright (c) 2002 osCommerce
	Released under the GNU General Public License

	IMPORTANT NOTE:

	This script is not part of the official osC distribution but an add-on contributed to the osC community.
	Please read the NOTE and INSTALL documents that are provided with this file for further information and installation notes.

	script name:	FaqDesk
	version:		1.2.5
	date:			2003-09-01
	author:			Carsten aka moyashi
	web site:		www..com

*/
?>