<?
if (!isset($_SESSION)) //判斷是否已經開啟SESSION
{
session_start();
}//開起SESSION}
$id=$_SESSION['mAccount'];
$mid=$_SESSION['mId'];
putenv("NLS_LANG=TRADITIONAL CHINESE_TAIWAN.AL32UTF8");
require_once("../function.php");
include("../db.php");
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JUME(Join You And Me)揪咪揪團活動網</title>
<link rel="stylesheet" href="../tab/themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)" />
<?
if($_SESSION['mId']!=''){
echo "<link rel=\"stylesheet\" href=\"../thick/thickbox.css\" type=\"text/css\" media=\"screen\" />
<style type=\"text/css\" media=\"all\">@import \"../thick/thickbox.css\";</style>";
}
?>
<link href="../member/style/show_member_detail.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>			
<script type="text/javascript" src="../tab/ui/ui.tabs.js"></script>
<script>
$(document).ready(function(){
$("#tabsEx2 > ul" ).tabs
({ fxAutoHeight: true });
});
</script>
<style type="text/css">
<!--
.style6 {color: #FF0000}
-->
</style>
</head>


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

<div id="content">
 <div id="raisedetail" align="center">

  <div id="tabsEx2" class="tab"> 
<br>
<br>       
  
    <ul style="height: 30px;"> 
        <li ><a href="#fragment-1"><span> 個人資料  </span></a></li> 
        <li ><a href="#fragment-2"><span> 近期發佈的活動</span></a></li> 
	    <li ><a href="#fragment-3"><span> 近期發起的揪團</span></a></li> 
	    <li ><a href="#fragment-4"><span> 近期參加過揪團</span></a></li> 
       
	</ul>

<div id="fragment-1" class="fragment" >     
<?
$mId=$_GET['mId'];
$str = oci_parse($conn,"SELECT * FROM MEMBER where MID='$mId' ") or die('Insert error');
oci_execute($str);

$row=oci_fetch_object($str);

url_session($mId,$c='mId');

echo "<table width='300' id='temp' align='center'> <tr valign=bottom><td rowspan='4'>";


	if($_SESSION['mId']!=''&&$_SESSION['mId']!=$row->MID){
		
		echo "<a href='../raise/send.php?height=260&width=400&mId=$row->MID' class=\"thickbox\" title=\"傳送訊息給$row->MACCOUNT\"><img src='../images/messenge.png' border='0'></a>";
		
		
		}

         echo"</td>
     

      <td>帳號：$row->MACCOUNT</td>
      
  </tr>
 

</table>";
  ?>
</div>  
  
  
<div id="fragment-2" class="fragment" align="center">    
<table width='600'  id="temp">  
<?  

$str_1 = oci_parse($conn,"select distinct ACTIVITY.AID,ACTIVITY.ANAME,ACTIVITY.ATIME,ACTIVITY.END_DATE,ACTIVITY.ACONTENT ,ACTIVITY.MID from ACTIVITY left outer join RAISE on ACTIVITY.AID=RAISE.AID where ACTIVITY.MID='$row->MID' order by ACTIVITY.AID desc") or die('Insert error');
oci_execute($str_1);
   
   $str_3=oci_fetch_all($str_1,$result);
   if($str_3!='0'){
   oci_execute($str_1);
 	  echo"<tr>
  	  <td colspan='3'>發表過的活動數：$str_3</td>
	  </tr> 
	  <tr>
	  <th>活動圖片</th>
      <th>活動資訊</th>
      <th>總共揪團數</th>
	  </tr>";   	
	  	for($b=0;$b<5;$b++){ 
   			if(list($aId,$aName,$start_date,$end_date,$content,$mId)=oci_fetch_row($str_1)){
	$str_pic = oci_parse($conn,"select PPATH from PICTURE where AID='$aId'") or die('Insert error');
oci_execute($str_pic);
  
	   
		
    	$num_pic=oci_fetch_all($str_pic,$result);
	    echo" <tr><td>";
	 
    
	 /*$str_21=mysql_query("select picture.pPath from activity left outer join picture on activity.aId=picture.aId 
		                	where activity.mId='$mId'");
			while(list($pPath)=mysql_fetch_row($str_21)){
	            
	              if($pPath!=''){echo"<img src='../activity/$pPath' target='_blank' height='150'>";}
	              else{echo"<img src='../activity/picture/original.png' target='_blank' height='150'>";}
	              echo"</td>";
			}*/
				  
		 if($num_pic!=0){
		 oci_execute($str_pic);
			list($pPath)=oci_fetch_row($str_pic);		 
	 	 echo"<img src='../activity/$pPath'  width='150' height='150'>";}
		 else{echo"<img src='../activity/picture/original.png'   width='150' height='150'>";}
		 echo"</td>";
	 
	 	echo"
	 	<td width='250'>活動名稱：$aName<br>
	     活動日期：$start_date ~ $end_date<br>
		 主辦單位：$host<br>
		 活動地點：$aPlace<br>
		
		 <div align='right'><a href='../activity/activity_show_detail.php?aId=$aId'>詳細資訊</a></div> </td>";
		 	$str_4 = oci_parse($conn,"select * from RAISE left outer join ACTIVITY on RAISE.AID=ACTIVITY.AID where ACTIVITY.AID='$aId'") or die('Insert error');
oci_execute($str_4);
			 
		 $str_5=oci_fetch_all($str_4,$result);
		 echo"<td align='center'><font size='20'>$str_5</td>
	 
		 </tr>";
	 }
	 }}
?>
</table>
</div>  
  
<div id="fragment-3" class="fragment" align="center"> 
<table width='600' id="temp" >
<?
	$str_6 = oci_parse($conn,"select * from  RAISE  where MID='$row->MID'") or die('Insert error');
oci_execute($str_6);
	
	$str_7=oci_fetch_all($str_6,$result);
	echo"<tr><td colspan='2'>發起過的揪團數：$str_7</td>";
	/*
	         echo"<td>評價："; 
			 
	$str_8=mysql_query("select distinct score.give,raise.rId,raise.mId FROM score left outer join raise on score.rId=raise.rId where raise.mId='$row->mId'");
    $total_raise=0;
	while($row_3=mysql_fetch_object($str_8))
        {
	       $total_raise+=$row_3->score.give;
	    }  
	if($total_raise>0){echo"<img src='../member/starPic/good.gif'>";}
	if($total_raise==0){echo"<img src='../member/starPic/normal.gif'>";}
	if($total_raise<0){echo"<img src='../member/starPic/bad.gif'>";}
	echo"</td></tr>";
		*/
	echo"<tr>
	         <th>活動資訊</th>
             <th>揪團資訊</th>
             <th>參加總人數</th>
	</tr>";
		$str_9 = oci_parse($conn,"select distinct ACTIVITY.AID,ACTIVITY.ANAME,RAISE.RID,RAISE.RPLACE,RAISE.RDATE,RAISE.RTIME 
	  from  RAISE left outer join ACTIVITY on RAISE.AID=ACTIVITY.AID where RAISE.MID='$row->MID' ORDER BY RAISE.RID DESC") or die('Insert error');
oci_execute($str_9);
	
   	$row_9=oci_fetch_all($str_9,$result);
	if($row_9!='0'){
	oci_execute($str_9);
    for($c=0;$c<5;$c++){ 
    
	if(list($aId,$aName,$rId,$rPlace,$rDate,$rTime)=oci_fetch_row($str_9))
         {
	       
		   $str_10 = oci_parse($conn,"select PPATH from PICTURE where AID='$aId'") or die('Insert error');
oci_execute($str_10);
	      
    	$pic=oci_fetch_all($str_10,$result);
    	
	              echo"<tr><td align='center'>$aName<br>";
	               if($pic!=0){
				   
		 $pPath=oci_fetch_row($str_10);
	 	 echo"<img src='../activity/$pPath[0]'  width='150' height='150'>";}
		 else{echo"<img src='../activity/picture/original.png'   width='150' height='150'>";}
		 echo"</td>";
	             
	   
	  	          echo"<td align='left' width='250'>活動:$aName 的揪團<br>
		                                集合地點：$rPlace<br>
								        集合時間：$rDate	$rTime".點."<br>
				       <div align='right'><a href='../raise/show_raise_detail.php?rId=$rId'>詳細資訊</a></div>
					   </td>";
					    $str_11 = oci_parse($conn,"select * from  TAKES left outer join RAISE on TAKES.rId=RAISE.RID where TAKES.RID='$rId' and RAISE.MID='$row->MID'") or die('Insert error');
oci_execute($str_11);
				 
	              $str_12=oci_fetch_all($str_11,$result);	   
				  echo"<td align='center'><font size='20'>$str_12</font>";	   
			    
				  echo"</tr>";

	      }}}
	
?>	
</table>
</div>

 
<div id="fragment-4" class="fragment" align="center"> 
<table width='600' id="temp">
<?
    $str_13 = oci_parse($conn,"SELECT * from RAISE left outer join TAKES on RAISE.RID=TAKES.RID where TAKES.MID='$row->MID'") or die('Insert error');
oci_execute($str_13);
	

    $str_14=oci_fetch_all($str_13,$result);
	 echo"<tr><td colspan='2'>參加過的揪團數：$str_14</td>";
	 /*
	      echo "<td>評價：";
		  
	$str_15=mysql_query("SELECT distinct grade.gGive,grade.gGetmid,take.mId FROM grade left outer join take on grade.gGetmid=take.mId WHERE gGetmid='$row->mId'");
	$total_take=0;
	while($row_4=mysql_fetch_object($str_15))
         {
	      $total_take+=$row_4->gGive;
         }
	 if($total_take>0){echo"<img src='../member/starPic/good.gif'>";}
	 if($total_take==0){echo"<img src='../member/starPic/normal.gif'>";}
	 if($total_take<0){echo"<img src='../member/starPic/bad.gif'>";}
	   echo"</td></tr>";
	   
		*/
	echo"<tr>
	         <th>活動資訊</th>
             <th>揪團資訊</th>
             <th>揪團總人數</th>
	     </tr>";	
		 
	 $str_16 = oci_parse($conn,"select TAKES.RID,RAISE.AID,RAISE.RID,RAISE.RPLACE,RAISE.MID,RAISE.RDATE,RAISE.RTIME 
	from  RAISE left outer join TAKES on TAKES.RID=RAISE.RID where TAKES.MID='$row->MID' order by RAISE.RID desc") or die('Insert error');
oci_execute($str_16);
	
	$row_16=oci_fetch_all($str_16,$result);
	if($row_16!='0'){oci_execute($str_16);
    for($c=0;$c<5;$c++){ 
	
	
	if(list($trId,$raId,$rId,$rPlace,$mId,$rDate,$rTime)=oci_fetch_row($str_16)){
	
	 $str_18 = oci_parse($conn,"select ANAME from ACTIVITY where AID='$raId'") or die('Insert error');
oci_execute($str_18);

	 	list($aName)=oci_fetch_row($str_18);
	 	echo"<tr><td align='center'>$aName<br>";
		$str_22 = oci_parse($conn,"select PPATH	from PICTURE where AID='$raId'") or die('Insert error');
oci_execute($str_22);
	
	 	$num_22=oci_fetch_all($str_22,$result);
	 	if($num_22!='0'){	
		oci_execute($str_22);
			list($pPath)=oci_fetch_row($str_22);
	        echo"<img src='../activity/$pPath'   width='150' height='150'>";
				  
	    }
		else{echo"<img src='../activity/picture/original.png'  width='150' height='150'>";
		}
	              echo"</td>";
				  echo"<td align='left' width='250'>";
				  $str40 = oci_parse($conn,"select MACCOUNT from MEMBER where MID='$mId'") or die('Insert error');
oci_execute($str40);
				  
       		
				  while(list($mAccount)=oci_fetch_row($str40)){
				             echo"主揪：$mAccount<br>
			                      
		                          集合地點：$rPlace<br>
								  集合時間：$rDate	$rTime".點."<br>";}
				       echo"<div align='right'><a href='../raise/show_raise_detail.php?rId=$rId'>詳細資訊</a></div>
					   </td>";
					    $str_19 = oci_parse($conn,"select * from  TAKES left outer join RAISE on TAKES.RID=RAISE.RID where TAKES.RID='$rId'") or die('Insert error');
oci_execute($str_19);
		   		 
	              $str_20=oci_fetch_all($str_19,$result);	   
				  echo"<td align='center'><font size='20'>$str_20</font></td>";	   
			    
				  echo"</tr>";
		   }	    }  }
		 
   // echo"$row_5->aId";         
  /*  $str_17=mysql_query("s");
	
	while(list($aId,$aName,$rId,$rTitle,$rPlace,$rDate,$rTime,)=mysql_fetch_row($str_16))
         {
	       $str_17=mysql_query("select picture.pPath from  activity left outer join picture on activity.aId=picture.aId where activity.aId='$aId'");
	       while(list($pPath)=mysql_fetch_row($str_17))
	            {
	              echo"<tr><td align='center'>$aName<br>";
	              if($pPath!=''){echo"<img src='../activity/$pPath' target='_blank' height='150'>";}
	              else{echo"<img src='../activity/picture/original.png' target='_blank' height='150'>";}
	              echo"</td>";    
	   
	  	          echo"<td align='left'>揪團名稱：$rTitle<br>
		                                集合地點：$rPlace<br>
								        集合時間：$rDate 的 $rTime<br>
				       <div align='right'><a href='../raise/show_raise_detail.php?rId=$rId'>詳細資訊</a></div>
					   </td>";
				  $str_18=mysql_query("select * from  take left outer join raise on take.rId=raise.rId where raise.mId='$row->mId'");
	              $str_19=oci_fetch_all($str_18);	   
				  echo"<td align='center'><font size='20'>$str_19</font>";	   
			    }
				  echo"</tr>";

	      }	 

		*/
?>	
</table>
</div>

</div>
</div>
</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 -->
</div>

</body>
</html>

<?
if($_SESSION['mId']!='')
echo "<script type=\"text/javascript\" src=\"../thick/thickbox.js\"></script>";
?>

