<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
//v1.8 www.bcoos.net 2006-08 GPL
//v1.7 www.exoops.info 2006/03 GPL
// $Id: xoopsfaq.php,v 1.6 2003/03/19 07:02:25 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Half-Dead
// Author Website : http://www.e-xoops.com
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
function b_faq_show($options) {
global $db, $myts;
$block  = array();
$block['content'] = "";
$sql    = "
		SELECT
		contents_id, category_id, contents_title, contents_time
		FROM
		".$db->prefix("xoopsfaq_contents")."
		WHERE
		contents_visible=1
		ORDER BY
		contents_time DESC";
if ( empty($options[2]) || !is_numeric($options[2]) ) {
	$options[2] = 5;
	}
if ( empty($options[1]) || !is_numeric($options[1]) ) {
	$options[1] = 35;
	}
$result = $db->query($sql, $options[2], 0);
while ( list($id, $cid, $title, $date) = $db->fetchRow($result) ) {
	$title = $myts->makeTboxData4Show($title);
	if ( strlen($title) > $options[1] ) {
		$title = substr($title, 0, $options[1])."..";
		}
	$block['content'] .= "
			&nbsp;<strong><big>&middot;</big></strong>
			<a href='".XOOPS_URL."/modules/xoopsfaq/index.php?cat_id=".$cid."#".$id."'>".$title."</a>";
		$block['title'] = _MB_FAQ_TITLE;
		if ($options[0] == 1) {
			$block['content'] .= " (".formatTimestamp($date, "s").")";
			}
		$block['content'] .= "<br />";
	}
return $block;
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function b_faq_edit($options) {
$form  = "<table border='0'>";
// SHOW DATE?
$form .= "<tr><td>"._MB_FAQ_SHOW.":</td><td>";
$chk   = "";
if ($options[0] == 0) {
	$chk = " checked='checked'";
	}
$form .= "<input type='radio' class='radio' name='options[0]' value='0'".$chk." />"._NO."";
$chk   = "";
if ($options[0] == 1) {
	$chk = " checked='checked'";
	}
$form .= "<input type='radio' class='radio' name='options[0]' value='1'".$chk." />"._YES."</td></tr>";
// TRIM
$form .= "
<tr><td>"._MB_FAQ_TRIM."</td>
<td><input type='text' class='text' size='3' maxlength='2' name='options[1]' value='".$options[1]."'></td>
</tr>";
// LIMIT TO
$form .= "
<tr><td>"._LIMIT."</td>
<td><input type='text' class='text' name='options[2]' value='".$options[2]."' size='3' maxlength='2' /></td>
</tr>";
$form .= "</table>";
return $form;
}
?>
