Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已解决] 投票结果统计问题

[复制链接]
pigcais 发表于 2011-9-2 16:04:56 | 显示全部楼层 |阅读模式
本帖最后由 pigcais 于 2011-9-2 16:11 编辑

http://www.huzhenbbs.com/thread-774-1-2.html

我有个贴子,地址如上

共13个选项,投票时最多可选5项,投票贴显示共47位会员投票

如何可以一次性查到哪47位会员来参与了投票呢?


另外:
投票结果直观图中看某选项为2人投票,但在查看详细投票人时只能看到一人会员ID 如下图




otherbank 发表于 2011-9-2 16:18:10 | 显示全部楼层
http://www.huzhenbbs.com/forum.p ... iewvote&tid=774
你输入这个网址即能看投票结果
回复

使用道具 举报

ARCHY` 发表于 2011-9-2 18:50:49 | 显示全部楼层
是否开启了游客允许投票
回复

使用道具 举报

 楼主| pigcais 发表于 2011-9-4 11:21:37 | 显示全部楼层
ARCHY` 发表于 2011-9-2 18:50
是否开启了游客允许投票

您好,没有~
回复

使用道具 举报

 楼主| pigcais 发表于 2011-9-4 11:22:07 | 显示全部楼层
otherbank 发表于 2011-9-2 16:18
http://www.huzhenbbs.com/forum.php?mod=misc&action=viewvote&tid=774
你输入这个网址即能看投票结果

还得一项项看,这样统计投票会员很难统计~
回复

使用道具 举报

otherbank 发表于 2011-9-4 12:43:22 | 显示全部楼层
pigcais 发表于 2011-9-4 11:22
还得一项项看,这样统计投票会员很难统计~

有办法了修改代码,刚调试出来
回复

使用道具 举报

otherbank 发表于 2011-9-4 12:48:23 | 显示全部楼层
pigcais 发表于 2011-9-4 11:22
还得一项项看,这样统计投票会员很难统计~

