<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/homestart.html
 * 如果您的模型要进行修改，请修改 models/modules/homestart.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
//引入公共方法
require("foundation/module_users.php");
require("foundation/fcontent_format.php");
require("foundation/fdnurl_aget.php");
require("foundation/agrade.php");

//引入语言包
	$u_langpackage=new userslp;
	$rf_langpackage=new recaffairlp;
	
 //变量获得
  $holder_id=short_check(get_argg('user_id'));//主人id
  $dress_name=short_check(get_argg('dress_name'));

	//数据表定义区
	$t_users=$tablePreStr."users";
	$t_online=$tablePreStr."online";

	$dbo=new dbex;
	//读写分离定义方法
	dbtarget('r',$dbServs);
	
	$info_item_init=$u_langpackage->u_unset;
  $user_info=get_user_info($dbo,$t_users,$holder_id);
  
  //控制数据显示
  $show_error="content_none";
  $show_data="";
  if(!$user_info){
		$show_error="";
		$show_data="content_none";
  }
  
  $user_sex_txt=get_user_sex($user_info['user_sex']);
  $user_birthday=brithday_format($user_info['birth_year'],$user_info['birth_month'],$user_info['birth_day']);
  $user_marrstate=get_user_marry($user_info['user_marry']);
  $user_lastlogin_time=$user_info['lastlogin_datetime'];
 

	$user_online=get_user_online_state($dbo,$t_online,$holder_id);
  $ol_state_ico="skin/$skinUrl/images/offline-now.gif";
  $ol_state_label=$u_langpackage->u_not_onl;
  $timer_txt=str_replace("{login_time}",format_datetime_txt($user_info['lastlogin_datetime']),$u_langpackage->u_login);
  if($user_online['hidden']=='0'){
  	  $ol_state_ico="skin/$skinUrl/images/online-now.gif";
      $ol_state_label=$u_langpackage->u_onl;
      $ol_timer=(int)((time()-$user_online['active_time'])/60);
      if($ol_timer==0){
      	 $ol_timer=1;
      }
      $timer_txt=str_replace("{login_time}",$ol_timer,$u_langpackage->u_login_near);
  }
?><!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></title>
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/homeiframe.css">
<?php echo get_dressup($dbo,$t_users,$holder_id,"iframe",$dress_name);?>
<script language=JavaScript src="skin/default/js/jooyea.js"></script>
<SCRIPT language=JavaScript src="servtools/ajax_client/ajax.js"></SCRIPT>
<script type='text/javascript'>
function fixImage(i,w,h){
	return true;
}

//新鲜事
function list_recent_affair(h_id,ra_type)
{		var recent_affair_div=document.getElementById("recent_affair");
		var url="modules.php?app=recent_affair&user_id="+h_id+"&t="+ra_type; //
		ajax=InitAjax();//实例化Ajax
		ajax.open("GET", url, true);
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ajax.send(null);
    recent_affair_div.innerHTML="<div style=\"width:150px; margin-left:auto; margin-right:auto; height:100px; padding:60px; *padding:30px; line-height:32px;\"><span class='right'>数据加载中...</span><img src='skin/<?php echo $skinUrl;?>/images/loading.gif'></div>";
    //获取执行状态
	  ajax.onreadystatechange = function() {
	      //如果执行状态成功，那么就把返回信息写到指定的层里
	     if (ajax.readyState==4&&ajax.status==200) {
	        recent_affair_div.innerHTML=ajax.responseText;
	        reSetIframeHeight();
	     }
	  }
}

</script>
</head>
<body>
<div id="append_parent">
</div>
<div class="myinfo ">
	<span class="right" title='<?php echo count_level($user_info['integral']);?>'><?php echo str_replace(array("{visitor_num}","{integral}","{uid}"),array($user_info['guest_num'],$user_info['integral'],$holder_id),$u_langpackage->u_ustate);?>
		<?php echo grade($user_info['integral']);?>
	</span>
	<a class="strong"><?php echo filt_word($user_info["user_name"]);?></a><span class="online_status_gif"><img id='ol_ioc_gif' src="<?php echo $ol_state_ico;?>"></span>
			 <span id='ol_label_txt' style='color:#838383'>
			 	  <?php echo $ol_state_label;?>
			 	 (<?php echo $timer_txt;?>)</span></div>
         <div class="mysig"><?php echo $u_langpackage->u_index;?><span><?php echo get_uhome_url($holder_id);?></span></div>
         <div class="myinfos ">
           <ul>
           <li><?php echo $u_langpackage->u_sex;?>：<?php echo info_item_format($info_item_init,$user_sex_txt);?></li>
           <li><?php echo $u_langpackage->u_bird;?>：<?php echo info_item_format($info_item_init,$user_birthday);?></li>
           <li><?php echo $u_langpackage->u_bld;?>：<?php echo info_item_format($info_item_init,get_user_blood($user_info["user_blood"]));?></li>
           <li><?php echo $u_langpackage->u_marr;?>：<?php echo info_item_format($info_item_init,$user_marrstate);?></li>
           <li><?php echo $u_langpackage->u_res;?>：<?php echo info_item_format($info_item_init,$user_info["reside_province"].$user_info["reside_city"]);?></li>
           <li><?php echo $u_langpackage->u_birc;?>：<?php echo info_item_format($info_item_init,$user_info["birth_province"].$user_info["birth_city"]);?></li>
           <li><?php echo $u_langpackage->u_qq;?>：<?php echo info_item_format($info_item_init,$user_info["user_qq"]);?></li>
           <li><?php echo $u_langpackage->u_email;?>：<?php echo info_item_format($info_item_init,$user_info["user_email"]);?></li></ul>
         </div>

<!--滑动门  -->
<div id="sec" class="top10">
<div id="secNav" class="sec right top10">
    <a id="sec_Title0" class="active" onclick="nTabs('sec',this);list_recent_affair(<?php echo $holder_id;?>,0);"><?php echo $rf_langpackage->rf_affair;?></a>
    <a id="sec_Title1" class="normal" onclick="nTabs('sec',this);list_recent_affair(<?php echo $holder_id;?>,1);" ><?php echo $rf_langpackage->rf_state;?></a>
    <a id="sec_Title2" class="normal" onclick="nTabs('sec',this);list_recent_affair(<?php echo $holder_id;?>,3);" ><?php echo $rf_langpackage->rf_blog;?></a>
    <a id="sec_Title3" class="normal" onclick="nTabs('sec',this);list_recent_affair(<?php echo $holder_id;?>,2);" ><?php echo $rf_langpackage->rf_album;?></a>
    <a id="sec_Title4" class="normal" onclick="nTabs('sec',this);list_recent_affair(<?php echo $holder_id;?>,4);" ><?php echo $rf_langpackage->rf_share;?></a>
</div>
<!--新鲜事开始!-->
<div id="recent_affair">
</div>
<script type='text/javascript'>	
	list_recent_affair(<?php echo $holder_id;?>,0);
</script>

<div class='pageerr <?php echo $show_error;?>'>
	<?php echo $pr_langpackage->pr_no_data;?>
</div>
<!-- face begin -->
<div id="face_list_menu" class="emBg" style="display:none;z-index:100;">
</div>
<!-- face end -->
<div class="clear"></div>
</body>
</html>