<?
if (!isset($_SESSION)) //判斷是否已經開啟SESSION
{
session_start();
}//開起SESSION}
$id=$_SESSION['mAccount'];
$mid=$_SESSION['mId'];

require_once ("../function.php");
check_login();

putenv("NLS_LANG=TRADITIONAL CHINESE_TAIWAN.AL32UTF8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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/ad_raise.all.css" type="text/css" media="screen" title="Flora (Default)" />
<link href="../member/style/ad_main.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Import jQuery and SimpleModal source files -->
<script src='../jQuery/jquery-1.2.6.js' type='text/javascript'></script>

<script type="text/javascript" src="../thick/thickbox.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>
<script type="text/javascript">
//Q & A
function recomm(id) {
	$('#'+id).show();
}
function hicomm(id) {
	$('#'+id).hide();
}
function delcomm(sn,id,mId){	
	$('#'+sn).hide();
	$('#'+id).hide();	
	$('#'+mId+'_'+id).hide();	
	$('#'+mId+'_'+id+'_2').hide();	

   $.ajax({
   type: "POST",
   url: "ad_process.php",
   data: {act:'del',qId:id},
   complete: function (xhr) {					 
	}
	
	});	//return true;
		
}	


function disable_raise(rid){

	var rid=rid;

	if(confirm('確定流團？')){
$.ajax({
   type: "POST",
   url: "dis_raise.php",
   data: {rId:rid},
   beforeSend:function(){
   /*$('#msgform').fadeOut(200);
   $('.message-loading').fadeIn(200);
*/
	
	},
  success: function(response) {
//location.href="../raise/ad_main.php?rId="+rid;
         /*if (response.responseText!='') {
	    $('#msg').html(response.responseText);
    	$('#msg').fadeIn();
	
  		}else{
	
		}*/
			
  },
  complete: function (xhr) {
							
location.href="../raise/ad_main.php?rId="+rid;
}
   });	return false;

}

}

</script>

<link rel="stylesheet" href="../thick/thickbox.css" type="text/css" media="screen" />
<style type="text/css" media="all">@import "../thick/thickbox.css";</style>
<!-- message Form JS and CSS files -->
<!-- IE 6 hacks -->
<!--[if lt IE 7]>
<link type='text/css' href='css/message_ie.css' rel='stylesheet' media='screen' />
<![endif]-->

</head>

<body>

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


<? 
include("../db.php");
//$str=mysql_query("SELECT * FROM `raise` NATURAL JOIN `take` WHERE rId='$rId'");


$rId=$_GET['rId'];


	$str = oci_parse($conn,"SELECT * FROM RAISE NATURAL JOIN MEMBER  WHERE RID='$rId'") or die('Insert error');
    oci_execute($str);

$row=oci_fetch_object($str);
CheckrID(($mid));

 $chk_usr=chk_user($row->MID);

?>
<div id="content">
 <div id="raisedetail" align="center">
 <div id="tabsEx2" class="tab"> 
        <br>
  
    <ul style="height: 30px;"> 
    	
        <li ><a href="#fragment-1"><span> 揪團管理  </span></a></li> 
        <li ><a href="#fragment-2"><span> 參加者管理</span></a></li> 
	   
	   
       
	</ul>


<div id="fragment-1" class="fragment">   
<table border="1" id="temp">
  <tr>
    <th class="must">主揪</th>
    <td><?=$row->MACCOUNT?><? if($row->RSTATE==0) echo "<font color='red'>&nbsp;&nbsp;此團已流團!!</font>"; ?></td>
  </tr>
  
  <tr>
    <th class="must">集合地點</th>
    <td><?=$row->RPLACE?></td>
  </tr>
  <tr>
    <th class="must">集合時間</th>
    <td>
	<?=$row->RTIME?>點
	</td>
  </tr>
  <tr>
    <th class="must">集合日期</th>
    <td><?=$row->RDATE?></td>
  </tr>
    <tr>
    <th class="must">主辦人電話</th>
    <td><?=$row->RPHONE?></td>
  </tr>
   <tr>
    <th>主辦人E-mail</th>
    <td><?=$row->REMAIL?></td>
  </tr>
 
    <tr>
    <th class="must">人數上限</th>
    <td><?=$row->RLIMIT?></td>
  </tr>
  <tr>
    <th>備註</th>
    <td><?=$row->RELSE?></td>
  </tr>

</table> 


<?
echo "<a href='show_raise_detail.php?rId=$rId'>回揪團頁面</a> | ";
$now=date("Y-m-d");
if($now<=$row->RDATE){
	if($row->RSTATE!=0){
		echo "<a href=\"#\" onclick=\"disable_raise('$rId');\"><img src='../member/images/cancle_group.png' border='0'></a>　　";
		echo "<a href='edit_raise.php?rId=$rId'><img src='../member/images/edit_raise.png' border='0'></a>　　";
	}
} echo "<a href=../activity/activity_show.php><img src='../member/images/back_activity.png' border='0'></a></div>";?>

</div>

<div id="fragment-2" class="fragment" align="center">  
<? 
	$str_2 = oci_parse($conn,"SELECT MID,MACCOUNT,TPHONE,TEMAIL,TRAFFIC,TELSE,RID FROM TAKES NATURAL JOIN MEMBER Where RID='$rId'") or die('Insert error');
    oci_execute($str_2);

$row_2=oci_fetch_all($str_2,$result);
$i=1;

if($row_2!=0){
 echo "<div id='messageForm' align='center'><table align='center' id='temp'><tr><th colspan='8' class='must'>參加者</th></tr>";
oci_execute($str_2);
   while(list($mId,$mAccount,$tPhone,$tEmail,$tTraffic,$tElse)=oci_fetch_row($str_2)){
 echo "
<tr><th width='10'>編號</th><th>會員</th><th>電話</th><th>email</th><th>備註</th></tr>";
   echo "<tr><td rowspan='3'>".$i."<br><a href=\"send.php?height=260&width=350&mId=$mId&rId=$rId\" class=\"thickbox\" title=\"傳送訊息給$mAccount\"><img src='../images/messenge.png' border='0'></a></td>";
		echo "<td rowspan='3'><a href='../member/show_member_detail.php?mId=$mId'>".$mAccount."<br><div>";
		
		
		echo"</a></div>";/*<div id='enlarge_images'></div>*/echo"</td>";	
	
				
		echo "<td>".$tPhone."</td>";
		echo "<td>".$tEmail."</td>";
		echo "<td>".$tElse."</td></tr>";
		echo "<th>交通方式</th><th colspan='2'></th></tr>";
		echo "<tr><td>".$tTraffic."</td>";
		echo "<td colspan='2'></td>";
		
		echo "
<input type='hidden' name='h' id='h$tt' value='$rId'/>
<input type='hidden' name='h' id='h$tt$tt' value='$mId'/></tr>";
	$i++;


}
echo "</table></div>";
}
else
{
echo "<div align='center'>此揪團目前無人參加</div>";}
?>
<?
echo "<div align='center'><a href=../activity/activity_show.php><img src='../member/images/back_activity' border='0'></a></div>"
?>
</div>
<!--
<div id="fragment-3" class="fragment" align="center"> 
<div id="qanda" align="center">
<!-- Q AND A -->
<? $str=mysql_query("SELECT member.mId,member.mAccount,qanda.qId,qanda.qContent,qanda.qTime FROM qanda NATURAL JOIN member WHERE qanda.rId='$rId'");
$num=oci_fetch_all($str);
if($num!=0){
   echo "<table id='msg' align='center'><tr><th>帳號</th><th>QANDA</th><th>時間</th></tr>";
   
   while(list($mId,$mAccount,$qId,$qContent,$qTime)=mysql_fetch_row($str)){
   		$time1 = str_replace("-", "", $qTime);
   		$time2 = str_replace(" ","",$time1);
		$time3 = str_replace(":","",$time2);
		$trid=$mId."_".$qId;
		$rtrid=$trid."_2";
   		echo "<tr id='$trid'><td>".$mAccount."</td>";
   		echo "<td>".$qContent."</td>";
		echo "<td>".$qTime."</td>";
		echo "<td>";
		
		
		
		$re_sql="select * from reply where qId='$qId'";
		$re_res=oci_fetch_all(mysql_query($re_sql));
		
		if($re_res==0){
		
		echo "<input id='re_btn' type='button' value='回覆' onclick='recomm($qId);' >";
		}else {
		echo "<input id='re_btn' type='button' value='修改' onclick='recomm($qId);' >";
		}
		
		echo "<input id='del_btn' type='button' value='刪除 'onclick='delcomm($mId$rId$time3,$qId,$mId);' ></td></tr>";
			if($re_res!=0){
		$re_row=mysql_fetch_object(mysql_query($re_sql));
		
		
		
		echo "<tr id='$rtrid'><td>回覆</td>";
   		echo "<td>".$re_row->rContent."</td>";
		echo "<td>".$re_row->rTime."</td></tr>";
		
		}
		
		echo "<tr id='$qId' style=\"display:none;\"><td colspan='4'>
		<form method='POST' action='ad_process.php'>
 	<div >
		<textarea name='rContent'  id='qContent'>";
		if($re_res!=0){
		$re_row=mysql_fetch_object(mysql_query($re_sql));
		
		
		echo $re_row->rContent;}
		echo "</textarea>";
		echo "<input id='re_btn' type='button' value='隱藏' onclick='hicomm($qId);' >";
		if($re_res==0){
		echo "<input type='hidden' name='act' value='rep'>";
		}else{echo "<input type='hidden' name='act' value='reupd'>";}
		echo "<input type='hidden' name='rId' id='rId' value='$rId'>
		<input type='hidden' name='qId' value='$qId'><br>
	   	<input type='submit'  value='送出' id='btn'/>
    </div>		 
</form ></td></tr>";
   }
   echo "</table>";
}

?>
</div><!--end #qanda-->
<?
echo "<div align='center'><a href=../activity/activity_show.php><img src='../member/images/back_activity' border='0'></a></div>"
?>
</div>
</div>
-->



</div><!--end raisedetail-->

</div><!-- end div#wrapper -->
<div id="footer">   
  <div id="footer-in" align="center">
    <br/><br/><br/><br/>
    <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>
