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

	//引入模块公共方法文件
	require("foundation/arecent_affair.php");
  require("foundation/module_restore.php");
  
	//变量取得
	$ra_type=short_check(get_argg('t'));
	$user_id=get_sess_userid();
	$pals_id=get_sess_mypals();
	$hidden_pals_id=get_session('hidden_pals');
	$hidden_type_id=get_session('hidden_type');
	$holder_id=short_check(get_argg('user_id'));
	$ra_mod_type='';
	$ra_type_str='';
	$ra_owner_sql='';
	$pals_str='';
	$limit_num=0;
	$show_setting='content_none';
	if($holder_id!=''){
		$limit_num=$home_affair_num;
		$ra_owner_sql=" user_id=$holder_id";
		$holder_id=" $holder_id";
		$hidden_button_over="void(0)";
		$hidden_button_out="void(0)";
	}else{
		if($hidden_pals_id!='' && $hidden_pals_id!=','){
			$pals_str=",".$pals_id.",";
			$hidden_pals_array=explode(",",$hidden_pals_id);
			foreach($hidden_pals_array as $rep){
				if($rep!=''){
					$pals_str=str_replace(",".$rep.",",",",$pals_str);
				}
			}
			$pals_str=preg_replace(array("/^,/","/,$/"),"",$pals_str);
			$pals_id=$pals_str;
		}
		if($hidden_type_id!='' && $hidden_type_id!=','){
			$hidden_type_id=preg_replace(array("/^,/","/,$/"),"",$hidden_type_id);
			$ra_mod_type=" and mod_type not in ($hidden_type_id)";
		}
	  $limit_num=$index_affair_num;
	  $ra_owner_sql=" user_id in ($pals_id)";
	  $hidden_button_over="feed_menu({id},1);";
	  $hidden_button_out="feed_menu({id},0);";
		$show_setting='';
	}
	if($ra_type!=0){
		$ra_type_str=" and type_id=$ra_type ";
	}

	//数据表定义区
	$t_rec_affair=$tablePreStr."recent_affair";
	$dbo=new dbex;
	
	//读写分离定义方法
	dbtarget('r',$dbServs);

	$ra_rs = array();
	if($pals_id!='' || $holder_id!=''){
	  $sql = "select * from $t_rec_affair where $ra_owner_sql $ra_type_str $ra_mod_type order by update_time desc limit $limit_num";
	  $ra_rs = $dbo->getRs($sql);
  }

	//显示控制
	$none_data="content_none";
	$is_null=0;
	if(empty($ra_rs)){
		$none_data="";
		$is_null=1;
	}
?><ul class="TabContent clear">
	<div id="sec_Content">
<!--新鲜事开始!-->
		<?php foreach($ra_rs as $rs){?>
		<div class="listcontent" id="feed_<?php echo $rs['id'];?>" onmouseout="<?php echo str_replace('{id}',$rs['id'],$hidden_button_out);?>" onmouseover="<?php echo str_replace('{id}',$rs['id'],$hidden_button_over);?>">
			<div class="listphoto left">
				<a href="home.php?h=<?php echo $rs["user_id"];?>" target="_blank" title="<?php echo $rf_langpackage->rf_v_home;?>"><img src='<?php echo $rs["user_ico"];?>' /></a>
			</div>
			<div style='float:left;width:80%'>
			<div class="listtit left"><a id="a_feed_menu_<?php echo $rs['id'];?>" onclick="ajaxmenu(this, this.id,<?php echo $rs['user_id'];?>,<?php echo $rs['mod_type'];?>)" href="javascript:void(0);" class="float_more"></a>
      	<a class="strong" href="home.php?h=<?php echo $rs['user_id'];?>" target="_blank" title="<?php echo $rf_langpackage->rf_v_home;?>"><?php echo filt_word($rs["user_name"]);?></a>
				<?php echo show_affair($rs["date_time"],filt_word(get_face($rs["content"])));?>
				<?php if($rs['for_content_id']!=0){?>
				<a onclick=toggle("replycontent",<?php echo $rs['mod_type'];?>,<?php echo $rs['for_content_id'];?>) id="openreply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>" href="javascript:void(0);"><?php echo $rf_langpackage->rf_re_com;?></a>
			</div>
			
			<div id="replycontent_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>">
				
				<div class="replytip"></div>
				<div id="show_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>">
					<?php echo get_restore($dbo,$rs['mod_type'],$rs['for_content_id'],0,3);?>
				</div>
				<?php if($user_id!=''){?>
				<div id="reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>_1" class="replyer">
					<input onclick=toggle2("reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>") name="input" type="text" value="<?php echo $rf_langpackage->rf_add_com;?>" />
				</div>
				<div id="reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>_2" class="reply" style="display:none" >
					<img src='<?php echo get_sess_userico();?>'>
					<textarea type="text" maxlength="160" onkeyup="return isMaxLen(this)" id="reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>_input" onblur=toggle2("reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>")></textarea>
					<div class="replybt">
						<input class="left button2" onclick="parent.restore_com(<?php echo $rs['user_id'];?>,<?php echo $rs['mod_type'];?>,<?php echo $rs['for_content_id'];?>);" type="submit" name="button" id="button" value="<?php echo $rf_langpackage->rf_submit;?>" />
						<a class="right" href="javascript: void(0);" onclick="showim(''); showFace(this,'face_list_menu','reply_<?php echo $rs['mod_type'];?>_<?php echo $rs['for_content_id'];?>_input');"><?php echo $rf_langpackage->rf_face;?></a>
					</div>
					<div class="clear"></div>
				</div>
				<?php }?>
			</div>
		<?php }?>
		<?php if($rs['for_content_id']==''){?>
		</div>
		<?php }?>
		</div>
		</div>
	</div>
				<div class="line clear"></div>
	<?php }?>
<div style="clear:both;padding-left:13px;padding-top:12px" class="<?php echo $none_data;?>">
	  <table border="0" width="95%">
			<tr>
				<td width='100%' valign='top' style="padding-top:3px;padding-bottom:12px;">
		         <?php echo $rf_langpackage->rf_none;?>
				</td>
			</tr>
	  </table>
	</div>	
	<div class="clear <?php echo $show_setting;?>" style="text-align:right; padding-right:14px; line-height:20px;">
		<a href="modules.php?app=pr_affair"><?php echo $rf_langpackage->rf_new_set;?></a>
	</div>
</ul>