wsq_event_center.inc.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3. exit('Access Denied');
  4. }
  5. if($_G['cache']['plugin']['xj_event']['mobilestyle'] == 1){
  6. if(file_exists(DISCUZ_ROOT.'./source/plugin/xj_event/module/wsqcenter/center.php')) {
  7. @include 'module/wsqcenter/center.php';
  8. include template('center',0,'source/plugin/xj_event/module/wsqcenter/template');
  9. exit();
  10. }
  11. }elseif($_G['cache']['plugin']['xj_event']['mobilestyle'] == 2){
  12. if(file_exists(DISCUZ_ROOT.'./source/plugin/xj_event/module/wsqcenter_mg/center.php')) {
  13. @include 'module/wsqcenter_mg/center.php';
  14. include template('center',0,'source/plugin/xj_event/module/wsqcenter_mg/template');
  15. exit();
  16. }
  17. }elseif($_G['cache']['plugin']['xj_event']['mobilestyle'] == 3){
  18. if(file_exists(DISCUZ_ROOT.'./source/plugin/xj_event/module/wsqcenter_hdb/center.php')) {
  19. @include 'module/wsqcenter_hdb/center.php';
  20. include template('center',0,'source/plugin/xj_event/module/wsqcenter_hdb/template');
  21. exit();
  22. }
  23. }
  24. $siteid = $_G['wechat']['setting']['wsq_siteid'];
  25. require_once libfile('function/post');
  26. if($_GET['pc']){
  27. $sqlstr = " AND postclass=".intval($_GET['pc']);
  28. }
  29. $tmp = explode("\n",$_G['cache']['plugin']['xj_event']['event_offline_class']);
  30. $offlineclass = array();
  31. foreach($tmp as $key=>$value){
  32. $eventclass = explode("|",$value);
  33. $offlineclass[$eventclass[0]] = $eventclass[1];
  34. }
  35. $tmp = explode("\n",$_G['cache']['plugin']['xj_event']['event_online_class']);
  36. $onlineclass = array();
  37. foreach($tmp as $key=>$value){
  38. $eventclass = explode("|",$value);
  39. $onlineclass[$eventclass[0]] = $eventclass[1];
  40. }
  41. $perpage = 10; //ÿҳÊý
  42. $listcount = DB::result_first("SELECT count(*) FROM ".DB::table('xj_event')." A,".DB::table('forum_thread')." B WHERE A.tid=B.tid ".$sqlstr." ORDER BY A.eid");
  43. $page = $_GET['page']?$_GET['page']:1;
  44. //if(@ceil($listcount/$perpage) < $page) {
  45. // $page = 1;
  46. //}
  47. $start_limit = ($page - 1) * $perpage;
  48. $query = DB::query("SELECT * FROM ".DB::table('xj_event')." A,".DB::table('forum_thread')." B WHERE A.tid=B.tid ".$sqlstr." ORDER BY A.eid DESC LIMIT $start_limit,$perpage");
  49. $toplist = array();
  50. while($value = DB::fetch($query)){
  51. $value['subject'] = cutstr($value['subject'],50);
  52. //»ñÈ¡±¨ÃûÈËÊý
  53. $value['zynumber'] = DB::result_first("SELECT count(*) FROM ".DB::table('xj_eventthread')." WHERE eid=".$value['eid']);
  54. $value['applynumber'] = DB::result_first("SELECT SUM(applynumber) FROM ".DB::table('xj_eventapply')." WHERE tid=".$value['tid']." and verify=1");
  55. $value['applynumber'] = $value['applynumber']?$value['applynumber']:0;
  56. $value['activityaid_url'] = $value['activityaid']?getforumimg($value['activityaid'],0,80,80):'static/image/common/nophoto.gif';
  57. $value['starttime'] = date('Y-m-d',$value['starttime']);
  58. $value['message'] = DB::result_first("SELECT message FROM ".DB::table('forum_post')." WHERE tid=".$value['tid']);
  59. $value['message'] = messagecutstr($value['message'],50);
  60. $value['setting'] = unserialize($value['setting']);
  61. $toplist[] = $value;
  62. }
  63. if($_GET['output']=='json'){
  64. foreach($toplist as $key=>$value){
  65. if($value['setting']['eventaa']){
  66. $toplist[$key]['use_cost_str'] = 'AA';
  67. }else{
  68. if($value['use_cost']>0){
  69. $toplist[$key]['use_cost_str'] = $value['use_cost'].lang('plugin/xj_event', 'yuan');
  70. }else{
  71. $toplist[$key]['use_cost_str'] = lang('plugin/xj_event', 'mianfei');
  72. }
  73. }
  74. if($value['postclass']==1){
  75. $toplist[$key]['postclass'] = lang('plugin/xj_event', 'xianxia');
  76. }else{
  77. $toplist[$key]['postclass'] = lang('plugin/xj_event', 'xianshan');
  78. }
  79. if($value['postclass']==1){
  80. $toplist[$key]['zclass'] = $offlineclass[$value['offlineclass']];
  81. }else{
  82. $toplist[$key]['zclass'] = $onlineclass[$value['onlineclass']];
  83. }
  84. if($_G['charset']=='gbk'){
  85. $toplist[$key]['subject'] = iconv("GBK", "UTF-8", $value['subject']);
  86. $toplist[$key]['zclass'] = iconv("GBK", "UTF-8", $toplist[$key]['zclass']);
  87. $toplist[$key]['postclass'] = iconv("GBK", "UTF-8", $toplist[$key]['postclass']);
  88. $toplist[$key]['use_cost_str'] = iconv("GBK", "UTF-8", $toplist[$key]['use_cost_str']);
  89. }
  90. }
  91. exit(json_encode($toplist));
  92. }
  93. ?>
  94. <script type="text/javascript" src="http://wsq.discuz.com/cdn/discuz/js/openjs.js"></script>
  95. <script>
  96. var menu = new Array();
  97. menu.push({name:"<?php echo lang('plugin/xj_event', 'xxhd'); ?>", pluginid:'xj_event:wsq_event_center', param:"pc=1"});
  98. menu.push({name:"<?php echo lang('plugin/xj_event', 'xshd'); ?>", pluginid:'xj_event:wsq_event_center', param:"pc=2"});
  99. WSQ.initBtmBar(menu);
  100. WSQ.showBtmBar();
  101. WSQ.initPlugin({name:'<?php echo lang('plugin/xj_event', 'huodzx'); ?>'});
  102. var initWx = {
  103. 'img': '<?php echo $_G['siteurl']; ?>/static/image/common/logo.png',
  104. 'desc': '<?php echo $_G['bbsname'].lang('plugin/xj_event', 'huodzx'); ?>',
  105. 'title': '<?php echo lang('plugin/xj_event', 'huodzx'); ?>',
  106. 'pluginid':'xj_event:wsq_event_center',
  107. 'param': 'a=1&b=2'
  108. };
  109. WSQ.initShareWx(initWx);
  110. </script>
  111. <script type="text/javascript" src="source/plugin/xj_event/js/jquery.js"></script>
  112. <script type="text/javascript">
  113. var i = 2;
  114. $(function(){
  115. $("#btnload").click(function(){
  116. $.getJSON("plugin.php?id=xj_event:wsq_event_center&pc=<?php echo $_GET['pc']; ?>&output=json",{page:i},function(json){
  117. if(json){
  118. var str = "";
  119. $.each(json,function(index,array){
  120. var str = '<div style="background-color:#FFFFFF;-moz-border-radius: 8px;-webkit-border-radius: 8px;border-radius:8px; padding:10px; margin-bottom:8px; border-bottom:2px #ddd solid;" onClick="window.open(\'http://wsq.discuz.com/?c=index&a=viewthread&f=wx&tid='+array['tid']+'&siteid=<?php echo $siteid; ?>&_bpage=1\',\'_parent\');"><div style="float:left; width:80px; height:80px; background-color:#ddd;"><img src="'+array['activityaid_url']+'" style="width:80px;height:80px;" border="0"></div><div style="margin-left:80px; padding:2px 10px; height:80px; line-height:26px; font-size:14px;">'+array['subject']+'</div><div style="clear:both;"></div><div style="height:30px;"><div style="float:left; width:120px; padding-top:12px;"><span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; ">'+array['postclass']+'</span><span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; margin-left:5px; ">'+array['zclass']+'</span></div><div style="margin-left:120px; padding:2px 10px; height:30px; line-height:30px; font-size:12px; text-align:right;"><?php echo lang('plugin/xj_event', 'baomingrs'); ?>: <span style="color:#FF3300; font-weight:bold;">'+array['applynumber']+'</span> <?php echo lang('plugin/xj_event', 'ren'); ?> <?php echo lang('plugin/xj_event', 'feiyong'); ?>:<span style="color:#FF3300; font-weight:bold;">'+array['use_cost_str']+'</span></div><div style="clear:both;"></div></div></div>';
  121. $("#mycontainer").append(str);
  122. });
  123. i++;
  124. }else{
  125. return false;
  126. }
  127. });
  128. });
  129. });
  130. </script>
  131. <style type="text/css">
  132. #container {margin:5px;}
  133. body {height:100%;}
  134. </style>
  135. </head>
  136. <body style="padding-top:10px;">
  137. <div id="mycontainer">
  138. <?php foreach($toplist as $value){ ?>
  139. <div style="background-color:#FFFFFF;-moz-border-radius: 8px;-webkit-border-radius: 8px;border-radius:8px; padding:10px; margin-bottom:8px; border-bottom:2px #ddd solid;" onClick="window.open('http://wsq.discuz.com/?c=index&a=viewthread&f=wx&tid=<?php echo $value['tid']; ?>&siteid=<?php echo $siteid; ?>&_bpage=1','_parent');">
  140. <div style="float:left; width:80px; height:80px; background-color:#ddd;">
  141. <img src="<?php echo $value['activityaid_url']; ?>" style="width:80px; height:80px;" border="0">
  142. </div>
  143. <div style="margin-left:80px; padding:2px 10px; height:80px; line-height:26px; font-size:14px;">
  144. <?php echo $value['subject']; ?>
  145. </div>
  146. <div style="clear:both;"></div>
  147. <div style="height:30px;">
  148. <div style="float:left; width:120px; padding-top:12px;">
  149. <span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; ">
  150. <?php
  151. if($value['postclass']==1){
  152. echo lang('plugin/xj_event', 'xianxia');
  153. }else{
  154. echo lang('plugin/xj_event', 'xianshan');
  155. }
  156. ?>
  157. </span>
  158. <span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; margin-left:5px; ">
  159. <?php
  160. if($value['postclass']==1){
  161. echo $offlineclass[$value['offlineclass']];
  162. }else{
  163. echo $onlineclass[$value['onlineclass']];
  164. }
  165. ?>
  166. </span>
  167. </div>
  168. <div style="margin-left:120px; padding:2px 10px; height:30px; line-height:30px; font-size:12px; text-align:right;">
  169. <?php echo lang('plugin/xj_event', 'baomingrs'); ?>: <span style="color:#FF3300; font-weight:bold;"><?php echo $value['applynumber']; ?></span> <?php echo lang('plugin/xj_event', 'ren'); ?>
  170. <?php echo lang('plugin/xj_event', 'feiyong'); ?>:<span style="color:#FF3300; font-weight:bold;">
  171. <?php
  172. if($value['setting']['eventaa']){
  173. echo 'AA';
  174. }else{
  175. if($value['use_cost']>0){
  176. echo $value['use_cost'].lang('plugin/xj_event', 'yuan');
  177. }else{
  178. echo lang('plugin/xj_event', 'mianfei');
  179. }
  180. }
  181. ?></span>
  182. </div>
  183. </div>
  184. <div style="clear:both;"></div>
  185. </div>
  186. <?php } ?>
  187. </div>
  188. <div class="nodata"></div>
  189. <div id="btnload" style="border:1px #ddd solid; background-color:#FFFFFF; height:40px; line-height:40px; font-size:14px; text-align:center; color:#666666; cursor:pointer; margin-bottom:30px;"><?php echo lang('plugin/xj_event', 'jzgdhd'); ?>...</div>
  190. </body>
  191. </html>