<?
if (!isset($_SESSION)) //判斷是否已經開啟SESSION
{
session_start();
}//開起SESSION}
$id=$_SESSION['mAccount'];
$mId=$_SESSION['mId'];
$dtoday=date("Y-m-d");
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JUME(Join You And Me)揪咪揪團活動網</title>
<link href="../member/style/show_all_act.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../jQuery/jquery-1.2.6.js"></script>		
<script type="text/javascript" src="../tab/ui/ui.core.js"></script>	
</head>


<body>
<div  id="header">
<? include("../member/header2.php"); 
include("../db.php");?>
</div>

 
<div id="content">
<div id="raisedetail">
<h2 align="center">&nbsp;</h2>
<table width="400" align="center" id="temp"> 
<tr><th>活動名稱</th><th>揪團數</th></tr>
<?
   $str=mysql_query("select * FROM activity where end_date>='$dtoday' and mId='$mId'");
   $total_now=mysql_num_rows($str);
   $show=ceil($total_now/12);
   echo "共".$total_now."筆活動";
   echo "請選擇頁數";
   for($i=1;$i<=$show;$i++){
   	 echo "<a href=show_all_act.php?page=$i>$i</a>";
   }
   /*查詢欄位資料*/
   $page=$_GET['page'];
   if(empty($page))$page=1;
   $start=12*($page-1);
   $str2=mysql_query("SELECT * FROM activity WHERE end_date>='$dtoday' and mId='$mId' ORDER BY end_date desc LIMIT $start,12");
   /*顯示資料庫資料*/
   while(list($aId,$aName)=mysql_fetch_row($str2))
   {
   		//$row=mysql_fetch_object($str);
    	echo "<tr><td align='center'>
		<a href='../activity/activity_show_detail.php?aId=$aId'>".$aName."</td>";
		$str3=mysql_query("select * from raise left outer join activity on raise.aId=activity.aId 
							where activity.aId='$aId'");	
   		$num=mysql_num_rows($str3);
				echo"<td align='center'><a href='../member/show_take_detail.php?aId=$aId'>$num</a></td></tr>";
   }
?>
</table>
<h2 align="center">歷史活動列表</h2>
<table width="400" align="center" id="temp"> 
<tr><th class="past">活動名稱</th><th class="past">揪團數</th></tr>
<?
    $str4=mysql_query("select * FROM activity where end_date<'$dtoday' and mId='$mId'");
	   $total_past=mysql_num_rows($str4);
   $show2=ceil($total_past/12);
   echo "共".$total_past."筆活動";
   echo "請選擇頁數";
   for($j=1;$j<=$show2;$j++){
   	 echo "<a href=show_all_act.php?page=$j>$j</a>";
   }
   /*查詢欄位資料*/
   $page=$_GET['page'];
   if(empty($page))$page=1;
   $start2=12*($page-1);
   $str5=mysql_query("SELECT * FROM activity WHERE end_date<'$dtoday' and mId='$mId' ORDER BY aId desc LIMIT $start2,12");
   /*顯示資料庫資料*/
   while(list($aId,$aName)=mysql_fetch_row($str5))
   {
   		//$row=mysql_fetch_object($str);
    	echo "<tr><td align='center'>
		<a href=../activity/activity_show_detail.php?aId=".$aId.">".$aName."</td>";
		$str6=mysql_query("select * from raise left outer join activity on raise.aId=activity.aId 
							where activity.aId='$aId'");	
   		$num=mysql_num_rows($str6);
				echo"<td align='center'><a href='../member/show_take_detail.php?aId=$aId'>$num</a></td></tr>";
   }
?>
</table>
<input type="button" onClick="history.back(-1);" value="回上頁">
</div>

</div>

</div><!-- end #raisedetail -->
</div><!-- end #content -->
<div id="footer">   
  <div id="footer-in" align="center">
    <p>版權資訊</p>
    <p>國立中山大學  資訊管理學系  揪咪揪團網 <a href="mailto:jumemis@yahoo.com.tw">揪咪團隊<img src="../mail/send email.gif" border="0"/></a> 版權所有  Taiwan All Rights Reserved</p> 
  </div><!-- end #footer-in -->
</div><!-- end #footer -->
</body>
</html>



