<?php
//  ------------------------------------------------------------------------ //
// 本模組由 tad 製作
// 製作日期：2011-04-19
// $Id:$
// ------------------------------------------------------------------------- //

//區塊主函式 (相簿(tad_web_image))
function tad_web_image(){
  global $xoopsDB;

	$andWebID=empty($_SESSION['WebID'])?"":"where a.WebID='{$_SESSION['WebID']}'";

	$sql = "select a.ActionName,a.ActionID,b.WebTitle,a.WebID from ".$xoopsDB->prefix("tad_web_action")." as a join ".$xoopsDB->prefix("tad_web")." as b on a.WebID=b.WebID $andWebID order by rand() limit 0,1";

	$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
	list($ActionName,$ActionID,$WebTitle,$WebID)=$xoopsDB->fetchRow($result);
  if(empty($ActionID))return;
  
  //if(!function_exists("show_files")){
    include_once XOOPS_ROOT_PATH."/modules/tad_web/upfile.php";
    $upfile_block=new upfile();
  //}

	$block['WebTitle']=$WebTitle;
	$block['WebID']=$WebID;
	$block['ActionID']=$ActionID;
	$block['ActionName']=$ActionName;
	$block['photos']=$upfile_block->show_files('upfile',"ActionID",$ActionID,true,"",false,false,$WebID,6);
	return $block;
}



?>