<?php
//  ------------------------------------------------------------------------ //
// 本模組由 tad 製作
// 製作日期：2007-11-04
// $Id: tadnews_re_block.php,v 1.2 2008/05/14 01:31:48 tad Exp $
// ------------------------------------------------------------------------- //

//區塊主函式 (列出最新的新聞評論)
function tadnews_b_show_3($options){
	global $xoopsDB;
	$modhandler = &xoops_gethandler('module');
  $xoopsModule = &$modhandler->getByDirname("tadnews");
	$com_modid=$xoopsModule->getVar('mid');
	$sql = "select com_id,com_text,com_itemid,com_uid from ".$xoopsDB->prefix("xoopscomments")." where com_modid='$com_modid' order by com_modified desc limit 0,{$options[0]}";
	$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
	$block="";
	$block['width']=$options[1];
	while(list($com_id,$txt,$nsn,$uid)=$xoopsDB->fetchRow($result)){
		$re['uid']=$uid;
		$re['uid_name']=XoopsUser::getUnameFromId($uid,0);
		$re['nsn']=$nsn;
		$re['com_id']=$com_id;
		$re['txt']=$txt;
		$block['re'][] = $re;
	}
	return $block;
}

//區塊編輯函式
function tadnews_re_edit($options){

	$form="<table style='width:auto;'>
	<tr><th>1.</th><th>"._MB_TADNEW_TADNEWS_RE_EDIT_BITEM0."</th><td><INPUT type='text' name='options[0]' value='{$options[0]}' size=3></td></tr>
	<tr><th>2.</th><th>"._MB_TADNEW_TADNEWS_RE_EDIT_BITEM1."</th><td><INPUT type='text' name='options[1]' value='{$options[1]}' size=3> px</td></tr>
	</table>
	";
	return $form;
}


?>