<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/poll/poll_list.html
 * 如果您的模型要进行修改，请修改 models/modules/poll/poll_list.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
	//引入公共模块
	require("foundation/module_poll.php");
	require("foundation/fpages_bar.php");
	require("foundation/module_users.php");
	
	//引入语言包
	$pol_langpackage=new polllp;
	
	//变量声明区
	$poll_rs=array();
	$ses_uid=get_sess_userid();
	$url_uid=short_check(get_argg('user_id'));
	$title_str=$pol_langpackage->pol_title;
	$is_login_mode='';
	$is_self_mode='partLimit';
	$button_show='';
	require("foundation/auser_validate.php");
	
	if($is_self=='Y' && !get_argg('m')){
		echo "<script type='text/javascript'>window.location.href='modules.php?app=poll_mine';</script>";
	}
	
	$mod=get_argg('m')? get_argg('m'):"new";
	
	//当前页面参数
	$page_num=trim(get_argg('page'));
	
	$dbo=new dbex;
	dbtarget('r',$dbServs);
	
	//数据表定义区
	$t_poll=$tablePreStr."poll";
	$t_users=$tablePreStr."users";
	$award_col='';
	$n_l='';$n_r='';$h_l='';$h_r='';$r_l='';$r_r='';
	switch($mod){
		case "new":
			$o_col="dateline";
			$limit="limit 20";
			$n_l="nowbutl";
			$n_r="nowbutr";
		break;
		case "hot":
			$o_col="voternum";
			$limit="limit 20";
			$h_l="nowbutl";
			$h_r="nowbutr";
		break;		
		case "reward":
			$o_col="credit";
			$limit="limit 20";
			$r_l="nowbutl";
			$r_r="nowbutr";
			$award_col=" and percredit>0 ";
		break;		
		default:echo "error";
	}
	$award_col.=' and is_pass = 1 ';
	$sql="select * from $t_poll where 1=1 $award_col order by $o_col desc $limit";
	if($is_self=='N'){
		$holder_name=get_hodler_name($dbo,$t_users,$url_uid);
		$sql="select * from $t_poll where user_id = $url_uid and is_pass = 1 ";
		$title_str=str_replace("{name}",$holder_name,$pol_langpackage->pol_who_page);
		$button_show='content_none';
	}
	$dbo->setPages($set_page_data_num,$page_num);//设置分页	
	$poll_rs=$dbo->getRs($sql);
	$page_total=$dbo->totalPage;//分页总数
	$poll_count=$dbo->rowCount;
	//数据显示
	$isset_data="";
	$none_data="content_none";	
	$isNull=0;
	if(empty($poll_rs)){
		$isNull=1;
		$none_data="";
		$isset_data="content_none";
	}
	
?>
<!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>
<script type='text/javascript'>
	parent.guide("poll");
</script>
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/iframe.css">
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/user_ico_small.css">
<!--[if lt IE 7]>
<style type="text/css">
.uico_photo_small span { behavior: url(skin/<?php echo $skinUrl;?>/css/ie_png_fix.htc);}
</style>
<![endif]-->
</head>
<body>
  <div class="main_right_title">
     <span class="main_title_dot5"></span>
     <span class="main_title_txt"><?php echo $title_str;?></span>
  </div>

	<!--按钮控制!-->
	<div id="tabsB" class="<?php echo $button_show;?>">
		<ul>
			<li><a href="?app=poll_list&m=new" title="<?php echo $pol_langpackage->pol_new;?>" class='<?php echo $n_l;?>'><span class='<?php echo $n_r;?>'><?php echo $pol_langpackage->pol_new;?></span></a></li>
			<li><a href="?app=poll_list&m=hot" title="<?php echo $pol_langpackage->pol_hot;?>" class='<?php echo $h_l;?>'><span class='<?php echo $h_r;?>'><?php echo $pol_langpackage->pol_hot;?></span></a></li>
			<li><a href="?app=poll_list&m=reward" title="<?php echo $pol_langpackage->pol_reward;?>" class='<?php echo $r_l;?>'><span class='<?php echo $r_r;?>'><?php echo $pol_langpackage->pol_reward;?></span></a></li>
			<li><a href="?app=poll_mine" title="<?php echo $pol_langpackage->pol_mine;?>"><span><?php echo $pol_langpackage->pol_mine;?></span></a></li>
		</ul>
			<div class="div_but" onclick="location.href='?app=poll_send'"><?php echo $pol_langpackage->pol_send;?></div>
	</div>
	
	<!--按钮控制!-->
	<div class="container">
		<div class="rs_head" style="margin-left:15px;"><?php echo str_replace("{poll_num}",$poll_count,$pol_langpackage->pol_total_poll);?></div>
	</div>	
	<?php foreach($poll_rs as $rs){?>
		<div class="poll_list_box">
			<div class="poll_user"><a class="photo" href="home.php?h=<?php echo $rs['user_id'];?>" target="_blank"><img src=<?php echo $rs['user_ico'];?> alt='<?php echo $rs['username'];?>' title='<?php echo $rs['username'];?>' height='43px' width='43px' /></a><a href="home.php?h=<?php echo $rs['user_id'];?>" target="_blank"><?php echo sub_str($rs['username'],6,true);?></a></div>
			<div class="poll_content">
				<dl>
					<dt>
						<a href='?app=poll_show&p_id=<?php echo $rs["p_id"];?>&user_id=<?php echo $url_uid;?>&m=<?php echo $mod;?>'><?php echo $rs['subject'];?></a>
					</dt>
					<dd><input type=<?php echo choo_type($rs['multiple']);?> disabled /><?php echo choo_option(filt_word($rs['option']),0);?></dd>
					<dd><input type=<?php echo choo_type($rs['multiple']);?> disabled /><?php echo choo_option(filt_word($rs['option']),1);?></dd>
					<dd>......</dd>
				</dl>
				<p><?php echo choo_ellip($rs['option']);?></p>
			</div>
			<div class="poll_status"><h4><strong><?php echo $rs['voternum'];?></strong><?php echo $pol_langpackage->pol_join;?></h4><a href='?app=poll_show&p_id=<?php echo $rs["p_id"];?>&user_id=<?php echo $url_uid;?>&m=<?php echo $mod;?>'><?php echo $pol_langpackage->pol_go_see;?></a></div>
		</div>
	<?php }?>
	
<?php echo page_show($isNull,$page_num,$page_total);?>

<div class="guide_info <?php echo $none_data;?>">
	<?php echo $pol_langpackage->pol_data_none;?>
</div>

</body>
</html>