<?php
//  ------------------------------------------------------------------------ //
// 本模組由 tad 製作
// 製作日期：2008-03-23
// $Id: tadgallery_show.php,v 1.3 2008/04/08 02:43:04 tad Exp $
// ------------------------------------------------------------------------- //


//區塊主函式 (會捲動的相片)
function tadgallery_good_show($options){
	global $xoopsDB;
	$sql = "select sn,title,description,filename,dir from ".$xoopsDB->prefix("tad_gallery")." where good='1' {$options[1]} limit 0,{$options[0]}";
	$result = $xoopsDB->query($sql);
	
	if(empty($options[4]))$options[4]="s";

	$pics="";
	while(list($sn,$title,$description,$filename,$dir)=$xoopsDB->fetchRow($result)){
	  $title=(empty($title))?$filename:$title;
    $description=(empty($description))?"":"<div style='padding:4px;background-color:#F0FFA0'>$description</div>";

		$pics.="
		<div class='blur'>
		  <div class='shadow'>
		    <div class='shadow_content'>
					<a href='".XOOPS_URL."/modules/tadgallery/view.php?sn={$sn}'><img src='".XOOPS_URL."/uploads/tadgallery/{$dir}/{$sn}_{$options[4]}_{$filename}' alt='{$title}' title='{$title}' /></a>
					<div style='padding:4px;margin-top:4px;'>$title</div>
					$description
		  	</div>
			</div>
		</div>";
	}
	$pics.="";


	
	
	$block="
	<style type='text/css'>
	/* Scroller Box */
	#scroller_container {
	 width: {$options[2]}px;
	 height: {$options[3]}px;
	 overflow: hidden;
	}
	/* Scoller Box */

	/* CSS Hack Safari */
	#dummy {;# }

	#scroller_container {
	 overflow: auto;
	}
  /* Scroller Box */
  .blur{
      background-color: #ccc; /*shadow color*/
      color: inherit;
      margin-left: 4px;
      margin-top: 4px;
      margin-right: 8px;
  }

  .shadow,
  .shadow_content{
      position: relative;
      bottom: 2px;
      right: 2px;
  }

  .shadow{
      background-color: #666; /*shadow color*/
      color: inherit;
  }

  .shadow_content{
      background-color: #fff; /*background color of content*/
      color: #000; /*text color of content*/
      border: 1px solid #000; /*border color*/
      padding: 8px;
  }
	</style>

	<script type='text/javascript' src='".XOOPS_URL."/modules/tadgallery/class/jscroller.js'></script>
	<div id='scroller_container'>
    <div class='{$options[5]} jscroller2_speed-{$options[6]} jscroller2_mousemove'>
     $pics
    </div>
   </div>";
	return $block;
}



//區塊編輯函式
function tadgallery_good_edit($options){
	$chked1_0=($options[1]=="order by post_date desc")?"checked":"";
	$chked1_1=($options[1]=="order by counter desc")?"checked":"";
	$chked1_2=($options[1]=="order by rand()")?"checked":"";

	$chked4_0=($options[4]=="s")?"checked":"";
	$chked4_1=($options[4]=="m")?"checked":"";
	
	$chked5_0=($options[5]=="jscroller2_up")?"checked":"";
	$chked5_1=($options[5]=="jscroller2_down")?"checked":"";

	$form="
	"._MB_TADGAL_TADGALLERY_EDIT_BITEM0."
	<INPUT type='text' name='options[0]' value='{$options[0]}'><br>
	"._MB_TADGAL_TADGALLERY_EDIT_BITEM2."
	<INPUT type='radio' $chked1_0 name='options[1]' value='order by post_date desc'>"._MB_TADGAL_TADGALLERY_EDIT_MODE1."
	<INPUT type='radio' $chked1_1 name='options[1]' value='order by counter desc'>"._MB_TADGAL_TADGALLERY_EDIT_MODE2."
	<INPUT type='radio' $chked1_2 name='options[1]' value='order by rand()'>"._MB_TADGAL_TADGALLERY_EDIT_MODE3."
	<br>
	"._MB_TADGAL_TADGALLERY_EDIT_BITEM3."
	<INPUT type='text' name='options[2]' value='{$options[2]}'><br>
	"._MB_TADGAL_TADGALLERY_EDIT_BITEM4."
	<INPUT type='text' name='options[3]' value='{$options[3]}'><br>
	"._MB_TADGAL_TADGALLERY_EDIT_BITEM5."
	<INPUT type='radio' $chked4_0 name='options[4]' value='s'>"._MB_TADGAL_TADGALLERY_EDIT_OPT1."
	<INPUT type='radio' $chked4_1 name='options[4]' value='m'>"._MB_TADGAL_TADGALLERY_EDIT_OPT2."<br>
  "._MB_TADGAL_GOOD_BITEM5."
	<INPUT type='radio' $chked5_0 name='options[5]' value='jscroller2_up'>"._MB_TADGAL_GOOD_BITEM5_OPT1."
	<INPUT type='radio' $chked5_1 name='options[5]' value='jscroller2_down'>"._MB_TADGAL_GOOD_BITEM5_OPT2."<br>
	"._MB_TADGAL_GOOD_BITEM6."
	<INPUT type='text' name='options[6]' value='{$options[6]}'> (0-1000)
	";
	return $form;
}
?>