修改文件source\module\forum\ forum_misc.php的479-520行代码
  1. require_once libfile('function/post');
  2. $polloptionid = is_numeric($_G['gp_polloptionid']) ? $_G['gp_polloptionid'] : '';

  3. $page = intval($_GET['page']) ? intval($_GET['page']) : 1;
  4. $perpage = 100;

  5. $overt = DB::result_first("SELECT overt FROM ".DB::table('forum_poll')." WHERE tid='$_G[tid]'");

  6. $polloptions = array();
  7. $query = DB::query("SELECT polloptionid, polloption FROM ".DB::table('forum_polloption')." WHERE tid='$_G[tid]'");
  8. while($options = DB::fetch($query)) {
  9. if(empty($polloptionid)) {
  10. $polloptionid = $options['polloptionid'];
  11. }
  12. $options['polloption'] = preg_replace("/\[url=(https?){1}:\/\/([^\["']+?)\](.+?)\[\/url\]/i",
  13. "<a href="\\1://\\2" target="_blank">\\3</a>", $options['polloption']);
  14. $polloptions[] = $options;
  15. }

  16. $arrvoterids = array();
  17. if($overt || $_G['adminid'] == 1 || $thread['authorid'] == $_G['uid']) {
  18. $voterids = '';
  19. $voterids = DB::result_first("SELECT voterids FROM ".DB::table('forum_polloption')." WHERE polloptionid='$polloptionid'");
  20. $arrvoterids = explode("\t", trim($voterids));
  21. } else {
  22. showmessage('thread_poll_nopermission');
  23. }

  24. if(!empty($arrvoterids)) {
  25. $count = count($arrvoterids);
  26. $multi = $perpage * ($page - 1);
  27. $multipage = multi($count, $perpage, $page, "forum.php?mod=misc&action=viewvote&tid=$_G[tid]&polloptionid=$polloptionid".( $_G[gp_handlekey] ? "&handlekey=".$_G[gp_handlekey] : '' ));
  28. $arrvoterids = array_slice($arrvoterids, $multi, $perpage);
  29. }
  30. $voterlist = $voter = array();
  31. if($voterids = dimplode($arrvoterids)) {
  32. $query = DB::query("SELECT uid, username FROM ".DB::table('common_member')." WHERE uid IN ($voterids)");
  33. while($voter = DB::fetch($query)) {
  34. $voterlist[] = $voter;
  35. }
  36. }
  37. include template('forum/viewthread_poll_voter');
复制代码
替换为

  1.   require_once libfile('function/post');
  2. $polloptionid = is_numeric($_G['gp_polloptionid']) ? $_G['gp_polloptionid'] : '0';
  3. $page = intval($_GET['page']) ? intval($_GET['page']) : 1;
  4. $perpage = 100;
  5. $overt = DB::result_first("SELECT overt FROM ".DB::table('forum_poll')." WHERE tid='$_G[tid]'");
  6. $polloptions = array();
  7.   $options['polloptionid'] = 0;
  8.   $options['polloption'] = preg_replace("/\[url=(https?){1}:\/\/([^\["']+?)\](.+?)\[\/url\]/i",
  9.    "<a href="\\1://\\2" target="_blank">\\3</a>", "all user");
  10.   $polloptions[] = $options;
  11. $query = DB::query("SELECT polloptionid, polloption FROM ".DB::table('forum_polloption')." WHERE tid='$_G[tid]'");
  12. while($options = DB::fetch($query)) {
  13.   $options['polloption'] = preg_replace("/\[url=(https?){1}:\/\/([^\["']+?)\](.+?)\[\/url\]/i",
  14.    "<a href="\\1://\\2" target="_blank">\\3</a>", $options['polloption']);
  15.   $polloptions[] = $options;
  16. }
  17. $arrvoterids = array();
  18. if($overt || $_G['adminid'] == 1 || $thread['authorid'] == $_G['uid']) {
  19.   if($polloptionid == '0'){
  20.    $voterids = DB::query("SELECT uid FROM ".DB::table('forum_pollvoter')." WHERE tid='$_G[tid]' order by uid");
  21.    while($voteuid = DB::fetch($voterids)) {
  22.     $arrvoterids[] = $voteuid['uid'];
  23.    }
  24.   }else{
  25.    $voterids = '';
  26.    $voterids = DB::result_first("SELECT voterids FROM ".DB::table('forum_polloption')." WHERE polloptionid='$polloptionid'");
  27.    $arrvoterids = explode("\t", trim($voterids));
  28.   }
  29. } else {
  30.   showmessage('thread_poll_nopermission');
  31. }
  32. if(!empty($arrvoterids)) {
  33.   $count = count($arrvoterids);
  34.   $multi = $perpage * ($page - 1);
  35.   $multipage = multi($count, $perpage, $page, "forum.php?mod=misc&action=viewvote&tid=$_G[tid]&polloptionid=$polloptionid".( $_G[gp_handlekey] ? "&handlekey=".$_G[gp_handlekey] : '' ));
  36.   $arrvoterids = array_slice($arrvoterids, $multi, $perpage);
  37. }
  38. $voterlist = $voter = array();
  39. if($voterids = dimplode($arrvoterids)) {
  40.   $query = DB::query("SELECT uid, username FROM ".DB::table('common_member')." WHERE uid IN ($voterids)");
  41.   while($voter = DB::fetch($query)) {
  42.    $voterlist[] = $voter;
  43.   }
  44. }
  45. include template('forum/viewthread_poll_voter');
复制代码

回复

使用道具 举报

45103532 发表于 2011-9-4 13:01:28 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| pigcais 发表于 2011-9-4 13:40:05 | 显示全部楼层
otherbank 发表于 2011-9-4 12:48

太强了,这样方便多了!

非常感谢!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-27 13:25 , Processed in 0.057058 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表