<?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";
	}
	
?>